:root {
  --navy: #15263d;
  --cream: #fff4dc;
  --gold: #ffd34e;
  --mint: #52d68a;
  --cyan: #32c5f4;
  --coral: #f76d5e;
  font-family: ui-rounded, "Avenir Next", Nunito, system-ui, sans-serif;
  color: var(--navy);
  background: #101e30;
  font-weight: 700;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 0, #2c4a59, #101e30 75%);
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 2px solid var(--navy);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--navy);
}
button:disabled {
  cursor: default;
  filter: saturate(0.4);
  opacity: 0.65;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
#app {
  width: min(100%, calc(100svh * 0.5625), 720px);
  min-width: 360px;
  height: 100svh;
  max-height: 1280px;
  position: relative;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 0 0 90px #0006;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
#game {
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  height: 60px;
  flex-shrink: 0;
  background: var(--navy);
  color: var(--cream);
  display: grid;
  grid-template-columns: 1fr 44px auto;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
}
.club {
  min-width: 0;
}
.eyebrow {
  display: block;
  color: var(--mint);
  letter-spacing: 1.8px;
  font-size: 9px;
  margin-bottom: 2px;
}
.club strong {
  font-size: 15px;
  line-height: 1.1;
  display: block;
  white-space: nowrap;
}
#pause {
  width: 44px;
  height: 44px;
  background: #2c4057;
  color: var(--cream);
  border-radius: 12px;
  font-size: 24px;
}
.wallet {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wallet strong {
  font-size: 23px;
  color: var(--gold);
}
.coin {
  color: var(--gold);
  font-size: 20px;
}
#income {
  display: block;
  color: var(--mint);
  font-size: 10px;
}
.scoreboard {
  height: 39px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 9px;
  background: #21374d;
  color: var(--cream);
  gap: 4px;
  padding: 0 8px;
}
.scoreboard strong {
  font-size: 21px;
  white-space: nowrap;
}
.scoreboard small {
  opacity: 0.45;
}
.kit {
  font-style: normal;
  padding: 2px 4px;
  border-radius: 4px;
}
.cyan {
  background: var(--cyan);
  color: var(--navy);
}
.coral {
  background: var(--coral);
  color: var(--navy);
}
#timer {
  background: var(--navy);
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--gold);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pitch-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #426f58;
  overflow: hidden;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.pitch-tag {
  position: absolute;
  right: 10px;
  top: 9px;
  font-size: 8px;
  letter-spacing: 1px;
  color: #fff4dc9c;
  pointer-events: none;
}
#callout {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cream);
  border: 2px solid var(--navy);
  border-radius: 10px;
  padding: 8px 12px;
  width: max-content;
  max-width: 92%;
  text-align: center;
  font-size: 11px;
  box-shadow: 0 3px 0 #15263d40;
}
#callout:empty {
  display: none;
}
.controls {
  flex-shrink: 0;
  padding: 6px 10px 3px;
  background: var(--cream);
  border-top: 3px solid var(--navy);
}
.lane-label {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.lanes {
  display: flex;
  gap: 6px;
}
.lanes button {
  height: 44px;
  flex: 1;
  background: var(--navy);
  color: var(--cream);
  border-radius: 9px;
  font-size: 10px;
}
.lanes button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--navy);
  box-shadow: 0 2px 0 var(--navy);
}
.lanes span {
  font-size: 18px;
  margin-right: 4px;
}
kbd {
  font: inherit;
  opacity: 0.55;
  font-size: 9px;
  margin-left: 4px;
}
.cards {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}
.card {
  width: 33.333%;
  position: relative;
  display: grid;
  grid-template-columns: 39px 1fr;
  grid-template-rows: 25px 21px 14px 15px;
  align-items: center;
  gap: 0 3px;
  padding: 7px 5px 4px;
  background: #fffaf0;
  border-radius: 12px;
  box-shadow: 0 3px 0 #15263d25;
  text-align: left;
  min-height: 86px;
  user-select: none;
  touch-action: none;
}
.portrait {
  grid-row: 1/3;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--cyan);
  color: var(--navy);
  border: 2px solid var(--navy);
  width: 36px;
  height: 43px;
  font-size: 24px;
  font-weight: 1000;
  background-size: cover;
  background-position: center;
}
.tackler {
  border-radius: 7px;
  width: 39px;
  box-shadow: inset 5px 0 0 #fff8;
}
.striker {
  background: var(--gold);
  border-radius: 14px 4px 12px 4px;
}
.role-title {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.role-title kbd {
  font-size: 8px;
  margin-left: 1px;
}
.role-cost {
  font-size: 15px;
  color: #936b0d;
}
.role-desc {
  grid-column: 1/3;
  font-size: 7px;
  letter-spacing: 0.4px;
  text-align: center;
  color: #52616a;
}
.reason {
  grid-column: 1/3;
  font-size: 8px;
  min-height: 13px;
  text-align: center;
  color: #7e4a36;
}
.card[aria-disabled="true"] {
  background: #e6e5db;
}
.card[aria-disabled="true"] .portrait {
  opacity: 0.55;
}
#upgrade {
  height: 49px;
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 9px;
  padding: 4px 10px;
  background: var(--mint);
  border-radius: 10px;
  margin-top: 8px;
  box-shadow: 0 2px 0 #15263d25;
}
#upgrade strong {
  font-size: 12px;
  display: block;
}
#upgrade small {
  font-size: 9px;
  display: block;
}
.upgrade-icon {
  font-size: 27px;
}
#upgrade-cost {
  margin-left: auto;
  white-space: nowrap;
  font-size: 17px;
}
.footnote {
  display: flex;
  justify-content: space-between;
  font-size: 7px;
  min-height: 13px;
  align-items: center;
  gap: 4px;
  color: #52616a;
}
#storage-notice {
  color: #914737;
  font-size: 8px;
}
#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #101e30b8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
#overlay:empty {
  display: none;
}
.panel {
  width: 100%;
  background: var(--cream);
  border: 3px solid var(--navy);
  border-radius: 24px;
  padding: 23px 20px;
  box-shadow: 0 9px 0 #0003;
  text-align: center;
  position: relative;
}
.panel h1 {
  font-size: 35px;
  line-height: 0.95;
  letter-spacing: -1.5px;
  margin: 10px 0 14px;
  font-weight: 1000;
}
.panel h2 {
  font-size: 15px;
  margin: 12px 0 6px;
}
.panel p {
  font-size: 12px;
  line-height: 1.5;
}
.panel .eyebrow {
  color: #61736e;
  font-size: 10px;
}
.panel button {
  display: block;
  width: 100%;
  min-height: 48px;
  border-radius: 11px;
  margin: 10px 0 0;
  padding: 9px;
  background: var(--gold);
  box-shadow: 0 3px 0 var(--navy);
  font-size: 14px;
  font-weight: 900;
}
.panel button.secondary {
  background: var(--navy);
  color: var(--cream);
  box-shadow: none;
}
.panel .setting {
  display: flex;
  justify-content: space-between;
  background: #e4e5d7;
  box-shadow: none;
  align-items: center;
}
.setting b {
  border-radius: 30px;
  background: var(--navy);
  color: var(--cream);
  padding: 4px 10px;
  font-size: 11px;
}
.setting[aria-pressed="true"] b {
  background: var(--mint);
  color: var(--navy);
}
.hero-badge {
  font-size: 64px;
  margin: 10px 0;
  filter: drop-shadow(0 4px 0 #15263d30);
}
.result-score {
  font-size: 40px;
  font-weight: 1000;
  margin: 10px;
}
.reward {
  background: var(--gold);
  border-radius: 10px;
  padding: 10px;
  font-size: 20px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  text-align: left;
  font-size: 12px;
  padding: 16px 4px;
  border-top: 1px solid #15263d2b;
  margin-top: 18px;
}
.stats strong {
  text-align: right;
}
.title-panel {
  background: transparent;
  color: var(--cream);
  border: 0;
  box-shadow: none;
  padding: 14px 6px;
}
.title-panel h1 {
  font-size: 65px;
  line-height: 0.85;
  transform: rotate(-5deg);
  color: var(--cream);
  text-shadow:
    3px 4px 0 var(--navy),
    -2px -2px 0 var(--navy),
    6px 8px 0 #0004;
  margin: 15px 0 20px;
}
.title-panel h1 span {
  display: block;
  color: var(--gold);
  font-size: 69px;
}
.title-panel .eyebrow {
  color: var(--mint);
  letter-spacing: 3px;
}
.title-panel p {
  color: var(--cream);
}
.title-panel .hero-badge {
  font-size: 80px;
}
.title-panel button {
  min-height: 52px;
}
.title-panel .tagline {
  letter-spacing: 2px;
  font-size: 10px;
}
.hold-track {
  height: 5px;
  background: #ffffff36;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.hold-track span {
  display: block;
  height: 100%;
  background: var(--gold);
  width: 0;
}
.menu-art {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
}
#overlay.title {
  background: linear-gradient(180deg, #18374add, #163a3f66 50%, #102033ee);
}
.hint {
  font-size: 10px !important;
  opacity: 0.75;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.highlight {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}
.warning {
  color: var(--coral) !important;
}
.result-win h1 {
  color: #278257;
}
.result-loss h1 {
  color: #ca5146;
}
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  width: 7px;
  height: 12px;
  background: var(--gold);
  animation: fall 3s linear infinite;
}
.confetti i:nth-child(3n) {
  background: var(--cyan);
}
.confetti i:nth-child(3n + 1) {
  background: var(--mint);
}
@keyframes fall {
  from {
    transform: translateY(-50px) rotate(0);
  }
  to {
    transform: translateY(720px) rotate(540deg);
  }
}
.reduced-motion * {
  animation: none !important;
  transition: none !important;
}
#overlay .visit-notice {
  font-size: 10px;
  color: var(--gold);
}
@media (min-height: 800px) {
  header {
    height: 72px;
  }
  .scoreboard {
    height: 44px;
  }
  .controls {
    padding: 9px 13px 5px;
  }
  .card {
    min-height: 102px;
    grid-template-rows: 29px 25px 15px 17px;
    padding: 8px;
  }
  .portrait {
    height: 49px;
    width: 39px;
  }
  .role-title {
    font-size: 12px;
  }
  .lanes button {
    height: 46px;
  }
  #upgrade {
    height: 56px;
  }
  .footnote {
    min-height: 18px;
  }
  .lane-label {
    font-size: 9px;
  }
}
@media (min-width: 700px) and (min-height: 1100px) {
  header {
    height: 105px;
  }
  .scoreboard {
    height: 60px;
  }
  .club strong {
    font-size: 25px;
  }
  .eyebrow {
    font-size: 13px;
  }
  .wallet strong {
    font-size: 33px;
  }
  .scoreboard {
    font-size: 15px;
  }
  #timer {
    font-size: 21px;
  }
  .card {
    min-height: 140px;
    grid-template-columns: 65px 1fr;
    grid-template-rows: 38px 34px 20px 20px;
  }
  .portrait {
    width: 60px;
    height: 65px;
    font-size: 36px;
  }
  .role-title {
    font-size: 19px;
  }
  .role-cost {
    font-size: 23px;
  }
  .role-desc {
    font-size: 11px;
  }
  .reason {
    font-size: 12px;
  }
  .lanes button {
    height: 56px;
    font-size: 16px;
  }
  #upgrade {
    height: 76px;
  }
  #upgrade strong {
    font-size: 19px;
  }
  #upgrade small {
    font-size: 13px;
  }
  .panel h1 {
    font-size: 48px;
  }
  .panel p {
    font-size: 17px;
  }
  .panel button {
    min-height: 60px;
    font-size: 19px;
  }
  .panel {
    padding: 32px;
  }
  .title-panel h1 {
    font-size: 90px;
  }
  .title-panel h1 span {
    font-size: 96px;
  }
  .lane-label {
    font-size: 12px;
  }
  #callout {
    font-size: 16px;
  }
}
@media (max-width: 359px) {
  #app {
    min-width: 0;
  }
  .role-title {
    font-size: 9px;
  }
  kbd {
    display: none;
  }
}
#overlay.title {
  background-size: cover;
  background-position: center;
}
.title-art-space {
  height: 100px;
}
.title-panel .menu-art {
  max-height: 150px;
}
.title-panel {
  isolation: isolate;
}
.title-panel p {
  text-shadow: 0 1px 3px var(--navy);
}

