/* Set Piece Studio — tablet-first, high-contrast for outdoor use. */
:root {
  --bg: #F4F5F0;
  --panel: #FFFFFF;
  --panel-2: #EEF0EA;
  --ink: #0E1A13;
  --ink-2: #4A5650;
  --ink-3: #7B857F;
  --line: #D9DDD4;
  --pitch: #0B3D24;
  --pitch-2: #146B3C;
  --accent: #0E7A4B;
  --accent-ink: #FFFFFF;
  --us: #FFD23F;
  --us-ink: #1B1400;
  --them: #E5484D;
  --good: #11865A;
  --mid: #B7791F;
  --bad: #C9353A;
  --focus: #2563EB;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --shadow: 0 1px 2px rgba(10, 30, 20, .06), 0 4px 16px rgba(10, 30, 20, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1310; --panel: #141D18; --panel-2: #1B2620; --ink: #EEF3EF; --ink-2: #B3BEB7; --ink-3: #85918A;
    --line: #2A3730; --accent: #2BB673; --accent-ink: #04140B; --good: #3CCB88; --mid: #E2A93B; --bad: #FF6B6F;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1310; --panel: #141D18; --panel-2: #1B2620; --ink: #EEF3EF; --ink-2: #B3BEB7; --ink-3: #85918A;
  --line: #2A3730; --accent: #2BB673; --accent-ink: #04140B; --good: #3CCB88; --mid: #E2A93B; --bad: #FF6B6F;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

/* Shell ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: 96px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; background: var(--pitch); color: #DDEBE2;
  display: flex; flex-direction: column; align-items: stretch; padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
  gap: 6px; z-index: 5;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: #fff; padding: 6px 0 14px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--us); color: var(--pitch); display: grid; place-items: center; }
.brand-text { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; text-align: center; line-height: 1.15; }
.rail-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rail a:not(.brand) {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px;
  color: #CFE2D6; text-decoration: none; font-size: .72rem; font-weight: 650; min-height: 60px; justify-content: center;
}
.rail a:not(.brand):hover { background: rgba(255,255,255,.07); }
.rail a.active { background: rgba(255, 210, 63, .16); color: var(--us); }
.main { min-width: 0; }
.page { max-width: 1280px; margin: 0 auto; padding: 24px 28px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 76px; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .brand { display: none; }
  .rail-links { flex-direction: row; justify-content: space-around; }
  .rail a:not(.brand) { min-height: 54px; padding: 6px 2px; font-size: .64rem; flex: 1; }
  .rail-bottom { flex: 0 0 64px !important; }
  .page { padding: 16px 16px 48px; }
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 650;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; -webkit-user-select: none;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn.icon-only, .btn:has(> .icon:only-child) { padding: 0; width: var(--tap); }
.btn.sm:has(> .icon:only-child) { width: 38px; }

/* Forms ------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--ink-3); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--panel); color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--panel);
  font-weight: 650; cursor: pointer; color: var(--ink);
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chips.big .chip { min-height: 56px; border-radius: 14px; padding: 0 18px; font-size: 1rem; }

/* Cards & lists ----------------------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.routine-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; text-decoration: none; color: inherit; transition: transform .1s, box-shadow .1s; }
.routine-card:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(10,30,20,.12); }
.routine-card .thumb-wrap { background: #17803F; aspect-ratio: 2 / 1; display: grid; }
.routine-card .thumb { width: 100%; height: 100%; display: block; }
.routine-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.routine-card h3 { margin: 0; font-size: 1rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); font-size: .75rem; font-weight: 650; }
.tag.attack { background: color-mix(in srgb, var(--us) 35%, var(--panel)); color: var(--ink); }
.tag.defend { background: color-mix(in srgb, var(--them) 22%, var(--panel)); color: var(--ink); }
.tag.scout { background: color-mix(in srgb, #8B5CF6 22%, var(--panel)); color: var(--ink); }
.stat-line { font-size: .8rem; color: var(--ink-2); display: flex; gap: 10px; }
.stat-line b { color: var(--ink); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 60px;
}
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--panel-2); border-radius: 10px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; }
.list-row .sub { font-size: .85rem; color: var(--ink-2); }
.score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; min-width: 56px; text-align: center; }

table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
table.data td.num, table.data th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); }
.empty .btn { margin-top: 8px; }

/* Modal & toast ----------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 15, 10, .55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 0 22px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 14px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.success { background: var(--good); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (max-width: 720px) { #toasts { bottom: 96px; } }

/* Login ------------------------------------------------------------------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 80% -10%, #1A8A45, transparent), var(--pitch);
}
.login .card { width: min(420px, 100%); padding: 28px; }
.login .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login .error { color: var(--bad); font-weight: 600; min-height: 1.4em; }

/* Board ------------------------------------------------------------------- */
.board-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.board-svg .token, .board-svg .mark { cursor: grab; }
.board-svg .handle { fill: #fff; stroke: #0B3D24; stroke-width: .25; cursor: grab; }
.board-svg .handle.bend { fill: #4CC2FF; }
.board-svg .mark.selected path:not(.hit), .board-svg .mark.selected ellipse, .board-svg .mark.selected rect { filter: drop-shadow(0 0 .4px #fff) drop-shadow(0 0 .4px #fff); }
.board-svg.readonly .token, .board-svg.readonly .mark { cursor: default; }

/* Editor ------------------------------------------------------------------ */
.editor { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; background: #0B2A1A; color: #EAF3EE; }
.editor .topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--pitch); border-bottom: 1px solid rgba(255,255,255,.08); min-width: 0; }
.editor .topbar .name { flex: 1; min-width: 80px; background: transparent; border: 1.5px solid transparent; color: #fff; font-size: 1.15rem; font-weight: 750; min-height: 44px; padding: 0 10px; border-radius: 10px; }
.editor .topbar .name:hover, .editor .topbar .name:focus { border-color: rgba(255,255,255,.25); box-shadow: none; }
.editor .save-state { font-size: .8rem; color: #9FC2AE; white-space: nowrap; min-width: 64px; text-align: right; }
.editor .btn { background: rgba(255,255,255,.08); border-color: transparent; color: #fff; }
.editor .btn:hover { background: rgba(255,255,255,.15); }
.editor .btn.primary { background: var(--us); color: var(--us-ink); }
.editor .btn.on { background: var(--us); color: var(--us-ink); }
.editor-body { display: grid; grid-template-columns: 76px 1fr 300px; min-height: 0; }
.editor-body.panel-closed { grid-template-columns: 76px 1fr 0; }
.editor-body.panel-closed .side-panel { display: none; }
.tools { display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #0E3321; overflow-y: auto; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: 12px;
  border: 0; background: transparent; color: #CFE2D6; font-size: .64rem; font-weight: 700; cursor: pointer; padding: 4px 2px;
}
.tool:hover { background: rgba(255,255,255,.07); }
.tool.on { background: var(--us); color: var(--us-ink); }
.tool .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,.4); display: grid; place-items: center; font-size: .6rem; font-weight: 800; }
.tool-sep { height: 1px; background: rgba(255,255,255,.1); margin: 4px 6px; }
.stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 10px; }
.stage .board-svg { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); }
.stage-hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .85rem; pointer-events: none; white-space: nowrap; }
.side-panel { background: var(--panel); color: var(--ink); overflow-y: auto; padding: 14px 16px 24px; border-left: 1px solid var(--line); }
.side-panel h3 { margin-top: 6px; }
.side-panel .section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.side-panel .section:last-child { border-bottom: 0; }
.phase-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--pitch); overflow-x: auto; }
.phase-chip {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 2px solid transparent;
  background: rgba(255,255,255,.08); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.phase-chip .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.15); font-size: .85rem; }
