/* DICE material system. Solid surfaces are the baseline; glass is progressive. */
:root {
  color-scheme: light;
  --bg: #f2f3f2;
  --bg-edge: #e7e9e8;
  --text: #232629;
  --muted: #656a6e;
  --subtle: #686e72;
  --glass-solid: #e8eae9;
  --glass: rgb(255 255 255 / .32);
  --glass-border: rgb(255 255 255 / .92);
  --glass-edge: rgb(88 99 105 / .12);
  --highlight: rgb(255 255 255 / .92);
  --selected: #fff;
  --selected-text: #232629;
  --button-solid: #2c3031;
  --button-glass: rgb(45 50 51 / .9);
  --button-text: #f9faf7;
  --shadow: 0 3px 8px rgb(34 44 39 / .035), 0 14px 28px rgb(34 44 39 / .055);
  --selection-shadow: 0 1px 2px rgb(31 43 38 / .07), 0 3px 8px rgb(31 43 38 / .1);
  --focus: #3b637c;
  --dot: #537267;
  --halo: rgb(255 255 255 / .6);
  --shadow-color: #303735;
  --table-top: #e3dfd5;
  --table-bottom: #d3cfc4;
  --table-edge: rgb(124 118 103 / .12);
  --table-highlight: rgb(255 255 255 / .65);
  --table-shadow: 0 12px 28px rgb(76 68 49 / .075);
  --radius-pill: 999px;
  --radius-control: 22px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --ease-out: cubic-bezier(.2,.7,.25,1);
  --ease-spring: cubic-bezier(.22,1.3,.4,1);
  --duration-fast: 160ms;
  --duration-material: 260ms;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #17191c; --bg-edge: #101215; --text: #f0f1f0; --muted: #a1a6ad; --subtle: #979da5; --glass-solid: #292d32; --glass: rgb(255 255 255 / .045); --glass-border: rgb(255 255 255 / .16); --glass-edge: rgb(0 0 0 / .18); --highlight: rgb(255 255 255 / .12); --selected: #51565c; --selected-text: #fff; --button-solid: #343a40; --button-glass: rgb(88 98 105 / .28); --shadow: 0 3px 8px rgb(0 0 0 / .1), 0 14px 28px rgb(0 0 0 / .12); --selection-shadow: 0 1px 2px rgb(0 0 0 / .15), 0 3px 8px rgb(0 0 0 / .18); --focus: #9ec8df; --dot: #a4bfb1; --halo: rgb(255 255 255 / .035); --shadow-color: #000; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #17191c; --bg-edge: #101215; --text: #f0f1f0; --muted: #a1a6ad; --subtle: #979da5; --glass-solid: #292d32; --glass: rgb(255 255 255 / .045); --glass-border: rgb(255 255 255 / .16); --glass-edge: rgb(0 0 0 / .18); --highlight: rgb(255 255 255 / .12); --selected: #51565c; --selected-text: #fff; --button-solid: #343a40; --button-glass: rgb(88 98 105 / .28); --shadow: 0 3px 8px rgb(0 0 0 / .1), 0 14px 28px rgb(0 0 0 / .12); --selection-shadow: 0 1px 2px rgb(0 0 0 / .15), 0 3px 8px rgb(0 0 0 / .18); --focus: #9ec8df; --dot: #a4bfb1; --halo: rgb(255 255 255 / .035); --shadow-color: #000; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 36%, transparent 20%, var(--bg-edge) 110%); z-index: -1; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
button svg { width: 20px; height: 20px; flex: none; }
button, label { user-select: none; -webkit-user-select: none; }
button[hidden], [hidden] { display: none !important; }
p, h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.app { max-width: 1120px; min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: max(30px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex: none; }
.brand h1 { display: flex; gap: 10px; align-items: center; font-size: 20px; font-weight: 620; letter-spacing: .18em; line-height: 1.5; }
.brand-icon { width: 25px; height: 25px; }
.brand p { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: .015em; margin-top: 4px; }
.header-controls { display: flex; gap: 10px; }
.glass { background: var(--glass-solid); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--highlight), var(--shadow); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass); border-color: var(--glass-border); backdrop-filter: blur(14px) saturate(135%); -webkit-backdrop-filter: blur(14px) saturate(135%); }
}
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; transition: transform var(--duration-material) var(--ease-spring), background var(--duration-fast); }
.icon-button:active { transform: scale(.93); }
.icon-button svg { width: 19px; height: 19px; }
.sound-on { display: none; }
[aria-pressed="true"] .sound-off { display: none; }
[aria-pressed="true"] .sound-on { display: initial; }

