/* Dice: shared live scale, with a distinct print composition for each theme. */
html[data-ludik-theme] #content[data-game="dice"] {
  --dice-paper: #f8e6c6 url("/redesign-art/paper.webp") center / 370px auto;
  --dice-yellow: #ffdc25;
  --dice-miss: #f52285;
  --dice-edge: #170f0c;
  --dice-rounding: 999px;
  --dice-torn: polygon(0 7px, 4% 5px, 7% 1px, 10% 7px, 14% 3px, 17% 5px, 20% 1px, 23% 2px, 27% 8px, 31% 3px, 36% 6px, 39% 1px, 44% 4px, 48% 3px, 51% 7px, 55% 0, 59% 5px, 62% 3px, 65% 8px, 69% 4px, 73% 6px, 76% 1px, 81% 4px, 85% 3px, 89% 6px, 93% 0, 96% 7px, 99% 3px, 100% 12%, calc(100% - 5px) 22%, 100% 34%, calc(100% - 4px) 47%, 100% 63%, calc(100% - 6px) 74%, 100% 89%, 99% calc(100% - 3px), 95% calc(100% - 8px), 91% 100%, 87% calc(100% - 5px), 82% calc(100% - 2px), 79% calc(100% - 7px), 75% 100%, 71% calc(100% - 4px), 66% calc(100% - 2px), 61% calc(100% - 7px), 57% 100%, 53% calc(100% - 5px), 49% calc(100% - 3px), 46% calc(100% - 7px), 42% 100%, 39% calc(100% - 6px), 35% calc(100% - 1px), 31% calc(100% - 8px), 27% calc(100% - 3px), 24% 100%, 20% calc(100% - 6px), 15% calc(100% - 3px), 11% calc(100% - 7px), 7% calc(100% - 2px), 3% 100%, 0 calc(100% - 5px), 4px 88%, 0 77%, 5px 64%, 0 49%, 3px 38%, 0 27%, 4px 14%);
  position: relative;
  padding-inline: clamp(12px, 3vw, 42px);
  background-position: center top;
  background-size: cover;

  & > .page-head h1 {
    font: italic 900 clamp(3.05rem, 8vw, 7.4rem)/.86 var(--lg-display);
    letter-spacing: -.045em;
    text-shadow: 2px 2px #1f160329;
    transform: rotate(-7deg) skewX(-6deg);
  }
  & > .page-head > div:first-child > p {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  & > .page-head .mini-game-tools button {
    padding: 4px 8px;
    font-size: .7rem;
  }
  & .game-layout { gap: clamp(14px, 2vw, 26px); }
  & .stage.panel.stage-dice {
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }
  & .instant-stage.instant-dice {
    min-height: 0;
    grid-template: "receipts" auto "scale" auto "caption" auto / minmax(0, 1fr);
    gap: clamp(9px, 1.35vw, 18px);
    padding: 0;
    background: transparent;
  }
  & .instant-dice::before { content: none; }
  & .dice-receipts {
    grid-area: receipts;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    align-items: start;
    gap: clamp(5px, 1vw, 12px);
  }
  & .dice-receipt {
    display: grid;
    align-content: center;
    justify-items: start;
    min-width: 0;
    margin: 0;
  }
  & .dice-receipt > div { display: grid; justify-items: start; min-width: 0; }
  & .dice-receipt :is(p, dt) {
    color: var(--lg-text);
    font-size: clamp(.625rem, 1.1vw, .93rem);
    font-weight: 800;
    line-height: 1.14;
  }
  & .dice-receipt :is(.instant-output, dd) {
    margin: .13em 0 0;
    padding: 0;
    color: var(--lg-text);
    background: none;
    font: italic 900 clamp(1.4rem, 3.7vw, 3.2rem)/1 var(--lg-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.035em;
    white-space: nowrap;
  }
  & .dice-meter-print { grid-area: scale; position: relative; isolation: isolate; }
  & .instant-dice-scale { width: 100%; margin: 0; padding: 0; }
  & .instant-dice-track {
    height: clamp(34px, 4.45vw, 61px);
    border: clamp(3px, .4vw, 6px) solid var(--dice-edge);
    border-radius: var(--dice-rounding);
    background-color: var(--dice-miss);
    background-image: radial-gradient(#3f001a25 .9px, transparent 1.4px), linear-gradient(180deg,#fff1da15, transparent 48%,#6c0b3829);
    background-size: 4px 4px, auto;
    box-shadow: 0 4px 0 #1b130d8e, inset 0 0 3px #24090c80;
  }
  & .instant-dice-track::before {
    background-color: var(--dice-yellow);
    background-image: radial-gradient(#62400525 .9px, transparent 1.4px), linear-gradient(180deg,#fff8be30,transparent 64%, #e693142f);
    background-size: 4px 4px, auto;
    border-start-start-radius: var(--dice-rounding);
    border-end-start-radius: var(--dice-rounding);
  }
  & .instant-dice[data-direction="over"] .instant-dice-track::before {
    border-radius: 0 var(--dice-rounding) var(--dice-rounding) 0;
  }
  & .instant-dice-threshold {
    z-index: 3;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #180e0b;
  }
  & .instant-dice-threshold::after {
    display: block;
    top: -11px;
    width: clamp(15px, 1.5vw, 21px);
    height: clamp(15px, 1.5vw, 21px);
    border: 2px solid #190f0b;
    background: var(--dice-miss);
    box-shadow: inset 0 0 0 2px #fff1dc;
  }
  & .instant-dice-threshold:not([data-ludik-value=""])::before,
  & .instant-dice-marker:not([data-ludik-value=""])::before {
    top: auto;
    bottom: calc(100% + var(--dice-tag-offset, 15px));
    min-width: 2.55em;
    padding: .29em .4em .58em;
    border: 0;
    border-radius: 0;
    color: var(--dice-tag-text, #190f0c);
    background: linear-gradient(var(--dice-tag-fill),var(--dice-tag-fill)) center 2px / calc(100% - 4px) 74% no-repeat, #19100c;
    clip-path: polygon(0 0,100% 0,100% 80%,61% 80%,50% 100%,39% 80%,0 80%);
    font: italic 900 clamp(.82rem, 1.75vw, 1.45rem)/1 var(--lg-display);
    font-variant-numeric: tabular-nums;
    text-align: center;
    text-shadow: none;
    box-shadow: none;
  }
  & .instant-dice-threshold { --dice-tag-fill: #e11977; --dice-tag-text: #fff5eb; }
  & .instant-dice-marker {
    --dice-tag-fill: var(--dice-yellow);
    --dice-tag-offset: clamp(24px, 3.7vw, 46px);
    top: 45%;
    width: 14px;
    height: 14px;
    border: 2px solid var(--dice-edge);
    border-radius: 50%;
    background: var(--dice-yellow);
    box-shadow: 0 1px 0 #190e09a8;
  }
  & .instant-dice[data-round-tone="win"] .instant-dice-marker { background: #72e490; border-color: #184b29; }
  & .instant-dice[data-round-tone="loss"] .instant-dice-marker { background: #fff0c0; border-color: #952429; }
  & .instant-dice[data-round-tone="loss"] .instant-dice-marker::before { --dice-tag-fill: #ffe5bc; }
  & .instant-dice-marker[data-near-threshold] { --dice-tag-offset: clamp(55px, 6.6vw, 95px); }
  & .instant-dice-ticks {
    margin: 9px -7px 0;
    color: var(--lg-text);
    font: italic 850 clamp(.88rem, 1.6vw, 1.25rem)/1.15 var(--lg-display);
    letter-spacing: .02em;
  }
  & .instant-dice-ticks span::before {
    inset: auto auto calc(100% + 2px) 50%;
    height: 12px;
    width: 2px;
    z-index: 2;
  }
  & .dice-round-caption {
    grid-area: caption;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    align-items: center;
    justify-content: space-between;
    padding-inline: 4px;
  }
  & .dice-round-caption dl {
    min-width: 0;
    margin: 0;
    padding: .28em .53em;
    background: var(--lg-panel);
    border: 1px solid var(--lg-border);
    color: var(--lg-text);
    border-radius: 3px;
    font-size: .74rem;
  }
  & .dice-round-caption dl > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
  & .dice-round-caption dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
  & .dice-round-caption .instant-stage-state { padding: .3em .58em; font-size: .74rem; }
  & #game-sidebar {
    position: relative;
    gap: 9px;
    padding: clamp(12px, 1.65vw, 23px);
  }
  & #game-sidebar form { gap: 8px; }
  & #game-sidebar .guest-fields { gap: 8px; }
  & #game-sidebar :is(form, fieldset, .instant-dice-options) > :is(.notice) {
    padding: .4em .55em;
    font-size: .8rem;
    line-height: 1.35;
  }
  & #game-sidebar :is(input:not([type=range],[type=checkbox],[type=radio]), select) {
    min-height: 35px;
    padding-block: 4px;
    font-weight: 810;
  }
  & #game-sidebar .instant-dice-options { gap: 6px 8px; }
  & #game-sidebar label { gap: 2px; font-size: .85rem; }
  & #game-sidebar label.instant-sound {
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
    width: fit-content;
    gap: .4rem;
  }
  & #game-sidebar .actions:has([data-action="dice-stake"]) { gap: 4px; }
  & #game-sidebar .actions:has([data-action="dice-stake"]) .button { min-height: 27px; padding: 2px 6px; }
  & #game-sidebar .instant-dice-options input[type=range] { min-height: 14px; height: 14px; accent-color: var(--lg-accent); }
  & #game-sidebar .auto-mode button { min-height: 38px; font: italic 900 1.05rem/1 var(--lg-display); }
  & #game-sidebar .actions > :is(.play-primary,.button[data-action="auth"],.button[data-action="auto-start"]) {
    flex: 1 1 8ch;
    min-height: 55px;
    padding: .26em .55em .34em;
    border: 2px solid #1e140b;
    background-color: var(--dice-yellow);
    color: #1a110b;
    font: italic 900 clamp(1.5rem, 2.55vw, 2.6rem)/1 var(--lg-display);
    font-variant-numeric: tabular-nums;
    box-shadow: 4px 4px #1b110b;
  }
  & #game-sidebar .actions > :is(.play-primary,.button[data-action="auth"],.button[data-action="auto-start"]):hover:not(:disabled) {
    background-color: #fff08c;
  }
  & #game-sidebar .actions > :is(.play-primary,.button[data-action="auth"],.button[data-action="auto-start"]):active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 2px 1px #1b110b;
  }
}

html[data-ludik-theme="stencil"] #content[data-game="dice"] {
  --dice-edge: #f4daba;
  --dice-miss: #a62018;
  --dice-yellow: #ffcd18;
  --dice-rounding: 15px;
  --lg-accent: #ffc138;

  & > .page-head { margin-block-end: 1px; min-height: clamp(86px, 11.1vw, 151px); }
  & > .page-head h1 {
    font-size: clamp(3.35rem, 7vw, 6.75rem);
    margin-inline: .13em 0;
    transform: rotate(-5deg) skewX(-6deg);
  }
  & > .page-head h1::before { clip-path: var(--lg-torn); background: var(--dice-paper); }
  & > .page-head h1::after {
    inset: 34% -.22em 23% -.27em;
    z-index: -2;
    height: auto;
    background: #df3020;
    clip-path: polygon(0 0, 22% 26%, 100% 0, 96% 16%, 100% 27%, 80% 50%, 100% 59%, 99% 78%, 100% 100%, 0 100%, 0 75%, 15% 55%, 0 38%, 2% 19%);
    transform: rotate(-5deg);
  }
  & .instant-stage.instant-dice {
    grid-template: "scale scale" auto "receipts caption" auto / minmax(0, 1.2fr) minmax(0, 1fr);
    gap: clamp(6px, 1.4vw, 13px) 9px;
  }
  & .dice-board-art {
    position: absolute;
    z-index: 0;
    inset: auto auto calc(100% - 73px) 57%;
    width: clamp(112px, 22vw, 319px);
    height: clamp(92px, 12.9vw, 184px);
    transform: translateX(-50%);
    pointer-events: none;
  }
  & .dice-board-trail {
    position: absolute;
    inset: 28% 41% 8% 0;
    z-index: -1;
    opacity: .88;
    background: #dfb78f;
    clip-path: polygon(0 77%, 15% 57%, 32% 41%, 50% 29%, 86% 12%, 100% 12%, 73% 25%, 44% 42%, 23% 57%, 2% 78%, 19% 70%, 41% 59%, 63% 41%, 93% 30%, 97% 37%, 71% 46%, 45% 59%, 19% 70%, 4% 91%, 23% 85%, 46% 71%, 68% 58%, 91% 49%, 91% 53%, 72% 61%, 47% 73%, 23% 85%, 0 95%);
  }
  & .dice-board-die {
    position: absolute;
    inset: 0 1% 0 auto;
    width: 61%;
    transform: rotate(-14deg);
    background: url("/redesign-art/stencil-dice.webp") center / contain no-repeat;
    filter: drop-shadow(3px 7px 4px #150a046d);
  }
  & .dice-meter-print { padding: clamp(45px, 5.5vw, 85px) clamp(27px, 4.15vw, 63px) 4px; }
  & .dice-meter-print::before {
    position: absolute;
    inset: 16% 7% auto auto;
    width: 50px;
    height: 33px;
    background: #ffcd21;
    clip-path: polygon(39% 0, 54% 4%, 51% 100%, 40% 12%, 27% 68%, 0 19%, 18% 8%, 36% 62%, 72% 8%, 100% 24%, 62% 89%, 70% 35%);
    pointer-events: none;
    content: "";
  }
  & .instant-dice-track {
    box-shadow: 0 4px 0 #0806047d, inset 0 0 0 2px #21160d;
    background-image: radial-gradient(#6e160a6e .8px, transparent 1.4px), linear-gradient(180deg,#f94b2488,transparent 55%,#430f122e);
  }
  & .instant-dice-track::before { box-shadow: inset 2px 0 0 #2515074f; }
  & .instant-dice-threshold {
    top: -7px;
    bottom: -7px;
    width: 6px;
    border: 1px solid #21120a;
    border-radius: 6px;
    background: #23160e;
    box-shadow: 0 0 0 2px #f9e1bc, inset 1px 0 0 #ffd836;
    --dice-tag-fill: #f2dabb;
    --dice-tag-text: #25160b;
    --dice-tag-offset: 12px;
  }
  & .instant-dice-threshold::after { display: none; }
  & .instant-dice-ticks span::before { height: 8px; }
  & .instant-dice-ticks span:not(:first-child,:last-child) { opacity: .74; }
  & .dice-receipts { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 14px; padding-inline: 4px; }
  & .dice-receipt, & .dice-receipt > div { display: flex; align-items: baseline; gap: 4px; }
  & .dice-receipt :is(.instant-output, dd) { font-size: clamp(.95rem, 1.4vw, 1.3rem); margin: 0; }
  & .dice-receipt :is(p, dt) { font-size: .72rem; font-weight: 690; }
  & .dice-round-caption { justify-content: flex-end; }
  & #game-sidebar {
    border-radius: 10px;
    background: var(--lg-rule), #121110bd;
    box-shadow: 3px 4px #070503;
  }
  & #game-sidebar .auto-mode button { min-height: 30px; }
  & #game-sidebar form:not([data-auto-series]) .actions > :is(.play-primary,.button[data-action="auth"]) {
    min-height: 64px;
    border: 2px solid #382210;
    border-radius: 10px;
    font-style: normal;
    box-shadow: 2px 4px #0a0603;
  }
}

@media (min-width: 960px) {
  html[data-ludik-theme="stencil"] #content[data-game="dice"] {
    & .game-layout { grid-template-columns: minmax(0,1fr); gap: clamp(14px, 2vw, 24px); }
    & #game-sidebar { padding: 12px clamp(14px, 2vw, 28px); }
    & #game-sidebar .auto-mode { width: min(205px,100%); }
    & #game-sidebar form:not([data-auto-series], :has(.guest-fields)) {
      grid-template:
        "stake options roll" auto
        "adjust options tools" auto
        "preview preview proof" auto
        "preview preview sound" auto / minmax(145px,.98fr) minmax(380px,2.6fr) minmax(190px,1.15fr);
      gap: 5px 18px;
      align-items: start;
      & > label:has(input[name="stake"]) { grid-area: stake; }
      & > .actions:has([data-action="dice-stake"]) { grid-area: adjust; margin: 0; }
      & > .instant-dice-options { grid-area: options; }
      & > .actions:has(> .play-primary) { grid-area: roll; margin: 0; }
      & > #preview { grid-area: preview; }
      & > details { grid-area: proof; }
      & > .actions:has([name="diceTurbo"]) { grid-area: tools; flex-wrap: nowrap; }
      & > .instant-sound { grid-area: sound; justify-content: start; gap: 10px; }
    }
    & #game-sidebar form:not([data-auto-series], :has(.guest-fields)) > .notice:first-child { grid-column: 1 / -1; grid-row: 5; }
    & #game-sidebar form > .guest-fields {
      grid-template: "stake options" auto "adjust options" auto / minmax(130px, .9fr) minmax(0, 2.6fr);
      align-items: start;
      column-gap: 14px;
      & > label:has(input[name="stake"]) { grid-area: stake; }
      & > .actions:has([data-action="dice-stake"]) { grid-area: adjust; }
      & > .instant-dice-options { grid-area: options; }
    }
    & #game-sidebar form:has(> .guest-fields) {
      grid-template: "notice notice" auto "fields roll" auto "preview preview" auto / minmax(0, 4fr) minmax(170px,1fr);
      align-items: start;
      column-gap: 14px;
      & > .notice { grid-area: notice; width: fit-content; }
      & > .guest-fields { grid-area: fields; }
      & > .actions:has(.button[data-action="auth"]) { grid-area: roll; }
      & > #preview { grid-area: preview; }
    }
    & #game-sidebar :is(form:not([data-auto-series]),.guest-fields) > .instant-dice-options {
      display: grid;
      grid-template-columns: minmax(115px,1.3fr) repeat(2,minmax(85px,1fr));
      & > input[type=range] { grid-column: 1 / -1; grid-row: 2; }
    }
  }
}

