.narration-history{max-height:220px;overflow:auto;display:grid;gap:12px}
.narration-history article{padding:12px;border:1px solid #ffffff20;border-radius:10px}
.narration-history p{white-space:pre-wrap;overflow-wrap:anywhere}
.vtt-scene-column{display:grid;gap:16px;min-width:0;align-content:start}
.vtt-roll-feed{background:#191623;border:1px solid #4c3c5c;border-radius:13px;padding:17px;min-width:0;box-shadow:0 7px 24px #08050d40}
.roll-feed-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:13px;flex-wrap:wrap}
.roll-feed-heading h2{font:600 17px 'DM Sans',sans-serif}
.roll-feed-heading p{font-size:12px;color:var(--muted);line-height:1.5;margin-top:5px}
.roll-feed-heading .check{font-size:12px;white-space:nowrap}
.roll-feed-list{display:grid;gap:9px;list-style:none;padding:0;margin:15px 0 0;max-height:440px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
.roll-feed-card{display:flex;align-items:center;justify-content:space-between;gap:15px;border:1px solid #4f3d60;border-radius:10px;padding:13px 15px;background:linear-gradient(120deg,#30213d70,#201b2a)}
.roll-feed-card.is-private{border-color:#766047;background:linear-gradient(120deg,#3b2c2370,#211b25)}
.roll-feed-info{min-width:0}.roll-feed-meta{display:flex;align-items:center;gap:9px;flex-wrap:wrap;font-size:12px}
.roll-feed-meta time{font-size:10px;color:var(--muted)}
.roll-feed-privacy{font-size:10px;padding:2px 7px;background:#443354;border-radius:20px;color:#e4c9ff}
.is-private .roll-feed-privacy{background:#554331;color:#f0d4a8}
.roll-feed-info h3{font-size:14px;margin-top:7px;overflow-wrap:anywhere}
.roll-feed-info p{font-size:12px;color:#c9bdd5;margin-top:5px;line-height:1.5;overflow-wrap:anywhere}
.roll-feed-info details{margin-top:8px;font-size:11px;color:#c4a7e3}
.roll-feed-info summary{cursor:pointer;padding:3px 0}
.roll-feed-total{font-size:32px;min-width:40px;text-align:center;color:#e1c2ff;line-height:1}
.roll-feed-empty{font-size:13px;color:var(--muted);padding:23px 0 8px}
.dice-show{position:fixed;z-index:24;top:50%;left:50%;transform:translate(-50%,-50%);width:min(720px,calc(100vw - 28px));padding:17px 22px 20px;border:1px solid #a478d1;border-radius:18px;background:radial-gradient(ellipse at 50% 0,#633e7f75,transparent 70%),#16101fef;color:#f7f0ff;box-shadow:0 12px 70px #000b,0 0 35px #a176c525;pointer-events:none;backdrop-filter:blur(10px);max-height:calc(100dvh - 24px);overflow:auto}
.dice-show[hidden]{display:none}
.dice-show-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;font-size:12px;color:#d0badf}
.dice-dismiss{pointer-events:auto;border:1px solid #9f79bf66;border-radius:8px;width:36px;height:36px;min-height:36px;background:#34243f;color:#fff;font-size:22px;cursor:pointer}
.dice-show-label{font-size:15px;font-weight:600;margin-top:3px;overflow-wrap:anywhere}
.dice-toss-area{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:10px;padding:18px 0 12px;perspective:650px;max-height:260px;overflow:hidden}
.dice-throw{width:72px;height:85px;flex:none}
.animated-die{width:72px;height:72px;position:relative;display:grid;place-items:center;filter:drop-shadow(0 8px 6px #0008);transform-style:preserve-3d}
.animated-die svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.animated-die polygon{fill:#603698;stroke:#cfadff;stroke-width:2;stroke-linejoin:round}
.animated-die path{fill:none;stroke:#c4a0eb;stroke-width:1.5;opacity:.45}
.die-face{position:relative;z-index:1;font-size:26px;font-weight:800;color:#fff;text-shadow:0 2px 3px #1b0d2c;transition:opacity .18s}
.animated-die small{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:10px;line-height:1.3;color:#d8c2ec}
.animated-die.is-discarded{opacity:.4}.animated-die.is-discarded .die-face{text-decoration:line-through}
.dice-show.is-rolling .die-face{opacity:0}
.dice-show.is-rolling .dice-throw{animation:dice-toss 1050ms var(--die-delay) cubic-bezier(.2,.65,.35,1) both}
.dice-show.is-settled .die-face{opacity:1}
.dice-show-result{text-align:center;font-size:28px;font-weight:700;margin-top:8px;color:#e4c9ff;line-height:1.4}
.dice-show.is-rolling .dice-show-result{font-size:17px;color:#c8b4d9}
.dice-extra{text-align:center;color:#c5aecf;font-size:12px;margin-top:8px}
@keyframes dice-toss{0%{transform:translate3d(var(--die-shift),-80px,-120px) rotateX(430deg) rotateY(var(--die-turn)) rotateZ(75deg);opacity:0}25%{opacity:1}48%{transform:translate3d(0,12px,0) rotateX(120deg) rotateY(130deg) rotateZ(-25deg)}70%{transform:translate3d(0,-19px,0) rotateX(35deg) rotateY(-30deg) rotateZ(10deg)}86%{transform:translate3d(0,5px,0) rotateX(-12deg) rotateY(8deg) rotateZ(-4deg)}100%{transform:translate3d(0,0,0) rotateX(0) rotateY(0) rotateZ(0);opacity:1}}
@media(max-width:730px){.vtt-roll-feed{padding:13px}.roll-feed-list{max-height:390px}.roll-feed-card{padding:12px;gap:10px}.roll-feed-total{font-size:28px}.roll-feed-heading .check{min-height:44px}.roll-feed-info summary{min-height:32px}.dice-show{padding:12px 14px 16px;top:50%}.dice-show-result{font-size:23px}.dice-throw{width:60px;height:74px}.animated-die{width:60px;height:60px}.animated-die small{top:60px}.die-face{font-size:23px}.dice-toss-area{gap:8px;max-height:250px}.dice-dismiss{width:44px;height:44px}}
@media(prefers-reduced-motion:reduce){.dice-show.is-rolling .dice-throw{animation:none}.die-face{transition:none}.dice-show{backdrop-filter:none}}



@media(max-height:500px){.dice-show{top:50%;max-height:calc(100dvh - 24px);padding:10px 14px}.dice-toss-area{padding-block:8px}.dice-show-result{font-size:20px}}

/* The canvas projects solid polyhedra; SVG remains the fallback. */
.dice-show{width:min(860px,calc(100vw - 28px));top:50%;border-color:#8b789b;background:linear-gradient(135deg,#292133f5,#141922f5)}
.dice-stage{margin-top:13px;border:1px solid #a8bdd42b;border-radius:13px;overflow:hidden;background:#18202a;box-shadow:inset 0 2px 15px #0006}
.dice-stage canvas{display:block;width:100%;height:280px}
.dice-stage canvas[hidden],.dice-toss-area[hidden]{display:none}
.dice-show-result{color:#f5dfb7;font-variant-numeric:tabular-nums;min-height:40px}
.dice-show.is-settled .dice-show-result{animation:dice-result-arrive .25s ease-out both}
@keyframes dice-result-arrive{from{opacity:.3;transform:translateY(6px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:730px){.dice-stage canvas{height:230px}.dice-stage{margin-top:9px}.dice-show{top:50%}}
@media(max-height:500px){.dice-show{top:50%}.dice-stage canvas{height:150px}.dice-stage{margin-top:4px}.dice-show-label{font-size:12px}.dice-show-result{min-height:28px;margin-top:4px}}
@media(prefers-reduced-motion:reduce){.dice-show.is-settled .dice-show-result{animation:none}}

/* A single gentle pulse on the roll panel, never a full-screen flash. */
.dice-natural{text-align:center;font-size:13px;font-weight:600;margin-top:3px;color:var(--dice-extreme)}
.dice-natural[hidden]{display:none}
.dice-high{--dice-extreme:#9ce6bd;--dice-pulse:#58c88a}
.dice-low{--dice-extreme:#f2a5ac;--dice-pulse:#d47781}
.dice-show.is-settled:is(.dice-high,.dice-low) .dice-stage{border-color:var(--dice-extreme);animation:dice-extreme-pulse 1.1s ease-in-out 1}
.dice-show:is(.dice-high,.dice-low) .dice-show-result{color:var(--dice-extreme)}
@keyframes dice-extreme-pulse{0%,100%{box-shadow:inset 0 0 0 0 transparent,0 0 0 0 transparent}50%{box-shadow:inset 0 0 28px -16px var(--dice-pulse),0 0 22px -9px var(--dice-pulse)}}
@media(prefers-reduced-motion:reduce){.dice-show.is-settled:is(.dice-high,.dice-low) .dice-stage{animation:none}}

/* The server snapshots the character accent for every roll. */
.dice-show{border-color:var(--dice-accent,#bd94ff);background:radial-gradient(ellipse at 50% 0,color-mix(in srgb,var(--dice-accent,#bd94ff) 25%,transparent),transparent 70%),#16101fef;box-shadow:0 12px 70px #000b,0 0 35px color-mix(in srgb,var(--dice-accent,#bd94ff) 18%,transparent)}
.animated-die polygon{fill:color-mix(in srgb,var(--dice-accent,#bd94ff) 55%,#171323);stroke:var(--dice-accent,#bd94ff)}
.animated-die path{stroke:var(--dice-accent,#bd94ff)}

/* Center both names on the popup itself; the close button occupies no layout space. */
.dice-show-heading{position:relative;display:block;min-height:36px;padding:0 48px;text-align:center}
.dice-show-identity{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;min-height:36px}
.dice-show-actor{font-size:clamp(18px,2.5vw,22px);font-weight:750;line-height:1.35;color:var(--dice-accent,#bd94ff);overflow-wrap:anywhere;min-width:0}
.dice-show-visibility{font-size:10px;font-weight:600;letter-spacing:.04em;border:1px solid #ffffff24;border-radius:20px;padding:3px 8px;color:#d0c6db;background:#ffffff08}
.dice-show-heading .dice-dismiss{position:absolute;right:0;top:0}
.dice-show-label{display:block;text-align:center;font-size:clamp(20px,3vw,26px);font-weight:750;line-height:1.3;margin:5px 0 14px;padding-inline:44px;overflow-wrap:anywhere;overflow:visible}
@media(max-width:730px){.dice-show-heading,.dice-show-identity{min-height:44px}.dice-show-label{padding-inline:8px;margin-bottom:10px}.dice-show-identity{gap:6px}}
@media(max-height:500px){.dice-show-actor{font-size:16px}.dice-show-label{font-size:18px;margin-block:3px 7px}}

/* A top-layer dialog keeps private narration centered, including over open editors. */
dialog.narration-show{--narration-text:#f5e9d4;--narration-background:#1c1522;--narration-accent:#e9c982;--narration-font:Georgia,serif;--narration-size:24px;--narration-align:center;position:fixed;inset:0;margin:auto;transform:none;width:min(760px,calc(100vw - 32px));max-width:760px;max-height:calc(100dvh - 32px);padding:clamp(24px,4vw,48px);border:1px solid var(--narration-accent);border-radius:22px;color:var(--narration-text);background:var(--narration-background);box-shadow:0 28px 100px #000b,0 0 0 5px #ffffff08;overflow:auto;text-align:center;pointer-events:auto}
dialog.narration-show[hidden]{display:none!important}
dialog.narration-show::backdrop{background:#080611c9;backdrop-filter:blur(5px)}
.narration-dismiss{position:absolute;right:16px;top:16px;border-color:var(--narration-accent);color:var(--narration-text);background:var(--narration-background)}
.narration-heading{display:grid;justify-items:center;gap:8px;padding:0 20px 22px;margin:0 auto 22px;border-bottom:1px solid var(--narration-accent)}
.narration-seal{display:grid;place-items:center;width:44px;height:44px;border:1px solid var(--narration-accent);border-radius:50%;font-size:26px;color:var(--narration-accent)}
.narration-eyebrow{margin:0;color:var(--narration-accent);font:800 clamp(18px,3.1vw,25px)/1.35 'DM Sans',system-ui,sans-serif;letter-spacing:.09em;text-align:center}
.narration-recipient{margin:0;font-size:13px;color:var(--narration-text);opacity:.8}
dialog.narration-show h2{margin:0 0 22px;color:var(--narration-accent);font:500 clamp(27px,4vw,36px)/1.25 var(--narration-font);overflow-wrap:anywhere;text-align:center}
.narration-copy{display:grid;max-height:42dvh;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--narration-accent) transparent}
.narration-copy>.narration-body,.narration-copy>.narration-space{grid-area:1/1;align-self:start;white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font:400 var(--narration-size)/1.75 var(--narration-font);text-align:var(--narration-align);max-height:none;overflow:visible}
.narration-space{visibility:hidden;pointer-events:none}
.narration-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.narration-footer{display:grid;gap:14px;margin-top:26px;padding:0;background:none;border:0}
.narration-footer .actions{justify-content:center;flex-wrap:wrap}
.narration-footer>.narration-status{font-size:12px;color:var(--narration-text);opacity:.8}
.narration-footer>p{margin:0;font-size:12px;color:var(--narration-text);opacity:.8}
.narration-footer .btn{min-height:44px;background:var(--narration-background);border-color:var(--narration-accent);color:var(--narration-text)}
.narration-footer .btn.primary{background:var(--narration-accent);color:var(--narration-background);font-weight:800}
.narration-options{display:grid;gap:14px;border:1px solid var(--line);border-radius:12px;padding:16px}
.narration-options legend{padding:0 6px;color:var(--accent)}
.narration-colors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.narration-colors input[type=color]{width:100%;height:44px;padding:4px;cursor:pointer}
.narration-preview-card{border:1px solid var(--narration-accent);border-radius:14px;padding:24px;background:var(--narration-background);color:var(--narration-text);text-align:var(--narration-align);max-height:300px;overflow:auto}
.narration-preview-card h3{font:500 27px/1.35 var(--narration-font);margin:16px 0;color:var(--narration-accent);text-align:center;overflow-wrap:anywhere}
.narration-preview-card [data-narration-mini-body]{font:400 var(--narration-size)/1.7 var(--narration-font);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}
@media(max-width:520px){dialog.narration-show{padding:26px 18px;border-radius:16px;width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}.narration-heading{padding:8px 14px 16px;margin-bottom:18px}.narration-copy>.narration-body,.narration-copy>.narration-space{font-size:min(var(--narration-size),25px)}.narration-footer .btn{width:100%}.narration-options{padding:12px}.narration-colors{gap:8px}.narration-preview-card{padding:18px}}
.narration-footer [hidden]{display:none!important}
