:root {
    --ink: #17202a;
    --muted: #68717a;
    --paper: #f5f1e8;
    --paper-deep: #e9e1d1;
    --panel: #fffdf8;
    --night: #101923;
    --night-soft: #1b2935;
    --copper: #bd6d34;
    --copper-bright: #e5a15f;
    --teal: #2c7876;
    --line: rgba(23, 32, 42, .16);
    --shadow: 0 18px 50px rgba(30, 35, 39, .11);
    --serif: Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
.visually-hidden { width: 1px; height: 1px; margin: -1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.5; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
code { font-family: var(--mono); }

.site-header {
    width: min(1180px, calc(100% - 40px));
    min-height: 78px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
    width: 40px; height: 40px; display: grid; place-items: center;
    color: #fff9ee; background: var(--night); font: 700 .75rem var(--mono);
    clip-path: polygon(50% 0, 92% 25%, 100% 72%, 50% 100%, 0 72%, 8% 25%);
}
.brand strong { display: block; letter-spacing: .13em; font-size: .82rem; }
.brand small { display: block; color: var(--muted); font: .57rem var(--mono); letter-spacing: .04em; }
.menu-toggle { min-height: 38px; padding: 0 11px; display: none; align-items: center; gap: 8px; color: var(--ink); border: 1px solid var(--line); background: var(--panel); font: 700 .68rem var(--mono); cursor: pointer; }
.menu-toggle > span:first-child { width: 1.1em; display: block; font-size: 1rem; line-height: 1; text-align: center; }
.menu-toggle > span:first-child::before { content: "☰"; }
.menu-toggle[aria-expanded="true"] > span:first-child::before { content: "×"; }
nav { display: flex; align-items: center; gap: 26px; }
nav a { color: var(--muted); font-size: .78rem; text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--copper); }
.language-switch { display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 2px; border: 1px solid var(--line); background: var(--panel); }
.language-switch a { min-width: 32px; min-height: 30px; padding: 4px 6px; display: grid; place-items: center; color: var(--muted); font: 700 .66rem var(--mono); }
.language-switch a:hover, .language-switch a:focus-visible { color: var(--night); background: var(--paper-deep); }
.language-switch a[aria-current="page"] { color: #fff9ee; background: var(--night); }

main { overflow-x: clip; overflow-y: visible; }
.hero {
    width: min(1180px, calc(100% - 40px));
    min-height: 500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(330px, .7fr);
    align-items: center;
    gap: 50px;
}
.eyebrow { margin: 0 0 17px; color: var(--teal); font: 700 .68rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.eyebrow > span { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: #39a482; box-shadow: 0 0 0 5px rgba(57,164,130,.12); }
h1 { max-width: 720px; margin: 0; font: 400 clamp(2.75rem, 6vw, 5.15rem)/.96 var(--serif); letter-spacing: -.045em; }
h1 em { display: block; color: var(--copper); font-weight: 400; }
.lead { max-width: 650px; margin: 25px 0 0; color: #4f5962; font-size: clamp(1rem, 1.5vw, 1.14rem); }
.hero-facts { margin-top: 29px; display: flex; flex-wrap: wrap; gap: 9px; }
.hero-facts span { padding: 7px 10px; border: 1px solid var(--line); background: rgba(255,255,255,.42); color: #59626b; font: .61rem var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.hero-die { position: relative; min-width: 0; }
.hero-die::before { content: ""; position: absolute; inset: 10% -12%; background: radial-gradient(circle, rgba(189,109,52,.15), transparent 66%); }
.hero-die svg { position: relative; width: 100%; overflow: visible; filter: drop-shadow(0 27px 22px rgba(61,45,29,.2)); transform: rotate(3deg); }
.hero-die .die-main { fill: url(#die-face); stroke: #743d21; stroke-width: 3; }
.hero-die .die-shadow { fill: rgba(16,25,35,.17); transform: translateY(17px); }
.hero-die path { fill: none; stroke: rgba(255,244,224,.55); stroke-width: 2; }
.hero-die text { fill: #fff8e9; font: 700 64px var(--serif); text-shadow: 0 2px 2px rgba(62,31,15,.3); }

.roll-workspace, .history-section, .entropy-note { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.roll-workspace { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(320px,.75fr); align-items: start; gap: 0 25px; }
.roller-stack { display: contents; }
.quick-section, .roller-section { min-width: 0; grid-column: 1; scroll-margin-top: 18px; }
.quick-section { grid-row: 1; padding: 48px 0 70px; }
.section-heading { margin-bottom: 23px; display: flex; align-items: end; justify-content: space-between; gap: 25px; }
.section-heading > div { display: flex; align-items: baseline; gap: 13px; }
.section-heading > div > span { color: var(--copper); font: 700 .65rem var(--mono); }
.section-heading h2 { margin: 0; font: 400 clamp(1.7rem, 3vw, 2.35rem) var(--serif); }
.section-heading p { max-width: 390px; margin: 0; color: var(--muted); font-size: .82rem; }
.quick-presets { padding: 19px; display: grid; gap: 18px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.quick-group-title { margin: 0 0 8px; color: var(--muted); font: 700 .6rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.quick-dice { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 7px; }
.quick-rolls { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.quick-dice button, .quick-rolls button { min-width: 0; min-height: 58px; padding: 11px 13px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; border: 1px solid var(--line); background: #fbf8f1; text-align: left; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.quick-dice button { align-items: center; text-align: center; }
.quick-dice button:hover, .quick-dice button:focus-visible, .quick-rolls button:hover, .quick-rolls button:focus-visible { z-index: 1; border-color: var(--copper); background: #fff7e9; outline: 2px solid rgba(189,109,52,.22); outline-offset: 1px; }
.quick-dice button.active, .quick-rolls button.active { color: #fff9ee; border-color: var(--teal); background: var(--teal); }
.quick-dice button.active span, .quick-rolls button.active span { color: #d8f0ea; }
.quick-dice button:active, .quick-rolls button:active { transform: translateY(2px); }
.quick-dice b { font: 700 .76rem var(--mono); }
.quick-rolls b { font: 600 .8rem var(--sans); }
.quick-dice span, .quick-rolls span { color: var(--copper); font: .61rem var(--mono); }
.quick-preset-status { min-height: 1.25em; margin: 9px 2px 0; color: var(--teal); font: .62rem var(--mono); }

.roller-section { padding: 70px 0 80px; border-top: 1px solid var(--line); }
.roller-section { grid-row: 2; }
.roller-layout { display: block; }
.dice-builder, .result-panel { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.dice-builder { padding: 28px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { width: 100%; margin-bottom: 15px; color: var(--muted); font: 700 .65rem var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.dice-picker-head { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.dice-picker-head > span { color: var(--muted); font: 700 .65rem var(--mono); letter-spacing: .09em; text-transform: uppercase; }
#clear-dice { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); color: var(--muted); background: transparent; font: 600 .61rem var(--mono); cursor: pointer; }
#clear-dice:hover, #clear-dice:focus-visible { color: var(--copper); border-color: var(--copper); background: #fff7e9; outline: 0; }
.dice-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.dice-choice { min-width: 0; padding: 12px 9px 9px; display: grid; grid-template-columns: 41px 1fr; align-items: center; gap: 7px; border: 1px solid var(--line); background: #faf7f0; transition: border-color .16s ease, background .16s ease; }
.dice-choice.featured { background: #fffaf2; }
.dice-choice.active { border-color: rgba(189,109,52,.55); background: #fff5e5; }
.dice-choice > label { padding: 7px 0; font: 700 .8rem var(--mono); cursor: text; }
.die-symbol { position: relative; width: 39px; height: 39px; display: grid; place-items: center; color: var(--night); background: #d9b27c; }
.die-symbol::after { content: ""; position: absolute; inset: 2px; border: 1px solid rgba(255,255,255,.55); clip-path: inherit; }
.die-symbol i { position: relative; z-index: 1; font: normal 700 .65rem var(--mono); }
.d4 { clip-path: polygon(50% 3%, 98% 94%, 2% 94%); }
.d6 { border-radius: 7px; background: #c99061; }
.d6::after { border-radius: 6px; }
.d8 { clip-path: polygon(50% 0, 94% 50%, 50% 100%, 6% 50%); background: #6eaaa0; }
.d10 { clip-path: polygon(50% 0, 93% 30%, 84% 81%, 50% 100%, 16% 81%, 7% 30%); background: #9aacc0; }
.d12 { clip-path: polygon(50% 0, 90% 20%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 20%); background: #c79c60; }
.d20 { clip-path: polygon(50% 0, 94% 25%, 100% 72%, 50% 100%, 0 72%, 6% 25%); background: var(--copper-bright); }
.d100 { border-radius: 50%; background: #7692a7; }
.d100::after { border-radius: 50%; }
.stepper { margin-top: 3px; grid-column: 1 / -1; display: grid; grid-template-columns: 42px minmax(42px,1fr) 42px; align-items: center; border: 1px solid var(--line); background: #fff; }
.stepper button { min-width: 42px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 1.15rem; cursor: pointer; }
.stepper button:hover, .stepper button:focus-visible { color: var(--copper); background: rgba(189,109,52,.08); outline: 0; }
.stepper button:disabled { color: #b8b8b4; cursor: not-allowed; opacity: .55; }
.stepper .die-count-input { width: 100%; height: 40px; margin: 0; padding: 0 3px; border: 0; border-right: 1px solid var(--line); border-left: 1px solid var(--line); background: #fffdf9; text-align: center; font: 700 .82rem var(--mono); -moz-appearance: textfield; }
.stepper .die-count-input::-webkit-inner-spin-button, .stepper .die-count-input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.stepper .die-count-input:focus { position: relative; z-index: 1; border-color: var(--copper); box-shadow: inset 0 0 0 2px rgba(189,109,52,.18); }
.options-grid { margin-top: 20px; display: grid; grid-template-columns: 1.25fr .55fr .85fr; gap: 12px; }
.options-grid label, .option-label, .advanced-row label { color: var(--muted); font: 700 .63rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.option-label { display: block; }
input, select { width: 100%; height: 43px; margin-top: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: #fff; outline: 0; }
input:focus, select:focus { border-color: var(--copper); box-shadow: 0 0 0 3px rgba(189,109,52,.11); }
.input-pair { display: grid; grid-template-columns: 1fr 30px 1.25fr; align-items: center; }
.input-pair input { min-width: 0; }
.input-pair b { margin-top: 7px; color: var(--copper); text-align: center; font: 700 1rem var(--serif); }
.formula-bar { margin-top: 18px; padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border: 1px dashed rgba(23,32,42,.25); background: #f6f2e9; }
.formula-bar span { color: var(--muted); font-size: .7rem; }
.formula-bar code { min-width: 0; color: var(--teal); font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.roll-button { width: 100%; min-height: 54px; margin-top: 12px; border: 0; color: #fff8ea; background: var(--night); font-weight: 700; letter-spacing: .025em; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.roll-button span { margin-right: 7px; color: var(--copper-bright); }
.roll-button:hover, .roll-button:focus-visible { background: #263847; outline: 3px solid rgba(44,120,118,.25); }
.roll-button:active { transform: translateY(2px); }
.roll-button:disabled, [data-quick-roll]:disabled, #advanced-roll:disabled { cursor: wait; opacity: .6; }
.advanced-entry { margin-top: 17px; padding: 14px; border: 1px solid var(--line); background: #f8f4eb; }
.advanced-entry-head { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.advanced-entry-head > div { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.advanced-entry-head span { font-size: .75rem; font-weight: 700; }
.advanced-entry-head small { color: var(--muted); font: .61rem var(--mono); }
#open-notation-help { padding: 5px 8px; flex: 0 0 auto; border: 0; color: var(--teal); background: transparent; font: 700 .62rem var(--mono); cursor: pointer; }
#open-notation-help:hover, #open-notation-help:focus-visible { color: var(--copper); outline: 1px solid var(--copper); }
.notation-manual { margin-top: 25px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); scroll-margin-top: 20px; }
.notation-manual > summary { padding: 17px 21px; color: var(--ink); background: #fbf8f1; cursor: pointer; }
.notation-manual > summary::marker { color: var(--copper); }
.notation-manual > summary span { margin-left: 4px; display: inline-flex; align-items: baseline; gap: 12px; }
.notation-manual > summary strong { font-size: .8rem; }
.notation-manual > summary small { color: var(--muted); font: .62rem var(--mono); }
.notation-manual[open] > summary { border-bottom: 1px solid var(--line); background: #f6efe3; }
.notation-guide { padding: 24px; background: #f8f4eb; }
.notation-guide p { color: var(--muted); font-size: .73rem; }
.notation-intro { max-width: 820px; margin: 0 0 18px; }
.notation-guide-grid { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 27px; align-items: start; }
.notation-reference, .notation-examples-panel { min-width: 0; }
.notation-pattern { padding: 12px; overflow-x: auto; border-left: 3px solid var(--copper); background: var(--night); white-space: nowrap; }
.notation-pattern code { color: #f4ede0; font-size: .71rem; }
.notation-pattern code span { color: #efad69; }
.notation-pattern code i { color: #79bdb1; font-style: normal; }
.notation-pattern code u { color: #d6ce7d; text-decoration: none; }
.notation-pattern code mark { color: #f2a2a2; background: transparent; }
.notation-pattern code b { color: #b8c3cb; font-weight: 400; }
.notation-guide .pattern-note { margin: 6px 0 0; font-size: .62rem; }
.notation-parts { margin: 13px 0 0; }
.notation-parts div { padding: 8px 0; display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 10px; border-bottom: 1px solid var(--line); }
.notation-parts dt { color: var(--copper); font-size: .72rem; font-weight: 700; }
.notation-parts dd { margin: 0; color: var(--muted); font-size: .7rem; }
.notation-guide h3 { margin: 0 0 8px; font: 700 .64rem var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.notation-guide .examples-intro { margin: 0 0 10px; }
.notation-examples { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.notation-examples button { min-width: 0; padding: 9px 10px; display: grid; grid-template-columns: minmax(90px,.45fr) minmax(0,1fr); align-items: start; gap: 8px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.48); text-align: left; cursor: pointer; }
.notation-examples button:hover, .notation-examples button:focus-visible { position: relative; z-index: 1; background: #fff6e7; outline: 2px solid var(--copper); outline-offset: -2px; }
.notation-examples code { color: var(--teal); font-size: .66rem; font-weight: 700; overflow-wrap: anywhere; }
.notation-examples span { color: var(--muted); font-size: .64rem; line-height: 1.4; }
.notation-guide .notation-tip { margin: 18px 0 0; padding: 13px 15px; border-left: 3px solid var(--teal); background: rgba(255,255,255,.5); line-height: 1.55; }
.advanced-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.advanced-row label { grid-column: 1 / -1; }
.advanced-row input { margin: 0; font-family: var(--mono); }
.advanced-row button, .text-button, #copy-result { padding: 0 15px; border: 1px solid var(--line); background: transparent; font-size: .72rem; cursor: pointer; }
.advanced-row button:hover, .advanced-row button:focus-visible, .text-button:hover, .text-button:focus-visible, #copy-result:hover:not(:disabled), #copy-result:focus-visible:not(:disabled) { border-color: var(--copper); color: var(--copper); outline: 0; }
.success-rule { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.success-rule-copy { display: flex; align-items: baseline; gap: 9px; }
.success-rule-copy strong { font-size: .72rem; }
.success-rule-copy small { color: var(--muted); font-size: .62rem; }
.success-rule-row { margin-top: 9px; display: grid; grid-template-columns: minmax(0,1.35fr) minmax(82px,.55fr) auto; align-items: end; gap: 8px; }
.explosion-rule-row { margin-top: 9px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
.explosion-rule-row label { color: var(--muted); font: 700 .59rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.success-rule-row label { color: var(--muted); font: 700 .59rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.success-rule-actions { display: flex; gap: 6px; }
.success-rule-actions button { min-height: 43px; padding: 0 10px; border: 1px solid var(--line); background: #fff; font-size: .64rem; cursor: pointer; }
.success-rule-actions button:first-child { color: #fff; border-color: var(--teal); background: var(--teal); }
.success-rule-actions button:hover, .success-rule-actions button:focus-visible { border-color: var(--copper); color: var(--copper); background: #fff8eb; outline: 0; }
.success-rule > p { margin: 8px 0 0; color: var(--muted); font-size: .61rem; }
.success-rule > p code { color: var(--teal); font-weight: 700; overflow-wrap: anywhere; }

.result-panel { min-width: 0; max-height: calc(100vh - 36px); margin-top: 48px; position: sticky; top: 18px; grid-column: 2; grid-row: 1 / 3; align-self: start; overflow-x: hidden; overflow-y: auto; }
.result-topline { height: 51px; padding: 0 19px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.09); color: #b8c2ca; background: var(--night); font: 700 .64rem var(--mono); text-transform: uppercase; letter-spacing: .09em; }
.result-heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.result-heading time { min-width: 0; color: #70b8ac; font-size: .58rem; font-weight: 600; letter-spacing: .015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-heading time::before { margin-right: 10px; color: #56636e; content: '\00b7'; }
#copy-result { height: 29px; color: #e7a766; border-color: rgba(255,255,255,.22); text-transform: none; letter-spacing: 0; }
#copy-result:disabled { color: #66717a; }
.result-total { min-height: 145px; padding: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--night); color: #fff8eb; }
.result-total small { color: #84919b; font: .64rem var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.result-value { font: 400 5rem/1 var(--serif); }
.result-total.critical .result-value { color: #f0ae65; text-shadow: 0 0 26px rgba(229,161,95,.28); }
.result-figures { margin-top: 7px; display: flex; align-items: center; justify-content: center; gap: 24px; }
.result-success-pips { min-width: 95px; padding-left: 22px; display: flex; flex-direction: column; border-left: 1px solid rgba(255,255,255,.16); }
.result-success-pips b { color: #70b8ac; font: 400 2.15rem/1 var(--serif); }
.result-success-pips small { margin-top: 5px; font-size: .55rem; }
.result-dice { min-height: 195px; padding: 22px; display: flex; flex-direction: column; justify-content: center; gap: 17px; }
.result-dice > p { max-width: 330px; margin: auto; color: var(--muted); text-align: center; font-size: .78rem; }
.result-group { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.result-group:last-child { padding-bottom: 0; border-bottom: 0; }
.result-group-head { margin-bottom: 9px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font: .64rem var(--mono); }
.result-group-head b { color: var(--ink); }
.result-values { display: flex; flex-wrap: wrap; gap: 7px; }
.result-die { width: 48px; height: 48px; display: grid; place-items: center; color: #18232c; background: #dab47c; font: 700 .8rem var(--mono); animation: tumble .32s cubic-bezier(.2,.8,.2,1) both; }
.result-die.dropped { filter: grayscale(1); opacity: .32; text-decoration: line-through; }
.result-die.critical-hit { color: #fff9ed; background: var(--copper); box-shadow: 0 0 0 3px rgba(189,109,52,.16); }
.result-die.critical-fail { color: #fff; background: #7b3540; }
.result-die.shape-4 { clip-path: polygon(50% 2%, 98% 94%, 2% 94%); }
.result-die.shape-6 { border-radius: 8px; }
.result-die.shape-8 { clip-path: polygon(50% 0, 96% 50%, 50% 100%, 4% 50%); background: #80b5aa; }
.result-die.shape-10 { clip-path: polygon(50% 0, 94% 30%, 84% 82%, 50% 100%, 16% 82%, 6% 30%); background: #aebdca; }
.result-die.shape-12 { clip-path: polygon(50% 0, 90% 20%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 20%); }
.result-die.shape-20 { clip-path: polygon(50% 0, 94% 25%, 100% 72%, 50% 100%, 0 72%, 6% 25%); background: #e3a25e; }
.result-die.shape-100 { border-radius: 50%; background: #8da4b5; }
.result-die.shape-custom { clip-path: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%); background: #93aaa4; }
.result-die.success { color: #fff; background: var(--teal); filter: drop-shadow(0 0 4px rgba(44,120,118,.42)); }
.result-die.failure { filter: grayscale(.65); opacity: .42; }
.result-die.exploded-roll { box-shadow: inset 0 0 0 2px rgba(255,255,255,.72); }
.result-die.explosion-trigger { outline: 2px solid #d66b37; outline-offset: 2px; }
.result-die.critical-hit { color: #fff9ed; background: var(--copper); box-shadow: 0 0 0 3px rgba(189,109,52,.16); }
.result-die.critical-fail { color: #fff; background: #7b3540; }
@keyframes tumble { from { opacity: 0; transform: translateY(-12px) rotate(-10deg) scale(.8); } to { opacity: 1; transform: none; } }
.result-breakdown { padding: 13px 19px; border-top: 1px solid var(--line); color: var(--muted); background: #f6f2e9; font: .65rem var(--mono); overflow-wrap: anywhere; }
.result-error { margin: 0; padding: 13px 19px; border-top: 1px solid #e4b5b5; color: #7b2730; background: #fff0f0; font-size: .75rem; }

.history-section { padding: 80px 0; border-top: 1px solid var(--line); }
.text-button { min-height: 36px; }
.session-layout { display: grid; grid-template-columns: minmax(0,.65fr) minmax(0,1.35fr); gap: 25px; }
.session-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.session-stats div { min-width: 0; padding: 23px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.session-stats div:nth-child(2n) { border-right: 0; }
.session-stats div:nth-last-child(-n+2) { border-bottom: 0; }
.session-stats dt { color: var(--muted); font: .62rem var(--mono); text-transform: uppercase; }
.session-stats dd { margin: 8px 0 0; font: 400 2rem var(--serif); }
.history-list { min-height: 200px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.history-list > p { margin: 0; padding: 25px; color: var(--muted); font-size: .78rem; }
.history-entry { padding: 13px 17px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px 20px; border-bottom: 1px solid var(--line); }
.history-entry:last-child { border-bottom: 0; }
.history-entry strong { font: 700 .72rem var(--mono); overflow-wrap: anywhere; }
.history-entry b { grid-row: 1 / 4; grid-column: 2; color: var(--copper); font: 400 1.75rem var(--serif); }
.history-entry small { color: var(--muted); font-size: .64rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-timestamp { color: var(--teal); font: 600 .61rem var(--mono); letter-spacing: .015em; }
.privacy-note { margin: 15px 0 0; color: var(--muted); font-size: .69rem; }

.entropy-note { margin-bottom: 85px; padding: 31px; display: grid; grid-template-columns: 64px minmax(220px,.7fr) minmax(300px,1.3fr); align-items: center; gap: 28px; color: #e6edf0; background: var(--night); box-shadow: var(--shadow); }
.entropy-note .eyebrow { margin-bottom: 5px; color: #70b8ac; }
.entropy-note h2 { margin: 0; font: 400 1.65rem var(--serif); }
.entropy-note > p { margin: 0; color: #aab5bd; font-size: .78rem; }
.entropy-icon { width: 62px; height: 62px; padding: 12px; display: flex; align-items: end; gap: 5px; border: 1px solid rgba(255,255,255,.16); }
.entropy-icon span { width: 8px; background: var(--copper-bright); animation: signal 1.25s ease-in-out infinite alternate; }
.entropy-icon span:nth-child(1) { height: 40%; }
.entropy-icon span:nth-child(2) { height: 90%; animation-delay: -.4s; }
.entropy-icon span:nth-child(3) { height: 62%; animation-delay: -.8s; }
@keyframes signal { to { height: 25%; opacity: .55; } }

footer { width: min(1180px, calc(100% - 40px)); min-height: 76px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font: .62rem var(--mono); }

@media (max-width: 900px) {
    .hero { min-height: 440px; grid-template-columns: minmax(0,1fr) 280px; gap: 20px; }
    .quick-dice { grid-template-columns: repeat(4,1fr); }
    .quick-rolls { grid-template-columns: repeat(2,1fr); }
    .roll-workspace, .session-layout { grid-template-columns: 1fr; }
    .quick-section { grid-row: 1; }
    .roller-stack { min-width: 0; display: block; grid-column: 1; grid-row: 2; }
    .result-panel { z-index: 12; top: 8px; margin: 0 0 38px; max-height: min(48vh,420px); box-shadow: 0 18px 45px rgba(16,25,35,.22); }
    .roller-section { padding-top: 52px; }
    .notation-guide-grid { grid-template-columns: 1fr; }
    .entropy-note { grid-template-columns: 64px 1fr; }
    .entropy-note > p { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
    .site-header { min-height: 70px; padding: 10px 0; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; }
    .menu-toggle { display: inline-flex; }
    .site-header #site-nav { grid-column: 1 / -1; width: 100%; padding: 8px; display: none; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
    .site-header #site-nav[data-open="true"] { display: grid; }
    .site-header #site-nav a { min-height: 40px; padding: 8px; display: grid; place-items: center; border: 1px solid var(--line); text-align: center; }
    .site-header .language-switch { grid-column: auto; grid-row: 1; width: auto; padding: 2px; display: inline-flex; box-shadow: none; }
    .site-header .language-switch a { min-height: 34px; padding: 4px 6px; border: 0; }
    .hero { min-height: 0; padding: 65px 0 75px; display: block; }
    .hero-die { width: 230px; margin: 25px auto -40px; opacity: .92; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .quick-presets { padding: 13px; }
    .quick-dice { grid-template-columns: repeat(4,1fr); }
    .quick-rolls { grid-template-columns: 1fr 1fr; }
    .dice-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .entropy-note { grid-template-columns: 1fr; }
    .entropy-note > p { grid-column: auto; }
    footer { padding: 20px 0; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 458px) {
    .site-header, .hero, .roll-workspace, .history-section, .entropy-note, footer { width: min(100% - 24px, 1180px); }
    .site-header { gap: 10px; }
    .brand small { display: none; }
    .site-header #site-nav { gap: 5px; }
    .site-header #site-nav a { font-size: .68rem; }
    h1 { font-size: clamp(2.35rem, 13vw, 3.25rem); }
    .hero { padding-top: 48px; }
    .hero-die { width: 190px; }
    .hero-facts { gap: 5px; }
    .hero-facts span { padding: 5px 6px; font-size: .53rem; }
    .quick-section { padding-top: 30px; }
    .quick-dice { grid-template-columns: repeat(3,1fr); }
    .quick-rolls { grid-template-columns: 1fr; }
    .quick-rolls button { min-height: 57px; }
    .roller-section, .history-section { padding: 55px 0; }
    .dice-builder { padding: 13px; }
    .dice-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
    .dice-choice { padding-inline: 8px; }
    .stepper { grid-template-columns: 40px minmax(38px,1fr) 40px; }
    .stepper button { min-width: 40px; }
    .options-grid { grid-template-columns: 1fr; }
    .formula-bar { align-items: flex-start; flex-direction: column; gap: 4px; }
    .formula-bar code { text-align: left; }
    .advanced-row { grid-template-columns: 1fr; }
    .advanced-row label { grid-column: auto; }
    .advanced-row button { min-height: 43px; }
    .advanced-entry-head { align-items: flex-start; }
    .advanced-entry-head > div { align-items: flex-start; flex-direction: column; gap: 2px; }
    .success-rule-copy { align-items: flex-start; flex-direction: column; gap: 2px; }
    .success-rule-row { grid-template-columns: minmax(0,1fr) minmax(82px,.55fr); }
    .explosion-rule-row { grid-template-columns: 1fr; }
    .success-rule-actions { grid-column: 1 / -1; }
    .success-rule-actions button { flex: 1; }
    .notation-manual > summary { padding: 14px 16px; }
    .notation-manual > summary span { display: inline; }
    .notation-manual > summary small { margin: 3px 0 0; display: block; }
    .notation-guide { padding: 12px; }
    .notation-pattern code { font-size: .62rem; }
    .notation-parts div { grid-template-columns: 65px minmax(0,1fr); }
    .notation-examples { grid-template-columns: 1fr; }
    .result-topline { padding: 0 13px; }
    .result-heading { gap: 7px; }
    .result-heading time { max-width: 205px; font-size: .53rem; }
    .result-heading time::before { margin-right: 7px; }
    .result-total { min-height: 126px; }
    .result-value { font-size: 4.2rem; }
    .result-figures { gap: 17px; }
    .result-success-pips { min-width: 82px; padding-left: 16px; }
    .result-success-pips b { font-size: 1.85rem; }
    .result-dice { padding: 17px; }
    .result-die { width: 44px; height: 44px; }
    .result-panel { top: 4px; max-height: min(52vh,390px); }
    .session-stats { grid-template-columns: 1fr; }
    .session-stats div, .session-stats div:nth-child(2n), .session-stats div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
    .session-stats div:last-child { border-bottom: 0; }
    .history-entry { grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; }
    .entropy-note { margin-bottom: 55px; padding: 23px; gap: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