.phase-chip.on { border-color: var(--us); background: rgba(255,210,63,.12); }
.phase-chip.on .n { background: var(--us); color: var(--us-ink); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line); cursor: pointer; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--panel) inset; }
@media (max-width: 1020px) {
  .editor-body { grid-template-columns: 68px 1fr; }
  .editor-body .side-panel { position: fixed; right: 0; top: 60px; bottom: 76px; width: min(340px, 92vw); z-index: 20; box-shadow: -10px 0 30px rgba(0,0,0,.3); border-radius: 16px 0 0 16px; }
  .editor .hide-narrow { display: none; }
}

/* Presentation ------------------------------------------------------------ */
.present { position: fixed; inset: 0; background: #06140C; color: #fff; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); }
.present .p-top { display: flex; align-items: center; gap: 8px 12px; padding: 12px 16px; flex-wrap: wrap; }
.present .p-title { flex: 1 1 200px; }
.present .p-title { flex: 1; min-width: 0; }
.present .p-title h1 { font-size: 1.4rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.present .p-title .eyebrow { color: #8FB9A1; }
.present .p-stage { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 16px; min-height: 0; padding: 0 16px; }
.present .board-box { position: relative; min-width: 0; min-height: 0; }
.present .board-box .board-svg { position: absolute; inset: 0; }
.present .caption {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: min(900px, 90%);
  background: rgba(4, 16, 10, .82); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 12px 18px; font-size: 1.15rem; line-height: 1.4;
  backdrop-filter: blur(6px);
}
.present .caption b { color: var(--us); margin-right: 8px; }
.present .p-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.present .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.present .btn:hover { background: rgba(255,255,255,.18); }
.present .btn.primary { background: var(--us); color: var(--us-ink); min-width: 120px; }
.present .dots { display: flex; gap: 6px; }
.present .dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; background: rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.present .dots button.on { background: var(--us); }
.present .side-notes { width: 300px; max-height: 100%; overflow: auto; background: rgba(4,16,10,.85); border-radius: 14px; padding: 14px 16px; font-size: .95rem; border: 1px solid rgba(255,255,255,.12); }
.present .side-notes h4 { margin: 0 0 6px; color: var(--us); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }

/* Print ------------------------------------------------------------------- */
.print-page { background: #fff; color: #111; padding: 24px; max-width: 1100px; margin: 0 auto; }
.print-page .no-print { display: flex; gap: 10px; margin-bottom: 18px; }
.print-page .p-routine { break-inside: avoid; page-break-inside: avoid; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px solid #111; }
.print-page .p-routine.page-break { break-before: page; page-break-before: always; }
.print-page .phases { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.print-page .phase-cell { break-inside: avoid; }
.print-page .phase-cell .board-svg { border-radius: 6px; }
.print-page .phase-cell .cap { font-size: .85rem; margin-top: 4px; }
.print-page .cover { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 4px solid #0B3D24; padding-bottom: 10px; margin-bottom: 20px; }
@media print {
  body { background: #fff; }
  .print-page { padding: 0; max-width: none; }
  .print-page .no-print { display: none; }
  @page { size: A4 landscape; margin: 12mm; }
  .board-svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Live logger ------------------------------------------------------------- */
.live { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
@media (max-width: 1020px) { .live { grid-template-columns: 1fr; } }
.step { margin-bottom: 18px; }
.step-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.step-label .n { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: .75rem; }
.team-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-toggle button { min-height: 64px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); font-weight: 800; font-size: 1.05rem; cursor: pointer; color: var(--ink); }
.team-toggle button.on.us { background: var(--us); border-color: var(--us); color: var(--us-ink); }
.team-toggle button.on.them { background: var(--them); border-color: var(--them); color: #fff; }
.outcome-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.outcome-grid button { min-height: 60px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); font-weight: 700; cursor: pointer; color: var(--ink); padding: 6px 10px; line-height: 1.2; }
.outcome-grid button.good { border-left: 8px solid var(--good); }
.outcome-grid button.mid { border-left: 8px solid var(--mid); }
.outcome-grid button.bad { border-left: 8px solid var(--bad); }
.outcome-grid button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.zone-picker { width: 100%; max-width: 560px; display: block; border-radius: 12px; touch-action: manipulation; }
.zone-picker .z { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.55); stroke-width: .15; cursor: pointer; }
.zone-picker .z:hover { fill: rgba(255,255,255,.18); }
.zone-picker .z.on { fill: rgba(255,210,63,.75); }
.zone-picker text { pointer-events: none; }
.clock { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clock .time { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 92px; }
.minute-input { width: 96px !important; text-align: center; font-weight: 800; font-size: 1.2rem; }
.event-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.event-row .min { font-weight: 800; width: 40px; font-variant-numeric: tabular-nums; }
.event-row .badge { width: 10px; align-self: stretch; border-radius: 4px; }
.badge.us { background: var(--us); } .badge.them { background: var(--them); }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.good { background: color-mix(in srgb, var(--good) 18%, var(--panel)); color: var(--good); }
.pill.mid { background: color-mix(in srgb, var(--mid) 18%, var(--panel)); color: var(--mid); }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, var(--panel)); color: var(--bad); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 8px; display: flex; gap: 10px; }
.sticky-save .btn { flex: 1; min-height: 64px; font-size: 1.1rem; }

/* Stats ------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { font-size: .8rem; color: var(--ink-2); font-weight: 650; }
.kpi .s { font-size: .78rem; color: var(--ink-3); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar { height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
.bar.us { background: #D9A800; }
.bar.them { background: var(--them); }
.bar-track { flex: 1; background: var(--panel-2); border-radius: 5px; height: 10px; overflow: hidden; display: flex; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; border: 0; background: transparent; border-radius: 9px; padding: 0 14px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.heat { width: 100%; max-width: 520px; display: block; border-radius: 12px; }
.trend { width: 100%; height: 180px; display: block; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Opponent ---------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { min-height: 48px; padding: 0 16px; border: 0; background: none; font-weight: 700; color: var(--ink-2); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; }
.pick { display: flex; gap: 10px; align-items: center; padding: 8px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--panel); text-align: left; color: var(--ink); }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.pick .mini { width: 84px; flex: none; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 1; }
.pick .mini svg { width: 100%; height: 100%; display: block; }
.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.order-item .mini { width: 120px; flex: none; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 1; }
.order-item .mini svg { width: 100%; height: 100%; display: block; }
.order-item .grow { flex: 1; min-width: 0; }
@media (max-width: 900px) { .present .side-notes { position: absolute; right: 16px; top: 0; width: min(300px, 80vw); z-index: 2; } .present .p-stage { grid-template-columns: 1fr; } }
.scoreboard { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.sb-side { display: flex; align-items: center; gap: 6px; }
.sb-label { font-weight: 800; width: 48px; }
.sb-val { font-size: 1.6rem; font-weight: 800; min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .present .p-title { order: 2; flex-basis: 100%; }
  .present .p-title h1 { font-size: 1.15rem; white-space: normal; }
  .present .caption { font-size: .95rem; bottom: 4px; }
}
