/* Strike Zone — neon bowling alley */
:root {
    --sz-bg: #070a14;
    --sz-panel: #121827;
    --sz-panel-2: #1b2233;
    --sz-line: #2d3852;
    --sz-text: #eef1fb;
    --sz-dim: #9aa6cc;
    --sz-accent: #ffd66b;
    --sz-cyan: #22d3ee;
    --sz-red: #ff7259;
    --sz-wood: #c98a4b;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--sz-bg);
    color: var(--sz-text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

body {
    background:
        radial-gradient(1000px 520px at 50% -10%, rgba(255, 214, 107, 0.10), transparent 60%),
        radial-gradient(800px 500px at 8% 18%, rgba(34, 211, 238, 0.055), transparent 60%),
        radial-gradient(700px 500px at 96% 30%, rgba(255, 114, 89, 0.045), transparent 60%),
        var(--sz-bg);
    min-height: 100vh;
}

.sz-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 14px 48px;
    min-height: 100vh;
}

.sz-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 10px;
}

.sz-back {
    color: var(--sz-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 10px;
    border: 1px solid var(--sz-line);
    border-radius: 9px;
    background: linear-gradient(180deg, #1e2740, #111726);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 14px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sz-back:hover {
    color: var(--sz-accent);
    border-color: var(--sz-accent);
    transform: translateY(-1px);
}

.sz-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.8px;
    text-align: center;
    background: linear-gradient(180deg, #fff6d8 0%, #ffd66b 58%, #e5a72c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px rgba(255, 214, 107, 0.16));
}

.sz-header-actions { display: flex; gap: 6px; }

.sz-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--sz-line);
    background: linear-gradient(180deg, #222c46, #121827);
    color: var(--sz-text);
    font-size: 17px;
    cursor: pointer;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 6px 14px rgba(0, 0, 0, 0.25);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.sz-icon-btn:hover {
    border-color: var(--sz-accent);
    transform: translateY(-1px);
}

/* ——— Scoreboard HUD ——— */
.sz-hud {
    position: relative;
    display: flex;
    gap: 0;
    margin-bottom: 8px;
    padding: 4px;
    background: linear-gradient(180deg, rgba(25, 32, 51, 0.97), rgba(8, 12, 22, 0.99));
    border: 1px solid var(--sz-line);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 26px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.sz-hud::before {
    content: "";
    position: absolute;
    top: 0;
    left: 9%;
    right: 9%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sz-accent), transparent);
    opacity: 0.72;
}

.sz-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 8px;
    text-align: center;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
}

.sz-chip:first-child { border-left: none; }

.sz-chip-label {
    display: block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: var(--sz-dim);
    text-transform: uppercase;
    white-space: nowrap;
}

.sz-chip-value {
    display: block;
    font-size: 19px;
    font-weight: 900;
    color: var(--sz-accent);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 14px rgba(255, 214, 107, 0.22);
    line-height: 1.2;
}

/* ——— Frame strip ——— */
.sz-scorecard {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 10px;
    padding: 4px;
    background: linear-gradient(180deg, rgba(18, 24, 39, 0.97), rgba(8, 12, 22, 0.99));
    border: 1px solid var(--sz-line);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 20px rgba(0, 0, 0, 0.26);
}

.sz-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 0;
    padding: 3px 1px 2px;
    border: 1px solid transparent;
    border-radius: 5px;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.sz-frame.is-current {
    background: rgba(255, 214, 107, 0.10);
    border-color: rgba(255, 214, 107, 0.4);
    box-shadow: 0 0 10px rgba(255, 214, 107, 0.12);
}

.sz-frame-no {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--sz-dim);
    line-height: 1;
}

.sz-frame-rolls {
    font-size: 9px;
    font-weight: 800;
    color: var(--sz-text);
    letter-spacing: 0.4px;
    line-height: 1.15;
    white-space: nowrap;
}

