/* ============================================================
   Rundown — Situational Play Trainer (app)
   Brand: Field Green / Clay / Chalk / Flash Yellow
   ============================================================ */

:root {
  --navy: #0B4D3C;
  --navy-2: #0E5C48;
  --navy-3: #083A2D;
  --red: #C4603C;
  --red-2: #A8502F;
  --gold: #F4C430;
  --gold-2: #E0B021;
  --grass: #4A7C3A;
  --grass-2: #3E6A2F;
  --dirt: #B88557;
  --dirt-2: #A1754A;
  --white: #FFFFFF;
  --cream: #F5F1E8;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --line: rgba(255, 255, 255, 0.12);
  --good: #22C55E;
  --bad: #EF4444;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 30px rgba(11, 77, 60, 0.15);
  --shadow-lg: 0 20px 48px rgba(11, 77, 60, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  color: var(--ink);
  background:
    /* center vignette — subtle darken at edges, draws eye to content */
    radial-gradient(
      ellipse at 50% 40%,
      rgba(0, 0, 0, 0) 40%,
      rgba(0, 0, 0, 0.35) 100%
    ),
    /* mow-stripes — visible but restrained */
    repeating-linear-gradient(
      -18deg,
      transparent 0 46px,
      rgba(255, 255, 255, 0.04) 46px 92px
    ),
    /* warming clay dirt glow at bottom */
    radial-gradient(
      ellipse at 50% 110%,
      rgba(196, 96, 60, 0.3) 0%,
      rgba(196, 96, 60, 0) 55%
    ),
    /* top gold dugout-light highlight */
    radial-gradient(
      circle at 85% -10%,
      rgba(244, 196, 48, 0.12) 0%,
      rgba(244, 196, 48, 0) 45%
    ),
    /* main field-green body gradient */
    linear-gradient(180deg, #0B4D3C 0%, #0E5C48 45%, #083A2D 100%) fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, button, select {
  font: inherit;
  color: inherit;
}

/* ============ SCREEN SYSTEM ============ */
.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 16px 48px;
  max-width: 720px;
  margin: 0 auto;
}
.screen.active { display: block; }

.hidden { display: none !important; }

/* ============ START SCREEN ============ */
.hero {
  text-align: center;
  padding: 40px 0 32px;
  color: var(--white);
  position: relative;
}
/* Animated chalked "diamond" behind the logo — breathing + rotating glow */
.hero::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 190px;
  height: 190px;
  border: 2px dashed rgba(244, 196, 48, 0.22);
  border-radius: 12px;
  pointer-events: none;
  z-index: 0;
  animation: diamondBreathe 5s ease-in-out infinite;
}
/* Three subtle fielder dots on the diamond perimeter */
.hero::after {
  display: none; /* reserved — fielder dots injected via .hero-field below */
}
.hero-field-dots {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 190px;
  pointer-events: none;
  z-index: 0;
}
.hero-field-dots circle {
  fill: var(--gold);
  opacity: 0.45;
  animation: dotPulse 3s ease-in-out infinite;
}
.hero-field-dots circle:nth-child(2) { animation-delay: 0.6s; }
.hero-field-dots circle:nth-child(3) { animation-delay: 1.2s; }
.hero-field-dots circle:nth-child(4) { animation-delay: 1.8s; }
@keyframes diamondBreathe {
  0%, 100% { transform: translateX(-50%) rotate(45deg) scale(1); opacity: 0.9; }
  50%      { transform: translateX(-50%) rotate(45deg) scale(1.03); opacity: 1; }
}
@keyframes dotPulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(1.15); }
}
.rocket-logo {
  display: inline-block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 24px rgba(244, 196, 48, 0.28));
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.hero h1 {
  margin: 14px 0 4px;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.tagline {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12px;
  position: relative;
  z-index: 1;
}
.welcome-line {
  margin: 10px 0 0;
  color: var(--chalk);
  font-size: 14px;
  position: relative;
  z-index: 1;
  opacity: 0.9;
}
.preview-pill {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 12px;
  background: rgba(244, 196, 48, 0.12);
  border: 1px solid rgba(244, 196, 48, 0.35);
  color: var(--gold);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  position: relative;
  z-index: 1;
}
.pp-dot {
  display: inline-block;
  animation: pp-pulse 1.8s ease-in-out infinite;
  color: var(--gold);
  margin-right: 4px;
}
@keyframes pp-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}
.welcome-line .wl-stat {
  color: var(--gold);
  font-weight: 800;
}