@media (max-width: 959px) {
  html[data-ludik-theme] #content[data-game="dice"] {
    & > .page-head { align-items: start; flex-direction: row; margin-block-end: 8px; }
  }
  html[data-ludik-theme="stencil"] #content[data-game="dice"] {
    & .dice-board-art { bottom: calc(100% - 47px); left: 60%; }
    & .dice-meter-print { padding-block-start: 50px; }
    & .dice-meter-print::before { top: 10%; right: 4%; width: 33px; height: 23px; }
    & #game-sidebar .instant-dice-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
    & #game-sidebar .instant-dice-options > label:has(select) { grid-column: 1 / -1; }
    & #game-sidebar .instant-dice-options > input[type=range] { grid-column: 1 / -1; grid-row: 3; }
  }
  html[data-ludik-theme="stencil"] #content[data-game="dice"] .dice-round-caption { justify-content: flex-start; }
}

@media (max-width: 535px) {
  html[data-ludik-theme] #content[data-game="dice"] {
    & > .page-head h1 { font-size: clamp(3.1rem, 13vw, 4.35rem); }
    & .dice-receipt > div { min-width: 0; }
    & .instant-dice-threshold { --dice-tag-offset: 13px; }
    & .instant-dice-ticks { margin-inline: -3px; }
    & .instant-dice-ticks span::before { height: 8px; }
    & #game-sidebar { padding: 13px 14px; }
  }
  html[data-ludik-theme="stencil"] #content[data-game="dice"] {
    & > .page-head { min-height: 76px; }
    & .dice-board-art { left: 58%; bottom: calc(100% - 37px); height: 86px; }
    & .dice-meter-print { padding-inline: 20px; }
    & .instant-stage.instant-dice { grid-template: "scale" auto "receipts" auto "caption" auto / minmax(0,1fr); }
    & .dice-receipts { gap: 4px 9px; }
    & .dice-round-caption { gap: 5px; justify-content: space-between; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  html[data-ludik-theme="stencil"] #content[data-game="dice"] .instant-dice[data-dice-toss] .dice-board-die {
    animation: dice-stencil-toss .64s cubic-bezier(.2,.75,.32,1) both;
  }
  html[data-ludik-theme="stencil"] #content[data-game="dice"] .instant-dice[data-dice-toss] .dice-board-trail {
    animation: dice-stencil-trail .64s ease-out both;
  }

}
@keyframes dice-stencil-toss {
  0% { transform: translate(-43%, 23%) rotate(-97deg) scale(.75); }
  47% { transform: translate(7%, -17%) rotate(13deg) scale(1.08); }
  78% { transform: translate(3%, 4%) rotate(-21deg); }
  100% { transform: rotate(-14deg); }
}
@keyframes dice-stencil-trail {
  from { opacity: .26; transform: translateX(-14px) scaleX(.72); }
  45% { opacity: 1; transform: scaleX(1.07); }
  to { opacity: .88; transform: none; }
}

