/* Sparge zidul — paddle and bricks (js/sparge-zidul.js). Theme-aware like the other game pages: tokens on
   :root, redefined under body.dark-theme. The canvas reads the --sz-* field colours, so a theme switch
   repaints the field too. */
:root {
    --sz-accent: #c2410c;
    --sz-accent-2: #0ea5e9;
    --sz-page-bg: #fff7ed;
    --sz-card-bg: #ffffff;
    --sz-card-border: #fde2c8;
    --sz-muted: #78716c;
    --sz-shadow: 0 10px 30px rgba(124, 45, 18, .14);
    --sz-stage-bg: #fbe9d7;
    --sz-field: #fffaf3;
    --sz-field-2: #fdf0e1;
    --sz-motif: rgba(194, 65, 12, .07);
    --sz-wall: #9a3412;
    --sz-wall-2: #fdba74;
    --sz-panel: #ffffff;
    --sz-panel-text: #7c2d12;
    --sz-ball: #1e293b;
    --sz-paddle: #c2410c;
    --sz-paddle-2: #fb923c;
    --sz-overlay: rgba(251, 233, 215, .72);
}

body.dark-theme {
    --sz-accent: #fb923c;
    --sz-accent-2: #38bdf8;
    --sz-page-bg: #120b07;
    --sz-card-bg: #22160f;
    --sz-card-border: #4a2c1a;
    --sz-muted: #c4b5a5;
    --sz-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    --sz-stage-bg: #0b0604;
    --sz-field: #160e0a;
    --sz-field-2: #1d130d;
    --sz-motif: rgba(251, 146, 60, .06);
    --sz-wall: #7c2d12;
    --sz-wall-2: #c2410c;
    --sz-panel: #261810;
    --sz-panel-text: #fed7aa;
    --sz-ball: #fff7ed;
    --sz-paddle: #fb923c;
    --sz-paddle-2: #fdba74;
    --sz-overlay: rgba(11, 6, 4, .72);
}

/* clip, not hidden: the site-wide `body { overflow-x: hidden }` makes <body> a scroll
   container that never scrolls, which silently kills any position: sticky inside. */
.sz-body, body.sz-body#page-top {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--sz-page-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: clip;
}
body.sz-playing { overscroll-behavior: none; }
body.sz-max { overflow: hidden; }
.sz-main { padding-top: 96px; padding-bottom: 40px; }
.sz-game .container, .sz-hero .container { max-width: 760px; }

/* ---- hero ---- */
.sz-hero { text-align: center; padding: 4px 0 12px; }
.sz-hero h1 { font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0 0 6px; display: inline-flex; align-items: center; gap: 12px; }
.sz-hero-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-grid; place-items: center; font-size: 22px; color: #fff; background: linear-gradient(135deg, #dc2626, #f59e0b); box-shadow: var(--sz-shadow); }
.sz-lead { max-width: 600px; margin: 0 auto; color: var(--sz-muted); font-size: 1rem; line-height: 1.55; }

/* ---- the stage ---- */
.sz-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    height: clamp(460px, calc(100vh - 96px), 900px);
    width: min(100%, 560px);
    margin: 0 auto;
    background: var(--sz-stage-bg);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--sz-shadow);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.sz-stage:focus-visible { box-shadow: 0 0 0 3px var(--sz-accent), var(--sz-shadow); }
@media (max-width: 575.98px) {
    .sz-stage { width: calc(100% + 24px); margin: 0 -12px; border-radius: 0; }
}
.sz-stage:fullscreen { width: 100%; height: 100% !important; border-radius: 0; margin: 0; }
.sz-stage:-webkit-full-screen { width: 100%; height: 100% !important; border-radius: 0; margin: 0; }
.sz-stage.is-max { position: fixed; inset: 0; z-index: 1052; width: 100vw; height: 100vh !important; margin: 0; border-radius: 0; }
@supports (height: 100dvh) { .sz-stage.is-max { height: 100dvh !important; } }