/* Thin gold chalk-line divider under the hero */
.hero::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 14px auto 0;
  border-radius: 2px;
  position: relative;
  z-index: 1;
  opacity: 0.8;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
/* Chalk-line accent on the top of every card — subtle tie to the field theme */
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 60%, var(--red) 100%);
  opacity: 0.7;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  position: relative;
}
.field-label::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 24px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.85;
}
.field-label:first-child { margin-top: 0; }

input[type="text"], select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #E5E7EB;
  border-radius: var(--radius);
  font-size: 16px;
  transition: border-color 0.15s;
  background: var(--white);
}
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--navy);
}

/* Sport picker */
.sport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.sport-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 18px;
  background: #F3F4F6;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}
.sport-btn:hover { background: #E5E7EB; transform: translateY(-1px); }
.sport-btn:active { transform: translateY(0) scale(0.985); }
.sport-btn.active {
  box-shadow: 0 4px 16px rgba(11, 77, 60, 0.3);
}
.sport-btn .sport-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
}
.sport-btn .sport-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.sport-btn.active {
  background: var(--navy);
  border-color: var(--gold);
}
.sport-btn.active .sport-title { color: var(--white); }
.sport-btn.active .sport-sub { color: var(--gold); }

/* Position picker */
.position-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.pos-btn {
  padding: 14px 4px;
  background: #F3F4F6;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  color: var(--ink-2);
  letter-spacing: 0.03em;
}
.pos-btn:hover { background: #E5E7EB; transform: translateY(-1px); }
.pos-btn:active { transform: translateY(0) scale(0.97); }
.pos-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 77, 60, 0.3);
}

/* Mode picker */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 560px) {
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
}
.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 16px;
  background: #F3F4F6;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.mode-btn .mode-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.mode-btn .mode-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.mode-btn.active {
  background: var(--navy);
  border-color: var(--gold);
}
.mode-btn.active .mode-title,
.mode-btn.active .mode-sub {
  color: var(--white);
}
.mode-btn.active .mode-sub { color: var(--gold); }

.length-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.len-btn {
  padding: 12px;
  background: #F3F4F6;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-2);
}
.len-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--gold);
}

/* Buttons */
.primary-btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.35);
}
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(230, 57, 70, 0.45);
}
.primary-btn:active { transform: translateY(0); }
.primary-btn.big {
  padding: 20px;
  font-size: 17px;
  margin-top: 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--red) 0%, var(--red-2) 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.25) inset,
    0 8px 22px rgba(196, 96, 60, 0.4),
    0 2px 0 rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}
.primary-btn.big::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 120%, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
}
.primary-btn.big:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.3) inset,
    0 12px 30px rgba(196, 96, 60, 0.55),
    0 2px 0 rgba(0,0,0,0.15);
}
.primary-btn.big:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.2) inset,
    0 4px 14px rgba(196, 96, 60, 0.35),
    0 1px 0 rgba(0,0,0,0.15);
}

.secondary-btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.secondary-btn:hover { background: var(--navy-2); }

.tertiary-btn {
  display: inline-block;
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
  margin-top: 8px;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: none;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }

/* Leaderboard */
.leaderboard h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--navy);
}
.leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
}
.leaderboard li {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #F9FAFB;
  border-radius: 10px;
  margin-bottom: 6px;
  counter-increment: rank;
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}
.leaderboard li::before {
  content: counter(rank);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  font-weight: 900;
  font-size: 13px;
  margin-right: 12px;
  flex-shrink: 0;
}
.leaderboard li:first-child::before { background: var(--gold); }
.leaderboard li:nth-child(2)::before { background: #D1D5DB; }
.leaderboard li:nth-child(3)::before { background: #F0B070; }
.leaderboard li.empty {
  background: transparent;
  color: var(--muted);
  justify-content: center;
}
.leaderboard li.empty::before { display: none; }
.lb-name { flex: 1; }
.lb-score { color: var(--red); font-weight: 800; }
.lb-pos {
  font-size: 11px;
  color: var(--white);
  background: var(--navy);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.legal {
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 16px;
}

/* ============ GAME SCREEN ============ */
#game-screen {
  padding: 12px 12px 32px;
}
.game-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 12px;
}
.hud {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.1);
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 210, 63, 0.2);
}
.hud-label {
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hud-val {
  color: var(--white);
  font-weight: 800;
  font-size: 18px;
  margin-top: 2px;
}

.field-wrap {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
#field {
  width: 100%;
  height: auto;
  display: block;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}
.tag {
  padding: 5px 11px;
  background: var(--cream);
  color: var(--navy);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.tag.pos {
  background: var(--red);
  color: var(--white);
}

.situation-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gold);
}
.situation-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--navy);
  line-height: 1.3;
}
.situation-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.4;
}
.option-btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}
.option-btn .opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--navy);
  color: var(--gold);
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.option-btn.correct {
  background: #F0FDF4;
  border-color: var(--good);
}
.option-btn.correct .opt-letter {
  background: var(--good);
  color: var(--white);
}
.option-btn.wrong {
  background: #FEF2F2;
  border-color: var(--bad);
}
.option-btn.wrong .opt-letter {
  background: var(--bad);
  color: var(--white);
}
.option-btn.disabled {
  cursor: default;
  pointer-events: none;
  opacity: 0.7;
}