/* Comic Dice. Paper panels and printed accents have independent contours. */
html[data-ludik-theme="comic"] #content[data-game="dice"] {
  --dice-ink: #0c0906;
  --dice-yellow: #fff000;
  --dice-miss: #ff0079;
  --dice-mint: #82f6b1;
  --dice-win: #81f2a8;
  --dice-loss: #ff5a52;
  --dice-cream: #fff4d8;
  --dice-stock: linear-gradient(113deg, #fff7e3a0, #fff5de74),
    url("/redesign-art/paper.webp") center / 565px auto, var(--dice-cream);
  --dice-display: var(--font-interface, system-ui, sans-serif);
  --dice-unit: clamp(.54px, .05981vw, 1px);
  --dice-gutter: clamp(9px, .72vw, 14px);
  --dice-top: calc(27 * var(--dice-unit));
  --dice-title-edge: polygon(7% 27%, 26% 9%, 25% 13%, 38% 6%, 37% 10%, 59% 2%, 58% 8%, 85% 0%, 82% 7%, 100% 0%, 95% 11%, 98% 10%, 92% 25%, 97% 24%, 93% 35%, 96% 35%, 89% 52%, 94% 50%, 88% 68%, 91% 68%, 78% 83%, 79% 78%, 66% 86%, 67% 82%, 55% 90%, 56% 85%, 44% 92%, 45% 87%, 27% 97%, 29% 91%, 9% 100%, 11% 93%, 0 100%, 5% 83%, 1% 84%, 6% 68%, 2% 69%, 9% 52%, 1% 56%, 7% 41%, 3% 42%, 10% 28%);
  --dice-paper-edge: polygon(.7% 7%, 3.8% 6%, 5% 3%, 8.4% 2%, 10.6% 3.3%, 14.8% 0, 17.9% 2.1%, 20.6% 5.7%, 23.3% 5.3%, 24.7% 4%, 27.5% 5.9%, 31.1% 4.4%, 34% 2.1%, 35% 4.5%, 40.2% 2.7%, 42.4% 3.8%, 44.5% 2%, 49.8% 1.1%, 51.4% 2.2%, 53.2% .9%, 56.4% 5.6%, 59.7% 4%, 62.8% 4.5%, 66% 1.4%, 68% 2.6%, 70.9% 0, 73.9% 1.9%, 75.9% 5%, 78.1% 3.5%, 81.9% 4.5%, 83.4% 3.1%, 85.7% 5.7%, 88.2% 5.6%, 89.5% 8%, 94% 7.7%, 95.7% 6.3%, 99.6% 7.9%, 98.5% 15.4%, 100% 18.5%, 98.5% 25.8%, 99.7% 29%, 98.8% 35%, 100% 40%, 98.8% 45%, 99.8% 52%, 99% 59%, 99.6% 64%, 98.8% 69%, 100% 76%, 98.8% 81%, 99.7% 87%, 97.7% 93.6%, 94% 94.4%, 93.1% 93%, 89.1% 95.3%, 87.9% 92.9%, 83% 94.6%, 80.7% 100%, 77% 96.1%, 72.6% 95.7%, 70.2% 96.9%, 68.7% 93%, 66.6% 92.6%, 62.6% 96.3%, 60.3% 95.2%, 58.1% 98.9%, 54.8% 97.5%, 52% 98.7%, 48.9% 95.6%, 46.2% 96.5%, 44.9% 94.9%, 42.3% 97%, 40.7% 96.2%, 35% 98.8%, 32.4% 97.3%, 30.1% 95.8%, 26.5% 97.3%, 23.6% 93.6%, 21.2% 94.3%, 16.8% 97%, 14.7% 93.1%, 11.1% 95.2%, 7.7% 96.5%, 5.1% 95%, 1% 95.7%, 1.9% 88.2%, .6% 84.9%, 1.6% 79.6%, 0 75%, 1% 70%, 2% 65%, .1% 60%, 1.8% 50%, 1% 44%, 2% 39%, .7% 34%, 1.6% 29%, .1% 23%, 1.1% 19%, 0 15%, 1.8% 10%);
  --dice-receipt-edge: polygon(4% 8%, 9% 7%, 14% 3%, 17% 8%, 22% 7%, 24% 4%, 28% 6%, 31% 3%, 36% 5%, 40% 3%, 43% 5%, 48% 2%, 50% 6%, 55% 5%, 58% 7%, 63% 4%, 67% 6%, 71% 2%, 75% 5%, 79% 2%, 83% 4%, 88% 3%, 92% 4%, 97% 0, 99% 9%, 100% 19%, 99% 27%, 100% 34%, 98.9% 45%, 100% 54%, 98.8% 61%, 99.2% 75%, 98% 86%, 94% 88%, 91% 94%, 86% 95%, 83% 99%, 79% 96%, 76% 98%, 72% 95%, 68% 100%, 65% 96%, 61% 98%, 57% 93%, 54% 94%, 51% 89%, 48% 93%, 44% 92%, 40% 97%, 36% 99%, 32% 94%, 28% 98%, 24% 94%, 20% 100%, 18% 94%, 15% 97%, 12% 94%, 8% 99%, 6% 91%, 2% 88%, 0 84%, 2% 74%, 1% 69%, 3% 59%, 1% 54%, 3% 44%, 1% 40%, 3% 30%, 2% 23%, 4% 17%);
  --dice-console-edge: polygon(3% 2.5%, 6% 1%, 12% 1%, 15% 1.9%, 22% .1%, 27% .9%, 33% .6%, 38% .1%, 43% 1%, 49% 1%, 54% 2.1%, 59% 1.1%, 63% 1.7%, 69% .8%, 74% 1.6%, 79% 1%, 84% 1.7%, 90% .9%, 94% 1.8%, 98% 1.9%, 99% 5%, 98.3% 9%, 100% 14%, 99.1% 18%, 99.6% 23%, 98.4% 27%, 99.6% 31%, 98.9% 35%, 100% 39%, 98.8% 45%, 99.8% 50%, 99% 55%, 100% 61%, 98.9% 67%, 99.6% 72%, 98.6% 76%, 99.6% 82%, 98.9% 86%, 100% 93%, 99% 97%, 95% 98%, 90% 97.7%, 84% 99.6%, 79% 98%, 73% 99.3%, 68% 98%, 63% 98.5%, 59% 98.2%, 53% 99.7%, 48% 98.1%, 44% 98.7%, 39% 100%, 34% 98.6%, 29% 99.3%, 24% 98.7%, 20% 99.5%, 15% 98%, 11% 98.7%, 7% 97.9%, 2% 97%, 1% 94%, 2.3% 89%, 1% 85%, 2.4% 80%, 1% 75%, 2% 71%, .8% 66%, 1.9% 61%, .6% 56%, 1.7% 51%, .6% 45%, 1.4% 40%, .5% 35%, 1.9% 30%, .6% 25%, 2% 20%, .7% 15%, 1.9% 11%, .1% 7%);
  --dice-stamp-edge: polygon(8% 16%, 19% 14%, 24% 9%, 27% 13%, 40% 5%, 43% 10%, 55% 5%, 60% 8%, 70% 2%, 73% 7%, 82% 3%, 85% 6%, 100% 0, 97% 15%, 100% 19%, 96% 28%, 98% 34%, 95% 43%, 98% 48%, 93% 60%, 96% 66%, 91% 76%, 93% 83%, 83% 85%, 79% 94%, 74% 89%, 64% 100%, 61% 94%, 53% 97%, 51% 92%, 43% 96%, 39% 91%, 30% 98%, 27% 89%, 18% 95%, 17% 89%, 3% 97%, 5% 80%, 0 76%, 6% 64%, 1% 59%, 7% 42%, 4% 35%, 9% 27%, 6% 22%);
  --dice-rays-edge: polygon(0 45%, 4% 40%, 66% 86%, 2% 52%, 0 45%, 37% 26%, 41% 19%, 46% 19%, 84% 69%, 38% 26%, 0 45%, 64% 9%, 67% 3%, 73% 0, 98% 56%, 64% 9%, 0 45%, 7% 88%, 4% 84%, 7% 80%, 44% 99%, 9% 89%, 0 45%);
  --dice-bolt-edge: polygon(65% 0, 58% 29%, 100% 5%, 0 100%, 38% 46%, 22% 50%);
  --lg-input: var(--dice-mint);
  --lg-mint: var(--dice-mint);
  --lg-accent: var(--dice-miss);
  --lg-border: var(--dice-ink);
  --lg-panel: var(--dice-cream);
  --lg-text: var(--dice-ink);
  isolation: isolate;
  width: min(100%, 1672px);
  padding: var(--dice-top) var(--dice-gutter) clamp(24px, 3vw, 50px);
  background: #ff1137 url("/redesign-art/plinko-pf01-paper.webp") 3px 1px / 420px 437px repeat;

  & > .page-head {
    position: relative;
    z-index: 2;
    width: fit-content;
    margin: 0 0 10px;
  }

  & > .page-head h1 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(46vw, 250px);
    aspect-ratio: 462 / 320;
    padding: 0 .12em .18em 0;
    isolation: isolate;
    color: var(--dice-ink);
    font: italic 950 clamp(48px, 14vw, 88px)/.88 var(--dice-display);
    letter-spacing: -.065em;
    transform: rotate(-9deg) skewX(-8deg);
    filter: drop-shadow(2px 2px 0 var(--dice-ink)) drop-shadow(-1px -1px 0 var(--dice-ink));
  }

  & > .page-head h1 > span { position: relative; z-index: 1; }
  & .dice-title-version {
    align-self: center;
    margin: -.65em 0 0 .35em;
    padding: .10em .20em;
    background: var(--dice-cream);
    border: .08em solid var(--dice-ink);
    box-shadow: .08em .08em 0 var(--dice-ink);
    font-size: .34em;
    letter-spacing: -.035em;
    white-space: nowrap;
    transform: rotate(5deg);
  }

  & > .page-head h1::before {
    inset: -8% -4% -6%;
    background: radial-gradient(#42280027 .6px, transparent 1px) 0 0 / 4px 4px, var(--dice-yellow);
    clip-path: var(--dice-title-edge);
    transform: rotate(9deg) skewX(8deg);
  }

  & > .page-head h1::after {
    inset: auto 14% 23% 10%;
    z-index: 0;
    height: .10em;
    background: var(--dice-miss);
    clip-path: polygon(1% 70%, 11% 36%, 52% 5%, 100% 13%, 96% 30%, 61% 46%, 38% 73%, 25% 92%, 30% 67%, 8% 92%, 0 100%);
    transform: skewX(-18deg);
  }

  & .game-layout {
    --lg-console-width: minmax(0, 29%);
    gap: clamp(12px, 1.4vw, 24px);
  }

  & .instant-stage.instant-dice {
    min-height: 0;
    padding: 0;
    gap: 0;
  }

  & .dice-receipts {
    --dice-paper-shape: var(--dice-receipt-edge);
    position: relative;
    isolation: isolate;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    gap: 0;
    min-height: 102px;
    margin: 0;
    padding: 11px 8px 15px;
  }

  & :is(.dice-receipts, .dice-meter-print, .dice-console-core)::before,
  & :is(.dice-receipts, .dice-meter-print, .dice-console-core)::after {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--dice-ink);
    clip-path: var(--dice-paper-shape);
    pointer-events: none;
    content: "";
  }

  & :is(.dice-receipts, .dice-meter-print, .dice-console-core)::after {
    z-index: -1;
    inset: clamp(2px, .26vw, 4px);
    background: var(--dice-stock);
  }

  & .dice-result-receipt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 3.4vw, 54px);
    padding: 0 3px;
  }

  & .dice-result-receipt .instant-output-label {
    text-align: center;
    color: var(--dice-ink);
    font: italic 950 clamp(19px, 3.8vw, 37px)/1.06 var(--dice-display);
    letter-spacing: -.055em;
  }

  & .instant-stage .dice-result-receipt .instant-output {
    position: relative;
    display: grid;
    place-items: center;
    isolation: isolate;
    min-width: 4.2ch;
    margin: 0;
    padding: .15em .42em .22em;
    color: var(--dice-ink);
    background: transparent;
    font: italic 950 clamp(37px, 8vw, 57px)/1.05 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.07em;
    white-space: nowrap;
    transform: rotate(-2.5deg);
  }

  & .dice-result-receipt .instant-output::before,
  & .dice-result-receipt .instant-output::after {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--dice-ink);
    clip-path: var(--dice-stamp-edge);
    content: "";
  }

  & .dice-result-receipt .instant-output::after {
    inset: clamp(2px, .28vw, 4px);
    z-index: -1;
    background: radial-gradient(#68441729 .55px, transparent 1px) 0 0 / 4px 4px, var(--dice-yellow);
  }

  & .dice-meter-print {
    --dice-paper-shape: var(--dice-paper-edge);
    display: block;
    isolation: isolate;
    margin: 16px 0 0;
    min-height: 0;
    padding: clamp(96px, 19vw, 138px) 5% clamp(30px, 6.8vw, 58px);
  }

  & .instant-dice-scale {
    --dice-guide-inset: 5%;
    --dice-rim: clamp(4px, .66vw, 11px);
    --dice-track-height: clamp(34px, 9vw, 66px);
    --dice-label-height: clamp(32px, 9vw, 54px);
    --dice-limit-width: clamp(65px, 20vw, 108px);
    --dice-roll-width: clamp(58px, 18vw, 94px);
    --dice-tail-height: clamp(16px, 4.1vw, 24px);
    --dice-roll-tail-height: calc(var(--dice-tail-height) * 1.25);
    --dice-tail-width: clamp(15px, 4.7vw, 26px);
    --dice-label-offset: 5px;
    --dice-line-thickness: clamp(2px, .44vw, 7px);
    --dice-threshold-gap: calc(var(--dice-tail-height) + 5px);
    width: 100%;
    margin: 0;
  }

  & .instant-dice-scale::before {
    position: absolute;
    top: 15%;
    left: 6%;
    z-index: 0;
    width: clamp(32px, 11vw, 105px);
    aspect-ratio: 1.1;
    background: var(--dice-ink);
    clip-path: var(--dice-rays-edge);
    content: "";
  }

  & .dice-lightning {
    position: absolute;
    top: -5%;
    right: 4%;
    width: clamp(49px, 12vw, 161px);
    aspect-ratio: 1;
    pointer-events: none;
  }

  & .dice-lightning::before,
  & .dice-lightning::after {
    position: absolute;
    inset: 0;
    background: var(--dice-ink);
    clip-path: var(--dice-bolt-edge);
    content: "";
  }

  & .dice-lightning::after {
    inset: clamp(2px, .3vw, 5px);
    background: var(--dice-yellow);
  }

  & .instant-dice-track {
    --dice-split: calc(var(--dice-guide-inset) + var(--instant-threshold, 49.95%) * .9);
    --dice-below: var(--dice-yellow);
    --dice-above: var(--dice-miss);
    --dice-track-border: var(--dice-rim);
    height: var(--dice-track-height);
    border: 0;
    border-radius: 999px;
    box-shadow: inset 0 0 0 var(--dice-rim) var(--dice-ink);
    background: radial-gradient(#31071016 .7px, transparent 1px) 0 0 / 4px 4px,
      linear-gradient(to right, var(--dice-below) var(--dice-split), var(--dice-above) var(--dice-split));
  }

  & .instant-dice[data-direction="over"] .instant-dice-track {
    --dice-below: var(--dice-miss);
    --dice-above: var(--dice-yellow);
  }

  & .instant-dice-track::before { display: none; }

  & .dice-comic-track {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    pointer-events: none;
  }

  & .instant-dice[data-dice-renderer="webgl"] .instant-dice-track { background: transparent; box-shadow: none; }

  & .instant-dice :is(.instant-dice-threshold, .instant-dice-marker) {
    inset: 0 0 auto;
    width: auto;
    height: 0;
    z-index: 3;
    transform: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: none;
    pointer-events: none;
  }

  & .instant-dice-threshold {
    --dice-x: var(--dice-split);
    --dice-label-x: clamp(calc(var(--dice-limit-width) / 2), calc(var(--dice-x) + var(--dice-label-offset)), calc(100% - var(--dice-limit-width) / 2));
    --dice-bubble: var(--dice-miss);
    --dice-bubble-ink: #fff5eb;
    --dice-callout-width: var(--dice-limit-width);
    --dice-callout-gap: var(--dice-threshold-gap);
    z-index: 4;
  }

  & .instant-dice-marker {
    --dice-x: calc(var(--dice-guide-inset) + clamp(0%, var(--instant-roll, 50%), 100%) * .9);
    --dice-label-x: clamp(calc(var(--dice-roll-width) / 2), var(--dice-x), calc(100% - var(--dice-roll-width) / 2));
    --dice-bubble: var(--dice-yellow);
    --dice-bubble-ink: var(--dice-ink);
    --dice-callout-width: var(--dice-roll-width);
    --dice-callout-gap: calc(var(--dice-tail-height) * .54);
    --dice-pointer-top: calc(-1 * var(--dice-callout-gap) - var(--dice-line-thickness) - 1px);
    --dice-pointer-length: var(--dice-roll-tail-height);
  }

  & .instant-dice-marker[data-near-threshold] {
    top: calc(-1 * (var(--dice-threshold-gap) + var(--dice-label-height) + 5px));
    --dice-callout-gap: 0px;
    --dice-callout-height: max(23px, calc(var(--dice-label-height) * .59));
    --dice-callout-font: clamp(16px, 4vw, 39px);
    --dice-pointer-length: calc(var(--dice-threshold-gap) + var(--dice-label-height) + 20px);
  }

  & .instant-dice-marker .dice-callout-tail {
    top: var(--dice-pointer-top);
    height: var(--dice-pointer-length);
  }

  & .instant-dice :is(.instant-dice-threshold, .instant-dice-marker):not([data-ludik-value=""])::before {
    inset: auto auto var(--dice-callout-gap) var(--dice-label-x);
    display: grid;
    place-items: center;
    width: var(--dice-callout-width);
    height: var(--dice-callout-height, var(--dice-label-height));
    min-width: 0;
    padding: 0 .08em .04em 0;
    border: var(--dice-line-thickness) solid var(--dice-ink);
    border-radius: clamp(5px, .8vw, 13px);
    background: var(--dice-bubble);
    color: var(--dice-bubble-ink);
    clip-path: none;
    font: italic 950 var(--dice-callout-font, clamp(18px, 5.55vw, 32px))/1 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.07em;
  }

  & .instant-dice-threshold::after {
    inset: calc(var(--dice-rim) * -.73) auto auto var(--dice-x);
    z-index: 4;
    width: clamp(20px, 3.05vw, 50px);
    height: clamp(20px, 3.05vw, 50px);
    border: var(--dice-line-thickness) solid var(--dice-ink);
    background: var(--dice-miss);
    box-shadow: inset 0 0 0 clamp(3px, .45vw, 7px) #fff7e2;
  }

  & .dice-result-line {
    --dice-ink-start: calc(var(--dice-pointer-top) + var(--dice-pointer-length) - 2px);
    position: absolute;
    top: var(--dice-ink-start);
    left: var(--dice-x);
    z-index: 3;
    width: clamp(5px, .52vw, 9px);
    height: calc(var(--dice-track-height) - var(--dice-ink-start) + clamp(5px, .85vw, 14px));
    background: var(--dice-ink);
    clip-path: polygon(32% 0, 66% 0, 75% 7%, 69% 15%, 84% 24%, 74% 34%,
      82% 44%, 68% 55%, 78% 63%, 63% 74%, 71% 83%, 56% 93%, 46% 100%,
      30% 94%, 34% 84%, 24% 74%, 34% 65%, 18% 54%, 28% 43%, 20% 33%,
      32% 24%, 25% 15%, 35% 8%);
    transform: translateX(-50%);
    pointer-events: none;
  }

  & .dice-callout-tail {
    position: absolute;
    left: var(--dice-x);
    top: calc(-1 * var(--dice-callout-gap) - var(--dice-line-thickness) - 1px);
    z-index: 4;
    width: var(--dice-tail-width);
    height: var(--dice-tail-height);
    transform: translateX(-50%);
    background: var(--dice-ink);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
  }

  & .dice-callout-tail::after {
    position: absolute;
    inset: 0 var(--dice-line-thickness) calc(2 * var(--dice-line-thickness));
    background: var(--dice-bubble);
    clip-path: inherit;
    content: "";
  }

  & .instant-dice .instant-dice-threshold { z-index: 4; }

  & .instant-dice-threshold .dice-callout-tail {
    translate: 27% 0;
    height: calc(var(--dice-tail-height) + var(--dice-line-thickness));
    clip-path: polygon(10% 0, 100% 0, 0 100%);
  }

  & [data-ludik-value=""] :is(.dice-callout-tail, .dice-result-line) { display: none; }
  & .instant-dice-marker[hidden] { display: none; }

  & .instant-dice-ticks {
    position: relative;
    display: block;
    height: 1em;
    margin: .44em 0 0;
    font: italic 950 clamp(17px, 4.9vw, 30px)/1 var(--dice-display);
    letter-spacing: -.035em;
    color: var(--dice-ink);
  }

  & .instant-dice-ticks span {
    position: absolute;
    left: calc(var(--dice-guide-inset) + var(--dice-tick-index) * 18%);
    transform: translateX(-50%);
  }

  & .instant-dice-ticks span:nth-child(1) { --dice-tick-index: 0; }
  & .instant-dice-ticks span:nth-child(2) { --dice-tick-index: 1; }
  & .instant-dice-ticks span:nth-child(3) { --dice-tick-index: 2; }
  & .instant-dice-ticks span:nth-child(4) { --dice-tick-index: 3; }
  & .instant-dice-ticks span:nth-child(5) { --dice-tick-index: 4; }
  & .instant-dice-ticks span:nth-child(6) { --dice-tick-index: 5; }

  & .instant-dice-ticks span::before {
    inset: auto auto calc(100% + .11em) 50%;
    z-index: 2;
    width: var(--dice-line-thickness);
    height: 1.05em;
    border-radius: 99px;
    transform: translateX(-50%);
  }

  & .instant-dice:not([data-instant-draft="true"])[data-round-tone="win"] { --dice-result-fill: var(--dice-win); }
  & .instant-dice:not([data-instant-draft="true"])[data-round-tone="loss"] { --dice-result-fill: var(--dice-loss); }
  & .dice-result-receipt .instant-output::after { background-color: var(--dice-result-fill, var(--dice-yellow)); }
  & .instant-dice .instant-dice-marker { --dice-bubble: var(--dice-result-fill, var(--dice-yellow)); }

  & #game-sidebar {
    --dice-paper-shape: var(--dice-console-edge);
    --dice-input-height: clamp(42px, 4.05vw, 68px);
    --dice-input-edge: clamp(2px, .3vw, 5px);
    --dice-input-font: clamp(21px, 2.48vw, 42px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
  }

  & .dice-console-core {
    display: grid;
    position: relative;
    isolation: isolate;
    gap: clamp(10px, .93vw, 16px);
    padding: clamp(19px, 1.85vw, 31px) clamp(19px, 1.8vw, 30px) clamp(20px, 1.5vw, 25px) clamp(19px, 2.65vw, 45px);
  }

  & #game-sidebar :is(form, fieldset, [data-auto-wager-fields]) {
    min-width: 0;
    gap: clamp(10px, 1vw, 17px);
  }

  & #game-sidebar .auto-mode {
    display: grid;
    grid-template-columns: 1.12fr 1fr;
    margin: 0 0 0 4px;
    border: var(--dice-input-edge) solid var(--dice-ink);
    border-radius: 0;
    background: var(--dice-stock);
    box-shadow: none;
    transform: skewX(-17deg) rotate(.4deg);
  }

  & #game-sidebar .auto-mode button {
    min-width: 0;
    min-height: clamp(48px, 4.15vw, 70px);
    padding: .12em .16em .18em;
    border: 0;
    border-radius: 0;
    color: var(--dice-ink);
    background: none;
    font: italic 950 clamp(21px, 2.55vw, 43px)/1 var(--dice-display);
    letter-spacing: -.067em;
  }

  & #game-sidebar .auto-mode button + button { border-left: var(--dice-input-edge) solid var(--dice-ink); }
  & #game-sidebar .auto-mode button[aria-pressed="true"] { background: var(--dice-mint); }

  & #game-sidebar :is(.dice-stake-caption, .dice-field-caption) {
    display: block;
    padding-inline-start: 5px;
    margin-block-end: 4px;
    color: var(--dice-ink);
    font: 900 clamp(18px, 2.09vw, 35px)/1 var(--dice-display);
    letter-spacing: -.045em;
  }

  & #game-sidebar :is(.dice-stake-stepper, .dice-field-entry, .dice-direction-field select) {
    min-height: var(--dice-input-height);
    border: var(--dice-input-edge) solid var(--dice-ink);
    border-radius: clamp(10px, 1.16vw, 19px);
    background: var(--dice-mint);
    color: var(--dice-ink);
  }

  & #game-sidebar .dice-stake-stepper {
    display: grid;
    grid-template-columns: minmax(44px, 17%) minmax(0, 1fr) minmax(44px, 17%);
  }

  & #game-sidebar .dice-stake-button {
    --dice-step-gutter: clamp(4px, .5vw, 8px);
    --dice-step-ink: clamp(2px, .18vw, 3px);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    padding: 0;
    color: var(--dice-ink);
    background: transparent;
    border: none;
    box-shadow: none;
    font: italic 900 clamp(17px, 1.8vw, 30px)/1 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
    touch-action: manipulation;
  }

  & .dice-stake-button[data-value="half"] {
    --dice-step-fill: var(--dice-yellow);
    --dice-step-angle: -6deg;
    --dice-step-edge: polygon(5% 13%, 26% 10%, 32% 4%, 46% 8%, 60% 1%, 66% 6%, 95% 0,
      91% 17%, 99% 20%, 94% 41%, 100% 48%, 96% 64%, 100% 74%, 94% 88%, 71% 91%, 65% 98%,
      50% 93%, 31% 100%, 28% 94%, 5% 100%, 9% 85%, 1% 77%, 5% 58%, 0 53%, 5% 34%, 1% 27%);
  }

  & .dice-stake-button[data-value="double"] {
    --dice-step-fill: #ff74ad;
    --dice-step-angle: 5deg;
    --dice-step-edge: polygon(1% 13%, 20% 11%, 27% 3%, 43% 6%, 48% 0, 65% 8%, 72% 5%, 81% 12%,
      98% 6%, 94% 23%, 100% 31%, 93% 50%, 98% 58%, 91% 76%, 97% 84%, 80% 89%, 71% 99%, 58% 94%,
      49% 100%, 34% 91%, 27% 96%, 19% 89%, 2% 95%, 6% 78%, 0 68%, 6% 51%, 1% 45%, 6% 28%);
  }

  & .dice-stake-button::before,
  & .dice-stake-button::after {
    position: absolute;
    inset: var(--dice-step-gutter);
    z-index: -2;
    background: var(--dice-ink);
    clip-path: var(--dice-step-edge);
    transform: translateY(var(--dice-step-shift, 0px)) rotate(var(--dice-step-angle));
    pointer-events: none;
    content: "";
  }

  & .dice-stake-button::after {
    inset: calc(var(--dice-step-gutter) + var(--dice-step-ink));
    inset-block-end: calc(var(--dice-step-gutter) + var(--dice-step-ink) + 1px);
    z-index: -1;
    background: radial-gradient(#3c171c35 .65px, transparent .9px) 0 0 / 4px 4px, var(--dice-step-fill);
  }

  & #game-sidebar .dice-stake-stepper button:first-child {
    border-radius: 12px 0 0 12px;
    border-inline-end: max(1px, calc(var(--dice-input-edge) * .55)) solid var(--dice-ink);
  }

  & #game-sidebar .dice-stake-stepper button:last-child {
    border-radius: 0 12px 12px 0;
    border-inline-start: max(1px, calc(var(--dice-input-edge) * .55)) solid var(--dice-ink);
  }

  & .dice-stake-button:hover:not(:disabled)::after { filter: brightness(1.12); }
  & .dice-stake-button:active:not(:disabled) { --dice-step-shift: 2px; --dice-step-angle: 0deg; }
  & #game-sidebar .dice-stake-button:focus-visible { outline: 2px solid var(--dice-ink); outline-offset: -2px; }
  @media (prefers-reduced-motion: no-preference) {
    & .dice-stake-button::before, & .dice-stake-button::after { transition: transform 100ms ease-out, filter 100ms ease; }
  }
  & #game-sidebar .dice-stake-stepper .dice-field-entry { min-height: 0; border: 0; border-radius: 0; background: transparent; }

  & #game-sidebar .dice-field-entry {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
  }

  & #game-sidebar .dice-field-entry > label { position: absolute; inset: 0; }

  & #game-sidebar .dice-field-entry input {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0 .15em;
    border: 0;
    border-radius: max(0px, calc(1.16vw - 5px));
    box-shadow: none;
    color: transparent;
    background: transparent;
    font: 950 var(--dice-input-font)/1 var(--dice-display);
    text-align: center;
    appearance: textfield;
    letter-spacing: -.045em;
  }

  & #game-sidebar .dice-field-entry input::-webkit-inner-spin-button { appearance: none; }
  & #game-sidebar .dice-field-entry input:focus {
    color: var(--dice-ink);
    background: #bcffce;
    outline: 2px solid var(--dice-miss);
    outline-offset: -3px;
  }

  & #game-sidebar .dice-field-value {
    font: 950 var(--dice-input-font)/1 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.052em;
    white-space: nowrap;
    pointer-events: none;
  }

  & #game-sidebar .dice-field-entry:focus-within .dice-field-value { visibility: hidden; }
  & #game-sidebar :is(.dice-direction-field select, .dice-stake-stepper button):disabled { opacity: .72; }

  & #game-sidebar .instant-dice-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(9px, .7vw, 12px);
    margin-block-start: clamp(2px, .65vw, 11px);
  }

  & #game-sidebar .dice-profit {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 8px;
    margin: 6px 0 0;
    padding-inline: 5px;
    color: var(--dice-ink);
    font: 750 clamp(12px, .93vw, 16px)/1.3 var(--dice-display);
  }
  & #game-sidebar .dice-profit > label { display: inline; padding: 0; color: inherit; font: inherit; }
  & #game-sidebar .dice-profit > output { font-weight: 900; font-variant-numeric: tabular-nums; }

  & #game-sidebar .dice-directions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  & #game-sidebar .dice-directions > button {
    min-height: 40px;
    padding: .3em .45em;
    border: var(--dice-input-edge) solid var(--dice-ink);
    border-radius: 7px;
    box-shadow: none;
    background: var(--dice-cream);
    color: var(--dice-ink);
    font: 850 clamp(14px, 1.12vw, 19px)/1 var(--dice-display);
  }
  & #game-sidebar .dice-directions > button[aria-pressed="true"] { background: var(--dice-mint); }
  & #game-sidebar .dice-directions > button:focus-visible { outline: 2px solid var(--dice-miss); outline-offset: 1px; }

  & #game-sidebar .dice-direction-field select {
    width: 100%;
    padding: 0 36px .04em .46em;
    appearance: none;
    font: italic 950 clamp(21px, 2.63vw, 44px)/1 var(--dice-display);
    letter-spacing: -.07em;
  }

  & #game-sidebar .dice-direction-field {
    position: relative;
    display: block;
  }

  & #game-sidebar .dice-direction-field::after {
    position: absolute;
    inset: 50% 6% auto auto;
    width: clamp(16px, 2vw, 34px);
    aspect-ratio: 1.65;
    background: var(--dice-ink);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform: translateY(-40%);
    pointer-events: none;
    content: "";
  }

  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) {
    position: relative;
    isolation: isolate;
    margin: clamp(11px, 1.15vw, 20px) 0 0;
    padding: clamp(5px, .5vw, 9px) 6px 6px 1px;
    gap: 8px;
  }

  & #game-sidebar .dice-roll-actions::before {
    position: absolute;
    top: -12%;
    left: -2%;
    width: clamp(29px, 5.2vw, 86px);
    aspect-ratio: 1.3;
    background: var(--dice-ink);
    clip-path: var(--dice-rays-edge);
    pointer-events: none;
    content: "";
  }

  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"]) {
    --dice-button-edge: polygon(9% 21%, 100% 0, 96% 85%, 0 100%);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: clamp(70px, 9.65vw, 162px);
    margin: 0;
    padding: .1em .15em .12em .45em;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--dice-ink);
    font: italic 950 clamp(36px, 4.9vw, 82px)/1 var(--dice-display);
    letter-spacing: -.085em;
    transform: rotate(-4deg) skewX(-5deg);
    box-shadow: none;
    clip-path: var(--dice-button-edge);
  }

  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"])::before,
  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"])::after {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--dice-ink);
    clip-path: var(--dice-button-edge);
    content: "";
  }

  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"])::after {
    inset: clamp(3px, .45vw, 8px) clamp(4px, .5vw, 8px) clamp(6px, .85vw, 14px);
    z-index: -1;
    background: radial-gradient(#492f0029 .55px, transparent 1px) 0 0 / 4px 4px, var(--dice-yellow);
  }

  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"]):hover:not(:disabled)::after { background-color: #fffa75; }
  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"]):active:not(:disabled) { transform: translateY(3px) rotate(-4deg) skewX(-5deg); }
  & #game-sidebar :is(.dice-roll-actions, .auto-series-actions) > .button:is(.play-primary, [data-action="auth"], [data-action="auto-start"], [data-action="auto-stop"]):focus-visible::after { background-color: var(--dice-mint); }
  & #game-sidebar .auto-series-actions > .button:is([data-auto-start], [data-action="auto-stop"]) { min-height: clamp(64px, 6vw, 100px); font-size: clamp(24px, 2.9vw, 48px); }
  & #game-sidebar .auto-series-actions > .button[data-action="auto-stop"]::after { background-color: #ff72ae; }

  & #game-sidebar .dice-comic-form:has([name="diceTurbo"]:checked) .dice-roll-actions .play-primary {
    touch-action: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  &[data-dice-holding] #game-sidebar .dice-roll-actions .play-primary {
    transform: translateY(3px) rotate(-4deg) skewX(-5deg);
  }

  & #game-sidebar .dice-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    padding-inline: 4px;
    font-size: clamp(.87rem, 1.4vw, 1.2rem);
  }

  & #game-sidebar label.dice-switch {
    display: inline-flex;
    align-items: center;
    gap: .36em;
    min-height: 44px;
    color: var(--dice-ink);
    font: 850 1em/1 var(--dice-display);
    white-space: nowrap;
    cursor: pointer;
  }

  & .dice-switch-label {
    display: inline-flex;
    align-items: center;
    gap: .26em;
  }

  & .dice-switch-label::before {
    width: 1em;
    height: 1.05em;
    background: currentColor;
    clip-path: polygon(0 36%, 25% 36%, 60% 7%, 60% 93%, 25% 64%, 0 64%, 0 36%, 68% 23%, 82% 34%, 89% 50%, 82% 66%, 68% 77%, 68% 64%, 76% 50%, 68% 36%, 68% 23%);
    content: "";
  }

  & .dice-switch:has([name="diceTurbo"]) .dice-switch-label::before {
    clip-path: polygon(57% 0, 98% 0, 65% 42%, 94% 42%, 19% 100%, 36% 55%, 4% 55%);
  }

  & .dice-switch:has([data-dice-auto-settings]) .dice-switch-label::before {
    background: radial-gradient(circle, transparent 22%, currentColor 25%);
    clip-path: polygon(38% 0, 62% 0, 65% 16%, 81% 9%, 96% 28%, 86% 42%, 100% 51%, 95% 74%, 77% 74%, 73% 93%, 50% 100%, 42% 85%, 25% 92%, 9% 74%, 17% 59%, 0 51%, 5% 27%, 23% 26%, 26% 9%);
  }

  & #game-sidebar .dice-switch input {
    --dice-switch-dot: 25%;
    --dice-switch-fill: #e6d1ab;
    appearance: none;
    flex: none;
    width: 2.55em;
    height: 1.5em;
    min-width: 0;
    margin: 0;
    border: 2px solid var(--dice-ink);
    border-radius: 99px;
    background: radial-gradient(circle at var(--dice-switch-dot) 50%, #fff1cf 0 .45em,
      var(--dice-ink) .47em .52em, transparent .54em), var(--dice-switch-fill);
    font-size: inherit;
    cursor: pointer;
  }

  & #game-sidebar .dice-switch input:checked { --dice-switch-dot: 75%; --dice-switch-fill: #24ca76; }
  & #game-sidebar .dice-switch input[name="diceTurbo"]:checked { --dice-switch-fill: var(--dice-miss); }
  & #game-sidebar .dice-switch input:focus-visible { outline: 3px solid #a81154; outline-offset: 2px; }
  & #game-sidebar label.dice-switch:has(input:disabled) { opacity: .65; cursor: default; }
  & #game-sidebar .auto-series-fields :is(label, summary) { font-size: .9rem; }

  & .dice-recent {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 10px 8px 0;
    padding: 8px 10px 9px;
    border: 2px solid var(--dice-ink);
    border-radius: 4px 2px 5px 2px;
    background: var(--dice-stock);
    box-shadow: 3px 3px var(--dice-ink);
    color: var(--dice-ink);
  }

  & .dice-auto-status {
    --dice-series-accent: var(--dice-yellow);
    display: grid;
    gap: clamp(6px, 1vw, 12px);
    min-width: 0;
    margin: 10px 8px 0;
    padding: clamp(7px, 1vw, 13px);
    border: 2px solid var(--dice-ink);
    border-radius: 3px 5px 3px 2px;
    background: var(--dice-stock);
    box-shadow: 3px 3px var(--dice-ink);
    color: var(--dice-ink);
  }

  & .dice-auto-status[hidden] { display: none; }
  & .dice-auto-status[data-dice-auto-phase="running"] { --dice-series-accent: var(--dice-win); }
  & .dice-auto-status[data-dice-auto-phase="stopping"] { --dice-series-accent: #ff83b8; }

  & .dice-auto-phase {
    display: grid;
    align-items: center;
    min-block-size: clamp(39px, 4vw, 51px);
    padding: .25em .9em .3em .65em;
    border-inline-start: clamp(6px, .7vw, 11px) solid var(--dice-series-accent);
    background: var(--dice-ink);
    clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
    color: #fff1d0;
    font: italic 850 clamp(14px, 1.55vw, 24px)/1.12 var(--dice-display);
    overflow-wrap: anywhere;
  }

  & .dice-auto-metrics {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1fr) minmax(0, 1.11fr);
    gap: clamp(4px, .9vw, 12px);
  }

  & .dice-auto-metric {
    display: grid;
    align-content: space-between;
    gap: .22rem;
    min-width: 0;
    padding: clamp(4px, .68vw, 9px) clamp(5px, .85vw, 14px);
    border: 2px solid var(--dice-ink);
    border-radius: 3px 2px 3px 2px;
    background: #fff4d6;
    box-shadow: 2px 2px var(--dice-ink);
  }

  & .dice-auto-metric:nth-child(3) {
    background: radial-gradient(#4d32031c .6px, transparent 1px) 0 0 / 4px 4px, #ffed72;
  }

  & .dice-auto-status[data-dice-auto-result="positive"] .dice-auto-metric:nth-child(2) { background: var(--dice-win); }
  & .dice-auto-status[data-dice-auto-result="negative"] .dice-auto-metric:nth-child(2) { background: #ffa69e; }

  & .dice-auto-metric > span {
    font: 800 clamp(11px, 1vw, 16px)/1.12 var(--dice-display);
  }

  & .dice-auto-metric > strong {
    font: italic 950 clamp(14px, 2.05vw, 33px)/1.06 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.06em;
    overflow-wrap: anywhere;
  }

  & .dice-auto-metric > strong[data-dice-auto-long] { font-size: clamp(13px, 1.55vw, 24px); }

  @media (max-width: 380px) {
    & .dice-auto-metric > span { min-block-size: 2.24em; }
  }

  & .dice-recent-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }

  & .dice-recent-list {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 56px;
    margin: 0;
    padding: 4px 4px 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--dice-ink) #e9d4af;
    list-style: none;
  }

  & :is(.dice-recent-tools .button, .dice-history-chip) {
    color: var(--dice-ink);
    border: 2px solid var(--dice-ink);
    border-radius: 3px;
    background: #fff4d6;
    box-shadow: 2px 2px var(--dice-ink);
  }

  & .dice-recent-tools .button { min-height: 36px; font-weight: 850; }
  & .dice-recent-tools .button:hover { background: var(--dice-mint); }
  & .dice-recent-list li { flex: none; }
  & .dice-recent-empty { color: #4c3627; font-weight: 730; font-size: .84rem; }
  & .dice-history-chip {
    min-height: 44px;
    min-width: 4.2em;
    padding: .28em .4em;
    font: italic 950 clamp(16px, 1.45vw, 24px)/1 var(--dice-display);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
  }
  & .dice-history-chip[data-result="win"] { background: var(--dice-win); }
  & .dice-history-chip[data-result="loss"] { background: var(--dice-loss); }
  & .dice-history-chip:hover { filter: brightness(1.12); }
  & .dice-history-chip:focus-visible { outline: 2px solid var(--dice-ink); outline-offset: 2px; }
  & .dice-history-chip:active { transform: translate(2px,2px); box-shadow: none; }
}