.sz-frame-score {
    font-size: 10px;
    font-weight: 800;
    color: var(--sz-accent);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* ——— Lane stage ——— */
.sz-stage {
    position: relative;
    background: linear-gradient(180deg, #0b101d, #060910);
    border: 1px solid rgba(255, 214, 107, 0.24);
    border-radius: 16px;
    padding: 9px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 22px 48px -18px rgba(0, 0, 0, 0.9),
        0 0 42px rgba(255, 214, 107, 0.08),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.sz-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 12%, transparent 85%, rgba(0, 0, 0, 0.18));
}

#strikeZoneCanvas {
    display: block;
    position: relative;
    z-index: 0;
    width: 100%;
    max-width: 460px;
    height: auto;
    aspect-ratio: 440 / 600;
    margin: 0 auto;
    border-radius: 10px;
    touch-action: manipulation;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 26px rgba(34, 211, 238, 0.06);
}

@media (min-width: 421px) {
    /* Keep the touch dock on screen on 1280x800 laptops now that the frame
       strip takes vertical space. */
    #strikeZoneCanvas {
        max-width: min(460px, max(280px, calc((100vh - 345px) * 440 / 600)));
        max-width: min(460px, max(280px, calc((100dvh - 345px) * 440 / 600)));
    }
}

.sz-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;
}

/* ——— Touch dock ——— */
.sz-touch {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.sz-aim { display: flex; gap: 8px; flex: 1; }

.sz-dir, .sz-throw {
    padding: 16px 10px;
    font-size: 16px;
    font-weight: 800;
    border-radius: 14px;
    cursor: pointer;
    color: var(--sz-text);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease;
}

.sz-dir {
    flex: 1;
    font-size: 18px;
    border: 1px solid #3a4667;
    background: linear-gradient(180deg, #242f4a, #141b2c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.3);
}

.sz-dir:hover { border-color: var(--sz-accent); color: var(--sz-accent); }
.sz-dir:active { transform: translateY(1px); background: linear-gradient(180deg, #3a2a10, #1c1408); color: var(--sz-accent); }

.sz-throw {
    flex: 1.6;
    border: 1px solid #ffe19a;
    background: linear-gradient(180deg, #ffe9ad 0%, #ffd66b 46%, #e7ab2c 100%);
    color: #1b1405;
    letter-spacing: 1.2px;
    box-shadow: 0 10px 26px rgba(255, 193, 64, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.72);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.sz-throw:hover { filter: brightness(1.04); transform: translateY(-1px); }
.sz-throw:active { transform: translateY(1px); filter: brightness(0.98); }

/* ——— Overlays ——— */
.sz-overlay {
    position: fixed;
    inset: var(--app-header-h, 72px) 0 0;
    background:
        radial-gradient(700px 420px at 50% 35%, rgba(255, 214, 107, 0.10), transparent 65%),
        rgba(4, 7, 13, 0.94);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 50;
}

.sz-overlay.hidden { display: none; }

.sz-panel {
    position: relative;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 214, 107, 0.08), transparent 55%),
        linear-gradient(160deg, rgba(25, 32, 52, 0.98), rgba(8, 12, 22, 0.99));
    border: 1px solid rgba(255, 214, 107, 0.24);
    border-radius: 20px;
    padding: 24px 22px;
    width: 100%;
    max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    text-align: center;
    box-shadow:
        0 30px 70px -24px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(255, 214, 107, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: szPanelIn 0.28s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

.sz-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--sz-accent), var(--sz-cyan), transparent);
    opacity: 0.8;
}

@keyframes szPanelIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sz-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    text-align: left;
}

.sz-menu-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 214, 107, 0.25);
}

.sz-menu-copy { min-width: 0; }

.sz-kicker {
    margin: 0 0 4px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1.8px;
    color: var(--sz-wood);
    text-transform: uppercase;
    line-height: 1.3;
}

.sz-panel-title {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 0.3px;
    background: linear-gradient(180deg, #fff6d8 0%, #ffd66b 58%, #e5a72c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(255, 214, 107, 0.16));
}

.sz-menu-copy .sz-panel-title {
    margin: 0;
    font-size: 24px;
    text-align: left;
}

.sz-tagline {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--sz-dim);
}