/* Feedback */
.feedback {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--red);
  animation: slideUp 0.3s ease;
}
.feedback.correct { border-top-color: var(--good); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.feedback-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.feedback-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bad);
  color: var(--white);
  font-weight: 900;
  font-size: 18px;
}
.feedback.correct .feedback-icon { background: var(--good); }
.feedback-head h3 {
  margin: 0;
  font-size: 20px;
  color: var(--navy);
}
.correct-line {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #F0FDF4;
  color: #166534;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
#feedback-explanation {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.coach-quote {
  background: var(--navy);
  color: var(--white);
  padding: 12px 14px;
  border-radius: var(--radius);
  border-left: 4px solid var(--gold);
  margin-bottom: 12px;
}
.coach-label {
  display: block;
  font-size: 10px;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.coach-quote p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
}

/* ============ RESULTS SCREEN ============ */
.results-card {
  text-align: center;
  padding: 28px 22px;
}
.stars {
  font-size: 42px;
  margin-bottom: 8px;
  letter-spacing: 4px;
}
.results-card h2 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 26px;
}
.results-sub {
  color: var(--muted);
  margin: 0 0 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
@media (max-width: 440px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: #F9FAFB;
  padding: 14px 8px;
  border-radius: var(--radius);
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  min-height: 0;
}
.achievement {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--navy);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(255, 210, 63, 0.4);
}
.buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============ MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 35, 66, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-content .icon-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: #F3F4F6;
  color: var(--ink);
}
.modal-content h3 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: 20px;
}
.share-card {
  background: linear-gradient(135deg, var(--navy), var(--navy-3));
  color: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  text-align: center;
  border: 2px solid var(--gold);
}
.share-card .sc-team {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.share-card .sc-name {
  font-size: 22px;
  font-weight: 800;
  margin: 6px 0;
}
.share-card .sc-score {
  font-size: 40px;
  font-weight: 900;
  color: var(--gold);
  margin: 6px 0;
  line-height: 1;
}
.share-card .sc-sub {
  font-size: 13px;
  opacity: 0.9;
}
#share-text {
  width: 100%;
  height: 110px;
  padding: 10px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  resize: none;
  font-family: -apple-system, monospace;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ============ PWA INSTALL BANNER ============ */
.install-banner {
  position: sticky;
  top: 0;
  z-index: 250;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%);
  color: var(--cream);
  border-bottom: 2px solid var(--gold);
  animation: installSlide 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.install-banner.hidden { display: none; }
@keyframes installSlide {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}
.install-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.install-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.install-copy {
  flex: 1;
  min-width: 0;
}
.install-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--cream);
  margin: 0;
  letter-spacing: 0.02em;
}
.install-sub {
  font-size: 12px;
  color: rgba(245, 241, 232, 0.75);
  margin-top: 1px;
  line-height: 1.35;
}
.install-action {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(244, 196, 48, 0.35);
}
.install-action:hover {
  background: var(--gold-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 196, 48, 0.5);
}
.install-x {
  background: transparent;
  color: rgba(245, 241, 232, 0.6);
  border: none;
  width: 28px;
  height: 28px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  transition: all 0.15s ease;
}
.install-x:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
}

/* iOS install steps inside the sheet */
.ios-steps {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.ios-steps li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(10, 35, 66, 0.1);
}
.ios-steps li:last-child { border-bottom: none; }
.ios-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  font-weight: 400;
}
.ios-steps strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
  margin-bottom: 2px;
}
.ios-steps p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

/* ============ GLOSSARY SHEET ============ */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet.hidden { display: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 77, 60, 0.55);
  backdrop-filter: blur(4px);
  animation: sheetFade 0.22s ease;
}
@keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }
.sheet-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(11, 77, 60, 0.25);
  display: flex;
  flex-direction: column;
  animation: sheetSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
