*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Chrome tokens — dark mode (default). All values match original exactly. */
    --bg:             #0a0a0a;
    --surface:        #111;
    --surface-2:      #161616;   /* shot-row hover, btn-shoot hover */
    --surface-3:      #1c1c1c;   /* shot-row active */
    --border:         #1e1e1e;
    --line:           #2a2a2a;
    --text:           #f0f0f0;
    --text-secondary: #aaa;      /* rule-t, event-desc, daily-block-desc, etc. */
    --text-dim:       #b8b8b8;   /* info-def body copy */
    --text-faint:     #888;      /* secondary-bank button default */
    --text-ghost:     #666;      /* log entries */
    --muted:          #555;
    --overlay-bg:     rgba(0,0,0,0.9);
    --wash-sm:        rgba(255,255,255,0.03); /* scoring-ref bg */
    --wash-md:        rgba(255,255,255,0.04); /* info-btn bg */
    --wash-lg:        rgba(255,255,255,0.06); /* bf-part.risk bg */

    /* Heat-check button gradient stops (dark mode) */
    --hc-grad-a:      #3a2200;
    --hc-grad-b:      #2a1a00;
    --hc-grad-hover-a: #452800;
    --hc-grad-hover-b: #351f00;

    /* ALL IN button gradient stops (dark mode) */
    --allin-grad-a:      #2a0000;
    --allin-grad-b:      #1a0000;
    --allin-grad-hover-a: #3a0000;
    --allin-grad-hover-b: #280000;

    /* Accent tokens — unchanged */
    --orange:  #ff5500;
    --green:   #00b050;
    --red:     #e03030;
    --yellow:  #ffc700;
    --gold:    #e8a200;
}

/* Light theme overrides */
body.light {
    --bg:             #f7f7f8;
    --surface:        #ffffff;
    --surface-2:      #f0f0f2;   /* shot-row hover */
    --surface-3:      #e8e8eb;   /* shot-row active */
    --border:         #e0e0e4;
    --line:           #d0d0d5;
    --text:           #1a1a1a;
    --text-secondary: #5a5a6a;
    --text-dim:       #4a4a5a;
    --text-faint:     #888;
    --text-ghost:     #767686;
    --muted:          #8888a0;
    --overlay-bg:     rgba(0,0,0,0.5);
    --wash-sm:        rgba(0,0,0,0.03);
    --wash-md:        rgba(0,0,0,0.04);
    --wash-lg:        rgba(0,0,0,0.05);

    /* Heat-check button: warm amber on light */
    --hc-grad-a:      #fff3d6;
    --hc-grad-b:      #ffeab8;
    --hc-grad-hover-a: #ffeab8;
    --hc-grad-hover-b: #ffd980;

    /* ALL IN button: light red tint on light */
    --allin-grad-a:      #ffeaea;
    --allin-grad-b:      #ffe0e0;
    --allin-grad-hover-a: #ffd5d5;
    --allin-grad-hover-b: #ffc8c8;

    /* Darken gold/yellow for legibility on white */
    --yellow:  #b07800;
    --gold:    #8a5e00;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 24px 20px 60px;
    /* Smooth theme crossfade — suppressed for reduced-motion */
    transition: background-color 0.2s ease, color 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    body { transition: none; }
}

/* ── Modal ───────────────────────────────────────────────────── */

.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;          /* scroll when a modal is taller than the screen */
    z-index: 100;
    padding: 20px;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px 28px;
    max-width: 360px;
    width: 100%;
    margin: auto;              /* centers vertically when it fits, scrolls when it doesn't */
}

