/* ============================================
   PENALTY — monochrome console aesthetic
   One accent color only: terminal green (#3CFF7A)
   Everything else: black / white / gray
   ============================================ */

:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --line: #2b2b2b;
  --text: #f2f2f2;
  --dim: #8a8a8a;
  --accent: #3cff7a;   /* goal / success */
  --danger: #ff4d4d;   /* save / loss */
  --font-mono: 'Courier New', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 720px;
}
.screen.active { display: block; }

/* ---------- SELECT SCREEN ---------- */
.topbar { text-align: center; margin-bottom: 32px; }
.topbar-tag {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--accent);
}
.title {
  font-size: 42px;
  letter-spacing: 8px;
  margin: 12px 0 8px;
}
.cursor {
  animation: blink 1s step-start infinite;
  color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }
.subtitle {
  color: var(--dim);
  font-size: 13px;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.team-card {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  padding: 28px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.team-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.team-card:focus-visible { outline: 2px solid var(--accent); }
.flag { font-size: 40px; }
.team-name { letter-spacing: 2px; font-size: 14px; }

/* ---------- GAME SCREEN ---------- */
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  padding: 14px 20px;
  margin-bottom: 20px;
}
.score-side { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 1px; }
.score-flag { font-size: 22px; }
.score-center { text-align: center; }
#score-display { font-size: 28px; letter-spacing: 4px; display: block; }
.round-label { font-size: 11px; color: var(--dim); letter-spacing: 2px; }

.pitch {
  position: relative;
  height: 180px;
  border: 1px solid var(--line);
  border-top: none;
  margin-bottom: 16px;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, #101010, #101010 40px, #0d0d0d 40px, #0d0d0d 80px);
}
.goal {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 220px; height: 90px;
}
.goal-post {
  position: absolute;
  top: 0; width: 4px; height: 90px;
  background: var(--text);
}
.goal-post.left { left: 0; }
.goal-post.right { right: 0; }
.crossbar {
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--text);
}
.keeper {
  position: absolute;
  bottom: 82px;
  left: 50%;
  font-size: 30px;
  transform: translateX(-50%);
  transition: left 0.35s ease, transform 0.35s ease;
  z-index: 2;
}
/* Same 80px offset, same 82px resting height as the ball below —
   this is what guarantees a direction match lands them in the exact
   same spot. Only the rotate() is extra (purely visual, doesn't
   move the anchor point since it applies after the translate). */
.keeper.dive-left  { left: calc(50% - 80px); transform: translateX(-50%) rotate(-20deg); }
.keeper.dive-right { left: calc(50% + 80px); transform: translateX(-50%) rotate(20deg); }

.ball {
  position: absolute;
  bottom: 14px;
  left: 50%;
  font-size: 26px;
  transform: translateX(-50%);
  transition: left 0.55s ease, bottom 0.55s ease;
  z-index: 3;
}
/* Identical left offsets and identical 82px landing height as the
   keeper above — same coordinate system, same parent (.pitch),
   same numbers, so left = left and right = right, exactly. */
.ball.kick-left     { left: calc(50% - 80px); bottom: 82px; }
.ball.kick-right    { left: calc(50% + 80px); bottom: 82px; }
.ball.kick-straight { left: 50%;              bottom: 82px; }

.players-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--dim);
}
.player-list { display: flex; flex-direction: column; gap: 3px; }
.player-list .current { color: var(--accent); }

.log-line {
  text-align: center;
  min-height: 18px;
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 14px;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.shot-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  padding: 14px 20px;
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.shot-btn:hover:not(:disabled) { border-color: var(--accent); }
.shot-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- RESULT SCREEN ---------- */
#screen-result {
  text-align: center;
  position: relative;
}
.flag-fill {
  position: absolute;
  inset: -24px;
  z-index: -1;
  opacity: 0.12;
  font-size: 90px;
  line-height: 1;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
}
.result-title {
  font-size: 34px;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.result-title.win { color: var(--accent); }
.result-title.lose { color: var(--danger); }
.result-sub {
  color: var(--dim);
  margin-bottom: 28px;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .keeper, .ball, .cursor { transition: none; animation: none; }
}

@media (max-width: 480px) {
  .title { font-size: 30px; letter-spacing: 4px; }
  .team-grid { grid-template-columns: 1fr; }
  .controls { flex-wrap: wrap; }
}