/* Penalty Shootout — football family. A real game, not a quiz: pick a corner,
   the keeper dives. Best of 5, keeper learns your pattern. Standalone static
   page; see ../_GAMES_CONTRACT.md */
:root {
  --brand: #2C3A43;
  --brand-2: #517485;
  --accent: #E84E0F;
  --green: #2E9E4F;
  --gold: #FFD700;
  --danger: #D2434D;
  --bg: #eaf2f6;
  --card: #ffffff;
  --ink: #1e2b33;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(44, 58, 67, 0.14);
  --pitch: #2E9E4F;
  --pitch-2: #268a44;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%;
}
.grad-bg { background: linear-gradient(180deg, #eaf2f6 0%, #dcebf2 100%); min-height: 100vh; }

.app {
  max-width: 640px; margin: 0 auto; min-height: 100vh;
  padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 14px;
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.back-link { font-weight: 800; color: var(--brand-2); text-decoration: none; font-size: 16px; padding: 8px 0; }
.back-link:active { opacity: .6; }
.topbar-title { font-weight: 800; color: var(--brand); font-size: 16px; }

/* ---------- header ---------- */
.game-head { text-align: center; }
.game-emoji { font-size: 48px; line-height: 1; }
.game-title { font-size: 26px; font-weight: 800; color: var(--brand); margin: 6px 0 2px; }
.game-sub { color: var(--brand-2); font-weight: 600; font-size: 15px; margin: 0; }

/* ---------- scoreboard ---------- */
.board {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px;
}
.side { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 88px; }
.side .who { font-weight: 800; color: var(--brand); font-size: 14px; }
.side .goals { font-size: 30px; font-weight: 800; color: var(--accent); line-height: 1; }
.side.you .goals { color: var(--green); }
.pips { display: flex; gap: 4px; }
.pip { width: 11px; height: 11px; border-radius: 50%; background: #d7e2e8; }
.pip.scored { background: var(--green); }
.pip.saved { background: var(--danger); }
.board .vs { font-weight: 800; color: var(--brand-2); font-size: 14px; }
.board .phase { font-weight: 700; color: var(--brand-2); font-size: 13px; text-align: center; }

/* ---------- goal ---------- */
.goal-wrap { display: flex; justify-content: center; }
.goal {
  position: relative; width: 100%; max-width: 440px; aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, var(--pitch) 0%, var(--pitch-2) 100%);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  border: 4px solid #ffffff;
}
/* goal frame */
.goal-frame {
  position: absolute; left: 8%; right: 8%; top: 12%; height: 56%;
  border: 7px solid #ffffff; border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.28) 0 2px, transparent 2px 26px),
              repeating-linear-gradient(0deg, rgba(255,255,255,.28) 0 2px, transparent 2px 22px);
}
.pitch-line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.5);
}
/* targets */
.targets { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.tcell {
  border: none; background: transparent; cursor: pointer; position: relative;
  transition: background .12s ease;
}
.tcell:active { background: rgba(255,255,255,.18); }
.tcell[disabled] { cursor: default; }
.tcell .arrow {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; opacity: 0; transition: opacity .2s ease;
}
.tcell.picked .arrow { opacity: 1; }
.tcell.corner-top-left { border-top-left-radius: 12px; }

/* the ball + keeper */
.ball {
  position: absolute; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 45%, #cfd8dd 46% 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,.35), inset 0 0 0 2px rgba(0,0,0,.12);
  font-size: 17px; line-height: 30px; text-align: center;
  transition: transform .42s cubic-bezier(.3,.9,.4,1);
  z-index: 5; pointer-events: none;
}
.keeper {
  position: absolute; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 25px; line-height: 46px; text-align: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.3);
  transition: transform .42s cubic-bezier(.3,.9,.4,1);
  z-index: 4; pointer-events: none;
}

.goal-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800; color: #fff; z-index: 8;
  text-shadow: 0 3px 10px rgba(0,0,0,.55); opacity: 0; transition: opacity .18s ease;
  pointer-events: none;
}
.goal-msg.show { opacity: 1; }
.goal-msg.goal { color: #EAFFE9; }
.goal-msg.saved { color: #FFE3E3; }

/* ---------- controls ---------- */
.pick-label { text-align: center; font-weight: 800; color: var(--brand); font-size: 17px; margin: 0; }
.pick-row { display: flex; gap: 10px; }
.pick-btn {
  flex: 1; min-height: 58px; border: none; border-radius: 14px;
  background: var(--card); color: var(--brand); font: inherit; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow); cursor: pointer; border: 3px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.pick-btn:active { transform: scale(0.97); }
.pick-btn.on { border-color: var(--accent); background: #fff3e8; }
.pick-btn small { font-weight: 600; color: var(--brand-2); font-size: 11px; }

/* ---------- feedback ---------- */
.feedback { min-height: 28px; text-align: center; font-weight: 800; font-size: 17px; }
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--danger); }

/* ---------- buttons ---------- */
.btn {
  min-height: 58px; padding: 12px 20px; border: none; border-radius: 14px;
  background: var(--brand-2); color: #fff; font: inherit; font-weight: 700;
  font-size: 17px; cursor: pointer; box-shadow: var(--shadow); min-width: 80px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--brand-2); border: 2px solid var(--brand-2); }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

/* ---------- end card ---------- */
.endcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 18px; text-align: center; display: flex; flex-direction: column; gap: 12px;
}
.endcard .big { font-size: 56px; line-height: 1; }
.endcard h2 { margin: 0; color: var(--brand); font-size: 23px; }
.endcard .score { font-size: 40px; font-weight: 800; color: var(--accent); }
.endcard p { margin: 0; color: var(--brand-2); font-weight: 600; }

.muted { color: var(--brand-2); font-weight: 600; }
.loading { text-align: center; color: var(--brand-2); font-weight: 700; padding: 28px 0; }
.legend-note { text-align: center; color: var(--brand-2); font-weight: 600; font-size: 13px; margin: 0; }
