:root {
  /* the dark look: a stadium under lights; the accent is the house amber (game-ui-colour §2), as Football's */
  --bg: #0b0d14;
  --bg2: #1b1a22;
  --ink: #e8e6ef;
  --accent: #ffb338;
  --accentLine: #ffd27a;
  --accentInk: #3a2204;
  --kInk1: #a4a2b5;
  --kInk2: #f5f3f9;
  --kLine1: #3a3546;
  --kLine2: #ffb338;
  --kBg2: #2c2420;
  --kBg3: #0b0d14;
  --kBg6: rgba(10, 9, 14, 0.9);
  --kBg9: #f5f3f9;
  --kInkG2: #0b0d14;
  --good: #7ad98a;
  --want: #ff8f6b;
}

/* R-C40: the light look */
:root[data-theme="light"] {
  --bg: #eef1f6;
  --bg2: #d9dde8;
  --ink: #16151c;
  --accent: #b26f00;
  --accentLine: #8a5600;
  --accentInk: #111111;
  --kInk1: #403e52;
  --kInk2: #0b0a10;
  --kLine1: #9c99ae;
  --kLine2: #b26f00;
  --kBg2: #ecdcc8;
  --kBg3: #dfe3ec;
  --kBg6: rgba(236, 239, 245, 0.94);
  --kBg9: #16151c;
  --kInkG2: #ffffff;
  --good: #1d7a32;
  --want: #b23a14;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
}
#app { height: 100%; display: flex; flex-direction: column; max-width: min(100%, 820px); margin: 0 auto; }
#hdr { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
#hdr .pill { background: var(--bg2); border: 2px solid var(--kLine1); border-radius: 999px; padding: 6px 11px; font-weight: 800; font-size: 15px; min-width: 44px; min-height: 44px; display: flex; align-items: center; cursor: pointer; justify-content: center; color: inherit; font-family: inherit; }
#hdrStatus { flex: 1; min-width: 0; text-align: center; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--kInk1); }

.scr { flex: 1; display: none; flex-direction: column; overflow-y: auto; padding: 6px 14px 18px; }
.scr.on { display: flex; }
#scr-menu { align-items: center; text-align: center; gap: 12px; }
#scr-menu h1 { font-size: clamp(30px, 8.5vw, 42px); color: var(--kInk2); display: flex; align-items: center; gap: 10px; margin-top: 6px; }
#scr-menu h1 .logo { width: 1.1em; height: 1.1em; }
#scr-menu .sub { color: var(--kInk1); font-weight: 600; }
button.big { width: 100%; border-radius: 16px; min-height: 52px; font-size: 18px; font-weight: 800; background: var(--bg2); color: var(--ink); border: 3px solid var(--kLine1); cursor: pointer; font-family: inherit; padding: 4px 10px; }
button.big:active { transform: translateY(2px); }
button.big.primary { background: var(--accent); border-color: var(--accentLine); color: var(--accentInk); }
button.big:disabled { opacity: 0.5; }
.menuRow { display: flex; gap: 8px; width: 100%; }
#needs { color: var(--kInk2); font-weight: 700; font-size: 14px; line-height: 1.4; }
#needs[hidden] { display: none; }
#saveNote { margin: 0 12px 6px; padding: 8px 12px; border-radius: 12px; background: var(--bg2); border: 2px solid var(--kLine2); color: var(--kInk2); font-weight: 800; font-size: 14px; line-height: 1.4; text-align: center; }
#saveNote[hidden] { display: none; }

#scr-play { padding: 0 6px 6px; gap: 6px; }
#playTop { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; padding: 2px 4px 0; min-height: 22px; font-variant-numeric: tabular-nums; }
#stageWrap { flex: 1; position: relative; min-height: 0; border-radius: 12px; overflow: hidden; background: var(--kBg3); }
canvas#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#glFail { position: absolute; inset: 16px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 16px; line-height: 1.5; color: var(--kInk2); background: var(--kBg6); border-radius: 12px; padding: 12px; }
#glFail[hidden] { display: none; }
#fpsNow { position: absolute; left: 6px; bottom: 6px; font: 11px/1.3 ui-monospace, monospace; color: var(--kInk1); background: var(--kBg6); padding: 2px 6px; border-radius: 6px; pointer-events: none; }
#fpsNow[hidden] { display: none; }