.sz-bar { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name tools" "stats stats"; align-items: center; gap: 6px; padding: 8px 8px 4px; }
.sz-name { grid-area: name; margin: 0; min-width: 0; padding-left: 4px; font-weight: 800; font-size: 1rem; color: var(--sz-panel-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sz-name small { font-weight: 600; font-size: .8rem; color: var(--sz-muted); }
.sz-tools { grid-area: tools; display: flex; gap: 4px; }
.sz-stats { grid-area: stats; display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr; gap: 5px; min-width: 0; }
.sz-stat { min-width: 0; padding: 4px 6px; border-radius: 10px; background: var(--sz-panel); border: 1px solid var(--sz-card-border); line-height: 1.1; text-align: center; }
.sz-stat small { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--sz-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sz-stat strong { display: block; font-size: 1.02rem; font-weight: 800; color: var(--sz-panel-text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sz-hearts { color: #e11d48; letter-spacing: -.05em; }
body.dark-theme .sz-hearts { color: #fb7185; }
.sz-round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--sz-card-border); display: grid; place-items: center; background: var(--sz-panel); color: var(--sz-panel-text); font-size: 15px; cursor: pointer; touch-action: manipulation; padding: 0; }
.sz-round:hover, .sz-round:focus-visible { border-color: var(--sz-accent); }
.sz-round:focus-visible { outline: 2px solid var(--sz-accent); outline-offset: 1px; }
.sz-round[hidden], .sz-round span[hidden] { display: none; }
.sz-stage[data-phase="menu"] #sz-pause, .sz-stage[data-phase="over"] #sz-pause { visibility: hidden; }

.sz-play { position: relative; flex: 1; min-height: 0; }
.sz-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: none; }
.sz-stage[data-phase="menu"] .sz-canvas, .sz-stage[data-phase="paused"] .sz-canvas { cursor: default; }

.sz-banner { position: absolute; left: 50%; top: 52%; z-index: 2; transform: translate(-50%, -50%) scale(.85); margin: 0; padding: 8px 18px; border-radius: 16px; max-width: 84%; text-align: center; color: #fff; font-weight: 900; font-size: clamp(1.1rem, 5.2vw, 1.8rem); line-height: 1.15; text-shadow: 0 2px 10px rgba(0, 0, 0, .45); background: linear-gradient(135deg, rgba(194, 65, 12, .93), rgba(220, 38, 38, .9)); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.sz-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sz-banner small { display: block; font-size: .55em; font-weight: 700; opacity: .95; }
.sz-banner.is-good { background: linear-gradient(135deg, rgba(14, 116, 144, .93), rgba(22, 163, 74, .9)); }
.sz-banner.is-bad { background: linear-gradient(135deg, rgba(71, 85, 105, .93), rgba(30, 41, 59, .92)); }
.sz-hint { position: absolute; left: 50%; bottom: 10px; z-index: 2; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(28, 12, 4, .66); color: #fff; font-weight: 700; font-size: .86rem; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.sz-hint[hidden] { display: none; }
.sz-hint-icon { display: inline-block; animation: sz-hint 1.6s ease-in-out infinite; }
@keyframes sz-hint { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

/* ---- overlays ---- */
.sz-overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 12px; background: var(--sz-overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); overflow-y: auto; touch-action: manipulation; }
.sz-overlay[hidden] { display: none; }
.sz-card { width: 100%; max-width: 380px; margin: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; border-radius: 18px; background: var(--sz-card-bg); border: 1px solid var(--sz-card-border); box-shadow: var(--sz-shadow); color: var(--text-color); text-align: center; }
.sz-card h2 { font-weight: 800; font-size: 1.4rem; margin: 0; }
.sz-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sz-mode { min-height: 56px; padding: 6px 8px; border: 1px solid var(--sz-card-border); border-radius: 14px; background: var(--sz-page-bg); color: inherit; font-weight: 800; font-size: .96rem; line-height: 1.15; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; text-align: left; }
.sz-mode svg, .sz-mode i { flex: none; color: var(--sz-accent); }
.sz-mode small { display: block; font-weight: 500; font-size: .72rem; color: var(--sz-muted); margin-top: 1px; }
.sz-mode[aria-checked="true"] { background: var(--sz-accent); border-color: var(--sz-accent); color: #fff; }
.sz-mode[aria-checked="true"] svg, .sz-mode[aria-checked="true"] i { color: #fff; }
.sz-mode[aria-checked="true"] small { color: rgba(255, 255, 255, .88); }
body.dark-theme .sz-mode[aria-checked="true"], body.dark-theme .sz-mode[aria-checked="true"] svg { color: #1c0d05; }
body.dark-theme .sz-mode[aria-checked="true"] small { color: rgba(28, 13, 5, .78); }
.sz-label { font-weight: 700; font-size: .92rem; color: var(--sz-muted); }
.sz-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sz-lv { position: relative; min-height: 44px; border-radius: 12px; border: 1px solid var(--sz-card-border); background: var(--sz-page-bg); color: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; touch-action: manipulation; display: grid; place-items: center; padding: 0; }
.sz-lv[aria-checked="true"] { background: var(--sz-accent); border-color: var(--sz-accent); color: #fff; }
body.dark-theme .sz-lv[aria-checked="true"] { color: #1c0d05; }
.sz-lv:disabled { opacity: .45; cursor: default; font-weight: 600; }
.sz-lv:disabled::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 6px; border-radius: 1px; background: currentColor; box-shadow: 0 -4px 0 -1px transparent; }
.sz-lv:disabled::before { content: ""; position: absolute; right: 6px; bottom: 9px; width: 5px; height: 5px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 3px 3px 0 0; }
.sz-lv .sz-lock { font-size: .7rem; }
.sz-lv.is-done::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.sz-picked { margin: 0; font-weight: 700; color: var(--sz-panel-text); min-height: 1.4em; }
.sz-picked small { display: block; font-weight: 500; font-size: .8rem; color: var(--sz-muted); }
.sz-note { margin: 0; font-size: .88rem; line-height: 1.4; color: var(--sz-muted); }
.sz-big { margin: 0; font-size: 2rem; font-weight: 900; color: var(--sz-panel-text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.sz-big:empty { display: none; }
.sz-mode:focus-visible, .sz-lv:focus-visible, .sz-btn:focus-visible { outline: 2px solid var(--sz-accent); outline-offset: 2px; }

.sz-btn { min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--sz-card-border); background: var(--sz-card-bg); color: inherit; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; }
.sz-btn:hover { border-color: var(--sz-accent); }
.sz-btn[hidden] { display: none; }
.sz-btn-primary { background: var(--sz-accent); border-color: var(--sz-accent); color: #fff; }
body.dark-theme .sz-btn-primary { color: #1c0d05; }
.sz-btn-ghost { background: transparent; border-color: transparent; color: var(--sz-muted); }
.sz-over-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; background: linear-gradient(135deg, #f59e0b, #dc2626); }
.sz-over-icon.is-bad { background: linear-gradient(135deg, #78716c, #44403c); }
.sz-over-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sz-over-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--sz-page-bg); font-weight: 600; text-align: left; }
.sz-over-list li strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.sz-over-list li.is-win { background: linear-gradient(135deg, rgba(245, 158, 11, .25), rgba(220, 38, 38, .15)); }
.sz-over-rec { margin: 0; font-weight: 800; color: #b45309; }
body.dark-theme .sz-over-rec { color: #fbbf24; }
.sz-over-rec:empty { display: none; }

.sz-actions { display: flex; justify-content: center; margin: 14px 0 10px; }
.sz-actions .sz-btn { min-width: 180px; }

/* ---- records ---- */
.sz-records { margin-top: 6px; padding: 14px; border-radius: 16px; background: var(--sz-card-bg); border: 1px solid var(--sz-card-border); }
.sz-records h2 { font-size: 1.08rem; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sz-records h2 svg, .sz-records h2 i { color: #f59e0b; }
.sz-rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sz-rec { padding: 8px 10px; border-radius: 12px; background: var(--sz-page-bg); min-width: 0; }
.sz-rec h3 { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--sz-muted); margin: 0 0 4px; }
.sz-rec ol { margin: 0; padding-left: 18px; font-size: .86rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.sz-rec p { margin: 0; font-size: .86rem; color: var(--sz-muted); }
.sz-rec .sz-best-row { font-weight: 800; color: var(--sz-panel-text); }
.sz-wallbar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-top: 6px; }
.sz-wallbar span { height: 10px; border-radius: 3px; background: var(--sz-card-border); }
.sz-wallbar span.is-done { background: linear-gradient(135deg, #f97316, #dc2626); }
.sz-reset-wrap { text-align: center; margin: 8px 0 0; }
.sz-link { border: 0; background: none; padding: 6px; color: var(--sz-muted); font-size: .85rem; text-decoration: underline; cursor: pointer; }

/* ---- help ---- */
.sz-help { margin: 12px auto 0; padding: 12px 14px; border-radius: 14px; background: var(--sz-card-bg); border: 1px solid var(--sz-card-border); }
.sz-help summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.sz-help ul { margin: 10px 0 4px; padding-left: 20px; line-height: 1.6; }
.sz-help li { margin-bottom: 6px; }
.sz-help kbd { font-size: .8em; }
.sz-cap { display: inline-block; min-width: 24px; padding: 0 5px; border-radius: 999px; background: var(--c); color: #fff; font-size: .78rem; font-weight: 900; text-align: center; line-height: 1.5; }
.sz-credit { max-width: 700px; margin: 18px auto 0; padding: 0 16px; text-align: center; color: var(--sz-muted); font-size: .78rem; line-height: 1.45; }
.sz-powered { text-align: center; color: var(--sz-muted); font-size: .85rem; margin: 10px 0 0; }
.sz-powered a { color: var(--sz-accent); }

@media (max-width: 420px) {
    .sz-main { padding-top: 88px; }
    .sz-bar { padding: 6px 6px 4px; gap: 4px; }
    .sz-stats { gap: 3px; }
    .sz-stat { padding: 3px; }
    .sz-stat strong { font-size: .94rem; }
    .sz-stat small { font-size: .6rem; }
    .sz-round { width: 34px; height: 34px; font-size: 14px; }
    .sz-tools { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
    .sz-banner { transition: none; }
    .sz-hint-icon { animation: none; }
}