.modal-head { font-size: 28px; font-weight: 900; letter-spacing: -0.5px; margin-bottom: 4px; }
.modal-sub  { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

.rules { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.rule  { display: flex; gap: 12px; align-items: flex-start; }

.rule-n {
    font-size: 10px; font-weight: 700; color: var(--orange);
    background: rgba(255,85,0,0.1); border: 1px solid rgba(255,85,0,0.2);
    border-radius: 3px; padding: 2px 6px; margin-top: 2px; flex-shrink: 0;
}

.rule-t { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.rule-t strong { color: var(--text); font-weight: 600; }

/* ── Scoring reference ───────────────────────────────────────── */

.scoring-ref {
    background: var(--wash-sm); border: 1px solid var(--line);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}

.scoring-ref-label {
    font-size: 10px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px;
}

.bank-formula {
    display: flex; align-items: stretch; justify-content: space-between;
    gap: 6px; margin-bottom: 10px;
}

.bf-part {
    flex: 1; display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 11px; font-weight: 700;
    padding: 8px 4px; border-radius: 8px; line-height: 1.3;
}

.bf-part.risk { color: var(--text); background: var(--wash-lg); border: 1px solid var(--line); }
.bf-part.heat { color: #ff8844; background: rgba(255,85,0,0.08); border: 1px solid rgba(255,85,0,0.25); }
.bf-part.last { color: #4ade80; background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.25); }

.bf-plus { align-self: center; color: var(--muted); font-weight: 700; font-size: 13px; flex-shrink: 0; }

.bf-detail { font-size: 11px; color: var(--muted); line-height: 1.5; margin-bottom: 5px; }

.bf-detail-key {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; margin-right: 5px;
}

.bf-detail-key.heat { color: #ff8844; }
.bf-detail-key.last { color: #4ade80; }

.scoring-ref-note {
    font-size: 11px; color: var(--muted); line-height: 1.5;
    border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px;
}

.daily-block {
    background: rgba(255,199,0,0.06);
    border: 1px solid rgba(255,199,0,0.2);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.daily-block-label {
    font-size: 10px; font-weight: 700; color: var(--yellow);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 4px;
}

.daily-block-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.daily-block-desc { font-size: 12px; color: var(--text-secondary); }

.daily-completed {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,199,0,0.15);
}

.daily-completed-check {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.2px; color: var(--yellow);
}

.daily-completed-score {
    font-size: 11px; font-weight: 600; color: rgba(255,199,0,0.65);
}

.modal-buttons { display: flex; gap: 8px; }

.btn-free {
    flex: 1; padding: 13px; background: var(--surface); border: 1px solid var(--line);
    color: var(--text); border-radius: 10px; font-family: inherit; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: border-color 0.15s;
}

.btn-free:hover { border-color: var(--muted); }

.btn-daily {
    flex: 1; padding: 13px; background: var(--yellow); border: none;
    color: #000; border-radius: 10px; font-family: inherit; font-size: 14px;
    font-weight: 800; cursor: pointer; transition: opacity 0.15s;
}

.btn-daily:hover { opacity: 0.85; }

/* ── Game shell ───────────────────────────────────────────────── */

/* Mobile: single column, full width */
.shell { width: 100%; display: none; }
.game-left  { }
.game-right { margin-top: 20px; }

/* Desktop: two columns, fills the screen */
@media (min-width: 800px) {
    body { padding: 32px 48px 60px; }

    .shell {
        display: none;
        grid-template-columns: 360px 1fr;
        grid-template-rows: auto 1fr;
        column-gap: 48px;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
    }

    .shell.visible {
        display: grid;
    }

    .hdr        { grid-column: 1 / -1; }
    .game-left  { grid-column: 1; grid-row: 2; }
    .game-right { grid-column: 2; grid-row: 2; margin-top: 0; }

    .end-shell.visible {
        max-width: 680px;
        margin: 0 auto;
        width: 100%;
    }

    /* Modals get room to breathe on desktop instead of a narrow column */
    .modal { max-width: 460px; padding: 40px 36px; }

    .info-modal { max-width: 760px; }
    .info-body { column-count: 2; column-gap: 40px; }
}

/* Mobile visible state */
.shell.visible { display: block; }

.hdr { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; }

.hdr-home-btn {
    background: none; border: 1px solid var(--line); border-radius: 8px;
    color: var(--muted); font-size: 16px; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: border-color 0.15s, color 0.15s;
    margin-top: 1px;
}

.hdr-home-btn:hover { border-color: var(--muted); color: var(--text); }

.hdr-center { flex: 1; text-align: center; }

.hdr-title {
    font-size: 20px; font-weight: 900; letter-spacing: 3px;
    text-transform: uppercase; cursor: pointer; display: inline-block;
    transition: color 0.15s;
}

.hdr-title:hover { color: var(--text-secondary); }

.hdr-sub   { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 3px; }

.hdr-theme-btn {
    background: none; border: 1px solid var(--line); border-radius: 8px;
    color: var(--muted); font-size: 15px; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: border-color 0.15s, color 0.15s;
    margin-top: 1px; line-height: 1;
}

.hdr-theme-btn:hover { border-color: var(--muted); color: var(--text); }

.daily-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,199,0,0.1); border: 1px solid rgba(255,199,0,0.25);
    border-radius: 20px; padding: 3px 10px; margin-top: 7px;
    font-size: 11px; font-weight: 600; color: var(--yellow);
}

/* ── Scoreboard ──────────────────────────────────────────────── */

.scoreboard {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; margin-bottom: 18px;
}

.sb-cell {
    padding: 14px 10px; text-align: center;
    background: var(--surface); transition: background 0.25s;
}

.sb-cell + .sb-cell { border-left: 1px solid var(--border); }
.sb-cell.danger { background: rgba(224,48,48,0.07); }

.sb-num {
    font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums;
    line-height: 1; margin-bottom: 5px; transition: color 0.25s;
}

.sb-cell.danger .sb-num { color: var(--red); }
.sb-lbl { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }

.miss-pips { display: flex; justify-content: center; gap: 5px; margin-bottom: 5px; }

.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background 0.2s; }
.pip.spent { background: var(--red); }

/* ── Heat bar ────────────────────────────────────────────────── */

.heat-wrap { margin-bottom: 22px; }
.heat-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }

.heat-name {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.8px; color: var(--muted); transition: color 0.3s;
}

.heat-bonus-txt { font-size: 11px; color: var(--muted); }
.heat-bonus-txt span { color: var(--orange); font-weight: 600; }

.heat-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }

.heat-bar {
    height: 100%; width: 0%; background: var(--muted);
    border-radius: 2px; transition: width 0.35s ease, background 0.35s ease;
}

/* ── Screens ─────────────────────────────────────────────────── */

.screen { display: none; }
.screen.active { display: block; }

/* ── Event banner ────────────────────────────────────────────── */

.event-banner {
    border-radius: 10px; padding: 11px 14px; margin-bottom: 12px;
    display: flex; align-items: flex-start; gap: 12px;
}

.event-banner.green-release { background: rgba(0,176,80,0.08);  border: 1px solid rgba(0,176,80,0.25); }
.event-banner.double-points { background: rgba(255,85,0,0.08);  border: 1px solid rgba(255,85,0,0.25); }
.event-banner.heat-surge    { background: rgba(255,199,0,0.08); border: 1px solid rgba(255,199,0,0.25); }

.event-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 2px;
}

.event-banner.green-release .event-label { color: var(--green); }
.event-banner.double-points .event-label { color: var(--orange); }
.event-banner.heat-surge    .event-label { color: var(--yellow); }

.event-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ── Shot list ───────────────────────────────────────────────── */

.screen-label {
    font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px;
}

.screen-label-row {
    display: flex; align-items: center; justify-content: space-between;
}

.screen-label-row .screen-label { margin-bottom: 0; }

.info-btn {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--wash-md);
    color: var(--muted); font-family: inherit; font-size: 11px;
    font-weight: 700; font-style: italic; line-height: 1;
    cursor: pointer; flex-shrink: 0; margin-bottom: 10px;
}