.ovl { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center; background: var(--kBg6); border-radius: 12px; padding: 12px; overflow-y: auto; overscroll-behavior: contain; }
.ovl.on { display: flex; }
.ovlCard { text-align: center; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; margin: auto; }
#ovlTitle { font-size: 24px; font-weight: 800; color: var(--kInk2); }
#ovlSub { color: var(--kInk1); font-weight: 700; line-height: 1.4; }

#scr-how .card, #scr-set .card { background: var(--bg2); border: 3px solid var(--kLine1); border-radius: 16px; padding: 14px; margin-bottom: 10px; font-size: 15px; line-height: 1.55; font-weight: 600; }
#scr-how h2, #scr-set h2 { margin-bottom: 8px; color: var(--kInk2); }
.legend { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.lgRow { font-size: 14px; font-weight: 700; }
#scr-set .card { display: flex; flex-direction: column; gap: 12px; }
.setRow { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg[hidden] { display: none; }
.seg button { flex: 1; min-height: 44px; min-width: 64px; border-radius: 12px; border: 3px solid var(--kLine1); background: var(--bg); color: var(--ink); font: 800 15px inherit; font-family: inherit; cursor: pointer; padding: 0 6px; }
.seg button.sel { border-color: var(--kLine2); background: var(--kBg2); }
.setNote { font: 12px/1.4 ui-monospace, monospace; color: var(--kInk1); }
.setNote2 { font-size: 14px; color: var(--kInk1); line-height: 1.4; }
.startRow { display: flex; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); background: var(--kBg9); color: var(--kInkG2); font-weight: 800; padding: 9px 16px; border-radius: 999px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 40; max-width: 90%; text-align: center; }
#toast.on { opacity: 1; }
html, body { overflow: hidden; overscroll-behavior: none; }
.scr { overscroll-behavior: contain; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* the play screen's top line, the hint, and the round picker */
#clockOut { text-align: center; color: var(--kInk1); }
#roundOut { text-align: right; color: var(--kInk1); white-space: nowrap; }
#hint { flex: none; text-align: center; color: var(--kInk1); font-weight: 800; font-size: 14px; padding: 4px 0 max(4px, env(safe-area-inset-bottom)); }
#hdrPause[hidden] { display: none; }
#veilTitle { font-size: 24px; font-weight: 800; color: var(--kInk2); }
.seg button:disabled { opacity: 0.45; cursor: default; }

/* Match: Pass and Shoot, over the bottom right of the pitch (a rail, R-C24); the goal banner */
#acts { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 10px; }
#acts[hidden] { display: none; }
button.act { min-height: 64px; min-width: 96px; border-radius: 20px; border: 3px solid var(--kLine1); background: var(--bg2); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 17px; cursor: pointer; opacity: 0.95; touch-action: manipulation; }
button.act:active { transform: translateY(2px); }
#banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: var(--kBg6); color: var(--accent); font-weight: 800; font-size: clamp(26px, 8vw, 40px); padding: 10px 22px; border-radius: 18px; pointer-events: none; white-space: nowrap; }
#banner[hidden] { display: none; }
#stageWrap.shake { animation: shake 0.45s linear; }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, -2px); } 80% { transform: translate(3px, 3px); } }
ul.how { margin: 0; padding-left: 20px; }
ul.how li { margin-bottom: 6px; }
#modeNote { color: var(--kInk1); font-weight: 700; font-size: 14px; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
#veilNote { color: var(--kInk1); font-weight: 700; line-height: 1.4; }
#veilNote[hidden], #veilMenu[hidden] { display: none; }