/* HTML controls stay in CSS pixels; the renderer uniformly fits the pitch. */
#feedback { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:11; }
#income, #callout, .role-desc, .reason, #upgrade small, .hint, .footnote, #storage-notice { font-size:12px !important; }
.card { grid-template-rows:25px 21px minmax(28px,auto) minmax(28px,auto); min-width:0; }
.role-desc, .reason { letter-spacing:0; line-height:1.15; overflow-wrap:normal; }
.portrait { width:36px; height:36px; background-size:contain; background-repeat:no-repeat; }
.art-placeholder { background:#FFD34E; color:#15263D; padding:20px; border-radius:12px; }
#overlay { align-items:safe center; }
#app { width:min(100%, max(390px, calc(100svh * 0.5625)),720px); }

@media (max-width:399px) {
  .card { grid-template-columns:33px minmax(0,1fr); padding-left:3px; padding-right:3px; gap:0 2px; }
  .portrait { width:31px; height:31px; }
  .role-title kbd { display:none; }
  #upgrade-cost { font-size:14px; }
  header { padding-left:8px; padding-right:8px; gap:6px; }
  #stage { letter-spacing:.5px; }
}

#loading-progress { width:100%; height:8px; accent-color:var(--mint); }
.footnote { flex-wrap:wrap; }
#art-status { font-size:10px; }
/* Keep callouts outside the pitch action and guard labels. */
#callout { bottom:34px; padding:5px 8px; }
.pitch-tag { display:none; }