.info-btn:hover { color: var(--text); border-color: var(--muted); }

/* ── In-game help overlay ────────────────────────────────────── */

.info-modal { cursor: pointer; max-height: 88vh; overflow-y: auto; }

.info-title {
    font-size: 22px; font-weight: 900; color: var(--text);
    letter-spacing: -0.3px; margin-bottom: 20px;
}

.info-group { margin-bottom: 22px; break-inside: avoid; }
.info-group:last-child { margin-bottom: 0; }

.info-section {
    font-size: 11px; font-weight: 700; color: var(--orange);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.info-item { margin-bottom: 14px; }
.info-item:last-child { margin-bottom: 0; }

.info-term {
    font-size: 12px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 5px;
}

.info-term.heat  { color: #ff8844; }
.info-term.bank  { color: #4ade80; }
.info-term.badge { color: var(--yellow); }
.info-term.check { color: var(--gold); }
.info-term.allin { color: var(--red); }

.info-def { font-size: 14px; color: var(--text-dim); line-height: 1.65; }
.info-def strong { color: var(--text); font-weight: 600; }

.info-dismiss {
    font-size: 10px; color: var(--muted); text-align: center;
    text-transform: uppercase; letter-spacing: 1.5px; margin-top: 20px;
}

/* Column headers — widths mirror .shot-name/.shot-pct/.shot-pts so each label
   sits directly above its value column. */
.shot-list-head {
    display: flex; align-items: center; gap: 12px; padding: 0 18px 6px;
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--muted);
}
.slh-name { flex: 1; }
.slh-pct  { width: 44px; text-align: right; }
.slh-pts  { width: 52px; text-align: right; }

.shot-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }

.shot-row {
    display: flex; align-items: center; padding: 15px 18px;
    background: var(--surface); cursor: pointer; transition: background 0.1s;
    position: relative; user-select: none; -webkit-tap-highlight-color: transparent; gap: 12px;
}

.shot-row + .shot-row { border-top: 1px solid var(--border); }
.shot-row:hover  { background: var(--surface-2); }
.shot-row:active { background: var(--surface-3); }

.shot-row::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}