@media (min-width: 960px) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    --dice-top: calc(54 * var(--dice-unit));
    --dice-logo-width: calc(427 * var(--dice-unit));

    & > .page-head {
      position: absolute;
      inset: calc(65 * var(--dice-unit)) auto auto calc(var(--dice-gutter) + 6 * var(--dice-unit));
      margin: 0;
    }
    & > .page-head h1 {
      width: var(--dice-logo-width);
      aspect-ratio: 462 / 296;
      font-size: calc(147 * var(--dice-unit));
    }

    & .dice-receipts {
      min-height: 0;
      height: calc(224 * var(--dice-unit));
      margin: calc(10 * var(--dice-unit)) 0 0 calc(435 * var(--dice-unit));
      padding: calc(15 * var(--dice-unit)) calc(15 * var(--dice-unit)) calc(24 * var(--dice-unit));
    }

    & .dice-result-receipt .instant-output-label { font-size: calc(46 * var(--dice-unit)); }
    & .instant-stage .dice-result-receipt .instant-output { font-size: calc(81 * var(--dice-unit)); }

    & .dice-meter-print {
      margin-top: calc(59 * var(--dice-unit));
      padding: calc(199 * var(--dice-unit)) 4% calc(79 * var(--dice-unit));
      min-height: calc(472 * var(--dice-unit));
    }

    & .instant-dice-scale {
      --dice-track-height: calc(114 * var(--dice-unit));
      --dice-label-height: calc(79 * var(--dice-unit));
      --dice-limit-width: calc(187 * var(--dice-unit));
      --dice-roll-width: calc(169 * var(--dice-unit));
      --dice-tail-height: calc(47 * var(--dice-unit));
      --dice-roll-tail-height: calc(76 * var(--dice-unit));
      --dice-tail-width: calc(41 * var(--dice-unit));
      --dice-label-offset: calc(32 * var(--dice-unit));
    }

    & .instant-dice-scale::before { top: 13.6%; }
    & .dice-lightning { top: -10.3%; right: 3.6%; }
    & .instant-dice :is(.instant-dice-threshold, .instant-dice-marker):not([data-ludik-value=""])::before { font-size: var(--dice-callout-font, calc(55 * var(--dice-unit))); }
    & .instant-dice-ticks { font-size: calc(56 * var(--dice-unit)); }
  }
}

