/* Mini-game styling shares the shell palette while preserving each game's native stage. */
html[data-ludik-theme] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
  --lg-paper: var(--ld-paper, #f3dfb4);
  --lg-ink: var(--ld-ink, #161310);
  --lg-yellow: var(--ld-yellow, #ffdb2d);
  --lg-accent: var(--ld-accent, #e52078);
  --lg-mint: var(--ld-mint, #93efb1);
  --lg-text: var(--lg-ink);
  --lg-muted: #493525;
  --lg-border: #272019;
  --lg-panel: var(--lg-paper);
  --lg-plate: #fff0cd;
  --lg-input: var(--lg-mint);
  --lg-title: var(--lg-yellow);
  --lg-title-ink: #15110b;
  --lg-shadow: 4px 4px 0 #1d1612;
  --lg-display: var(--ld-display, "Arial Black", Impact, system-ui, sans-serif);
  --lg-rule: repeating-linear-gradient(126deg, #27130a12 0 1px, #fffaed30 1px 3px, transparent 3px 5px);
  --lg-grain: radial-gradient(#3b1f144d .65px, transparent .9px) 0 0 / 4px 4px;
  --lg-torn: polygon(0 9%, 3% 8%, 5% 3%, 9% 5%, 13% 0, 18% 4%, 23% 2%, 29% 5%, 34% 1%, 39% 5%, 44% 2%, 49% 5%, 54% 1%, 59% 4%, 65% 0, 70% 4%, 75% 2%, 80% 6%, 86% 1%, 91% 5%, 96% 2%, 100% 7%, 98% 14%, 100% 88%, 97% 95%, 93% 93%, 89% 99%, 84% 94%, 80% 99%, 74% 94%, 70% 98%, 64% 94%, 59% 99%, 54% 95%, 48% 99%, 44% 94%, 39% 98%, 33% 94%, 28% 98%, 24% 95%, 18% 100%, 12% 95%, 7% 99%, 3% 94%, 0 96%, 2% 87%, 0 82%);
  --accent: var(--lg-yellow);
  --accent-soft: var(--lg-yellow);
  --muted: var(--lg-muted);
  --line: var(--lg-border);
  width: min(100%, 1420px);
  padding: clamp(14px, 2.2vw, 30px) clamp(12px, 3vw, 38px) clamp(18px, 3.5vw, 42px);
  background: var(--ld-texture) center top / 100% auto repeat-y, var(--ld-shell);
}

html[data-ludik-theme="stencil"] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
  --lg-text: #f5e6c9;
  --lg-muted: #dcc3a4;
  --lg-border: #dfbd93;
  --lg-panel: #161413;
  --lg-plate: #211a17;
  --lg-input: #100e0c;
  --lg-title: var(--lg-paper);
  --lg-shadow: 4px 4px 0 #060505;
  --lg-rule: repeating-linear-gradient(127deg, #e4b3980b 0 1px, #05030312 1px 3px, transparent 3px 5px);
  --lg-grain: radial-gradient(#ecd7af1d .65px, transparent .9px) 0 0 / 4px 4px;
}

html[data-ludik-theme] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
  & > .page-head, & .crash-game > .page-head {
    position: relative;
    align-items: start;
    gap: 12px;
    margin-bottom: clamp(12px, 2.1vw, 25px);
  }
  & :is(.page-head h1) {
    position: relative;
    display: inline-block;
    isolation: isolate;
    margin: 0;
    padding: .13em .38em .22em .30em;
    color: var(--lg-title-ink);
    font: italic 900 clamp(2.45rem, 6.6vw, 6.1rem)/.9 var(--lg-display);
    letter-spacing: -.04em;
    transform: rotate(-3deg);
    text-shadow: 1px 1px 0 #906b3059;
  }
  & :is(.page-head h1)::before {
    position: absolute;
    inset: -.04em -.03em -.05em -.04em;
    z-index: -1;
    clip-path: var(--lg-torn);
    content: "";
    background: var(--lg-grain), var(--lg-title);
  }
  & :is(.page-head h1)::after {
    position: absolute;
    bottom: 13%;
    left: 14%;
    right: 12%;
    z-index: -1;
    height: .09em;
    background: var(--lg-accent);
    transform: rotate(-3deg) skew(-26deg);
    content: "";
  }
  & .page-head p {
    max-width: 65ch;
    margin: 9px 0 0;
    padding: .2em .53em;
    width: fit-content;
    color: var(--lg-text);
    background: var(--lg-panel);
    border: 1px solid var(--lg-border);
    font-size: .875rem;
    line-height: 1.45;
    font-weight: 650;
  }
  & .mini-game-tools { gap: 6px; }
  & .mini-game-tools :is(button,.tag) {
    color: var(--lg-text);
    border: 1px solid var(--lg-border);
    border-radius: 6px;
    background: var(--lg-panel);
  }
  & :is(.game-layout, .crash-layout) {
    --lg-console-width: minmax(254px, 30%);
    grid-template-columns: minmax(0, 1fr) var(--lg-console-width);
    gap: clamp(12px, 2.15vw, 25px);
    align-items: start;
  }
  & :is(#game-sidebar,.crash-controls) {
    min-width: 0;
    padding: clamp(12px, 1.7vw, 21px);
    color: var(--lg-text);
    border: 2px solid var(--lg-border);
    border-radius: 8px 3px 8px 3px;
    background: var(--lg-rule), var(--lg-panel);
    box-shadow: var(--lg-shadow);
  }
  & :is(#game-sidebar,.crash-controls) :is(h2,h3) {
    color: var(--lg-text);
    font-family: var(--lg-display);
    font-weight: 850;
    line-height: 1.15;
  }
  & :is(#game-sidebar,.crash-controls) :is(label, summary, small, legend, p, .instant-picks-line, .hilo-opening-status, .step-cashout-row p) {
    color: var(--lg-text);
    font-weight: 650;
  }
  & :is(#game-sidebar,.crash-controls) :is(input:not([type=range],[type=checkbox],[type=radio]), select) {
    width: 100%;
    min-width: 0;
    color: var(--lg-text);
    border: 2px solid var(--lg-border);
    border-radius: 5px;
    background: var(--lg-input);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
  }
  & :is(#game-sidebar,.crash-controls) select { text-overflow: ellipsis; }
  & :is(#game-sidebar,.crash-controls) :is(input[type=range],input[type=checkbox],input[type=radio]) { accent-color: var(--lg-accent); }
  & :is(#game-sidebar,.crash-controls) :is(details,.notice,.auto-series-fields,.step-summary,.step-console-head,.step-console-card) {
    border-color: var(--lg-border);
    background: var(--lg-panel);
    color: var(--lg-text);
  }
  & #game-sidebar :is(.table-wrap, th, td) { color: var(--lg-text); border-color: var(--lg-border); }
  & #game-sidebar .table-wrap { background: var(--lg-plate); }
  & #game-sidebar th { background: var(--lg-panel); }
  & :is(#game-sidebar,.crash-controls) :is(.step-summary,.step-console-card) :is(span,strong,small) { color: inherit; }
  & .auto-mode {
    gap: 2px;
    padding: 2px;
    border: 2px solid var(--lg-border);
    border-radius: 6px;
    background: var(--lg-panel);
  }
  & .auto-mode button {
    min-height: 38px;
    border-radius: 2px;
    color: var(--lg-text);
    background: transparent;
    font-family: var(--lg-display);
    font-weight: 750;
  }
  & .auto-mode button[aria-pressed=true] {
    background: var(--lg-mint);
    border-color: var(--lg-border);
    color: #141310;
  }
  & .auto-mode button:not(:disabled):hover {
    background: var(--lg-yellow);
    color: #17130d;
  }
  & :is(#game-sidebar,.crash-controls) .button {
    border: 1px solid var(--lg-border);
    border-radius: 5px;
    color: var(--lg-text);
    background: var(--lg-panel);
  }
  & :is(#game-sidebar,.crash-controls) .button:is(.play-primary,.step-cashout,[data-action=auth],[data-action=crash-cashout], [data-form=crash-bet] [type=submit], [data-form=crash-next-bet] [type=submit]) {
    min-height: 47px;
    padding: .47em .66em;
    color: #17130b;
    border: 2px solid #23180e;
    background: var(--lg-yellow);
    box-shadow: 2px 3px 0 #1f150d;
    font-family: var(--lg-display);
    font-size: clamp(.98rem, 1.65vw, 1.32rem);
    font-weight: 850;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  & :is(#game-sidebar,.crash-controls) .button:is(.play-primary,.step-cashout,[data-action=auth],[data-action=crash-cashout], [data-form=crash-bet] [type=submit], [data-form=crash-next-bet] [type=submit]):hover:not(:disabled) {
    color: #17130b;
    background: #ffe871;
    border-color: #17110d;
  }
  & :is(#game-sidebar,.crash-controls) .button[data-action=auto-stop] { color: #fff4db; background: #9e193f; }
  & :is(#game-sidebar,.crash-controls) .button:focus-visible,
  & :is(.step-cell,.instant-keno-grid button,.plinko-bin button):focus-visible {
    outline: 3px solid var(--lg-accent);
    outline-offset: -2px;
  }
  & :is(.stage.panel,.crash-stage) {
    min-width: 0;
    min-height: 0;
    border: 2px solid var(--lg-border);
    border-radius: 9px 3px 9px 3px;
    box-shadow: var(--lg-shadow);
    color: var(--lg-text);
    background: var(--lg-rule), var(--lg-panel);
  }
  & :is(.instant-stage,.step-stage) {
    --instant-muted: var(--lg-muted);
    --instant-rose: var(--lg-accent);
    --instant-amber: #bc5018;
    --instant-green: #13542b;
    --instant-bad: #a91940;
    --step-accent: #753317;
    color: var(--lg-text);
    background: var(--lg-rule), var(--lg-panel);
  }
  & :is(.instant-stage,.step-stage) :where(.instant-stage-top h2,.step-stage-head h2,.instant-output,.instant-facts dd) { color: var(--lg-text); }
  & :is(.instant-stage-top h2,.step-stage-head h2) { font-family: var(--lg-display); font-weight: 850; }
  & :is(.instant-stage-state,.step-phase) {
    color: var(--lg-text);
    background: var(--lg-plate);
    border: 1px solid var(--lg-border);
    border-radius: 4px;
  }
  & .step-phase[data-step-phase-label=active] { color: #16341d; background: var(--lg-mint); border-color: #1f3526; }
  & :is(.step-stage-head p,.step-stage-note,.step-stage-note strong,.mines-plan-footer p,.mines-plan-footer output,.beef-ladder-legend,.step-card-slot > span) { color: var(--lg-text); }
  & .instant-facts > div, & .instant-keno-draw {
    border: 2px solid var(--lg-border);
    border-radius: 5px;
    color: var(--lg-text);
    background: var(--lg-plate);
  }
  & :is(.result-strip,.plinko-feedback,#crash-info .table-wrap,#crash-info details) {
    min-width: 0;
    color: var(--lg-text);
    border: 1px solid var(--lg-border);
    border-radius: 5px;
    background: var(--lg-panel);
  }
  & .result-strip :is(strong,a,button), & #crash-info :is(h2,summary,small) { color: var(--lg-text); }
  & .result-strip .button { background: var(--lg-plate); border: 1px solid var(--lg-border); }
  & :is(.stage-column, #game-sidebar, .crash-main, .crash-controls) { min-width: 0; }
  & :is(.step-stage,.instant-stage) [hidden] { display: none !important; }
}

html[data-ludik-theme="comic"] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
  & :is(#game-sidebar,.crash-controls,.instant-keno,.step-stage) {
    background: url("/redesign-art/paper.webp") center / 510px auto, var(--lg-paper);
  }
  & .crash-stage { background: url("/redesign-art/paper.webp") center / 510px auto, var(--lg-paper); }
  & :is(#game-sidebar,.crash-controls) .button:is(.play-primary,.step-cashout,[data-action=auth],[data-action=crash-cashout]) { font-style: italic; }
}

html[data-ludik-theme="stencil"] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
  & .page-head h1::after { background: #b62020; }
  & :is(#game-sidebar,.crash-controls) .button:is(.play-primary,.step-cashout,[data-action=auth],[data-action=crash-cashout], [data-form=crash-bet] [type=submit], [data-form=crash-next-bet] [type=submit]) {
    border-color: var(--lg-border);
    border-radius: 7px;
    box-shadow: 2px 3px 0 #050403;
  }
  & .auto-mode button[aria-pressed=true] { background: var(--lg-yellow); }
  & :is(.instant-stage,.step-stage) {
    --instant-amber: #ffd669;
    --instant-green: #a0efa4;
    --instant-bad: #ffa9a6;
    --step-accent: #ffcf52;
  }
}

html[data-ludik-theme] #content[data-game=plinko] {
  & .stage.stage-plinko {
    overflow: hidden;
    border-color: #6f1122;
    background: var(--ld-texture) center / cover, #d82843;
  }
  & .stage.stage-plinko::before, & .stage.stage-plinko::after {
    position: absolute;
    z-index: 0;
    inset: 21% auto auto 10%;
    width: clamp(22px, 4.8vw, 77px);
    aspect-ratio: 1;
    background: color-mix(in srgb, var(--lg-yellow) 91%, #a91137);
    clip-path: polygon(77% 0, 31% 37%, 57% 35%, 15% 98%, 88% 45%, 62% 47%);
    pointer-events: none;
    transform: rotate(-14deg);
    content: "";
  }
  & .stage.stage-plinko::after { inset: 26% 8% auto auto; transform: rotate(23deg) scale(.85); }
  & .plinko-board { max-width: 700px; padding: clamp(8px, 2cqw, 18px); }
  & .plinko-board canvas { aspect-ratio: 1.53; }
  & .plinko-bins {
    gap: 0;
    margin-inline: clamp(7px, 2.6cqw, 20px);
    border: 2px solid #21160f;
    border-top: 0;
    background: #271610;
  }
  & .plinko-bin {
    min-height: clamp(25px, 5.4cqw, 38px);
    color: #18110c;
    border-radius: 0;
    border-inline: 1px solid #28150d;
    background: var(--lg-yellow);
  }
  & .plinko-bin:nth-child(odd) { background: #ed4598; }
  & .plinko-bin[data-tier=none] { background: var(--lg-paper); }
  & .plinko-bin::before { background: #27130c4f; }
  & .plinko-bin.plinko-landed { color: #17130b; background: #fff7bd; box-shadow: 0 0 12px #fff1a4; }
  & .plinko-bin-detail { color: #20160e; background: var(--lg-paper); border-color: #20160e; }
  & .plinko-sound input { accent-color: var(--lg-accent); }
  & .plinko-recent .button { color: var(--lg-text); background: var(--lg-plate); border-color: var(--lg-border); }
  & .plinko-recent .button[data-result=win] strong { color: var(--instant-green,#237345); }
  & .plinko-recent .button[data-result=loss] strong { color: var(--instant-bad,#ad2351); }
}
html[data-ludik-theme="stencil"] #content[data-game=plinko] {
  & .plinko-layout {
    grid-template-columns: var(--lg-console-width) minmax(0,1fr);
    grid-template-areas: "controls board" "controls feedback";
  }
  & .stage.stage-plinko { border-color: var(--lg-border); background: var(--lg-rule), #181311; }
  & .stage.stage-plinko::before, & .stage.stage-plinko::after { opacity: .87; }
  & .plinko-bins { border-color: var(--lg-border); }
  & .plinko-bin:nth-child(odd) { background: #c13e29; color: #fff3cb; }
  & .plinko-bin.plinko-landed { background: var(--lg-yellow); color: #18120c; }
  & .plinko-recent .button[data-result=win] strong { color: #a4eca7; }
  & .plinko-recent .button[data-result=loss] strong { color: #ffa3a6; }
}

html[data-ludik-theme] #content[data-game=dice] {
  & .instant-dice { min-height: 388px; }
  & .instant-dice-scale { padding-inline: 9px; margin-top: 40px; }
  & .instant-dice-track {
    height: clamp(24px, 4vw, 41px);
    border: 3px solid #1b1510;
    background: #e72e87;
  }
  & .instant-dice-track::before { background: var(--lg-yellow); }
  & .instant-dice-threshold {
    z-index: 2;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #231710;
    box-shadow: none;
  }
  & .instant-dice-threshold::before, & .instant-dice-marker::before {
    position: absolute;
    z-index: 3;
    left: 50%;
    padding: .25em .42em;
    border-radius: 3px;
    font: 800 clamp(.72rem, 1.55vw, 1rem)/1 var(--lg-display);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transform: translateX(-50%);
    content: attr(data-ludik-value);
  }
  & .instant-dice-threshold:not([data-ludik-value=""])::before {
    top: -2.24em;
    color: #fff7ea;
    border: 1px solid #1d130e;
    background: #bc1d69;
  }
  & .instant-dice-threshold::after {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 13px;
    height: 13px;
    border: 2px solid #231710;
    border-radius: 50%;
    background: #f9dfd5;
    transform: translateX(-50%);
    content: "";
  }
  & .instant-dice-marker {
    width: 17px;
    height: 17px;
    z-index: 3;
    transform: translate(-50%,-50%);
    border: 2px solid #19140b;
    border-radius: 2px;
    background: var(--lg-yellow);
    box-shadow: none;
  }
  & .instant-dice-marker:not([data-ludik-value=""])::before {
    top: calc(100% + 6px);
    color: #20160d;
    border: 1px solid #25190e;
    background: var(--lg-yellow);
  }
  & .instant-dice-ticks {
    margin: 28px -4px 0;
    gap: 0;
    color: var(--lg-text);
    font-size: clamp(.69rem, 1.35vw, .87rem);
    font-weight: 750;
  }
  & .instant-dice-ticks span { position: relative; }
  & .instant-dice-ticks span::before {
    position: absolute;
    left: 50%;
    top: -25px;
    width: 2px;
    height: 10px;
    background: currentColor;
    content: "";
  }
  & .instant-dice .instant-output { background: var(--lg-yellow); color: #1d150c; padding: 0 .2em .1em; }
}
html[data-ludik-theme="stencil"] #content[data-game=dice] {
  & .instant-dice-track { background: #a32124; border-color: var(--lg-border); }
  & .instant-dice-threshold { width: 5px; top: -5px; bottom: -5px; background: var(--lg-paper); }
  & .instant-dice-threshold::after { display: none; }
  & .instant-dice-threshold:not([data-ludik-value=""])::before { color: #22150c; background: var(--lg-paper); }
}

html[data-ludik-theme] #content[data-game=crash] {
  & .crash-game { gap: 12px; }
  & .crash-game > .page-head { margin-bottom: 0; }
  & .stage.crash-stage { background: url("/redesign-art/paper.webp") center / 510px auto, var(--lg-paper); --crash-color: #26160f; }
  & .crash-stage[data-crash-phase=running] { --crash-color: #26160f; }
  & .crash-stage[data-crash-phase=settled] { --crash-color: #a21e3b; }
  & .crash-stage-copy { inset-block-start: 8.5%; gap: 4px; }
  & .crash-phase { color: #192519; background: var(--lg-mint); border: 1px solid #231b13; border-radius: 3px; }
  & .crash-multiplier {
    padding: 0 .14em .03em;
    color: var(--crash-color);
    font-family: var(--lg-display);
    font-style: italic;
    line-height: 1;
    letter-spacing: -.035em;
    text-shadow: none;
    background: var(--lg-yellow);
    font-variant-numeric: tabular-nums;
  }
  & .crash-stage-copy p { color: var(--lg-text); font-weight: 700; }
  & .crash-stage-copy progress { background: #3f281d48; }
  & .crash-stage-copy progress::-webkit-progress-bar { background: #3f281d48; }
  & .crash-stage-copy progress::-webkit-progress-value { background: var(--lg-accent); }
  & .crash-stage-copy progress::-moz-progress-bar { background: var(--lg-accent); }
  & .crash-history {
    padding: 2px 10px;
    border: 1px solid var(--lg-border);
    border-radius: 3px;
    color: var(--lg-text);
    background: var(--lg-paper);
  }
  & .crash-history-points li { background: #f0cca3; border-color: #312515; color: #1e150e; border-radius: 4px; }
  & .crash-history-points li[data-tone=medium] { background: var(--lg-mint); color: #1a2414; }
  & .crash-history-points li[data-tone=high] { background: var(--lg-yellow); color: #1e150e; }
  & .crash-wager { color: var(--lg-text); }
}
html[data-ludik-theme="stencil"] #content[data-game=crash] {
  & .stage.crash-stage { background: var(--lg-rule), radial-gradient(at 72% 50%,#6a241b,#230e0e); }
  & .crash-phase { color: #27170c; background: var(--lg-paper); }
  & .crash-stage-copy p { color: #fff0d9; }
  & .crash-history { background: var(--lg-panel); }
  & .crash-history-points li { background: #54201d; color: #fff0d9; border-color: var(--lg-border); }
  & .crash-history-points li[data-tone=medium] { background: #694024; color: #fff0d9; }
  & .crash-history-points li[data-tone=high] { background: var(--lg-yellow); color: #24170c; }
}

html[data-ludik-theme] #content[data-game=mines] {
  & .step-grid {
    gap: clamp(4px,.97vw,8px);
    width: min(100%,430px);
    border: 2px solid #2a1b13;
    border-radius: 3px;
    background: var(--lg-plate);
    box-shadow: 2px 3px 0 #29170f;
  }
  & .step-cell {
    color: var(--lg-text);
    border: 2px solid var(--lg-border);
    border-radius: 4px;
    background: var(--lg-rule), #eedbb4;
    box-shadow: inset -2px -2px #2d1b0c42;
  }
  & .step-cell[data-cell-state=safe], & [data-mines-auto-plan] .step-cell[data-cell-state=planned] {
    color: #19482a;
    border-color: #295937;
    background: var(--lg-mint);
    box-shadow: inset -2px -2px #28552d55;
  }
  & .step-cell:is([data-cell-state=danger],[data-cell-state=struck]) { color: #fff1e4; background: #a42342; border-color: #481527; }
  & .step-cell[data-cell-state=struck] { background: #cb2851; box-shadow: inset 0 0 0 2px #ffb6a7; }
  & .step-cell[data-mines-waiting] { border-style: dashed; }
  & .mines-plan-clear { color: var(--lg-text); background: var(--lg-plate); border-color: var(--lg-border); }
}
html[data-ludik-theme="comic"] #content[data-game=mines] .step-cell:is([data-cell-state=closed],[data-cell-state=next]) {
  & > svg { visibility: hidden; }
  &::before {
    position: absolute;
    inset: 22% 28%;
    background: currentColor;
    clip-path: polygon(69% 0,12% 57%,46% 53%,32% 100%,88% 42%,56% 46%);
    content: "";
  }
}
html[data-ludik-theme="stencil"] #content[data-game=mines] {
  & .game-layout { grid-template-columns: var(--lg-console-width) minmax(0,1fr); }
  & #game-sidebar { grid-column: 1; grid-row: 1; }
  & .stage-column { grid-column: 2; grid-row: 1; }
  & .step-stage { background: var(--lg-grain), radial-gradient(at 42% 44%,#721822,#32110f 82%); }
  & .step-grid { background: #3c1716; border-color: var(--lg-border); }
  & .step-cell { color: #f1bfa1; background: var(--lg-rule), #521815; border-color: #cda37c; }
  & .step-cell[data-cell-state=closed] > svg { visibility: hidden; }
  & .step-cell[data-cell-state=safe], & [data-mines-auto-plan] .step-cell[data-cell-state=planned] {
    color: #d0f47d;
    background: #275130;
    border-color: #8fc77b;
  }
  & .step-cell:is([data-cell-state=danger],[data-cell-state=struck]) { color: #fff8d9; background: #9a281d; border-color: #ffab7d; }
}

html[data-ludik-theme] #content[data-game=beef] {
  & .game-layout { grid-template-columns: minmax(0,1fr); }
  & .step-stage[data-step-stage=beef] { gap: 13px; min-height: 0; }
  & .beef-ladder {
    grid-template-columns: none;
    grid-auto-columns: minmax(118px, 1fr);
    grid-template-rows: auto;
    grid-auto-flow: column;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--lg-accent) var(--lg-plate);
    border: 2px solid var(--lg-border);
    border-radius: 5px;
    background: var(--lg-panel);
    box-shadow: none;
  }
  & .beef-ladder-step::before { display: none; }
  & .beef-ladder-step {
    --beef-edge: #3d2b20;
    --beef-body: var(--lg-plate);
    --beef-base: var(--lg-paper);
    --beef-ink: var(--lg-text);
    --beef-detail: var(--lg-text);
  }
  & .beef-checkpoint {
    min-height: clamp(111px, 13vw, 165px);
    border: 2px solid var(--beef-edge);
    border-radius: 7px 3px 7px 3px;
    background: var(--lg-rule), linear-gradient(var(--beef-body),var(--beef-base));
    box-shadow: inset -2px -2px #24140f38;
  }
  & .beef-ladder-step[data-beef-state=safe] {
    --beef-edge: #387943;
    --beef-body: var(--lg-mint);
    --beef-base: #a9df96;
    --beef-ink: #172813;
    --beef-detail: #21411e;
  }
  & .beef-ladder-step[data-beef-state=next] {
    --beef-edge: #ad591b;
    --beef-body: #ffea80;
    --beef-base: #edb837;
    --beef-ink: #31200c;
    --beef-detail: #483418;
  }
  & .beef-ladder-step[data-beef-state=danger] {
    --beef-edge: #fc9c8d;
    --beef-body: #a62c2c;
    --beef-base: #631d1f;
    --beef-ink: #fff4d6;
    --beef-detail: #ffe4cc;
  }
  & .beef-step-mark svg { width: clamp(25px,4vw,49px); height: clamp(25px,4vw,49px); }
  & .beef-step-factor { font-family: var(--lg-display); font-size: clamp(.88rem,2.4vw,1.38rem); }
  & .step-move.button { border: 2px solid var(--lg-border); font-weight: 750; }
  & .step-move.button:not(:disabled) { background: var(--lg-yellow); color: #21160b; }
  & .step-move.button :is(svg,small) { color: inherit; }
}
html[data-ludik-theme="stencil"] #content[data-game=beef] {
  & .beef-ladder { padding: clamp(9px,1.5vw,16px); background: var(--lg-grain), #601b19; }
  & .beef-ladder-step[data-beef-state=preview], & .beef-ladder-step[data-beef-state=closed] {
    --beef-edge: #cba477;
    --beef-body: #33302a;
    --beef-base: #171512;
    --beef-ink: #fff1cb;
    --beef-detail: #ead4ae;
  }
  & .beef-ladder-step[data-beef-state=safe] { --beef-edge:#93cf90; --beef-body:#2b5732; --beef-base:#193321; --beef-ink:#edffd8; --beef-detail:#cfedbd; }
  & .beef-ladder-step[data-beef-state=next] { --beef-edge:#ffdf65; --beef-body:#574619; --beef-base:#28210d; --beef-ink:#fff2c3; --beef-detail:#f7d67e; }
}

html[data-ludik-theme] #content[data-game=keno] {
  & .instant-keno { gap: 12px; min-height: 0; }
  & .instant-keno-picker { width: min(100%,740px); }
  & .instant-keno-grid { --instant-keno-cols: 10; gap: clamp(3px,.67vw,7px); }
  & .instant-keno-grid button {
    min-height: clamp(29px,4.6vw,56px);
    aspect-ratio: auto;
    color: var(--lg-text);
    border: 2px solid var(--lg-border);
    border-radius: 4px;
    background: var(--lg-rule), var(--lg-plate);
    box-shadow: inset -2px -2px #3f230a25;
    font-family: var(--lg-display);
    font-size: clamp(.76rem,1.8vw,1.35rem);
    font-weight: 880;
  }
  & .instant-keno-grid button:not(:disabled):hover { color: #19180c; background: var(--lg-yellow); border-color: var(--lg-border); }
  & .instant-keno-grid button[aria-pressed=true] { color: #20180b; background: var(--lg-yellow); border-color: #59451b; }
  & .instant-keno-grid button[data-drawn=true] { color: var(--lg-text); background: var(--lg-panel); border-style: dashed; }
  & .instant-keno-grid button[data-drawn=true][aria-pressed=true] { color: #16291b; background: var(--lg-mint); border-color: #30593b; border-style: solid; }
  & .instant-keno-actions .button,
  & .instant-keno-history li { color: var(--lg-text); background: var(--lg-panel); border-color: var(--lg-border); border-radius: 4px; }
  & .instant-keno-history li[data-tone=hit] { color: #18291c; background: var(--lg-mint); border-color: #30593b; }
  & .instant-keno-draw :is(span,.instant-keno-hits,.instant-keno-hits strong) { color: var(--lg-text); }
  & #preview .table-wrap { max-height: clamp(145px,28vh,275px); }
  & #preview th { position: sticky; top: 0; }
}
html[data-ludik-theme="stencil"] #content[data-game=keno] {
  & .game-layout { grid-template-columns: var(--lg-console-width) minmax(0,1fr); }
  & #game-sidebar { grid-column: 1; grid-row: 1; }
  & .stage-column { grid-column: 2; grid-row: 1; }
  & .instant-keno-grid button[aria-pressed=true]:not([data-drawn=true]) { background: #ffa51d; }
}

html[data-ludik-theme] #content[data-game=limbo] {
  & .instant-limbo {
    min-height: 415px;
    background: radial-gradient(ellipse at 50% 46%,#f14074,#b9203d 82%);
  }
  & .instant-limbo :is(.instant-stage-top h2,.instant-stage-state) {
    padding: .28em .46em;
    border: 1px solid #21180d;
    border-radius: 3px;
    background: var(--lg-paper);
    color: #271810;
  }
  & .instant-limbo-dial { isolation: isolate; }
  & .instant-limbo-dial::before, & .instant-limbo-dial::after {
    position: absolute;
    right: 10%;
    top: 10%;
    width: clamp(16px, 3.7vw, 48px);
    aspect-ratio: 1;
    background: var(--lg-yellow);
    clip-path: polygon(0 100%, 38% 16%, 53% 29%, 0 100%, 63% 42%, 82% 53%, 0 100%, 90% 70%, 93% 84%);
    transform: rotate(-12deg);
    pointer-events: none;
    content: "";
  }
  & .instant-limbo-dial::after { inset: auto auto 12% 10%; transform: rotate(168deg) scale(.82); }
  & .instant-limbo-dial :is(.instant-output,.instant-output-label) { color: #24170d; }
  & .instant-limbo-dial .instant-output {
    max-width: 100%;
    padding: 0 .16em .09em;
    background: var(--lg-yellow);
    font-family: var(--lg-display);
    font-style: italic;
    font-size: clamp(2.35rem,8.6vw,6.2rem);
    line-height: 1;
  }
  & .instant-limbo-rings {
    width: min(72%,285px);
    background: var(--lg-grain), var(--lg-paper);
    border: 4px solid #2b1c13;
    box-shadow: 0 0 0 3px var(--lg-paper), 0 0 0 6px #2b1c13, inset 0 0 0 4px var(--lg-paper), inset 0 0 0 6px #3c281985;
  }
  & .instant-limbo-rings::before { border: 1px dashed #50351ac7; }
  & .instant-limbo-rings::after { border-top-color: var(--lg-accent); border-right-color: #3b291482; }
  & .instant-facts > div { background: var(--lg-paper); color: #25180e; }
  & .instant-facts :is(dt,dd) { color: inherit; }
}
html[data-ludik-theme="stencil"] #content[data-game=limbo] {
  & .instant-limbo { background: var(--lg-rule), #171412; }
  & .instant-limbo-dial .instant-output-label { color: var(--lg-text); }
  & .instant-limbo-dial .instant-output { color: var(--lg-yellow); background: none; }
  & .instant-limbo-rings {
    background: var(--lg-rule), #15120f;
    border-color: var(--lg-paper);
    box-shadow: 0 0 0 3px #15120f, 0 0 0 6px #d7aa7a, inset 0 0 0 3px #21160f, inset 0 0 0 6px var(--lg-yellow);
  }
  & .instant-limbo-rings::before { border-color: #d7aa7a; }
  & .instant-limbo-rings::after { border-top-color: var(--lg-yellow); }
  & .instant-facts > div { background: var(--lg-panel); color: var(--lg-text); }
}

html[data-ludik-theme] #content[data-game=hilo] {
  & .step-stage[data-step-stage=hilo] {
    position: relative;
    isolation: isolate;
    background: var(--lg-rule), var(--lg-panel);
  }
  & .step-card {
    border: 2px solid #2e2013;
    border-radius: 8px;
    box-shadow: 3px 4px 0 #25413077;
  }
  & .step-card-face[data-suit=red] { color: #bf2350; }
  & .step-card-back {
    color: #24180e;
    background: repeating-linear-gradient(130deg,#ffde2f 0 7px,#eeb529 7px 9px);
  }
  & .step-card-back::before { border-color: #30230f; }
  & .step-card-history { border-color: var(--lg-border); background: var(--lg-plate); }
  & .step-card-history h3 { color: var(--lg-text); }
  & .step-move.button { background: var(--lg-yellow); color: #21150a; }
  & .step-move.button :is(svg, small) { color: inherit; }
  & .hilo-opening-quote.button:disabled { opacity: .88; }
}
html[data-ludik-theme="stencil"] #content[data-game=hilo] {
  & .step-card-table { gap: clamp(18px,4.5vw,56px); }
  & .step-card-back {
    color: var(--lg-yellow);
    background: repeating-linear-gradient(130deg,#8a2328 0 7px,#681918 7px 10px);
    border-color: var(--lg-border);
  }
  & .step-card-back::before { border-color: #ffce73; }
}

html[data-ludik-theme] #content:is([data-game=crash],[data-game=beef],[data-game=hilo]) {
  --lg-mascot: url("/redesign-art/mascot-comic.webp");
  & :is(.crash-game > .page-head,.step-stage) { position: relative; }
}
html[data-ludik-theme="stencil"] #content:is([data-game=crash],[data-game=beef],[data-game=hilo]) {
  --lg-mascot: url("/redesign-art/mascot-stencil.webp");
}
html[data-ludik-theme="comic"] #content[data-game=mines] { --lg-mascot: url("/redesign-art/mascot-comic.webp"); }

@media (min-width: 980px) {
  html[data-ludik-theme] #content[data-game=crash] .crash-game > .page-head::after,
  html[data-ludik-theme] #content[data-game=beef] > .page-head::after,
  html[data-ludik-theme] #content[data-game=hilo] .step-stage::after,
  html[data-ludik-theme="comic"] #content[data-game=mines] .step-stage::after {
    position: absolute;
    inset: auto auto 0 5%;
    width: clamp(85px,11vw,148px);
    height: clamp(85px,11vw,148px);
    content: "";
    pointer-events: none;
    background: var(--lg-mascot) 50% 16% / 93% auto no-repeat;
    filter: drop-shadow(1px 0 0 var(--lg-paper)) drop-shadow(-1px 1px 0 var(--lg-paper));
  }
  html[data-ludik-theme] #content[data-game=crash] .crash-game > .page-head::after,
  html[data-ludik-theme] #content[data-game=beef] > .page-head::after {
    left: min(57%,650px);
    bottom: -9px;
    height: clamp(72px,9vw,117px);
    background-size: 86% auto;
  }
  html[data-ludik-theme] #content[data-game=hilo] .step-stage,
  html[data-ludik-theme="comic"] #content[data-game=mines] .step-stage {
    position: relative;
  }
  html[data-ludik-theme] #content[data-game=hilo] .step-card-table,
  html[data-ludik-theme="comic"] #content[data-game=mines] .step-grid {
    margin-inline-start: clamp(100px,10vw,157px);
  }
  html[data-ludik-theme] #content[data-game=hilo] .step-stage::after,
  html[data-ludik-theme="comic"] #content[data-game=mines] .step-stage::after {
    bottom: 23%;
    height: clamp(115px,15vw,180px);
    background-position: center 22%;
  }
}

@media (min-width: 960px) {
  html[data-ludik-theme="stencil"] #content:is([data-game=dice],[data-game=hilo]) .game-layout { grid-template-columns: minmax(0,1fr); }
  html[data-ludik-theme] #content[data-game=beef] #game-sidebar,
  html[data-ludik-theme="stencil"] #content[data-game=hilo] #game-sidebar {
    display: grid;
    grid-template-columns: minmax(150px,19%) minmax(0,1fr);
    align-items: start;
    column-gap: 16px;
  }
  html[data-ludik-theme] #content[data-game=beef] #game-sidebar > .step-console,
  html[data-ludik-theme="stencil"] #content[data-game=hilo] #game-sidebar > .step-console {
    grid-column: 1 / -1;
    grid-template-columns: minmax(135px,.72fr) minmax(260px,1.3fr) minmax(195px,1fr);
    align-items: start;
  }
  html[data-ludik-theme] #content[data-game=beef] #game-sidebar > details,
  html[data-ludik-theme="stencil"] #content[data-game=hilo] #game-sidebar > details { grid-column: 1 / -1; }
  html[data-ludik-theme] #content[data-game=beef] #game-sidebar form:not([data-auto-series]) {
    grid-template-columns: repeat(3,minmax(0,1fr));
    align-items: start;
  }
  html[data-ludik-theme="stencil"] #content[data-game=dice] {
    & .instant-dice { min-height: 295px; gap: 9px; padding-block: 16px; }
    & .instant-dice-body { gap: 3px; padding-top: 3px; }
    & .instant-dice .instant-output { font-size: clamp(2.25rem, 5vw, 3.25rem); }
    & .instant-dice-scale { width: 100%; margin-top: 31px; }
    & .instant-facts > div { padding-block: 8px; }
    & #game-sidebar .auto-mode { width: min(245px,100%); }
    & #game-sidebar form:not([data-auto-series], :has(.guest-fields)) {
      grid-template-columns: minmax(115px,.9fr) max-content minmax(275px,2fr) minmax(130px,.9fr);
      grid-template-areas: "stake stake-tools settings play" "quote quote proof turbo" "quote quote sound turbo";
      gap: 7px 12px;
      align-items: start;
      & > label:has(input[name=stake]) { grid-area: stake; }
      & > .actions:has([data-action=dice-stake]) { grid-area: stake-tools; margin-top: 24px; }
      & > .instant-dice-options { grid-area: settings; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
      & > .instant-dice-options input[type=range] { grid-column: 1 / -1; grid-row: 2; }
      & > .actions:has(.play-primary) { grid-area: play; margin-top: 16px; }
      & > #preview { grid-area: quote; }
      & > details { grid-area: proof; }
      & > .actions:has([name=diceTurbo]) { grid-area: turbo; }
      & > .instant-sound { grid-area: sound; justify-content: start; gap: 9px; }
    }
  }
}

@media (max-width: 959px) {
  html[data-ludik-theme] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
    & :is(.game-layout, .crash-layout) { grid-template-columns: minmax(0,1fr); }
    & .plinko-layout { grid-template-areas: "board" "controls" "feedback"; }
    & :is(.stage-column, #game-sidebar, [data-step-layout] .stage, [data-step-layout] .result-strip) { grid-column: auto; grid-row: auto; }
    & [data-step-layout] .stage-column { display: block; }
    & #game-sidebar { align-self: stretch; }
    & .instant-keno-grid { --instant-keno-cols: 10; }
    & .instant-keno-grid button { font-size: clamp(.67rem, 2.7vw,1.07rem); }
  }
}
@media (max-width: 520px) {
  html[data-ludik-theme] #content:is([data-game=plinko],[data-game=dice],[data-game=crash],[data-game=mines],[data-game=beef],[data-game=keno],[data-game=limbo],[data-game=hilo]) {
    & .page-head h1 { font-size: clamp(2.35rem, 13vw, 3.6rem); }
    & .page-head p { margin-top: 7px; font-size: .81rem; }
    & :is(.instant-stage,.step-stage) { padding-inline: clamp(8px,3vw,15px); }
    & .instant-dice { min-height: 365px; }
    & .instant-limbo { min-height: 365px; }
    & .instant-limbo-rings { width: min(72%,200px); }
    & .instant-keno-grid { --instant-keno-cols: 8; }
    & .mini-game-tools { flex-wrap: wrap; }
    & .crash-game > .page-head { grid-template-columns: minmax(0,1fr); }
    & .crash-game > .page-head .mini-game-tools { justify-content: start; }
    & .step-stage .step-card-table { margin-inline-start: 0; }
  }
}
.game-volume {
  display: inline-grid;
  grid-template-columns: max-content minmax(0, 1fr) 4ch;
  align-items: center;
  gap: .35rem;
  min-inline-size: 0;
  padding: .25rem .4rem;
  border: 2px solid #231710;
  background: #ffdf32;
  color: #231710;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 850;
}

.game-volume input[type="range"] {
  min-inline-size: 0;
  inline-size: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: #231710;
  cursor: pointer;
}

.game-volume input[type="range"]:focus-visible {
  outline: 2px solid #231710;
  outline-offset: 3px;
}

.game-volume [data-game-volume-value] {
  font-variant-numeric: tabular-nums;
  text-align: end;
}