.shot-row.low::before    { background: var(--green); }
.shot-row.medium::before { background: var(--yellow); }
.shot-row.high::before   { background: var(--red); }

.shot-name { font-size: 14px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 7px; }
.shot-pct  { font-size: 13px; color: var(--muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.shot-pts  { font-size: 13px; font-weight: 700; color: var(--orange); width: 52px; text-align: right; }

.shot-badge {
    font-size: 9px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.8px; border-radius: 3px; padding: 2px 5px;
}

.shot-badge.contested {
    background: rgba(224,48,48,0.12); color: var(--red);
    border: 1px solid rgba(224,48,48,0.25);
}

.shot-badge.in-zone {
    background: rgba(0,176,80,0.1); color: var(--green);
    border: 1px solid rgba(0,176,80,0.25);
}

.shot-meta {
    display: flex; gap: 4px; align-items: center; flex-shrink: 0;
}

.shot-heat-pip {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #ff8844;
    background: rgba(255,136,68,0.1); border: 1px solid rgba(255,136,68,0.2);
    border-radius: 3px; padding: 2px 5px;
}

.shot-bank-hint {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #4ade80;
    background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.18);
    border-radius: 3px; padding: 2px 5px;
}

.secondary-bank { text-align: center; margin-top: 8px; }

.secondary-bank button {
    background: none; border: 1px solid var(--line); border-radius: 8px;
    color: var(--text-faint); font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 9px 20px; cursor: pointer; width: 100%; transition: border-color 0.15s, color 0.15s;
}

.secondary-bank button:hover { border-color: var(--green); color: var(--green); }

/* ── Decide screen ───────────────────────────────────────────── */

.decide-amount { text-align: center; padding: 24px 0 20px; }

.decide-num {
    font-size: 84px; font-weight: 900; line-height: 1;
    letter-spacing: -4px; color: var(--yellow);
}

.decide-lbl {
    font-size: 12px; color: var(--muted); text-transform: uppercase;
    letter-spacing: 2px; margin-top: 6px;
}

.decide-last {
    text-align: center; font-size: 13px; color: var(--green);
    font-weight: 600; margin-bottom: 18px; letter-spacing: 0.3px;
}

.decide-main-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.btn-bank {
    padding: 18px 10px; background: var(--green); color: #000;
    border: none; border-radius: 12px; font-family: inherit; font-size: 15px;
    font-weight: 800; cursor: pointer; line-height: 1.3; transition: opacity 0.15s;
}

.btn-bank:hover { opacity: 0.85; }
.btn-bank .btn-sub { font-size: 11px; font-weight: 500; color: rgba(0,0,0,0.5); display: block; margin-top: 3px; }

/* Basketball orange. Dark text reads far better than white on orange.
   Same look in both themes. */
.btn-shoot {
    padding: 18px 10px; border: none; border-radius: 12px;
    color: #2b1606; font-family: inherit; font-size: 15px; font-weight: 800;
    cursor: pointer; line-height: 1.3; transition: filter 0.15s;
    background: var(--orange);
}

.btn-shoot:hover { filter: brightness(1.06); }
.btn-shoot .btn-sub { font-size: 11px; font-weight: 600; color: rgba(43,22,6,0.7); display: block; margin-top: 3px; }

.heat-check-separator {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}

.heat-check-separator::before,
.heat-check-separator::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.heat-check-separator span {
    font-size: 10px; color: var(--muted); text-transform: uppercase;
    letter-spacing: 1.5px; white-space: nowrap;
}

.btn-heat-check {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, var(--hc-grad-a), var(--hc-grad-b));
    border: 1px solid rgba(232,162,0,0.35);
    color: var(--gold); border-radius: 12px; font-family: inherit;
    font-size: 14px; font-weight: 800; cursor: pointer;
    letter-spacing: 0.5px; transition: border-color 0.15s, background 0.15s;
    text-align: left;
}