@media (max-width: 959px) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    & .game-layout {
      grid-template: "board" auto "recent" auto "console" auto / minmax(0, 1fr);
      gap: 12px;
    }
    & .game-layout:has(.dice-auto-status:not([hidden])) {
      grid-template: "board" auto "recent" auto "series" auto "console" auto / minmax(0, 1fr);
    }
    & .stage-column { display: contents; }
    & .stage-dice { grid-area: board; }
    & .dice-recent { grid-area: recent; margin-block-start: 0; }
    & .dice-auto-status { grid-area: series; margin-block-start: 0; }
    & > .page-head h1 { margin-inline-start: 5px; }
    & #game-sidebar { --dice-input-height: 48px; grid-area: console; width: min(100%, 37rem); justify-self: center; }
  }
}

@media (480px <= width < 960px) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    --dice-logo-width: clamp(158px, 34vw, 280px);
    --dice-top: 24px;

    & > .page-head {
      position: absolute;
      inset: 18px auto auto var(--dice-gutter);
      margin: 0;
    }

    & > .page-head h1 { width: var(--dice-logo-width); font-size: clamp(51px, 12vw, 105px); }
    & .dice-receipts { min-height: clamp(116px, 20vw, 171px); margin-inline-start: var(--dice-logo-width); }
  }
}

