:root{color-scheme:dark;--ember:#f08a38;--paper:#ede3d0;--muted:#b6aba0;--line:rgba(220,190,150,.2)}
*{box-sizing:border-box}body{margin:0;background:#0b0a0d;color:var(--paper);font:14px "Dice Numerals",sans-serif}button,input,select{font:inherit}button,a,input,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:disabled{cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid #ffad68;outline-offset:5px}button{color:inherit}a{color:inherit}button.quiet{border:0;background:none;padding:8px 12px;color:#c5bcb0;font-size:12px}button.quiet:hover:not(:disabled){color:white}.masthead{height:88px;max-width:1780px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:0 48px}.brand{display:inline-flex;gap:10px;align-items:center;min-height:44px;border-radius:4px;text-decoration:none;color:#f6efe4;white-space:nowrap}.brand img{display:block;flex:none;width:48px;height:48px;object-fit:contain}.brand-copy{display:grid;gap:4px}.brand-wordmark{font:800 18px/1 "RollBerry Brand","Dice Numerals",sans-serif;letter-spacing:.025em;text-transform:uppercase}.brand .lab{font-size:10px;line-height:1.2;font-weight:400;letter-spacing:.5px;color:#b7ab9d}.header-right{display:flex;gap:15px;align-items:center}main{max-width:1780px;margin:auto;padding:0 28px}.theatre{height:calc(100svh - 144px);min-height:680px;max-height:1040px;position:relative;isolation:isolate;overflow:hidden;border:1px solid #46372f;border-radius:5px;background:#141014;box-shadow:0 28px 80px #0008}.environment,.vignette{position:absolute;inset:0;pointer-events:none}.environment{background-image:url('./media/c45b96902ae5fd94b30b7ad8.png');background-size:cover;background-position:center 58%;z-index:-4;filter:saturate(.74) brightness(.82)}.vignette{background:radial-gradient(ellipse at 50% 52%,transparent 18%,#0b080b36 65%,#0b080ba6 100%),linear-gradient(180deg,#09080c8a,transparent 34%,transparent 63%,#0b080bf0 99%);z-index:-3}.stage-corner{position:absolute;top:28px;color:#c2ab8d;font-size:11px;z-index:5;display:flex;gap:10px}.stage-corner.left{left:32px;display:grid;gap:7px}.stage-corner .tiny{font-size:8px;letter-spacing:2.7px;color:#968b7d}.stage-corner.left>span+span{font-family:"Display",serif;font-size:18px;letter-spacing:.3px}.stage-corner.right{right:32px;align-items:center}.status-dot{width:4px;height:4px;border-radius:50%;background:#f0b575;box-shadow:0 0 9px #eda86c80}.heading{position:absolute;top:58px;left:15%;right:15%;text-align:center;pointer-events:none;z-index:3}.eyebrow{font-size:9px;letter-spacing:3.6px;color:#b5a18b;font-weight:500;margin:0 0 16px}h1{font-family:"Display",Georgia,serif;font-size:clamp(28px,2.35vw,43px);font-weight:400;line-height:1.3;letter-spacing:.25px;margin:0;color:#f3e9d7;text-shadow:0 2px 15px #0008}.heading-rule{display:flex;gap:16px;align-items:center;justify-content:center;margin:20px 0 0}.heading-rule>span{height:1px;width:60px;background:linear-gradient(90deg,transparent,#ae875870)}.heading-rule>span:last-child{transform:rotate(180deg)}.heading-rule svg{width:12px;height:17px;fill:none;stroke:#b7996b;stroke-width:.7}.target{position:absolute;left:50%;top:195px;transform:translateX(-50%);display:grid;text-align:center;gap:5px;color:#e1c6a1;z-index:4}.target[hidden]{display:none}.target span{font-size:8px;letter-spacing:2px}.target b{font-family:"Display",serif;font-size:25px;font-weight:400}.halo{position:absolute;width:500px;height:330px;border-radius:50%;top:38%;left:50%;transform:translate(-50%,-20%);background:radial-gradient(ellipse,#d2732333,transparent 66%);filter:blur(36px);z-index:-1;opacity:.45;pointer-events:none}.dice{position:absolute;inset:0;z-index:1;pointer-events:none}.dice canvas{display:block;width:100%;height:100%;transition:opacity .5s}.readout{position:absolute;bottom:76px;left:20%;right:20%;text-align:center;z-index:4;pointer-events:none}.readout>button{pointer-events:auto}.state-line{color:#cebea9;font-size:12px;letter-spacing:.4px;min-height:18px;margin:0 0 9px}.result-line{display:flex;gap:16px;align-items:center;justify-content:center;min-height:51px;margin:-18px 0 2px}.result-line[hidden]{display:none}.result-label{font-family:"Display",serif;font-size:24px;font-weight:400;color:#f1d1a7;letter-spacing:.6px}.result-line strong{font-family:"Dice Numerals";font-weight:400;font-size:39px;font-variant-numeric:tabular-nums;color:#fff0d3}.equation{height:20px;line-height:20px;margin:0;color:#ab9a86;font-size:12px;font-variant-numeric:tabular-nums;letter-spacing:.5px}.ornament{height:24px;display:flex;justify-content:center;align-items:center;gap:13px;margin:2px 0 8px;color:#b78c58}.ornament span{width:104px;height:1px;background:linear-gradient(90deg,transparent,#9b754444)}.ornament span:last-child{transform:rotate(180deg)}.ornament i{font-style:normal;font-size:5px}.roll{position:relative;min-width:250px;height:54px;border:1px solid #c3955d;border-radius:3px;background:linear-gradient(180deg,#714625dd,#41291ee8);box-shadow:inset 0 0 0 3px #38271c,inset 0 0 0 4px #a8793f55,0 5px 22px #0008;color:#f4e1c3;display:inline-flex;align-items:center;justify-content:center;gap:15px;font-size:12px;letter-spacing:1.2px;transition:background .2s,box-shadow .2s}.roll:hover:not(:disabled){background:linear-gradient(180deg,#965b2c,#583720);box-shadow:inset 0 0 0 3px #38271c,inset 0 0 0 4px #bd8c4c88,0 0 30px #df8d2530}.roll:active:not(:disabled){transform:translateY(1px)}.roll svg{height:22px;width:22px;stroke:#edc38b;fill:none;stroke-width:.9}.roll kbd{font-family:inherit;color:#b49a75;font-size:13px;margin-left:10px}.roll:disabled{opacity:.5}.roll-hint{font-size:9px;letter-spacing:.7px;color:#9c8f80;margin:13px 0 0}.scene-footer{position:absolute;z-index:5;bottom:22px;left:32px;right:32px;display:flex;justify-content:space-between;align-items:center;color:#aa9785;font-size:10px}.scene-footer>span{letter-spacing:1.5px;min-width:110px}.tempo-control{display:flex;gap:5px;border:1px solid #83624044;border-radius:30px;padding:3px;background:#17101470}.tempo-control button{border:0;border-radius:25px;padding:7px 15px;background:none;color:#a08f7e;font-size:10px}.tempo-control button[aria-pressed=true]{background:#61432b60;color:#e9ceb0}.sound{border:0;background:none;font-size:10px;color:#a89682;min-width:110px;text-align:right;padding:8px 0}.sound[aria-pressed=true]{color:#e0c097}.settings{position:absolute;z-index:10;right:18px;top:18px;width:300px;background:#171218f5;backdrop-filter:blur(25px);border:1px solid #735434;border-radius:5px;padding:22px;box-shadow:0 20px 90px #000c}.settings[hidden]{display:none}.settings-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.settings h2{font-family:"Display";font-size:17px;font-weight:400;margin:0}.settings label{display:grid;gap:8px;margin-bottom:20px;color:#b9aa99;font-size:11px}.settings select,.settings input{height:38px;border:1px solid #614d40;border-radius:3px;padding:0 10px;background:#100e13;color:#eee1d0;width:100%;min-width:0}.input-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}.settings-note{line-height:1.7;font-size:10px;color:#a59482}.apply{background:#83512c;border:1px solid #bd8d50;border-radius:3px;width:100%;padding:12px;margin-top:12px;font-size:12px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.landing-flash{position:absolute;inset:0;z-index:2;pointer-events:none;opacity:0;background:radial-gradient(ellipse at 50% 51%,#ffe3a815,transparent 35%)}.theatre[data-phase=rolling] .halo{opacity:.8}.theatre[data-phase=result] .result-line{animation:reveal .4s ease-out both}.theatre[data-phase=result] .equation{animation:reveal .45s .1s ease-out both}.theatre[data-phase=result] .landing-flash{animation:flash .7s ease-out both}.theatre[data-phase=result][data-natural=true] .result-label{color:#ffd58d}.theatre[data-phase=result][data-natural=true] .landing-flash{background:radial-gradient(ellipse at 50% 51%,#ffd48c44,transparent 45%)}@keyframes reveal{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}@keyframes flash{0%{opacity:0}20%{opacity:1}100%{opacity:0}}.fallback-die{position:absolute;left:50%;top:47%;transform:translate(-50%,-50%);font-size:76px;color:#f4d2a5}
@media(max-height:850px){.theatre{min-height:540px}.masthead{height:70px}.theatre{height:calc(100svh - 120px)}.heading{top:36px}.heading h1{font-size:30px}.heading .eyebrow{font-size:8px;margin-bottom:11px}.heading-rule{margin-top:13px}.target{top:147px}.readout{bottom:59px}.state-line{font-size:11px}.ornament{height:13px;margin:0 0 6px}.roll{height:46px}.roll-hint{margin-top:10px}.result-label{font-size:21px}.result-line strong{font-size:32px}.result-line{min-height:39px;margin:-13px 0 0}.scene-footer{bottom:16px}}
@media(max-width:800px){.masthead{padding:0 20px;height:70px}.brand{gap:8px}.brand img{width:36px;height:36px}.brand-wordmark{font-size:15px}.header-right{gap:4px}.header-right .quiet{font-size:10px;padding:8px}.brand .lab{font-size:9px}main{padding:0 12px}.theatre{min-height:620px;height:calc(100svh - 120px)}.heading{left:3%;right:3%;top:90px}.heading h1{font-size:27px}.stage-corner{top:22px}.stage-corner.left{left:20px}.stage-corner.right{right:20px;font-size:9px}.stage-corner.left>span+span{font-size:15px}.readout{left:4%;right:4%;bottom:90px}.target{top:195px}.roll{min-width:240px}.scene-footer{left:16px;right:16px;bottom:16px;flex-wrap:wrap;gap:12px}.scene-footer>span,.sound{min-width:70px;font-size:9px}.tempo-control{order:3;width:100%;justify-content:center;border:0;background:none}.tempo-control button{padding:6px 15px}.result-label{font-size:21px}.result-line strong{font-size:33px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}.no-motion *, .no-motion *:before,.no-motion *:after{animation:none!important;transition:none!important}
@media(max-width:800px){.target{top:230px}}
.environment{filter:saturate(.3) brightness(.43) blur(3px)}.halo,.landing-flash{display:none!important}.theatre[data-phase=result] .result-line,.theatre[data-phase=result] .equation{animation-duration:.25s}.heading h1{font-size:clamp(27px,2.1vw,38px)}

.dice canvas{transition:none!important}.environment{filter:saturate(.3) brightness(.43) blur(3px)}

/* Result effects remain local to the selected die; no full-screen flash. */
.die-labels{position:absolute;inset:0;z-index:3;pointer-events:none}.die-label{position:absolute;transform:translate(-50%,-100%);white-space:nowrap;padding:6px 11px;border:1px solid #a77b4550;border-radius:3px;background:#171216ce;color:#e6c694;font-size:10px;letter-spacing:.6px;box-shadow:0 3px 14px #0004}.die-label[data-kept=false]{color:#a29c96;border-color:#8c86822e;background:#141216bf}.die-label[data-kept=true]:before{content:'◆';font-size:6px;margin-right:7px;color:#eabf7d}.die-label[hidden]{display:none}
.effect-previews{grid-column:1/-1;padding:0 0 30px;border-bottom:1px solid var(--line)}.effect-previews h2{margin-top:0}.effect-previews>div{display:flex;gap:12px;flex-wrap:wrap}.effect-previews button{border:1px solid #9d784b77;border-radius:3px;background:#302319;padding:11px 16px;color:#e9cfac;font-size:12px}.effect-previews button:hover:not(:disabled){background:#4a3320}.effect-previews p{max-width:none}
@media(max-height:850px){.die-label{font-size:9px;padding:4px 8px}}
@media(max-width:800px){.die-label{font-size:9px;padding:4px 7px}}

/* Material selection stays independent of roll settings and result state. */
.design-select{appearance:none;background:transparent;border:0;border-bottom:1px solid #a1835b70;border-radius:0;color:#ddc9aa;font:400 18px "Display",serif;letter-spacing:.2px;padding:0 24px 8px 0;max-width:240px;cursor:pointer;background-image:linear-gradient(45deg,transparent 50%,#af936b 50%),linear-gradient(135deg,#af936b 50%,transparent 50%);background-position:calc(100% - 9px) 10px,calc(100% - 5px) 10px;background-size:4px 4px;background-repeat:no-repeat}
.design-select option{background:#211a1b;color:#eee0ca;font:13px "Dice Numerals",sans-serif}
.design-select:focus-visible{outline:2px solid #e8b16e;outline-offset:5px}

@media(max-width:800px){.design-select{font-size:14px;max-width:185px;padding-bottom:6px}.stage-corner.left{gap:5px}.heading{top:112px}}

.collection-select{appearance:none;border:0;background:transparent;color:#ad9b84;font:500 9px "Dice Numerals",sans-serif;letter-spacing:1.6px;text-transform:uppercase;max-width:240px;padding:0 0 5px;cursor:pointer}.collection-select option{background:#211a1b;color:#eee0ca;font-size:12px;letter-spacing:0}.collection-select:focus-visible{outline:2px solid #e8b16e;outline-offset:3px}.design-select{font-size:16px;max-width:270px}.stage-corner.left{max-width:280px}
.skins-open{width:max-content;max-width:100%;border:1px solid #b68a5877;border-radius:4px;background:#39281ecc;color:#f2d4a7;font-size:11px;letter-spacing:.25px;padding:9px 12px;margin-bottom:5px}.skins-open:hover:not(:disabled){background:#654425}
.skin-gallery{width:min(1000px,calc(100vw - 32px));max-height:calc(100svh - 48px);padding:30px;color:var(--paper);border:1px solid #8e6948;border-radius:8px;background:radial-gradient(ellipse at 0 0,#33251e,#151218 65%);box-shadow:0 30px 120px #000c;overscroll-behavior:contain}.skin-gallery::backdrop{background:#07060bc9;backdrop-filter:blur(8px)}.skin-gallery-head{display:flex;justify-content:space-between;gap:20px;align-items:start}.skin-gallery-head .eyebrow{font-size:9px;margin:0 0 10px}.skin-gallery h2{font:400 29px "Display",serif;margin:0}.skin-gallery-head .quiet{font-size:28px;padding:0 6px;line-height:1}.skin-gallery-note{color:#b9aa9a;font-size:12px;line-height:1.7;margin:14px 0 23px}.skin-tools{display:flex;gap:16px;align-items:center}.skin-tools input{min-width:0;width:100%;height:40px;border:1px solid #665142;background:#100d12;border-radius:4px;color:#efdfcb;padding:0 12px}.skin-tools span{white-space:nowrap;color:#c8a87c;font-size:11px}.skin-filters{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0 22px}.skin-filters button{background:#282026;border:1px solid #514039;border-radius:24px;padding:8px 12px;color:#b9ab9c;font-size:11px}.skin-filters button[aria-pressed=true]{background:#5a3b25;color:#f6d4a2;border-color:#bd8a4a}.skin-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.skin-card{display:flex;flex-direction:column;align-items:center;justify-content:start;min-height:200px;padding:16px 12px 18px;border:1px solid #4c3c35;border-radius:5px;background:radial-gradient(ellipse at 50% 15%,#30282c,#1a161c 75%);text-align:center}.skin-card:hover:not(:disabled){border-color:#b48a5a;background:#2c2226}.skin-card[aria-pressed=true]{outline:1px solid #e2b576;outline-offset:-4px;border-color:#e2b576}.skin-card strong{font:400 14px "Display",serif;color:#eddbc2;line-height:1.55}.skin-card-group{font-size:9px;color:#a89583;margin-top:7px;line-height:1.5}.skin-chip{display:block;position:relative;width:80px;height:90px;margin:0 0 14px;clip-path:polygon(50% 0,96% 25%,96% 75%,50% 100%,4% 75%,4% 25%);background:linear-gradient(145deg,var(--skin-edge),var(--skin-high) 33%,var(--skin-low) 80%)}.skin-chip:before{content:'';position:absolute;inset:0;opacity:.35;background:repeating-linear-gradient(122deg,transparent 0 13px,var(--skin-edge) 14px,transparent 16px 25px)}.skin-card[data-pattern="3"] .skin-chip:before{background:repeating-radial-gradient(ellipse at 10% 90%,transparent 0 6px,var(--skin-edge) 7px,transparent 9px)}.skin-card[data-pattern="6"] .skin-chip:before{background:radial-gradient(circle,var(--skin-edge) 1px,transparent 2px) 0 0/9px 11px}.skin-chip svg{position:absolute;inset:0;width:100%;height:100%;fill:none;stroke:var(--skin-ink);stroke-width:.7;opacity:.45}.skin-chip b{position:absolute;inset:33px 0 0;font:500 22px "Display",serif;color:var(--skin-ink);text-shadow:0 1px 2px #0009}.skin-gallery #skin-empty{padding:25px 0;text-align:center;color:#cbb49d}body:has(.skin-gallery[open]){overflow:hidden}
@media(max-width:1100px){.skin-gallery{width:min(900px,calc(100vw - 32px))}.skin-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.stage-corner.left{max-width:240px}}
@media(max-width:800px){.skins-open{font-size:10px;padding:7px 10px;margin-bottom:1px}.stage-corner.left{gap:4px}.heading{top:145px}.heading-rule{margin-top:12px}.target{top:244px}.skin-gallery{padding:20px 16px;max-height:calc(100svh - 24px);width:calc(100vw - 20px)}.skin-gallery h2{font-size:21px}.skin-gallery-note{font-size:11px;margin-bottom:15px}.skin-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.skin-card{min-height:176px;padding:14px 8px}.skin-card strong{font-size:11px}.skin-chip{width:65px;height:74px;margin-bottom:10px}.skin-chip b{top:26px;font-size:19px}.skin-filters{gap:6px}.skin-filters button{font-size:10px;padding:7px 9px}}
@media(max-width:800px){.design-select{font-size:12px;max-width:215px}.collection-select{font-size:8px;letter-spacing:1.1px;max-width:215px}.stage-corner.left{max-width:215px}}

.theatre[data-special=twenty] .result-line,.theatre[data-special=one] .result-line{text-shadow:0 2px 5px #000,0 0 15px #000,0 0 25px #000}

.skin-render{display:block;object-fit:contain;width:100%;max-width:190px;height:135px;margin:-8px 0 10px;border-radius:3px}.skin-card:has(.skin-render){padding-top:12px}@media(max-width:800px){.skin-render{height:106px;margin-bottom:8px}}

/* One headline above the die; one centered numerical result below it. */
.heading [hidden]{display:none}
.heading .natural-badge{position:static;margin:0;font:400 clamp(27px,2.1vw,38px)/1.3 "Display",serif;letter-spacing:.3px;color:#9de1b2;text-shadow:0 2px 15px #0009,0 0 32px #40b57830}
.theatre[data-special=one] .heading .natural-badge{color:#f1aba6;text-shadow:0 2px 15px #0009,0 0 32px #b4475430}
.theatre[data-special=twenty] .heading-rule svg{stroke:#8dd7a8}
.theatre[data-special=one] .heading-rule svg{stroke:#d68986}
.result-line{display:flex;flex-direction:column;gap:5px;min-height:0;margin:0 0 8px}
.result-line .result-label{font:500 10px/1.4 "Dice Numerals",sans-serif;letter-spacing:2.4px;text-transform:uppercase;color:#c6b39c}
.result-line strong{display:block;font:400 48px/1.05 "Display",serif;font-variant-numeric:tabular-nums;color:#f6e8d0}
.theatre[data-special=twenty] .result-line .result-label{color:#a4c7af}
.theatre[data-special=twenty] .result-line strong{color:#c0edcd}
.theatre[data-special=one] .result-line .result-label{color:#cca7a5}
.theatre[data-special=one] .result-line strong{color:#f0c5c0}
.equation{height:auto;min-height:20px;line-height:1.65}
@media(max-height:850px){.result-line{gap:2px;margin-bottom:4px}.result-line strong{font-size:36px}.result-line .result-label{font-size:9px}.heading .natural-badge{font-size:30px}}
@media(max-width:800px){.heading .natural-badge{font-size:25px}.result-line strong{font-size:36px}.result-line{gap:3px}.result-line .result-label{font-size:9px}.equation{font-size:10px}.readout{bottom:90px}}
@media(max-height:850px) and (min-width:801px){.readout{bottom:43px}}

/* Explicit names accompany rarity colours; background layers are untouched. */
.rarity-badge{display:inline-flex;align-items:center;width:max-content;color:var(--rarity-color);border:1px solid color-mix(in srgb,var(--rarity-color) 40%,transparent);border-radius:3px;padding:3px 7px;font:500 9px "Dice Numerals",sans-serif;letter-spacing:.7px;background:#100d1480}.rarity-badge:before{content:"◆";font-size:6px;margin-right:6px}.rarity-badge[hidden],.rarity-filters[hidden]{display:none}.rarity-filters{margin-top:-10px;padding-top:12px;border-top:1px solid #463a36}.rarity-filters button{color:var(--rarity-color);border-color:color-mix(in srgb,var(--rarity-color) 38%,transparent)}.rarity-filters button[aria-pressed=true]{color:var(--rarity-color);border-color:var(--rarity-color);background:#302934}.skin-card[data-tier]{border-top:2px solid var(--rarity-color)}.design-select optgroup{font:600 12px "Dice Numerals",sans-serif;color:#e8c89c;background:#211a1b}.stage-corner .rarity-badge{margin:0 0 2px}.skin-card .rarity-badge{margin-top:9px}
@media(max-width:800px){.stage-corner .rarity-badge{font-size:8px;padding:2px 6px}.rarity-filters{gap:5px}.rarity-filters button{font-size:9px}}

/* Compact controls keep the throwing surface and its lighting unobstructed. */
.roll-controls,.utility-controls{display:flex;align-items:center;gap:8px}
.scene-footer{display:grid;grid-template-columns:1fr auto 1fr}.utility-controls{justify-self:end}
.roll-controls label{display:block;min-width:0}
.roll-controls select{height:36px;max-width:142px;border:1px solid #8b705642;border-radius:4px;background:#171216b8;color:#d5c2a8;padding:0 7px;font-size:11px;cursor:pointer}
.roll-controls select option{background:#211a1b;color:#eee0ca}
.roll-controls select:disabled{opacity:.45;cursor:default}
.control-more{display:inline-flex;align-items:center;justify-content:center;flex:none;width:36px;height:36px;padding:8px;border:1px solid #8b705642;border-radius:4px;background:#171216b8;color:#baa58b}
.control-more svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round}
.control-more:hover:not(:disabled){color:#f2d3a7;border-color:#b78b58}
.control-more[data-active=true]{color:#efbf7f;border-color:#bd8a55}
.control-more:disabled{opacity:.35;cursor:default}
.utility-controls .sound{min-width:0;padding:8px 6px;white-space:nowrap;text-align:center}
.roll kbd{font-size:11px;letter-spacing:0;white-space:nowrap}
.settings{position:fixed;inset:0;margin:auto;width:min(340px,calc(100vw - 32px));max-height:calc(100svh - 32px);overflow:auto;color:var(--paper);background:#19141bf5}
.settings::backdrop,.preview-dialog::backdrop{background:#07060bb8;backdrop-filter:blur(5px)}
.settings .quiet,.preview-dialog .quiet{min-width:36px;min-height:36px;font-size:24px;padding:0 6px}
.settings label{margin-bottom:16px}.settings-top{margin-bottom:16px}
.settings-reset{display:block;margin:12px auto 0;min-height:32px;padding:7px 5px;border:0;border-radius:3px;background:none;color:#c1ad94;font-size:11px;text-decoration:underline;text-underline-offset:3px}
.settings-reset:hover:not(:disabled){color:#f0d1aa;background:#61432b25}
.settings-reset-note{margin:4px 0 0;color:#aa9c8c;font-size:10px;line-height:1.5;text-align:center}
.preview-dialog{width:min(620px,calc(100vw - 32px));max-height:calc(100svh - 32px);padding:26px;border:1px solid #735434;border-radius:6px;background:#19141bf5;color:var(--paper);box-shadow:0 20px 90px #000c;overscroll-behavior:contain}
.preview-dialog .effect-previews{padding:0;border:0}
.preview-dialog h2{margin:0;font:400 24px "Display",serif}
.preview-dialog p{color:#bcae9c;font-size:12px;line-height:1.7;margin:0 0 20px}
.preview-dialog .effect-previews>div:not(.settings-top){display:grid;grid-template-columns:1fr 1fr;gap:9px}
.preview-dialog .effect-previews button:not(.quiet){text-align:left;font-size:11px;padding:12px;min-height:42px}
body:has(.settings[open]),body:has(.preview-dialog[open]){overflow:hidden}
@media(max-height:850px) and (min-width:801px){.scene-footer{bottom:8px}.roll-controls select,.control-more{height:32px}.control-more{width:32px;padding:6px}}
@media(max-width:800px){.scene-footer{display:grid;grid-template-columns:1fr auto;gap:7px;bottom:12px}.roll-controls,.utility-controls{gap:4px}.roll-controls select{height:32px;padding:0 4px;font-size:10px;max-width:105px}.control-more{width:32px;height:32px;padding:6px}.utility-controls .sound{padding:7px 2px;font-size:9px}.tempo-control{grid-column:1/-1;order:initial;width:auto;justify-self:center;padding:0}.tempo-control button{min-height:30px;padding:6px 12px}.preview-dialog{padding:20px 16px}.preview-dialog h2{font-size:21px}.preview-dialog .effect-previews button:not(.quiet){font-size:10px}.roll kbd{display:none}}
@media(max-width:800px){.roll-controls{grid-area:1/1}.utility-controls{grid-area:1/2}.tempo-control{grid-row:2}}
@media(max-width:360px){.scene-footer{left:12px;right:12px}.utility-controls .sound{font-size:0;width:28px;min-height:32px;background:center/18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23baa58b' stroke-width='1.4'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3ZM16 8a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14'/%3E%3C/svg%3E")}.utility-controls .sound[aria-pressed=false]{opacity:.55}}
@media(max-width:360px){.theatre{min-height:680px}}

/* The collection name is an explicit switch, not a static eyebrow label. */
.collection-select{height:32px;width:260px;max-width:100%;padding:0 28px 0 9px;border:1px solid #8b70565c;border-radius:4px;background-color:#171216b8;color:#d5c2a8;font-size:10px;letter-spacing:.3px;text-transform:none;background-image:linear-gradient(45deg,transparent 50%,#c5a67f 50%),linear-gradient(135deg,#c5a67f 50%,transparent 50%);background-position:calc(100% - 13px) 14px,calc(100% - 9px) 14px;background-size:4px 4px;background-repeat:no-repeat}
.collection-select:hover:not(:disabled){border-color:#bb8b54;color:#f0d1aa}
@media(max-width:800px){.collection-select{width:215px;height:30px}}

/* A target replaces the eyebrow in the heading, leaving the dice area clear. */
.heading .target{position:static;transform:none;display:flex;align-items:center;justify-content:center;gap:8px;height:10px;margin:0 0 16px}
.heading .target[hidden]{display:none}.heading .target span{font-size:9px}.heading .target b{font:500 16px/1 "Dice Numerals",sans-serif;color:#f0d1a7}
@media(max-height:850px){.heading .target{margin-bottom:11px}}
@media(max-width:360px){.heading-rule{display:none}}

/* The rarity control replaces the static badge and filters the design list. */
.rarity-select{width:max-content;max-width:100%;height:24px;padding:0 25px 0 8px;font-size:9px;color:var(--rarity-color);border-color:color-mix(in srgb,var(--rarity-color) 38%,transparent);background-position:calc(100% - 13px) 10px,calc(100% - 9px) 10px}
.rarity-select:hover:not(:disabled){color:var(--rarity-color);border-color:var(--rarity-color)}
.rarity-select[hidden]{display:none}

/* Real W20 renders in native pickers; unsupported browsers keep text selects. */
.design-select:disabled{cursor:default;background-image:none}
@supports (appearance:base-select){
 .visual-select,.visual-select::picker(select){appearance:base-select}
 .visual-select{background-image:none;padding-right:9px;gap:8px;align-items:center}
 .visual-select>button{display:contents}
 .visual-select selectedcontent{display:flex;align-items:center;gap:7px;min-width:0;overflow:hidden;white-space:nowrap}
 .visual-select selectedcontent .option-name{overflow:hidden;text-overflow:ellipsis}
 .visual-select selectedcontent .option-die{display:none}
 .design-select.visual-select{height:30px;width:260px;max-width:100%;padding:0 5px 3px 0;font-size:15px}
 .design-select.visual-select selectedcontent .option-die{display:block;width:30px;height:26px;object-fit:cover;border-radius:3px}
 .visual-select::picker-icon{color:#c5a67f;font-size:10px}
 .visual-select:disabled::picker-icon{visibility:hidden}
 .visual-select:open::picker-icon{rotate:180deg}
 .visual-select::picker(select){min-width:280px;width:320px;max-width:calc(100vw - 32px);max-height:min(430px,65svh);margin:6px 0;padding:5px;border:1px solid #8f6c43;border-radius:7px;background:#19151b;color:#e6d8c4;box-shadow:0 16px 42px #000b;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#806547 #19151b}
 .visual-select option{display:flex;align-items:center;gap:12px;min-height:66px;padding:6px 10px;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--option-color,#dfd0bb);font:400 12px "Dice Numerals",sans-serif;letter-spacing:.1px;white-space:normal;cursor:pointer}
 .visual-select option .option-die{display:block;flex:none;width:72px;height:62px;object-fit:cover;border-radius:4px}
 .visual-select option .option-name{flex:1;line-height:1.45}
 .visual-select option:checked{border-color:#bd925761;background:#3b2d2280}
 .visual-select option:hover:not(:disabled),.visual-select option:focus{outline:none;border-color:#b78f59;background:#4b352e}
 .visual-select option::checkmark{order:3;margin-left:auto;color:#f0c27d;font-size:15px}
 @media(max-width:800px){.design-select.visual-select{width:215px;height:25px;font-size:12px}.design-select.visual-select selectedcontent .option-die{width:26px;height:22px}.visual-select::picker(select){width:280px}.visual-select option{min-height:62px}}
}

/* Gallery-only quick actions: sibling buttons keep selection and bookmarking separate. */
.skin-item{position:relative;min-width:0}
.skin-item>.skin-card{width:100%;height:100%}
.skin-favorite{position:absolute;right:5px;top:5px;display:grid;place-items:center;width:36px;height:36px;padding:8px;border:1px solid transparent;border-radius:50%;background:#171217b8;color:#b2a596}
.skin-favorite svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linejoin:round}
.skin-favorite:hover:not(:disabled){border-color:#94724c;color:#f0cc8f;background:#3d2c24}
.skin-favorite[aria-pressed=true]{color:#edba70}
.skin-favorite[aria-pressed=true] svg{fill:currentColor}
.skin-favorite:focus-visible{outline:2px solid #edba70;outline-offset:2px}
.skin-filters .skin-reset{margin-left:auto;padding-inline:3px;border-color:transparent;background:none;color:#d8b789;text-decoration:underline;text-underline-offset:3px}
.skin-filters .skin-reset:hover:not(:disabled){color:#ffe1b1}
.skin-filters .skin-reset[hidden],.favorite-storage[hidden]{display:none}
.favorite-storage{font-size:11px;line-height:1.6;color:#b9aa9a;margin:14px 0 0}
@media(max-width:800px){.skin-favorite{width:40px;height:40px;right:2px;top:2px}}

/* Confirm resetting in place, with the safe action focused first. */
.settings-reset[hidden],.settings-reset-note[hidden],.settings-reset-confirmation[hidden]{display:none}
.settings-reset-confirmation{margin-top:12px;padding-top:12px;border-top:1px solid #73543466}
.settings-reset-question{margin:0 0 7px;color:#e3ceb0;font-size:12px;font-weight:500;text-align:center}
.settings-reset-confirmation strong{display:block;color:#e3ceb0;font-weight:500}
.settings-reset-actions{display:flex;justify-content:center;gap:8px;margin-top:12px}
.settings-reset-actions button{min-height:34px;padding:7px 12px;border:1px solid #73543488;border-radius:3px;background:transparent;color:#cfbda6;font-size:11px}
.settings-reset-actions button:hover:not(:disabled){border-color:#bd8d50;color:#f3dfc0}
#settings-reset-confirm{background:#61432b70;color:#ead0ad}

/* One warm chevron for every select, including native controls and text fallbacks. */
:root{--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23c5a67f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.settings select,.roll-controls select{appearance:none;padding-right:28px;background-image:var(--select-chevron);background-position:right 9px center;background-size:10px 7px;background-repeat:no-repeat}
.design-select,.collection-select{background-image:var(--select-chevron);background-position:right 9px center;background-size:10px 7px;background-repeat:no-repeat}
.design-select:disabled{background-image:none}
@supports(appearance:base-select){
 .visual-select{background-image:none}
 .visual-select::picker-icon{content:'';width:10px;height:7px;flex:none;background:var(--select-chevron) center/contain no-repeat}
}
@media(forced-colors:active){
 .settings select,.roll-controls select{appearance:auto;background-image:none}
 .visual-select::picker-icon{content:'⌄';height:auto;background:none;color:ButtonText}
}

/* The current skin can be bookmarked without leaving the dice table. */
.design-choice{display:flex;align-items:center;gap:6px;width:260px;max-width:100%}
.design-choice>.design-select{flex:1;min-width:0;width:0;max-width:none}
.design-favorite{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:7px;border:0;border-radius:4px;background:transparent;color:#b2a596}
.design-favorite svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linejoin:round}
.design-favorite:hover:not(:disabled){color:#f0cc8f;background:#61432b30}
.design-favorite[aria-pressed=true]{color:#edba70}
.design-favorite[aria-pressed=true] svg{fill:currentColor}
.design-favorite:focus-visible{outline:2px solid #edba70;outline-offset:1px}
@media(max-width:800px){.design-choice{width:215px}.theatre:has(.rarity-select:not([hidden])) .heading{top:157px}}

/* Shared interaction states: quiet at rest, warm on intent, clear when unavailable. */
:root{
 --ui-focus:#e5b77a;--ui-hover:#f0d1aa;--ui-border-hover:#b78b58;--ui-hover-surface:#61432b30;
 --ui-muted:#b6a38d;--ui-disabled-opacity:.5;--ui-scroll-thumb:#806547;--ui-scroll-track:#19151b;
 --ui-close:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 4 8 8m0-8-8 8' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
html,dialog{scrollbar-color:var(--ui-scroll-thumb) var(--ui-scroll-track);scrollbar-width:thin}
@supports(appearance:base-select){.visual-select::picker(select){scrollbar-color:var(--ui-scroll-thumb) var(--ui-scroll-track)}}
::selection{background:#755032;color:#fff0d3}
input{caret-color:var(--ui-focus)}
.settings input::placeholder,.skin-tools input::placeholder{color:#a99b8c;opacity:1}
.settings select:not(:disabled){cursor:pointer}
:is(.settings select,.settings input,.skin-tools input,.roll-controls select):hover:not(:disabled){border-color:var(--ui-border-hover)}
:is(.design-select,.collection-select):hover:not(:disabled){color:var(--ui-hover);border-color:var(--ui-border-hover)}
.rarity-select:hover:not(:disabled){color:var(--rarity-color);border-color:var(--rarity-color)}
button.quiet{border-radius:4px}
button.quiet:hover:not(:disabled),.sound:hover:not(:disabled),.tempo-control button:hover:not(:disabled){color:var(--ui-hover);background-color:var(--ui-hover-surface)}
.tempo-control button[aria-pressed=true]{color:#e9ceb0;background-color:#61432b60}
.tempo-control button[aria-pressed=true]:hover:not(:disabled){background-color:#79523170}
.apply:hover:not(:disabled){background:#956033;border-color:var(--ui-focus)}
.settings-reset:hover:not(:disabled),.skin-filters .skin-reset:hover:not(:disabled){color:var(--ui-hover);background-color:var(--ui-hover-surface)}
.settings-reset-actions button:hover:not(:disabled){color:var(--ui-hover);border-color:var(--ui-border-hover)}
#settings-reset-confirm:hover:not(:disabled){background:#79523170}
.skin-filters :where(button:not(.skin-reset)):hover:not(:disabled){color:var(--ui-hover);border-color:var(--ui-border-hover);background:#3a2c27}
.skin-filters button[aria-pressed=true]:hover:not(:disabled){background:#6a472b}
.rarity-filters button:hover:not(:disabled){color:var(--rarity-color);border-color:var(--rarity-color)}
.rarity-filters button[aria-pressed=true]:hover:not(:disabled){background:#443344}
.skin-card[aria-pressed=true]{outline:none;box-shadow:inset 0 0 0 3px #19151b,inset 0 0 0 4px #e2b576}
.skin-favorite:hover:not(:disabled),.design-favorite:hover:not(:disabled){color:var(--ui-hover);background-color:var(--ui-hover-surface)}
.dialog-close.quiet{display:grid;place-items:center;flex:none;width:36px;height:36px;min-width:36px;min-height:36px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--ui-muted)}
.dialog-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
.dialog-close.quiet:hover:not(:disabled){color:var(--ui-hover);background:var(--ui-hover-surface)}
.skin-tools input[type=search]::-webkit-search-cancel-button{appearance:none;width:20px;height:20px;margin-left:8px;background:var(--ui-muted);mask:var(--ui-close) center/16px no-repeat;cursor:pointer}
.skin-tools input[type=search]::-webkit-search-cancel-button:hover:not(:disabled){background:var(--ui-hover)}

.brand:hover:not(:disabled),.brand:hover:not(:disabled) .lab{color:var(--ui-hover)}

button:disabled,input:disabled,select:disabled{cursor:default}
.roll:disabled,.control-more:disabled,button.quiet:disabled,.settings :is(select,input):disabled,.roll-controls select:disabled,.design-select:disabled,.design-favorite:disabled{opacity:var(--ui-disabled-opacity)}
.roll:disabled{cursor:wait}
/* A selection mark must never replace keyboard focus (especially the current gallery card). */
:is(button,a,input,select,summary,.skin-card,.design-select,.collection-select,.skin-favorite,.design-favorite):focus-visible{outline:2px solid var(--ui-focus);outline-offset:2px}
@media(max-width:360px){
 .utility-controls .sound{display:grid;place-items:center;background-image:none}
 .utility-controls .sound[aria-pressed=false]{opacity:1}
 .utility-controls .sound::before{content:'';width:18px;height:18px;background:currentColor;mask:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3ZM16 8a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14' fill='none' stroke='black' stroke-width='1.4'/%3E%3C/svg%3E")}
 .utility-controls .sound[aria-pressed=false]::before{mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3Zm13 0 6 6m0-6-6 6' fill='none' stroke='black' stroke-width='1.4'/%3E%3C/svg%3E")}
}
@media(forced-colors:active){
 :root{--ui-focus:Highlight;--ui-hover:Highlight;--ui-border-hover:Highlight;--ui-muted:ButtonText;--ui-hover-surface:Canvas;--ui-scroll-thumb:auto;--ui-scroll-track:auto}
 html,dialog{scrollbar-color:auto}
 button:disabled,input:disabled,select:disabled{color:GrayText!important;opacity:1!important}
 .skin-card[aria-pressed=true]{border-color:Highlight}

.skin-tools input[type=search]::-webkit-search-cancel-button,.utility-controls .sound::before{forced-color-adjust:none;background:ButtonText}
}

/* Compact third-party credits stay outside the throwing surface. */
.page-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 22px;min-height:55px;padding:12px 8px;color:#a39484;font-size:9px;line-height:1.6;letter-spacing:.1px}
.page-footer span{white-space:nowrap}
.page-footer a{border-radius:2px;text-decoration-color:#a3948466;text-underline-offset:3px}
.page-footer a:hover{color:var(--ui-hover);text-decoration-color:currentColor}
@media(max-width:800px){.page-footer{column-gap:16px}}

/* Keep the chamber, result and touch controls in their own rows. */
@media (max-width: 800px) {
  .masthead { height: 56px; padding-inline: 12px; }
  .header-right .quiet { min-height: 44px; }
  main { padding-inline: 8px; }
  .theatre {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(175px, 1fr) auto auto;
    height: auto;
    min-height: calc(100svh - 92px);
    max-height: none;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  }
  .stage-corner.left, .stage-corner.right, .heading, .readout, .scene-footer { position: relative; inset: auto; }
  .stage-corner.left { grid-area: 1 / 1; width: min(100%, 250px); max-width: none; }
  .stage-corner.right { grid-area: 1 / 2; align-self: start; margin: 12px 0 0 8px; }
  .stage-corner.left select, .stage-corner.left .design-choice { width: 100%; max-width: 100%; }
  .stage-corner.left select, .skins-open { min-height: 34px; }
  .stage-corner.left .design-select { padding-right: 44px; }
  .stage-corner.left .skin-favorite { width: 44px; height: 44px; top: 50%; transform: translateY(-50%); }
  .heading, .theatre:has(.rarity-select:not([hidden])) .heading { grid-area: 2 / 1 / 3 / -1; top: auto; margin-top: 8px; }
  .heading h1 { font-size: clamp(20px, 5vw, 27px); }
  .heading .eyebrow, .heading-rule { display: none; }
  .heading .target { margin-bottom: 4px; }
  .dice, .die-labels { grid-area: 3 / 1 / 4 / -1; }
  .dice { position: relative; inset: auto; min-width: 0; min-height: 0; }
  .dice canvas { position: absolute; inset: 0; }
  .fallback-die { font-size: clamp(38px, 15vw, 68px); white-space: nowrap; }
  .readout { grid-area: 4 / 1 / 5 / -1; }
  .readout .ornament { display: none; }
  .readout .roll { min-height: 46px; }
  .readout .roll-hint { margin-block: 7px; }
  .scene-footer {
    grid-area: 5 / 1 / 6 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 6px;
    margin-top: 4px;
    padding-top: 5px;
    border-top: 1px solid #765f4d66;
  }
  .roll-controls { min-width: 0; }
  .roll-controls label { min-width: 0; }
  .roll-controls select { min-height: 44px; max-width: 100%; font-size: 16px; }
  .scene-footer .control-more { flex: 0 0 44px; width: 44px; height: 44px; }
  .utility-controls .sound { min-height: 44px; min-width: 44px; }
  .tempo-control button { min-height: 44px; }
  .skin-gallery, .settings, .preview-dialog { max-height: calc(100dvh - 24px); }
  .skin-tools input, .settings input, .settings select { font-size: 16px; }
  .dialog-close, .apply { min-width: 44px; min-height: 44px; }
}
@media (max-width: 360px) {
  .scene-footer .roll-controls {
    grid-area: 1 / 1 / 2 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 44px;
  }
  .scene-footer .roll-controls select { width: 100%; padding-right: 22px; }
  .scene-footer .tempo-control { grid-area: 2 / 1; justify-self: start; }
  .scene-footer .tempo-control button { padding-inline: 7px; }
  .scene-footer .utility-controls { grid-area: 2 / 2; }
  .scene-footer .sound { min-width: 44px; width: 44px; }
  .stage-corner.right { font-size: 8px; }
}

.dice-area, .appearance-options { display: contents; }
.appearance-options > summary, .roll-on-die { display: none; }

@media (max-width: 800px) and (pointer: coarse),
       (max-width: 1024px) and (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  body {
    --mobile-bg: #0c1013;
    --mobile-surface: #1b2228;
    --mobile-line: #363f46;
    --mobile-text: #f4f7f8;
    --mobile-muted: #b7c1c8;
    --mobile-accent: #aff2de;
    background: var(--mobile-bg);
    color: var(--mobile-text);
    font: 1rem/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  }
  .masthead {
    height: auto;
    min-height: 60px;
    padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    gap: 8px;
  }
  .masthead .brand { gap: 9px; color: var(--mobile-text); }
  .masthead .brand img { width: 34px; height: 34px; }
  .masthead .brand-wordmark { display: none; }
  .masthead .brand .lab {
    font: 700 clamp(1.4rem, 7vw, 2rem)/1.08 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: inherit;
    letter-spacing: -.045em;
  }
  .header-right { gap: 2px; }
  .header-right button.quiet { min-width: 44px; min-height: 44px; padding: 5px 8px; font-size: .875rem; color: var(--mobile-muted); }
  main { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .theatre {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(clamp(242px, 55svh, 540px), 1fr) auto auto auto;
    gap: 8px;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .environment, .vignette, .halo, .stage-corner.right, .heading .eyebrow, .heading-rule,
  .readout .ornament, .readout .roll, .readout .roll-hint { display: none; }
  .heading, .theatre:has(.rarity-select:not([hidden])) .heading {
    position: absolute;
    grid-area: auto;
    inset: 10px 12px auto;
    margin: 0;
    text-align: center;
  }
  .heading #stage-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .heading .target { height: auto; margin: 0; color: var(--mobile-muted); }
  .heading .natural-badge { font: 600 .9rem/1.25 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
  .dice-area {
    display: block;
    position: relative;
    grid-area: 1 / 1;
    min-width: 0;
    min-height: 0;
    border-radius: 25px;
    background: radial-gradient(ellipse at 50% 44%, #263d3b 0%, #162426 42%, transparent 76%);
  }
  .dice-area .dice, .dice-area .die-labels { position: absolute; inset: 15px 0 54px; }
  .dice-area .dice canvas { position: absolute; inset: 0; }
  .fallback-die { color: var(--mobile-accent); font: 650 clamp(3.25rem, 17vw, 6rem)/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
  .roll-on-die {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    align-content: end;
    justify-items: center;
    width: 100%;
    height: 100%;
    min-height: 44px;
    border: 0;
    border-radius: inherit;
    padding: 0;
    background: transparent;
    color: #112820;
    appearance: none;
    touch-action: manipulation;
  }
  .roll-on-die span {
    display: grid;
    place-items: center;
    min-height: 44px;
    max-width: 100%;
    padding: 6px 20px;
    border-radius: 999px;
    background: var(--mobile-accent);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
  }
  .roll-on-die:active:not(:disabled) span { background: #7fcbb7; }
  .roll-on-die:focus-visible { outline: 2px solid var(--mobile-accent); outline-offset: 0; }
  .roll-on-die:disabled span, [data-phase=rolling] .roll-on-die span { background: var(--mobile-surface); color: var(--mobile-text); }
  .readout {
    grid-area: 2 / 1;
    position: relative;
    inset: auto;
    display: grid;
    place-content: center;
    min-height: 62px;
  }
  .readout .state-line { margin: 0; color: var(--mobile-muted); font: inherit; }
  .readout .result-line {
    flex-direction: row-reverse;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin: 0;
    min-height: 0;
  }
  .readout .result-line strong {
    font: 720 clamp(2rem, 9vw, 3rem)/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--mobile-text);
  }
  .readout .result-line .result-label, .readout .equation {
    color: var(--mobile-muted);
    font: .875rem/1.3 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    letter-spacing: 0;
    text-transform: none;
  }
  .readout .equation:empty { display: none; }
  .theatre[data-preview=true] .readout .roll-hint {
    display: block;
    margin: 4px 0 0;
    color: var(--mobile-muted);
    font-size: .875rem;
    letter-spacing: 0;
  }
  .scene-footer {
    grid-area: 3 / 1;
    position: relative;
    inset: auto;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .scene-footer .roll-controls {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr) 44px;
    gap: 6px;
  }
  .scene-footer .roll-controls select, .scene-footer .control-more {
    width: 100%;
    max-width: none;
    min-height: 44px;
    border: 1px solid var(--mobile-line);
    border-radius: 13px;
    background-color: var(--mobile-surface);
    color: var(--mobile-text);
    font-size: 1rem;
  }
  .scene-footer .roll-controls select { padding-inline: 12px 24px; }
  .scene-footer .control-more svg { width: 21px; height: 21px; }
  .scene-footer .control-more[data-active=true] { color: var(--mobile-accent); border-color: var(--mobile-accent); }
  .appearance-options { display: block; grid-area: 4 / 1; min-width: 0; }
  .appearance-options > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 13px;
    color: var(--mobile-muted);
    font-size: .9375rem;
    cursor: pointer;
    list-style: none;
  }
  .appearance-options > summary::-webkit-details-marker { display: none; }
  .appearance-options > summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg);
  }
  .appearance-options[open] > summary::after { transform: rotate(45deg); }
  .appearance-options > summary:active { background: var(--mobile-surface); }
  .appearance-options .stage-corner.left {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 6px;
    background: var(--mobile-surface);
    border-radius: 15px;
  }
  .appearance-options :is(.design-choice, .rarity-select) { grid-column: 1 / -1; }
  .appearance-options :is(select, .design-choice, .skins-open) { width: 100%; max-width: 100%; }
  .appearance-options :is(select, .skins-open) {
    min-height: 44px;
    margin: 0;
    border: 1px solid var(--mobile-line);
    border-radius: 10px;
    background-color: var(--mobile-bg);
    color: var(--mobile-text);
  }
  .appearance-options select { font-size: 1rem; }
  .appearance-options .skins-open { font-size: .875rem; }
  .appearance-options .skin-favorite { width: 44px; height: 44px; }
  .settings, .skin-gallery, .preview-dialog {
    max-height: calc(100dvh - env(safe-area-inset-top) - 16px);
    border: 1px solid var(--mobile-line);
    border-radius: 24px 24px 0 0;
    background: var(--mobile-surface);
    color: var(--mobile-text);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .settings, .skin-gallery, .preview-dialog {
    inset: auto 0 0;
    width: min(100%, 600px);
    max-width: 100%;
    margin: 0 auto;
  }
  .settings h2, .skin-gallery h2, .preview-dialog h2 {
    font: 700 1.3rem/1.25 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--mobile-text);
  }
  .settings label { color: var(--mobile-muted); font-size: .875rem; margin-bottom: 12px; }
  .settings :is(input, select), .skin-tools input {
    min-height: 44px;
    border-color: var(--mobile-line);
    border-radius: 10px;
    background-color: var(--mobile-bg);
    color: var(--mobile-text);
    font-size: 1rem;
  }
  .settings [data-i18n=randomNote] { display: none; }
  .settings :is(.settings-note, .settings-reset, .settings-reset-note) { color: var(--mobile-muted); }
  .settings :is(.dialog-close, .apply, .settings-reset, .settings-reset-actions button),
  .skin-gallery :is(.dialog-close, .skin-filters button, .skin-favorite),
  .preview-dialog .effect-previews button { min-height: 44px; min-width: 44px; }
  .settings .apply { border-radius: 13px; background: var(--mobile-accent); color: #112820; border: 0; font-weight: 650; }
  .mobile-preferences { display: grid; gap: 8px; margin-bottom: 12px; }
  .mobile-preferences[hidden] { display: none; }
  .mobile-preferences :is(.tempo-control, .utility-controls) {
    display: flex;
    grid-column: 1;
    order: 0;
    width: 100%;
  }
  .mobile-preferences .utility-controls { justify-content: end; }
  .mobile-preferences :is(button, .control-more) { min-height: 44px; min-width: 44px; font-size: .875rem; }
  .mobile-preferences .tempo-control { padding: 3px; border-radius: 14px; background: var(--mobile-bg); }
  .mobile-preferences .tempo-control button { flex: 1; border-radius: 11px; color: var(--mobile-muted); padding-inline: 5px; }
  .mobile-preferences .tempo-control button[aria-pressed=true] { background: var(--mobile-line); color: var(--mobile-text); }
  .page-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); color: var(--mobile-muted); }
}

@media (max-width: 1024px) and (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .masthead { min-height: 44px; }
  .masthead .brand .lab { font-size: 1.4rem; }
  .theatre {
    --landscape-side: max(172px, calc((100% - 12px) / 2.7));
    grid-template-columns: minmax(0, 1fr) var(--landscape-side);
    grid-template-rows: minmax(138px, calc(100svh - 105px)) auto;
    column-gap: 12px;
  }
  .heading, .theatre:has(.rarity-select:not([hidden])) .heading { right: 39%; }
  .dice-area {
    grid-area: 1 / 1 / 2 / -1;
    background-size: calc(100% - var(--landscape-side) - 12px) 100%;
    background-repeat: no-repeat;
  }
  .dice-area .dice, .dice-area .die-labels { inset: 6px calc(var(--landscape-side) + 12px) 0 0; }
  .roll-on-die {
    grid-template-columns: minmax(0, 1fr) var(--landscape-side);
    column-gap: 12px;
  }
  .roll-on-die span { grid-column: 2; margin-bottom: 8px; }
  .readout { grid-area: 1 / 2; padding-bottom: 52px; }
  .scene-footer { grid-area: 2 / 1; }
  .appearance-options { grid-area: 2 / 2; }
}

@font-face{font-family:"Dice Numerals";font-style:normal;font-weight:100 900;font-display:block;src:url(./media/29160a80ff49ddcab2c97711.ttf) format("truetype")}
@font-face{font-family:"Display";font-style:normal;font-weight:100 900;font-display:block;src:url(./media/f4d83d34d1f6c741193e4acf.ttf) format("truetype")}
@font-face{font-family:"RollBerry Brand";font-style:normal;font-weight:800;font-display:block;src:url(./media/767ab810e8717ff66a098868.woff2) format("woff2")}