.btn-heat-check:hover { border-color: rgba(232,162,0,0.6); background: linear-gradient(135deg, var(--hc-grad-hover-a), var(--hc-grad-hover-b)); }
.btn-heat-check .hc-title { font-size: 15px; font-weight: 900; margin-bottom: 3px; }
.btn-heat-check .hc-sub   { font-size: 11px; color: rgba(232,162,0,0.65); font-weight: 500; }

/* ── Miss screen ─────────────────────────────────────────────── */

.miss-screen   { text-align: center; padding: 28px 0; }
.miss-headline { font-size: 38px; font-weight: 900; color: var(--red); letter-spacing: -1px; margin-bottom: 8px; }
.miss-lost     { font-size: 15px; color: var(--muted); margin-bottom: 28px; line-height: 1.5; }
.miss-lost strong { color: var(--text-secondary); }

.miss-continue {
    width: 100%; padding: 14px; background: var(--surface); border: 1px solid var(--line);
    color: var(--text); border-radius: 10px; font-family: inherit; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: border-color 0.15s;
}

.miss-continue:hover { border-color: var(--muted); }

/* ── Heat Check result ───────────────────────────────────────── */

.hc-result-screen { text-align: center; padding: 32px 0; }

.hc-result-headline { font-size: 36px; font-weight: 900; letter-spacing: -1px; margin-bottom: 8px; }
.hc-result-headline.win  { color: var(--gold); }
.hc-result-headline.loss { color: var(--red); }

.hc-result-pts {
    font-size: 64px; font-weight: 900; letter-spacing: -3px;
    line-height: 1; margin-bottom: 6px;
}

.hc-result-pts.win  { color: var(--yellow); }
.hc-result-pts.loss { color: var(--red); opacity: 0.6; }