@media (max-width: 380px) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    & .dice-meter-print { padding-inline: 6%; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    & .dice-lightning { transform-origin: 36% 72%; transition: transform .17s ease; }
    & .dice-meter-print:has(.instant-dice-track:is(:hover, :active)) .dice-lightning { transform: translate(3px,-3px) rotate(4deg); }
    & .instant-dice[data-dice-toss] .dice-lightning { animation: dice-comic-flash .55s ease-out; }
    & .instant-dice[data-dice-toss] .dice-result-receipt .instant-output { animation: dice-comic-stamp .38s cubic-bezier(.24,.82,.35,1.15) both; }
  }
}

@keyframes dice-comic-stamp {
  from { transform: translateY(-9px) rotate(-8deg) scale(1.16); }
  56% { transform: translateY(2px) rotate(1deg) scale(.97); }
  to { transform: rotate(-2.5deg); }
}

@keyframes dice-comic-flash {
  from { transform: translate(5%, -8%) rotate(7deg) scale(1.1); filter: brightness(1.32); }
  to { transform: none; filter: none; }
}

@supports (clip-path: shape(from 0 0, line to 100% 100%, close)) {
  html[data-ludik-theme="comic"] #content[data-game="dice"] {
    --dice-rays-edge: shape(
      from 0 45%, line to 4% 39%, line to 8% 40%, line to 66% 85%, line to 2% 52%, close,
      move to 37% 26%, line to 40% 19%, line to 46% 19%, line to 84% 69%, close,
      move to 62% 8%, line to 66% 2%, line to 73% 0, line to 98% 56%, close,
      move to 5% 87%, line to 5% 82%, line to 9% 80%, line to 45% 99%, close
    );
  }
}