.main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding-top: 12px; }
.dice-stage { position: relative; width: 100%; flex: 1; display: grid; place-items: center; min-height: 260px; max-height: 430px; margin: 10px 0 0; isolation: isolate; }
.table-surface { position: absolute; top: 0; bottom: 7px; left: 50%; transform: translateX(-50%); width: min(100%, 760px); border-radius: clamp(26px, 5vw, 38px); background: radial-gradient(ellipse at 30% 15%, var(--table-top), var(--table-bottom) 115%); border: 1px solid var(--table-edge); box-shadow: inset 0 2px 3px var(--table-highlight), inset 0 -2px 4px rgb(89 80 61 / .06), var(--table-shadow); z-index: -2; pointer-events: none; }
.table-surface::after { content: ""; position: absolute; inset: 1px; border-radius: inherit; background: url('./assets/table-grain.svg'); opacity: .14; pointer-events: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --table-top: #34373b; --table-bottom: #272a2e; --table-edge: rgb(255 255 255 / .07); --table-highlight: rgb(255 255 255 / .12); --table-shadow: 0 12px 28px rgb(0 0 0 / .18); }
}
:root[data-theme="dark"] { --table-top: #34373b; --table-bottom: #272a2e; --table-edge: rgb(255 255 255 / .07); --table-highlight: rgb(255 255 255 / .12); --table-shadow: 0 12px 28px rgb(0 0 0 / .18); }
.stage-light { position: absolute; width: min(85%, 640px); height: 75%; top: 17%; border-radius: 50%; background: radial-gradient(ellipse, var(--halo), transparent 70%); z-index: -1; pointer-events: none; }
.dice-grid { --die-size: clamp(70px, min(21vw, 19svh), 128px); --cell-size: calc(var(--die-size) * 1.85); --rows: 1; position: relative; width: min(100%, 740px); height: 100%; min-height: calc(var(--cell-size) * var(--rows)); align-self: stretch; }
.dice-grid[data-count="1"] { --die-size: clamp(108px, min(32vw, 26svh), 166px); grid-template-columns: var(--cell-size); }
.dice-grid[data-count="3"] { --die-size: clamp(42px, min(13.7vw, 14svh), 92px); grid-template-columns: repeat(3, var(--cell-size)); column-gap: 12px; }
.dice-grid[data-count="4"] { --die-size: clamp(55px, min(17vw, 11.7svh), 86px); --rows: 2; }
.dice-grid[data-count="5"], .dice-grid[data-count="6"] { --die-size: clamp(40px, min(13.7vw, 11.5svh), 86px); --rows: 2; }
.dice-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.dice-grid.is-3d { visibility: hidden; }
.dice-stage[data-renderer="webgl"] .table-surface { opacity: 0; }
.die-slot { position: absolute; left: 0; top: 0; width: var(--cell-size); height: var(--cell-size); perspective: 800px; perspective-origin: 50% 40%; }
.die-shadow { position: absolute; width: calc(var(--die-size) * 1.3); height: calc(var(--die-size) * .28); left: 50%; top: 82%; border-radius: 50%; background: var(--shadow-color); filter: blur(6px); opacity: .26; transform: translateX(-50%); }
.die-contact { position: absolute; width: calc(var(--die-size) * .64); height: calc(var(--die-size) * .12); left: 50%; top: 88.5%; border-radius: 50%; background: var(--shadow-color); filter: blur(2px); opacity: .2; transform: translateX(-50%); }
.die-shadow::after { content: ""; position: absolute; width: 55%; height: 42%; left: 22%; top: 25%; border-radius: 50%; background: var(--shadow-color); }
.die-lift { position: absolute; left: 50%; top: 46%; width: var(--die-size); height: var(--die-size); transform: translate(-50%, -50%); transform-style: preserve-3d; }
.die-camera { width: 100%; height: 100%; transform: rotateX(-38deg) rotateY(-30deg); transform-style: preserve-3d; }
.die-cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.die-face, .die-shell, .die-bevel { position: absolute; left: 50%; top: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.die-shell { width: 88%; height: 88%; background: #e6e4dd; border-radius: 4%; }
.die-face, .die-bevel { background: linear-gradient(145deg, var(--face-top, #fdfcf7), var(--face-bottom, #e7e4db)); }
.die-face { width: 87%; height: 87%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14%; gap: 8%; border-radius: calc(var(--die-size) * .012); box-shadow: inset 0 1px 1.3px rgb(255 255 255 / .82), inset 0 -1px 1.5px rgb(82 76 58 / .06); }
.pip { width: 94%; aspect-ratio: 1; align-self: center; justify-self: center; border-radius: 50%; background: radial-gradient(circle at 30% 23%, #a1a2a3 0%, #343539 11%, transparent 28%), radial-gradient(circle at 50% 65%, #202124, #030405 72%); box-shadow: inset 0 1.8px 2.5px rgb(0 0 0 / .82), 0 .8px 1px rgb(255 255 255 / .95), 0 -.5px .6px rgb(0 0 0 / .18); }
.die-slot.is-moving, .is-moving .die-cube, .is-moving .die-lift, .is-moving .die-shadow { will-change: transform; }
.is-moving .die-contact { will-change: opacity; }

.result { height: 128px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: .19em; line-height: 16px; }
.result-value { font-size: 66px; font-weight: 450; font-variant-numeric: tabular-nums; line-height: 1.12; letter-spacing: -.05em; margin-top: 3px; }
.result-value.is-ready { font-size: 42px; font-weight: 480; letter-spacing: -.055em; margin-top: 9px; line-height: 1.35; }
.result-detail { color: var(--muted); font-size: 13px; line-height: 22px; letter-spacing: .02em; }
.result-detail.is-equation { letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.result.is-rolling .result-value { color: var(--muted); font-size: 42px; line-height: 1.55; letter-spacing: .08em; }
.result.is-revealed .result-value { animation: reveal 360ms var(--ease-out) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px) scale(.97); } to { opacity: 1; transform: none; } }

.dock { width: min(100%, 380px); flex: none; }
.count-fieldset { border: 0; padding: 0; margin: 0; width: 100%; min-width: 0; }
.count-fieldset legend { text-align: center; width: 100%; color: var(--muted); font-size: 12px; line-height: 18px; padding: 0; margin-bottom: 10px; }
.count-selector { position: relative; height: 58px; border-radius: var(--radius-pill); display: grid; grid-template-columns: repeat(6, 1fr); padding: 6px; isolation: isolate; }
.selection { position: absolute; left: 6px; top: 6px; bottom: 6px; width: calc((100% - 12px) / 6); background: var(--selected); box-shadow: var(--selection-shadow); border-radius: var(--radius-pill); transform: translateX(100%); transition: transform 300ms var(--ease-spring); z-index: -1; }
.count-selector label { position: relative; display: grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 16px; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.count-selector input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.count-selector label:has(:checked) { color: var(--selected-text); font-weight: 600; }
.count-selector label:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-pill); }
.count-fieldset:disabled label { cursor: default; }
.count-fieldset:disabled { opacity: .7; }
.roll-button { position: relative; width: 100%; height: 70px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; border-radius: var(--radius-control); font-size: 19px; letter-spacing: -.015em; font-weight: 590; color: var(--button-text); background: var(--button-solid); transition: transform 340ms var(--ease-spring), opacity var(--duration-fast), box-shadow var(--duration-material); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .roll-button { background: linear-gradient(165deg, rgb(255 255 255 / .19), transparent 58%), var(--button-glass); } }
.roll-button::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 1px 1px 0 var(--highlight), inset -1px -1px 0 rgb(73 85 79 / .04); }
.roll-button svg { width: 24px; height: 24px; }
.roll-button .roll-arrow { position: absolute; right: 25px; width: 18px; height: 18px; opacity: .55; }
.roll-button:active:not([aria-disabled="true"]) { transform: scale(.975) translateY(1px); transition-duration: 90ms; }
.roll-button[aria-disabled="true"] { cursor: default; opacity: .7; }
.keyboard-hint { text-align: center; margin-top: 16px; font-size: 10px; letter-spacing: .015em; color: var(--subtle); line-height: 1.6; }
.keyboard-hint .desktop-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .roll-button:hover:not([aria-disabled="true"]) { box-shadow: inset 0 1px 0 var(--highlight), 0 4px 8px rgb(34 44 39 / .055), 0 18px 32px rgb(34 44 39 / .085); }
  .keyboard-hint .touch-hint { display: none; }
  .keyboard-hint .desktop-hint { display: block; }
}

.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 32px; flex: none; min-height: 44px; }
.offline-status { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--subtle); line-height: 1.5; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: currentColor; opacity: .55; }
.offline-status.is-ready .status-dot { background: var(--dot); opacity: 1; }
.install-button { min-height: 44px; padding: 0 0 0 8px; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: 11px; white-space: nowrap; }
.install-button svg { width: 15px; height: 15px; }
.toast, .update-notice { position: fixed; z-index: 10; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); border-radius: 18px; color: var(--text); background: var(--glass-solid); padding: 14px 20px; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }
.toast { pointer-events: none; }
.update-notice { display: flex; gap: 16px; align-items: center; padding: 4px 6px 4px 16px; white-space: nowrap; }
.update-notice button { min-height: 44px; border: 0; border-radius: 13px; background: var(--selected); color: var(--selected-text); padding: 0 12px; font-size: 12px; }
.update-notice button:disabled { opacity: .6; }

.install-dialog { color: var(--text); background: var(--bg); border: 1px solid var(--glass-border); border-radius: 30px; padding: 36px 30px 26px; width: min(420px, calc(100vw - 32px)); max-height: calc(100svh - 40px); box-shadow: 0 30px 100px rgb(0 0 0 / .18); overflow: auto; }
.install-dialog::backdrop { background: rgb(21 25 28 / .3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dialog-close { position: absolute; right: 12px; top: 12px; border: none; background: transparent; }
.install-dialog img { border-radius: 15px; display: block; margin-bottom: 24px; }
.install-dialog h2 { font-size: 27px; font-weight: 540; line-height: 1.2; letter-spacing: -.035em; margin-bottom: 14px; }
.install-dialog p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.install-dialog ol { margin: 24px 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.install-dialog li { margin-bottom: 10px; padding-left: 4px; }
.install-dialog .install-note { font-size: 11px; margin-top: 22px; }
.dialog-install { width: 100%; min-height: 48px; background: var(--button-solid); border: 1px solid var(--glass-edge); border-radius: 14px; margin-top: 24px; font-size: 15px; }
.noscript { position: fixed; inset: auto 16px 16px; padding: 20px; background: var(--selected); color: var(--text); border-radius: 16px; z-index: 20; line-height: 1.5; }

@media (min-width: 700px) and (min-height: 800px) {
  .app { padding-top: max(44px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .dice-stage { margin-top: 24px; max-height: 470px; }
  .result { height: 140px; }
  .dock { width: 400px; }
  .brand h1 { font-size: 22px; }
  .brand p { font-size: 13px; }
}
@media (max-width: 480px) {
  .app { padding-top: max(22px, env(safe-area-inset-top)); padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .header-controls { gap: 8px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 11px; }
  .brand-icon { width: 23px; height: 23px; }
  .dice-stage { min-height: 220px; }
  .result { height: 108px; }
  .result-value { font-size: 58px; }
  .result-detail { line-height: 20px; }
  .keyboard-hint { margin-top: 10px; }
  .footer { margin-top: 14px; }
  .offline-status { font-size: 9px; }
  .install-button { font-size: 10px; }
}
@media (max-width: 480px) and (min-height: 721px) {
  .dice-grid[data-count="5"], .dice-grid[data-count="6"] { --rows: 3; --die-size: clamp(40px, min(16.5vw, calc(8.4svh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) * .18)), 70px); }
}
@media (min-width: 481px) and (min-height: 601px) and (max-height: 820px) {
  .app { padding-top: max(22px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .dice-stage { min-height: 200px; }
  .dice-grid[data-count="1"] { --die-size: min(20svh, 126px); }
  .dice-grid[data-count="2"] { --die-size: min(15svh, 108px); }
  .dice-grid[data-count="3"] { --die-size: min(11svh, 76px); }
  .dice-grid[data-count="4"] { --die-size: min(9.5svh, 72px); }
  .dice-grid[data-count="5"], .dice-grid[data-count="6"] { --die-size: min(8.5svh, 68px); }
  .result { height: 112px; }
  .footer { margin-top: 16px; }
}
@media (max-width: 360px) {
  .app { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .count-selector { padding: 6px 4px; }
  .selection { left: 4px; width: calc((100% - 8px) / 6); }
  .header-controls { gap: 6px; }
  .footer { gap: 8px; }
}
@media (max-height: 720px) and (orientation: portrait) {
  .app { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .main { padding-top: 0; }
  .dice-stage { min-height: 190px; margin-top: 5px; }
  .result { height: 105px; }
  .result-value { font-size: 56px; }
  .result-value.is-ready { font-size: 36px; margin-top: 6px; }
  .result-detail { font-size: 12px; }
  .dice-grid[data-count="4"] { --die-size: clamp(49px, min(16vw, 10.5svh), 76px); }
  .count-fieldset legend { margin-bottom: 8px; }
  .roll-button { margin-top: 14px; height: 62px; border-radius: 20px; }
  .keyboard-hint { margin-top: 11px; }
  .footer { margin-top: 12px; }
}
@media (max-height: 590px) and (orientation: portrait) {
  .app { padding-top: max(12px, env(safe-area-inset-top)); }
  .brand p { margin-top: 2px; }
  .dice-stage { min-height: 170px; }
  .result { height: 90px; }
  .result-value { font-size: 48px; }
  .result-value.is-ready { font-size: 32px; }
  .result-detail { font-size: 11px; line-height: 18px; }
  .dice-grid[data-count="1"] { --die-size: 96px; }
  .dice-grid[data-count="4"] { --die-size: 49px; }
  .dice-grid[data-count="5"], .dice-grid[data-count="6"] { --die-size: clamp(38px, 12.5vw, 44px); }
  .count-fieldset legend { margin-bottom: 6px; font-size: 11px; }
  .roll-button { height: 58px; margin-top: 12px; }
  .keyboard-hint { margin-top: 8px; font-size: 9px; }
  .footer { margin-top: 4px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .app { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .brand p { display: none; }
  .header { min-height: 44px; }
  .main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(264px, 42%); grid-template-rows: auto auto; gap: 0 16px; padding: 0; }
  .dice-stage { grid-row: 1 / 3; margin: 0; min-height: 180px; max-height: none; height: 100%; }
  .result { height: 78px; justify-content: center; }
  .result-value { font-size: 39px; margin-top: 1px; }
  .result.is-rolling .result-value { font-size: 34px; line-height: 1.2; }
  .result-value.is-ready { font-size: 32px; margin-top: 0; }
  .result-detail { font-size: 10px; line-height: 16px; }
  .dice-grid { --die-size: clamp(48px, 11vw, 78px); column-gap: 6px; }
  .dice-grid[data-count="1"] { --die-size: clamp(85px, 15vw, 126px); }
  .dice-grid[data-count="3"] { --die-size: clamp(35px, 7vw, 50px); column-gap: 4px; }
  .dice-grid[data-count="4"] { --die-size: 49px; }
  .dice-grid[data-count="5"], .dice-grid[data-count="6"] { --die-size: 38px; column-gap: 2px; }
  .dock { align-self: start; }
  .count-fieldset legend { font-size: 10px; line-height: 16px; margin-bottom: 2px; }
  .roll-button { height: 50px; margin-top: 8px; border-radius: 17px; }
  .keyboard-hint { display: none; }
  .footer { margin-top: 4px; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass, .roll-button, .toast, .update-notice { background: var(--glass-solid); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--glass-edge); }
  .roll-button { background: var(--button-solid); }
  .install-dialog::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(21 25 28 / .55); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --button-solid: #e6e8e4; --button-glass: rgb(228 232 226 / .9); --button-text: #242928; }
}
:root[data-theme="dark"] { --button-solid: #e6e8e4; --button-glass: rgb(228 232 226 / .9); --button-text: #242928; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .roll-button:active:not([aria-disabled="true"]), .icon-button:active { transform: none; }
}
@media (forced-colors: active) {
  .glass, .roll-button { border: 1px solid ButtonText; }
  .selection { background: Highlight; }
  .count-selector label:has(:checked) { color: HighlightText; }
  .die-face, .die-shell, .die-bevel { forced-color-adjust: none; }
}