@keyframes sheetSlide {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-handle {
  width: 42px;
  height: 4px;
  background: rgba(11, 77, 60, 0.18);
  border-radius: 2px;
  margin: 8px auto 4px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  border-bottom: 1px solid rgba(11, 77, 60, 0.1);
}
.sheet-head h3 {
  margin: 0;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 24px;
  letter-spacing: 0.03em;
  color: var(--navy);
}
.sheet-head .icon-btn {
  background: rgba(11, 77, 60, 0.08);
  color: var(--navy);
}
.sheet-body {
  overflow-y: auto;
  padding: 16px 20px 32px;
  -webkit-overflow-scrolling: touch;
}
.sheet-intro {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.g-section {
  margin-bottom: 22px;
}
.g-section h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}
.g-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.g-list dt {
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
}
.g-list dd {
  margin: 0;
  color: var(--ink-2);
}
.g-list dd em { color: var(--navy); font-style: italic; font-weight: 600; }
.g-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--white);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

/* Help / Glossary button in game header — pill-shaped, gold so it's obvious */
#help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 6px 12px 6px 6px;
  height: 36px;
  background: #F4C430;
  color: #0A2342;
  border: 2px solid #F4C430;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
#help-btn:hover,
#help-btn:focus-visible {
  background: #FFD23F;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.22);
  outline: none;
}
#help-btn .help-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: #0A2342;
  color: #F4C430;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
#help-btn .help-label { line-height: 1; }

/* One-time attention pulse — runs for a handful of cycles on first-play so the
   glossary catches the player's eye, then settles down. */
@keyframes helpPulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 0 0 0 rgba(244,196,48,0.7); }
  50%      { box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 0 0 10px rgba(244,196,48,0); }
}
#help-btn.pulse {
  animation: helpPulse 1.4s ease-in-out 3;
}

/* On narrow phones, drop the word to keep the header tight but KEEP the gold pill */
@media (max-width: 380px) {
  #help-btn .help-label { display: none; }
  #help-btn { padding: 6px; }
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 24px;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastUp 0.25s ease;
}
@keyframes toastUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ FIELD SVG ============ */
.field-grass   { fill: var(--grass); }
.field-grass-2 { fill: var(--grass-2); }
.field-dirt    { fill: var(--dirt); }
.field-line    { stroke: var(--white); stroke-width: 2; fill: none; }
.field-base    { fill: var(--white); stroke: #888; stroke-width: 1; }
.pitcher-circle-bg { fill: var(--dirt-2); }

.fielder {
  transition: all 0.25s ease;
}
.fielder-circle {
  fill: var(--white);
  stroke: var(--navy);
  stroke-width: 2.5;
}
.fielder-label {
  font-size: 14px;
  font-weight: 800;
  fill: var(--navy);
  text-anchor: middle;
  dominant-baseline: central;
  font-family: -apple-system, sans-serif;
}
.fielder.active .fielder-circle {
  fill: var(--red);
  stroke: var(--gold);
  stroke-width: 3;
  filter: drop-shadow(0 0 12px rgba(255, 210, 63, 0.7));
}
.fielder.active .fielder-label {
  fill: var(--white);
}

.runner {
  fill: var(--gold);
  stroke: var(--navy);
  stroke-width: 2;
}
.ball {
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
.ball-shadow {
  pointer-events: none;
}
.ball-seam {
  pointer-events: none;
}
.throw-ball {
  filter: drop-shadow(0 3px 5px rgba(230, 57, 70, 0.5));
}

/* Fielder pulse on ball arrival */
.fielder.pulse .fielder-circle {
  animation: pulse 0.45s ease-out;
}
@keyframes pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); filter: drop-shadow(0 0 12px rgba(255, 210, 63, 0.8)); }
  100% { transform: scale(1); }
}
.fielder.pulse .fielder-circle {
  transform-origin: center;
  transform-box: fill-box;
}

.fielder.active .fielder-circle {
  animation: activeGlow 2.4s ease-in-out infinite;
}
@keyframes activeGlow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.5)); }
  50%      { filter: drop-shadow(0 0 16px rgba(255, 210, 63, 0.85)); }
}

.runner-group {
  transition: transform 0.15s linear;
}

/* ============ Tablet / Larger ============ */
@media (min-width: 720px) {
  .hero h1 { font-size: 48px; }
  #game-screen .hud-val { font-size: 22px; }
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
  .buttons {
    flex-direction: row;
    justify-content: center;
  }
  .buttons button { max-width: 200px; }
}

/* ============ Safe area (iOS) ============ */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