.sz-name-row { text-align: left; margin-bottom: 14px; }

.sz-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--sz-dim);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.sz-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: 9px;
    border: 1px solid var(--sz-line);
    background: #0a0e18;
    color: var(--sz-text);
}

.sz-input:focus { outline: 2px solid var(--sz-accent); border-color: transparent; }

.sz-controls-hint {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--sz-dim);
}

.sz-controls-hint p { margin: 0 0 7px; }
.sz-controls-hint p:last-child { margin-bottom: 0; }

.sz-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 1.2px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 10px;
    font-family: inherit;
    transition: transform 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
}

.sz-btn-primary {
    background: linear-gradient(180deg, #ffe9ad 0%, #ffd66b 46%, #e7ab2c 100%);
    border: 1px solid #ffe19a;
    color: #1b1405;
    box-shadow: 0 10px 26px rgba(255, 193, 64, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.72);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.sz-btn-ghost {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #36415e;
    color: var(--sz-dim);
}

.sz-btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.sz-btn-primary:active { transform: translateY(1px); filter: brightness(0.98); }
.sz-btn-ghost:hover { color: var(--sz-text); border-color: var(--sz-dim); }

.sz-over-reason {
    margin: -4px 0 14px;
    font-size: 14.5px;
    color: var(--sz-wood);
    font-weight: 600;
}

.sz-results {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sz-result {
    flex: 1;
    background: linear-gradient(180deg, rgba(31, 39, 61, 0.9), rgba(15, 20, 33, 0.95));
    border: 1px solid var(--sz-line);
    border-radius: 10px;
    padding: 9px 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sz-result-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--sz-dim);
    text-transform: uppercase;
}

.sz-result-value {
    display: block;
    font-size: 21px;
    font-weight: 900;
    color: var(--sz-accent);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 14px rgba(255, 214, 107, 0.2);
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
    outline: 2px solid var(--sz-accent);
    outline-offset: 2px;
}

@media (max-width: 420px) {
    .sz-title { font-size: 18px; }
    .sz-hud { padding: 4px 2px; }
    .sz-chip { flex: 1 1 0; padding: 5px 3px; }
    .sz-chip-label { font-size: 8.5px; letter-spacing: 0.6px; }
    .sz-chip-value { font-size: 16px; }
    .sz-frame-no { font-size: 7.5px; }
    .sz-frame-rolls { font-size: 9.5px; letter-spacing: 0; }
    .sz-frame-score { font-size: 10.5px; }
    .sz-panel { padding: 18px 15px; }
    .sz-panel-title { font-size: 22px; }
    .sz-menu-mark { width: 50px; height: 50px; }
    .sz-menu-copy .sz-panel-title { font-size: 20px; }
    .sz-menu-copy .sz-kicker { font-size: 8.5px; letter-spacing: 1.2px; }
    .sz-throw { flex: 1.3; }
    .sz-results { gap: 6px; }
    .sz-result { padding: 7px 4px; }
    .sz-result-value { font-size: 18px; }

    /* Keep the game title on one line: the back label becomes an arrow. */
    .sz-back {
        width: 40px;
        min-width: 40px;
        padding: 0;
        font-size: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sz-back::before {
        content: "\2190";
        font-size: 18px;
    }

    .sz-header { gap: 7px; }
}

@media (max-width: 420px) and (max-height: 700px) {
    /* On short phones keep the whole lane visible: the frame strip moves
       below the touch dock where it can be reviewed by scrolling. */
    .sz-main {
        display: flex;
        flex-direction: column;
    }

    .sz-header { order: 0; }
    .sz-hud { order: 1; }
    .sz-stage { order: 2; }
    .sz-touch { order: 3; }
    .sz-scorecard { order: 4; margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .sz-panel { animation: none; }
    .sz-btn, .sz-dir, .sz-throw, .sz-icon-btn, .sz-back, .sz-frame { transition: none; }
    .sz-btn-primary:hover, .sz-throw:hover, .sz-dir:hover, .sz-icon-btn:hover, .sz-back:hover {
        transform: none;
    }
}
