* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  font-family: 'Montserrat', sans-serif;

  background:
    linear-gradient(135deg, #131313, #272727e5 45%, #000000);

  color: white;
  text-align: center;

  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;

  background-image: url("images/pattern.png");
  background-repeat: repeat;
  background-size: 400px;
  background-position: center;

  opacity: 0.04;
  pointer-events: none;

  animation: floatPattern 30s ease-in-out infinite alternate;

  z-index: 0;
}

.app {
  max-width: 900px;
  width: 100%;
  padding: 48px 20px;

  position: relative;
  z-index: 1;
}

@keyframes floatPattern {
  from {
    transform: translate(0, 0);
  }

  to {
    transform: translate(-20px, -20px);
  }
}

.logo {
  display: block;
  width: min(700px, 90vw);
  height: auto;
  padding-bottom: 20px;
  margin-left: auto;
  margin-right: auto;
}

h1 {
  margin: 0 0 30px;
  font-size: clamp(34px, 8vw, 56px);
  line-height: 1;
  letter-spacing: -1px;
}

p {
  margin: 0 0 26px;
  color: rgb(255, 255, 255);
  font-size: 17px;
}

.welcome-text {
  font-weight: 800;
}

input,
button {
  height: 54px;
  border-radius: 999px;
  font-size: 18px;
}

input {
  width: min(100%, 230px);
  padding: 0 20px;
  text-align: center;
  text-transform: uppercase;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  outline: none;
  letter-spacing: 3px;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.48);
  letter-spacing: 1px;
}

input:focus {
  border-color: #f5c542;
  box-shadow: 0 0 0 4px rgba(245, 197, 66, 0.18);
}

button {
  padding: 0 26px;
  margin-left: 8px;
  border: none;
  background: linear-gradient(135deg, #f8d86b, #d69b18);
  color: #171006;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.pitch {
  margin: 38px auto 0;
  width: min(100%, 380px);
  height: 260px;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 50%, transparent 50%),
    linear-gradient(#20a94e, #137c37);
  background-size: 72px 100%, 100% 100%;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 0 60px rgba(0, 0, 0, 0.18);
}

.pitch::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
}

.pitch::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
}

.goal {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 150px;
  height: 54px;
  transform: translateX(-50%);
  border: 4px solid white;
  border-top: none;
  z-index: 2;
}

.goal::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.35) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.35) 1px, transparent 1px);
  background-size: 14px 14px;
}

.ball {
  position: absolute;
  bottom: 20px;
  left: 50%;
  font-size: 34px;
  transform: translateX(-50%);
  z-index: 5;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.45));
}

.goal-text {
  opacity: 0;
  position: absolute;
  left: 0;
  top: 94px;
  width: 100%;
  font-size: clamp(42px, 10vw, 64px);
  font-weight: 900;
  color: #f8d86b;
  text-shadow: 0 4px 0 #111, 0 0 22px rgba(248, 216, 107, 0.65);
  z-index: 6;
}

.pitch.play {
  animation: stadiumShake 0.35s ease-in-out 1.65s 3;
}

.pitch.play .ball {
  animation: shoot 2s cubic-bezier(.16,.84,.29,1) forwards;
}

.pitch.play .goal-text {
  animation: goalFlash 1.2s forwards;
}

@keyframes shoot {
  0% {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) scale(1) rotate(0deg);
  }
  45% {
    bottom: 105px;
    left: 43%;
    transform: translateX(-50%) scale(1.12) rotate(300deg);
  }
  75% {
    bottom: 170px;
    left: 52%;
    transform: translateX(-50%) scale(1.22) rotate(620deg);
  }
  100% {
    bottom: 204px;
    left: 50%;
    transform: translateX(-50%) scale(0.75) rotate(900deg);
  }
}

@keyframes goalFlash {
  0%, 62% {
    opacity: 0;
    transform: scale(0.6);
  }
  76% {
    opacity: 1;
    transform: scale(1.18);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes stadiumShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.result {
  margin: 40px auto 0;
  animation: revealUp 0.5s ease forwards;
}

.result p {
  color: white;
  margin-bottom: -10px;
  size: 17px;
  font-weight: bold;
}

.team-card {
  margin: 12px 0;
  padding: 16px;
  border-radius: 16px;
  background: transparent;
  border: none;
  font-size: 26px;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.8) rotateY(90deg);
  animation: revealCard 0.25s forwards;
}

.team-card:nth-child(2) {
  animation-delay: 0.1s;
}


@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .app {
    padding: 34px 16px;
  }

  input,
  button {
    width: 100%;
    margin: 8px 0 0;
  }

  .pitch {
    height: 240px;
  }
}

.shirt-grid {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 15px;
}

@keyframes revealCard {
  from {
    opacity: 0;
    transform: scale(0.8) rotateY(90deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

.team-image {
  width: 260px;
  height: auto;
  display: block;

  filter: drop-shadow(0 20px 30px rgba(0,0,0,.4));
}

.team-card h3 {
  color: white;
  margin-top: 12px;
  font-size: 24px;
}

@keyframes revealCard {
  from {
    opacity: 0;
    transform: rotateY(90deg);
  }

  to {
    opacity: 1;
    transform: rotateY(0);
  }
}

@media (max-width: 768px) {

  .shirt-grid {
    flex-direction: column;
    align-items: center;
    gap: 35px;
  }

  .team-image {
    width: min(280px, 85vw);
    height: auto;
  }

  .team-card:nth-child(2) {
    margin-top: -100px;
  }
}

.team-card {
  position: relative;
}

.status-eliminated .team-image {
  filter: grayscale(100%) brightness(0.65);
}

.team-status-banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);

  white-space: nowrap;
  width: max-content;
  min-width: 180px;

  text-align: center;
  font-size: clamp(14px, 2vw, 24px);
  line-height: 1;

  color: white;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 10px 20px;
  border: 3px solid white;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.status-eliminated .team-status-banner {
  background: #8b1e1e;
}

.status-round16 .team-status-banner {
  background: #0f5f46;
}

.status-quarter .team-status-banner {
  background: #1f4f6f;
}

.status-semi .team-status-banner {
  background: #4b2e6f;
}

.status-finalist .team-status-banner {
  background: #7a3f1d;
}

.status-winner .team-status-banner {
  background: linear-gradient(135deg, #f6d365, #b8860b);
  color: #111;
  border-color: #fff2b8;
}

.standings-button {
  display: inline-block;
  padding: 14px 26px;

  background: transparent;
  color: white;

  border: 3px solid #f6d365;
  border-radius: 999px;

  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0.8px;
  text-transform: uppercase;

  box-shadow: none;
}

.standings-button:hover {
  background: rgba(246, 211, 101, 0.12);
  color: #f6d365;
}

@media (max-width: 768px) {
  #kickButton,
  .standings-button {
    width: min(420px, 92vw);
    margin-top: 14px;
  }

  .standings-button {
    padding: 14px 18px;
    font-size: 18px;
    text-align: center;
  }
}

.form-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.standings-button {
  display: block;
  width: fit-content;
  margin: 30px auto 0;
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 14px;
  }

  #accessCode,
  #kickButton,
  .standings-button {
    width: min(420px, 92vw);
    box-sizing: border-box;
  }
}