.hc-result-desc { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.hc-result-desc strong { color: var(--text-secondary); }

.hc-continue {
    width: 100%; padding: 14px; border: none; border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: opacity 0.15s;
}

.hc-continue.win  { background: var(--gold); color: #000; }
.hc-continue.loss { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.hc-continue:hover { opacity: 0.85; }

/* ── Log ─────────────────────────────────────────────────────── */

.log-section { margin-top: 20px; }

.log-toggle-btn {
    background: none; border: none; color: var(--muted); font-family: inherit;
    font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
    cursor: pointer; display: block; width: 100%; text-align: center; padding: 4px;
}

.log-toggle-btn:hover { color: var(--text-faint); }

.log-panel {
    display: none; margin-top: 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px; padding: 12px;
    max-height: 160px; overflow-y: auto;
}

.log-panel.open { display: block; }

.log-entry { font-size: 12px; color: var(--text-ghost); padding: 3px 0; border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: none; }

/* ── End screen ──────────────────────────────────────────────── */

.end-shell { width: 100%; max-width: 440px; display: none; }
.end-shell.visible { display: block; }

.end-top {
    text-align: center; padding-bottom: 22px;
    border-bottom: 1px solid var(--border); margin-bottom: 18px;
}

.end-over-label {
    font-size: 10px; font-weight: 700; color: var(--red);
    text-transform: uppercase; letter-spacing: 2.5px; margin-bottom: 10px;
}

.end-score { font-size: 84px; font-weight: 900; line-height: 1; letter-spacing: -4px; margin-bottom: 8px; }
.end-tier  { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 2.5px; color: var(--orange); }
.end-best  { font-size: 12px; color: var(--muted); margin-top: 5px; }

.risk-rating-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between;
}

.risk-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.risk-value { font-size: 16px; font-weight: 800; }
.risk-value.conservative { color: #4ade80; }
.risk-value.calculated   { color: #60a5fa; }
.risk-value.reckless     { color: var(--orange); }
.risk-value.maniac       { color: var(--red); }

.end-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px;
}

.es-cell { padding: 14px 10px; text-align: center; background: var(--surface); }
.es-cell + .es-cell { border-left: 1px solid var(--border); }
.es-val  { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.es-lbl  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }

.shot-chart {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-bottom: 12px;
}

.chart-row  { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.chart-name { width: 84px; font-size: 12px; color: var(--muted); font-weight: 500; flex-shrink: 0; }
.chart-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.chart-fill  { height: 100%; background: var(--orange); border-radius: 2px; transition: width 0.5s ease; }
.chart-n     { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; width: 36px; text-align: right; flex-shrink: 0; }

.end-actions { display: flex; gap: 10px; }

.btn-share {
    flex: 1; padding: 14px; background: #1d9bf0; color: white; border: none;
    border-radius: 10px; font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: opacity 0.15s;
}

.btn-share:hover { opacity: 0.85; }

.btn-new {
    flex: 1; padding: 14px; background: var(--surface); border: 1px solid var(--line);
    color: var(--text); border-radius: 10px; font-family: inherit; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: border-color 0.15s;
}

.btn-new:hover { border-color: var(--muted); }

/* ── ALL IN button (left column slot) ───────────────────────── */

.all-in-slot { margin-top: 20px; }

.all-in-separator {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}

.all-in-separator::before,
.all-in-separator::after {
    content: ''; flex: 1; height: 1px; background: rgba(224,48,48,0.25);
}

.all-in-separator span {
    font-size: 10px; color: var(--red); text-transform: uppercase;
    letter-spacing: 1.5px; white-space: nowrap; opacity: 0.7;
}

.btn-all-in {
    width: 100%; padding: 14px 16px;
    background: linear-gradient(135deg, var(--allin-grad-a), var(--allin-grad-b));
    border: 1px solid rgba(224,48,48,0.4);
    color: var(--red); border-radius: 12px; font-family: inherit;
    font-size: 14px; font-weight: 800; cursor: pointer;
    letter-spacing: 0.5px; transition: border-color 0.15s, background 0.15s;
    text-align: left;
}

.btn-all-in:hover { border-color: rgba(224,48,48,0.7); background: linear-gradient(135deg, var(--allin-grad-hover-a), var(--allin-grad-hover-b)); }
.all-in-title { font-size: 15px; font-weight: 900; margin-bottom: 3px; letter-spacing: 2px; }
.all-in-sub   { font-size: 11px; color: rgba(224,48,48,0.6); font-weight: 500; line-height: 1.4; }

/* ── ALL IN result screen ────────────────────────────────────── */

.all-in-result-screen { text-align: center; padding: 32px 0; }

/* Suspense flip indicator */
.all-in-flip-indicator {
    font-size: 48px; font-weight: 900; line-height: 1;
    margin-bottom: 16px; min-height: 56px;
    display: flex; align-items: center; justify-content: center;
}

.all-in-flip-indicator.flipping {
    color: var(--red);
    animation: all-in-pulse 0.35s ease-in-out infinite;
}

.all-in-flip-indicator.done { display: none; }

@keyframes all-in-pulse {
    0%   { opacity: 1;   transform: scale(1);    }
    50%  { opacity: 0.3; transform: scale(0.9);  }
    100% { opacity: 1;   transform: scale(1);    }
}

.all-in-result-headline {
    font-size: 30px; font-weight: 900; letter-spacing: -0.5px; margin-bottom: 10px;
}

.all-in-result-headline.win  { color: var(--yellow); }
.all-in-result-headline.loss { color: var(--red); }

.all-in-result-pts {
    font-size: 64px; font-weight: 900; letter-spacing: -3px;
    line-height: 1; margin-bottom: 8px;
}

.all-in-result-pts.win  { color: var(--yellow); }
.all-in-result-pts.loss { color: var(--red); opacity: 0.6; }

.all-in-result-desc {
    font-size: 14px; color: var(--muted); margin-bottom: 28px; line-height: 1.5;
}

.all-in-result-desc strong { color: var(--text-secondary); }

.all-in-result-continue {
    width: 100%; padding: 14px; border: none; border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: opacity 0.15s;
}

.all-in-result-continue.win  { background: var(--yellow); color: #000; }
.all-in-result-continue.loss { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.all-in-result-continue:hover { opacity: 0.85; }

/* ── End screen ALL IN framing ───────────────────────────────── */

.end-over-label.all-in-win  { color: var(--yellow); }
.end-over-label.all-in-loss { color: var(--red); font-size: 12px; }

@media (max-width: 380px) {
    .decide-num      { font-size: 64px; }
    .end-score       { font-size: 68px; }
    .hc-result-pts   { font-size: 50px; }
}

/* ── Clutch Mode visual escalation ──────────────────────────── */

/* clutch-1: first miss — subtle tension. Warm the pips, desaturate slightly. */
body.clutch-1 .pip.spent {
    background: #c02020;
    box-shadow: 0 0 4px 1px rgba(224, 48, 48, 0.35);
}

body.clutch-1 .scoreboard {
    border-color: rgba(224, 48, 48, 0.18);
}

/* clutch-final: last life — pulsing pips, scoreboard border glow. */
body.clutch-final .pip.spent {
    background: var(--red);
    box-shadow: 0 0 7px 2px rgba(224, 48, 48, 0.7);
    animation: clutch-pip-pulse 1s ease-in-out infinite;
}

body.clutch-final .scoreboard {
    border-color: rgba(224, 48, 48, 0.55);
    box-shadow: 0 0 0 1px rgba(224, 48, 48, 0.18), 0 0 20px 0 rgba(224, 48, 48, 0.12);
    animation: clutch-border-pulse 1.2s ease-in-out infinite;
}

/* Vignette overlay on the shell when on final life */
body.clutch-final .shell::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(180, 0, 0, 0.18) 100%);
    z-index: 0;
    animation: clutch-vignette-pulse 1.2s ease-in-out infinite;
}

@keyframes clutch-pip-pulse {
    0%, 100% { box-shadow: 0 0 7px 2px rgba(224, 48, 48, 0.7); }
    50%       { box-shadow: 0 0 14px 4px rgba(224, 48, 48, 0.95); }
}

@keyframes clutch-border-pulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(224, 48, 48, 0.18), 0 0 20px 0 rgba(224, 48, 48, 0.12); }
    50%       { box-shadow: 0 0 0 1px rgba(224, 48, 48, 0.38), 0 0 32px 0 rgba(224, 48, 48, 0.22); }
}

@keyframes clutch-vignette-pulse {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1; }
}

/* Respect prefers-reduced-motion: keep the color cues but kill all animation */
@media (prefers-reduced-motion: reduce) {
    body.clutch-1 .pip.spent,
    body.clutch-final .pip.spent {
        animation: none;
    }
    body.clutch-final .scoreboard {
        animation: none;
    }
    body.clutch-final .shell::before {
        animation: none;
        opacity: 0.8;
    }
}

/* ── Decide screen slam animation ────────────────────────────── */

@keyframes decide-slam {
    0%   { transform: scale(1.55); opacity: 0; }
    60%  { transform: scale(0.96); opacity: 1; }
    80%  { transform: scale(1.03); }
    100% { transform: scale(1);    opacity: 1; }
}

.decide-num.slam {
    animation: decide-slam 0.42s cubic-bezier(0.22, 0.68, 0, 1.2) both;
}

@media (prefers-reduced-motion: reduce) {
    .decide-num.slam {
        animation: none;
    }
}