html[data-ludik-theme="comic"] #dialog:is([data-variant="dice-history"], [data-variant="dice-proof"], [data-variant="dice-rules"], [data-variant="dice-hotkeys"]) {
  --dice-dialog-ink: #0c0906;
  --dice-dialog-stock: linear-gradient(#fff7e3a0, #fff5de74),
    url("/redesign-art/paper.webp") center / 565px auto, #fff4d8;
  --text: var(--dice-dialog-ink);
  --muted: #524030;
  --line: var(--dice-dialog-ink);
  --accent: #fff000;
  --mint: #296c41;
  --inverse: var(--dice-dialog-ink);
  color: var(--dice-dialog-ink);
  border: 3px solid var(--dice-dialog-ink);
  border-radius: 6px 3px 7px 3px;
  background: var(--dice-dialog-stock);
  box-shadow: 7px 8px var(--dice-dialog-ink);
  padding: clamp(12px, 2.2vw, 24px);

  &::backdrop { background: #1e0817bc; }
  & .dialog-head { align-items: start; }
  & .dialog-head h2 {
    flex: 1;
    color: var(--dice-dialog-ink);
    font: italic 950 clamp(1.3rem, 5.5vw, 2rem)/1.12 var(--font-interface);
    letter-spacing: -.055em;
  }

  & :is(.icon-button, .button) {
    color: var(--dice-dialog-ink);
    border: 2px solid var(--dice-dialog-ink);
    border-radius: 3px;
    background: #fff000;
    box-shadow: 2px 2px var(--dice-dialog-ink);
    font-weight: 850;
  }

  & :is(.icon-button, .button):hover:not(:disabled) { background: #82f6b1; }

  & :is(.dice-history-bet, a, button, summary):focus-visible {
    outline: 2px solid #c50959;
    outline-offset: 3px;
  }

  & :is(.notice, .minigame-rules, .stat, details, pre, kbd) {
    border-color: #2c1e15;
    background: #fff2d1;
    color: var(--dice-dialog-ink);
  }

  & :is(input[readonly], textarea[readonly]) {
    border-color: var(--dice-dialog-ink);
    background: #fff5d6;
    color: var(--dice-dialog-ink);
  }

  & .stat strong { color: var(--dice-dialog-ink); }

  & :is(.muted, small, summary) { color: var(--muted); }
  & .dice-proof-sheet { overflow-wrap: anywhere; }
  & .dice-proof-numbers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    margin: 0;
  }

  & .dice-proof-numbers > div {
    display: grid;
    align-items: center;
    justify-items: center;
    padding: .45rem .2rem;
    border: 2px solid var(--dice-dialog-ink);
    background: #fff5d6;
    box-shadow: 3px 3px var(--dice-dialog-ink);
    text-align: center;
  }

  & .dice-proof-numbers dt { font-weight: 830; }
  & .dice-proof-numbers dd {
    margin: 0;
    padding: .06em .25em;
    font: italic 950 clamp(1.42rem, 5.75vw, 2.65rem)/1.1 var(--font-interface);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.055em;
    white-space: nowrap;
    background: #fff000;
    transform: skewX(-6deg) rotate(-2deg);
  }

  & .dice-history-sheet ol {
    display: grid;
    gap: .55rem;
    list-style: none;
    margin: 0;
    padding: 3px 4px 5px 1px;
  }

  & .dice-history-bet {
    display: grid;
    grid-template-columns: minmax(3.2rem, .65fr) minmax(0, 1.45fr) repeat(2, minmax(0, .85fr)) auto;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .5rem;
    text-align: left;
    color: var(--dice-dialog-ink);
    background: #fff1cd;
    border: 2px solid var(--dice-dialog-ink);
    border-radius: 3px;
    box-shadow: 3px 3px var(--dice-dialog-ink);
    cursor: pointer;
  }

  & .dice-history-bet:hover { background: #fff8e5; }
  & .dice-history-bet:active { transform: translate(2px, 2px); box-shadow: 1px 1px var(--dice-dialog-ink); }
  & .dice-history-roll {
    padding: .15em;
    font: italic 950 clamp(1.02rem, 3.85vw, 1.58rem)/1.05 var(--font-interface);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.065em;
    text-align: center;
    border: 2px solid var(--dice-dialog-ink);
    background: #fff000;
    transform: rotate(-3deg);
  }

  & [data-result="win"] .dice-history-roll,
  & .dice-proof-numbers[data-result="win"] > div:first-child dd { background: #81f2a8; }
  & [data-result="loss"] .dice-history-roll,
  & .dice-proof-numbers[data-result="loss"] > div:first-child dd { background: #ff5a52; }
  & .dice-history-bet :is(.dice-history-date, .dice-history-amount) { display: grid; gap: .08rem; overflow-wrap: anywhere; }
  & .dice-history-arrow { font: 900 1.5rem/1 var(--font-interface); }
}

html[data-ludik-theme="comic"] #dialog[data-variant="dice-rules"] {
  --dice-rules-yellow: #fff000;
  --dice-rules-mint: #82f6b1;
  --dice-rules-pink: #ffa3c8;
  --dice-rules-edge: polygon(0 8%, 8% 3%, 14% 7%, 21% 1%, 31% 5%, 44% 0, 52% 6%, 64% 1%, 74% 5%,
    86% 1%, 96% 5%, 100% 0, 98% 47%, 100% 61%, 97% 96%, 87% 94%, 79% 100%, 69% 95%,
    58% 99%, 49% 93%, 38% 100%, 28% 94%, 17% 99%, 8% 94%, 0 96%, 2% 60%);
  width: min(720px, calc(100% - 24px));
  max-inline-size: none;
  max-block-size: calc(100dvh - 22px);
  overflow: hidden;
  padding: 0;
  background: #ff1137 url("/redesign-art/plinko-pf01-paper.webp") 3px 1px / 420px 437px repeat;

  & #dialog-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(7px, 1.4vw, 14px);
    max-block-size: calc(100dvh - 28px);
    padding: clamp(8px, 2.3vw, 16px) clamp(8px, 2.3vw, 20px);
  }

  & .dialog-head {
    align-items: center;
    margin: 0;
    padding: 2px 3px 2px 2px;
  }

  & .dialog-head h2 {
    position: relative;
    isolation: isolate;
    flex: 0 1 auto;
    min-inline-size: 0;
    margin: 0;
    padding: .34em .59em .48em;
    font-size: clamp(1.35rem, 4.3vw, 2.45rem);
    line-height: 1.07;
    overflow-wrap: normal;
    filter: drop-shadow(-1px -1px var(--dice-dialog-ink)) drop-shadow(2px 3px var(--dice-dialog-ink));
  }

  & .dialog-head h2::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    clip-path: var(--dice-rules-edge);
    background: radial-gradient(#59270024 .57px, transparent 1px) 0 0 / 4px 4px, var(--dice-rules-yellow);
    transform: rotate(-1.8deg) skewX(-4deg);
    content: "";
  }

  & .dialog-head .icon-button {
    flex: 0 0 44px;
    block-size: 44px;
    background: #fff4d8;
    font: 900 1.5rem/1 var(--font-interface);
  }

  & .minigame-rules[data-rules-game="dice"] {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: clamp(9px, 2vw, 15px);
    min-inline-size: 0;
    min-block-size: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--dice-dialog-ink) #fff4d8;
    padding: 4px 5px 5px 2px;
    background: transparent;
    font-size: clamp(.91rem, 2.8vw, 1rem);
    line-height: 1.45;
  }

  & .minigame-rules section {
    --dice-rule-accent: var(--dice-rules-yellow);
    --dice-rule-padding: clamp(9px, 2.3vw, 15px);
    gap: .69em;
    min-inline-size: 0;
    margin: 0;
    padding: 0 var(--dice-rule-padding) var(--dice-rule-padding);
    border: 2px solid var(--dice-dialog-ink);
    border-radius: 3px 2px 5px 2px;
    background: var(--dice-dialog-stock);
    box-shadow: 2px 3px var(--dice-dialog-ink);
  }

  & .minigame-rules section:has(dl) { --dice-rule-accent: var(--dice-rules-mint); }
  & .minigame-rules section:last-of-type { --dice-rule-accent: var(--dice-rules-pink); }

  & .minigame-rules h3 {
    margin-inline: calc(-1 * var(--dice-rule-padding));
    padding: .34em var(--dice-rule-padding) .4em;
    border-block-end: 2px solid var(--dice-dialog-ink);
    background: radial-gradient(#59270024 .57px, transparent 1px) 0 0 / 4px 4px, var(--dice-rule-accent);
    font: italic 920 clamp(1.15rem, 3.5vw, 1.48rem)/1.1 var(--font-interface);
    letter-spacing: -.035em;
  }

  & .minigame-rules ol { gap: .58em; padding-inline-start: 1.36em; }
  & .minigame-rules li { padding-inline-start: .18em; }
  & .minigame-rules li::marker { color: #97124e; font-weight: 900; }
  & .minigame-rules-version { color: #584030; font-size: .9em; font-weight: 650; }

  & .minigame-rules dl {
    gap: 1px;
    border: 1.5px solid var(--dice-dialog-ink);
    border-radius: 3px;
    background: var(--dice-dialog-ink);
  }

  & .minigame-rules dl div {
    grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
    gap: 6px;
    padding: 6px clamp(6px, 1.3vw, 10px);
    background: #fff6df;
  }

  & .minigame-rules dl div:nth-child(even) { background: #f7e8c6; }
  & .minigame-rules dt { font-size: .92em; font-weight: 760; }
  & .minigame-rules dd { color: var(--dice-dialog-ink); font-weight: 720; }

  & .minigame-rules .button {
    min-height: 44px;
    max-width: 100%;
    padding: .45em .8em;
    background: var(--dice-rules-mint);
    line-height: 1.18;
    white-space: normal;
  }

  & .minigame-rules [data-action="close"] {
    justify-self: end;
    padding-inline: 1em;
    background: var(--dice-rules-yellow);
    font-size: 1.13em;
    font-style: italic;
  }

  & .minigame-rules .button:hover:not(:disabled) { background: #fff5a0; }

  @media (min-width: 760px) {
    & .minigame-rules[data-rules-game="dice"] { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
    & .minigame-rules > :nth-child(n + 3) { grid-column: 1 / -1; }
  }
}

@media (max-width: 510px) {
  html[data-ludik-theme="comic"] #dialog[data-variant="dice-history"] {
    & .dice-history-bet {
      grid-template: "roll date date arrow" auto "roll stake payout arrow" auto / minmax(3.2rem,.62fr) repeat(2, minmax(0,1fr)) auto;
      gap: .33rem .45rem;
      font-size: .825rem;
    }

    & .dice-history-roll { grid-area: roll; }
    & .dice-history-date { grid-area: date; }
    & .dice-history-amount { grid-area: payout; }
    & .dice-history-date + .dice-history-amount { grid-area: stake; }
    & .dice-history-arrow { grid-area: arrow; }
  }
}

html[data-ludik-theme="comic"] #content[data-game="dice"] {
  & [data-dice-range-mode]:not([data-dice-renderer="webgl"]) .instant-dice-track {
    background: radial-gradient(#31071016 .7px, transparent 1px) 0 0 / 4px 4px,
      var(--dice-range-gradient, linear-gradient(var(--dice-miss), var(--dice-miss)));
  }

  & .dice-range-editor {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
  }

  & .dice-range-handle {
    --dice-knob-size: clamp(23px, 2.5vw, 42px);
    position: absolute;
    display: grid;
    place-items: center;
    left: var(--dice-handle-position);
    top: calc(var(--dice-rim) * .65);
    width: max(44px, calc(var(--dice-knob-size) + 6px));
    height: max(44px, calc(var(--dice-knob-size) + 6px));
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--dice-ink);
    transform: translate(-50%, -50%);
    cursor: ew-resize;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
  }

  & .dice-range-handle[data-lower] { top: 75%; }
  & .dice-range-handle:disabled { cursor: default; }
  & .dice-range-handle:is(:focus-visible, [data-dragging]) { z-index: 2; outline: none; }

  & .dice-handle-dot {
    display: block;
    width: var(--dice-knob-size);
    height: var(--dice-knob-size);
    border: clamp(2px, .33vw, 6px) solid var(--dice-ink);
    border-radius: 50%;
    background: var(--dice-miss);
    box-shadow: inset 0 0 0 clamp(2px, .4vw, 7px) #fff6df, 0 2px 0 #120b0780;
    pointer-events: none;
  }

  & [data-range-end="0"] > .dice-handle-dot { background: var(--dice-mint); }
  & .dice-range-handle:is(:focus-visible, [data-dragging]) .dice-handle-dot {
    outline: 2px solid var(--dice-ink);
    outline-offset: 2px;
    scale: 1.09;
  }

  & .dice-handle-value {
    position: absolute;
    left: 50%;
    bottom: 100%;
    display: none;
    min-width: 2em;
    padding: .12em .22em .16em;
    border: 2px solid var(--dice-ink);
    border-radius: 3px;
    background: var(--dice-mint);
    box-shadow: 2px 2px var(--dice-ink);
    font: italic 900 clamp(15px, 2.35vw, 30px)/1.15 var(--dice-display);
    text-align: center;
    transform: translateX(-50%);
    pointer-events: none;
  }

  & [data-range-end="1"] > .dice-handle-value { background: var(--dice-miss); color: #fff8e6; }
  & .dice-range-handle:not(:disabled):is(:focus-visible, [data-dragging]) .dice-handle-value { display: block; }

  & .dice-range-tools {
    --dice-range-control-height: clamp(38px, 2.8vw, 46px);
    --dice-range-bound-width: clamp(39px, 3.1vw, 55px);
    display: flex;
    grid-area: range-tools;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 9px 8px 1px;
  }

  & .instant-dice[data-dice-range-mode] {
    grid-template-areas: "receipts" "scale" "range-tools";
    grid-template-rows: auto auto auto;
  }

  & .dice-range-tools :is(.dice-range-add, .dice-range-item) {
    min-height: var(--dice-range-control-height);
    border: 2px solid var(--dice-ink);
    border-radius: 4px 2px 4px 2px;
    background: var(--dice-stock);
    box-shadow: 2px 2px var(--dice-ink);
    color: var(--dice-ink);
  }

  & .dice-range-tools .dice-range-add {
    flex: none;
    padding: .25em .72em;
    background: var(--dice-yellow);
    font: italic 900 clamp(13px, 1.05vw, 18px)/1 var(--dice-display);
    cursor: pointer;
  }

  & .dice-range-tools .dice-range-add:hover:not(:disabled) { background: #fff879; }
  & .dice-range-tools .dice-range-add:disabled { opacity: .6; cursor: default; }
  & .dice-range-tools button:focus-visible { z-index: 1; outline: 2px solid var(--dice-ink); outline-offset: 2px; }
  & .dice-range-list { display: contents; }

  & .dice-range-item {
    display: grid;
    flex: none;
    grid-template-columns: var(--dice-range-bound-width) .6em var(--dice-range-bound-width) max(30px, 1.9em);
    align-items: stretch;
    font: italic 900 clamp(13px, 1vw, 17px)/1 var(--dice-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.04em;
  }

  & :is(.dice-range-bound, .dice-range-dash) {
    display: grid;
    place-items: center;
    position: relative;
    min-width: 0;
  }

  & .dice-range-bound-value {
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
  }

  & .dice-range-item input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 1px;
    color: transparent;
    background: transparent;
    font: inherit;
    letter-spacing: inherit;
    text-align: center;
    appearance: textfield;
  }

  & .dice-range-item input::-webkit-inner-spin-button,
  & .dice-range-item input::-webkit-outer-spin-button { appearance: none; }
  & .dice-range-item input:focus {
    z-index: 1;
    color: var(--dice-ink);
    background: var(--dice-mint);
    outline: 2px solid var(--dice-ink);
    outline-offset: -2px;
  }
  & .dice-range-item input:focus + .dice-range-bound-value { visibility: hidden; }
  & .dice-range-bound:has(input:enabled):hover { background: #ffda6c6b; }

  & .dice-range-item [data-dice-range-remove] {
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 0 0 .06em;
    border: 0;
    border-radius: 0;
    border-inline-start: 2px solid var(--dice-ink);
    background: #ffb5cb;
    color: var(--dice-ink);
    font: 900 1.25em/1 var(--dice-display);
    cursor: pointer;
  }

  & .dice-range-item [data-dice-range-remove]:hover:not(:disabled) { background: #ff82a9; }
  & .dice-range-item [data-dice-range-remove]:disabled { color: #735843; background: #f0ddba; cursor: default; }

  @media (max-width: 620px), (pointer: coarse) {
    & .dice-range-tools { --dice-range-control-height: 48px; }
    & .dice-range-item { grid-template-columns: var(--dice-range-bound-width) .6em var(--dice-range-bound-width) 44px; }
  }

  @media (hover: hover) {
    & .dice-range-handle:not(:disabled):hover { z-index: 1; }
    & .dice-range-handle:not(:disabled):hover .dice-handle-value { display: block; }
  }

  @media (prefers-reduced-motion: no-preference) {
    & .dice-handle-dot { transition: scale .12s ease; }
  }
}

html[data-ludik-theme="comic"] #dialog[data-variant="dice-proof"] .dice-proof-numbers dd {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

html[data-ludik-theme="comic"] #content[data-game="dice"] #game-sidebar .dice-comic-form[data-auto-series] {
  --dice-auto-edge: clamp(2px, .22vw, 4px);
  --dice-auto-control: clamp(44px, 3.1vw, 52px);
  --dice-auto-gap: clamp(7px, .66vw, 11px);

  & .auto-series-fields {
    display: grid;
    gap: var(--dice-auto-gap);
    padding: clamp(9px, 1.05vw, 17px);
    border: var(--dice-auto-edge) solid var(--dice-ink);
    border-radius: 4px 9px 4px 8px;
    background: var(--dice-stock);
    box-shadow: 3px 3px var(--dice-ink);
    color: var(--dice-ink);
  }

  & .auto-series-fields label {
    gap: 4px;
    min-inline-size: 0;
    color: var(--dice-ink);
    font: 850 clamp(.78rem, 1.02vw, 1.08rem)/1.12 var(--dice-display);
    letter-spacing: -.025em;
  }

  & .auto-series-fields :is(input, select, .auto-unlimited) {
    min-block-size: var(--dice-auto-control);
    border: var(--dice-auto-edge) solid var(--dice-ink);
    border-radius: 7px 4px 7px 4px;
    background: var(--dice-mint);
    color: var(--dice-ink);
    font: 850 clamp(.87rem, 1.18vw, 1.2rem)/1.12 var(--dice-display);
    font-variant-numeric: tabular-nums;
  }

  & .auto-series-fields input { padding-inline: .52em; }

  & .auto-series-fields select[name] {
    appearance: none;
    padding-inline: .52em 20px;
    background-image: linear-gradient(45deg, transparent 50%, var(--dice-ink) 51%),
      linear-gradient(135deg, var(--dice-ink) 49%, transparent 50%);
    background-position: right 12px center, right 7px center;
    background-repeat: no-repeat;
    background-size: 5px 5px;
  }

  & .auto-series-fields :is(input, select, .auto-unlimited):focus-visible {
    outline: 2px solid #a81154;
    outline-offset: 2px;
  }

  & .auto-count-group { grid-template-columns: minmax(0, 1fr) var(--dice-auto-control); column-gap: 0; }
  & .auto-count-group input { border-radius: 7px 0 0 4px; }

  & .auto-series-fields .auto-unlimited {
    width: auto;
    margin-inline-start: calc(-1 * var(--dice-auto-edge));
    border-radius: 0 4px 7px 0;
    font: 900 1.55rem/1 var(--dice-display);
  }

  & .auto-series-fields .auto-unlimited[aria-pressed="true"] { background: #ff9bcc; }
  & .auto-series-fields .auto-unlimited:hover:not(:disabled, [aria-pressed="true"]) { background: #b5ffcc; }

  & .auto-series-fields :is(.auto-progression, .auto-series-limits) {
    gap: 5px var(--dice-auto-gap);
    padding-block-start: var(--dice-auto-gap);
    border-block-start: var(--dice-auto-edge) solid var(--dice-ink);
  }

  & .auto-progression { grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr); }
  & .auto-series-limits { align-items: stretch; }
  & .auto-series-limits label { grid-template-rows: 1fr auto; }
  & .auto-progression label:has(input:disabled) { opacity: 1; }
  & .auto-series-fields input:disabled { background: #f0deb2; color: #504031; }
  & .auto-series-fields:disabled { opacity: .78; }

  & .auto-series-fields small {
    padding-inline-start: .12em;
    color: #3e2c20;
    font-size: clamp(.72rem, .89vw, .88rem);
    line-height: 1.18;
  }

  & .auto-series-actions {
    container-type: inline-size;
    gap: 9px;
    margin: 0;
    padding: 2px 1px 3px;
  }

  & .auto-series-actions > .button:is([data-auto-start], [data-action="auto-stop"], [data-action="auth"]) {
    --dice-button-edge: polygon(5% 10%, 100% 0, 96% 90%, 0 100%);
    min-block-size: clamp(66px, 21cqi, 92px);
    padding: 14px 10%;
    font: italic 950 clamp(18px, 7.5cqi, 36px)/1.10 var(--dice-display);
    letter-spacing: -.04em;
    text-align: center;
    text-wrap: balance;
    overflow-wrap: normal;
    transform: none;
  }

  & .auto-series-actions > .button:is([data-auto-start], [data-action="auto-stop"], [data-action="auth"])::after {
    inset: 4px 5px 8px;
  }

  & .auto-series-actions > .button:is([data-auto-start], [data-action="auto-stop"], [data-action="auth"]):active:not(:disabled) {
    transform: translateY(2px);
  }

}
