/* DCS3 Quest: an adventurer's tome lit by embers. */
:root {
  --bg: #110D0B; --surface: #1C1612; --raised: #261D17; --line: #4A3A2A; --bronze: #B98B52;
  --ink: #EFE2C4; --muted: #BFAE90; --accent: #E8763A; --accent-strong: #D9652B; --accent-press: #C2551F;
  --parchment: #EFE2C4; --parchment-ink: #2A1E14;
  --font-display: "Cinzel", Georgia, serif;
  --font-text: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1180px; --gutter: 24px; --r-sm: 6px; --r-md: 12px;
}
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(body, h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd) { margin: 0; }
:where(ul[class], ol[class]) { list-style: none; padding: 0; }
:where(img, svg) { display: block; max-width: 100%; height: auto; }
:where(a) { color: inherit; }
:where(button) { font: inherit; color: inherit; }
body {
  background: radial-gradient(1200px 700px at 78% -10%, rgba(232,118,58,.13), transparent 60%), radial-gradient(900px 600px at -10% 40%, rgba(185,139,82,.07), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--ink); font-family: var(--font-text); font-size: 19px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
#turnkey-credit { display: none; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); position: relative; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; }
.skip:focus { left: 16px; top: 16px; }
:where(a, button, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Embers */
.embers { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.embers i { position: absolute; bottom: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: radial-gradient(circle, #FFC27A 0%, #E8763A 45%, rgba(232,118,58,0) 70%); opacity: 0; animation: rise var(--d) linear var(--delay) infinite; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 70% { opacity: .6; } 100% { transform: translate(var(--drift), -105vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .embers { display: none; } }
main, .nav, .footer { position: relative; z-index: 1; }

/* Frames with corner ornaments */
.frame { position: relative; border: 1px solid var(--line); border-radius: var(--r-sm); }
.frame::before, .frame::after { content: ""; position: absolute; width: 18px; height: 18px; border-color: var(--bronze); border-style: solid; pointer-events: none; z-index: 2; }
.frame::before { top: -5px; left: -5px; border-width: 2px 0 0 2px; }
.frame::after { bottom: -5px; right: -5px; border-width: 0 2px 2px 0; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(17,13,11,.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
body.admin-bar .nav { top: 32px; }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--bronze); }
.brand span { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: .02em; line-height: 1.1; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a { text-decoration: none; font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: .06em; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.nav__links a:hover { color: var(--ink); }
.nav__links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav__right { display: flex; align-items: center; gap: 12px; }
.nav__toggle { display: none; background: none; border: 1px solid var(--bronze); border-radius: var(--r-sm); padding: 8px 14px; font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: .06em; cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 10px; justify-content: center; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .06em; line-height: 1; padding: 16px 24px; border-radius: var(--r-sm); border: 1px solid transparent; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-strong); color: var(--bg); box-shadow: inset 0 0 0 0 var(--bronze); }
.btn--primary:hover { background: var(--accent); box-shadow: inset 0 0 0 2px rgba(17,13,11,.35); }
.btn--ghost { border-color: var(--bronze); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--raised); }
.btn--sm { padding: 12px 16px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }

/* Type */
.h1, .h2, .h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }
.h1 { font-size: clamp(42px, 5.6vw, 76px); line-height: 1.06; }
.h2 { font-size: clamp(32px, 3.8vw, 50px); line-height: 1.1; }
.h3 { font-size: 24px; line-height: 1.2; }
.ember { color: var(--accent); }
.lede { font-size: 21px; color: var(--muted); max-width: 54ch; }
.kicker { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--bronze); }
.rule { display: flex; align-items: center; gap: 14px; color: var(--bronze); }
.rule::before, .rule::after { content: ""; height: 1px; background: currentColor; flex: 1; opacity: .5; }

/* Hero */
.hero__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; padding-block: 80px 96px; }
.hero .kicker { margin-bottom: 20px; }
.hero__sub { margin-top: 24px; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px; align-items: center; }
.hero__art { position: relative; justify-self: end; width: min(500px, 100%); }
.hero__art::before { content: ""; position: absolute; inset: -20%; background: radial-gradient(closest-side, rgba(232,118,58,.42), rgba(232,118,58,.12) 55%, transparent 76%); z-index: 0; animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
.hero__art .frame { z-index: 1; background: var(--bg); padding: 10px; }
.hero__art img { border-radius: 4px; }

/* d20 */
.dice { display: flex; align-items: center; gap: 18px; margin-top: 40px; }
.d20 { width: 92px; height: 92px; padding: 0; border: 0; background: none; cursor: pointer; flex-shrink: 0; transition: filter .3s; }
.d20 svg { width: 100%; height: 100%; overflow: visible; }
.d20 .face { fill: var(--raised); stroke: var(--bronze); stroke-width: 1.6; stroke-linejoin: round; }
.d20 .edge { stroke: var(--bronze); stroke-width: 1.1; opacity: .75; }
.d20 .num { font-family: var(--font-display); font-weight: 800; font-size: 24px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.d20.is-rolling svg { animation: roll .75s cubic-bezier(.3,.7,.3,1); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(250deg) scale(.86); } 100% { transform: rotate(360deg) scale(1); } }
.d20.is-crit { filter: drop-shadow(0 0 14px rgba(232,118,58,.9)); }
.d20.is-crit .face { stroke: var(--accent); }
.d20.is-crit .num { fill: var(--accent); }
.d20.is-fumble .num { fill: var(--muted); }
.dice__text strong { display: block; font-family: var(--font-display); font-size: 17px; letter-spacing: .04em; }
.dice__text span { font-size: 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .d20.is-rolling svg, .hero__art::before { animation: none; } }

/* Ability scores */
.abilities { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding-bottom: 104px; }
.ability { text-align: center; padding: 22px 16px 20px; background: var(--surface); }
.ability__label { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--bronze); }
.ability__score { font-family: var(--font-display); font-size: 38px; font-weight: 800; line-height: 1.1; margin-top: 8px; }
.ability__mod { display: inline-block; margin-top: 12px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; color: var(--muted); }

/* Section */
.section { padding-block: 104px; }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head .lede { margin-top: 16px; }
.section-head .kicker { margin-bottom: 14px; }

/* Character sheet tabs */
.sheet { background: var(--surface); }
.sheet__tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sheet__tabs::-webkit-scrollbar { display: none; }
.sheet__tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 16px 22px 14px; font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .08em; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.sheet__tab:hover { color: var(--ink); }
.sheet__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); background: var(--raised); }
.sheet__panel { display: grid; grid-template-columns: 5fr 7fr; gap: 40px; align-items: center; padding: 40px; }
.sheet__panel[hidden] { display: none; }
.sheet__panel p { color: var(--muted); }
.sheet__panel p + p { margin-top: 14px; }
.sheet__panel .h3 { margin-bottom: 16px; font-size: 28px; }
.sheet__shot { overflow: hidden; background: var(--bg); }
.sheet__shot img { width: 100%; border-radius: 4px; }
.js .sheet__panel:not([hidden]) { animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* GM split */
.gm { display: grid; grid-template-columns: 6fr 5fr; gap: 56px; align-items: center; }
.gm__shot { transform: rotate(-1.6deg); background: var(--bg); padding: 8px; }
.gm__shot img { border-radius: 4px; }
.gm p { color: var(--muted); margin-top: 18px; max-width: 52ch; }
.loot { margin-top: 26px; display: grid; gap: 10px; }
.loot li { display: flex; gap: 12px; align-items: baseline; }
.loot li::before { content: ""; width: 8px; height: 8px; transform: rotate(45deg) translateY(-2px); background: var(--accent); flex-shrink: 0; }

/* Lore scroll */
.lore { background: var(--parchment); color: var(--parchment-ink); border-radius: var(--r-md); padding: 64px; display: grid; grid-template-columns: 4fr 8fr; gap: 56px; position: relative; }
.lore::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(42,30,20,.35); border-radius: 8px; pointer-events: none; }
.lore .kicker { color: #7A5A33; }
.lore__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; margin-top: 14px; }
.lore__body p { font-size: 19px; color: #4A3A2A; }
.lore__body p + p { margin-top: 16px; }
.lore__body p:first-child::first-letter { float: left; font-family: var(--font-display); font-weight: 800; font-size: 4.2em; line-height: .85; padding: 6px 10px 0 0; color: var(--accent-press); }
.lore__sign { margin-top: 24px; font-family: var(--font-display); font-size: 15px; letter-spacing: .08em; color: #7A5A33; }

/* CTA */
.cta { text-align: center; padding-block: 112px 120px; }
.cta .h2 { max-width: 18ch; margin-inline: auto; }
.cta p { color: var(--muted); max-width: 52ch; margin: 18px auto 0; }
.cta__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 36px; color: var(--muted); font-size: 16px; background: rgba(17,13,11,.6); }
.footer__inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }
.footer__note { width: 100%; font-size: 14px; color: #8C7D65; }
.footer__note a { text-decoration: underline; text-underline-offset: 3px; }

/* Page head */
.page-head { padding-block: 80px 44px; }
.page-head .lede { margin-top: 16px; }
.page-head .kicker { margin-bottom: 14px; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; padding-bottom: 112px; }
.gallery button { display: block; width: 100%; padding: 6px; margin: 0; background: var(--surface); cursor: zoom-in; aspect-ratio: 768 / 606; }
.gallery button img { width: 100%; height: 100%; object-fit: cover; object-position: top left; border-radius: 3px; transition: filter .25s; filter: saturate(.85) brightness(.92); }
.gallery button:hover img { filter: none; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1200px, 94vw); max-height: 92vh; color: var(--ink); }
.lightbox::backdrop { background: rgba(10, 7, 5, .9); }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: var(--r-sm); border: 1px solid var(--bronze); }
.lightbox__bar { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.lightbox__bar button { background: var(--raised); border: 1px solid var(--bronze); border-radius: var(--r-sm); padding: 10px 18px; font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .06em; cursor: pointer; }

/* Class select */
.classes { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding-bottom: 112px; }
.class { padding: 40px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.class--hero { background: radial-gradient(120% 120% at 100% 0%, rgba(232,118,58,.18), transparent 60%), var(--raised); }
.class__role { font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: .2em; color: var(--bronze); }
.class .h2 { font-size: 40px; }
.class p { color: var(--muted); }
.class dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 6px 0 10px; font-size: 17px; }
.class dt { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .12em; color: var(--bronze); padding-top: 3px; }
.class dd { color: var(--ink); }
.class .btn { align-self: flex-start; margin-top: auto; }

/* Contact */
.raven { display: grid; grid-template-columns: 7fr 5fr; gap: 56px; align-items: center; padding-block: 72px 112px; }
.raven p { color: var(--muted); margin-top: 18px; max-width: 48ch; }
.raven__mail { display: inline-block; margin-top: 26px; font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 2.8vw, 34px); text-decoration: none; border-bottom: 2px solid var(--accent); word-break: break-word; }
.raven__mail:hover { color: var(--accent); }
.raven__art { background: var(--bg); padding: 10px; }
.raven__art img { border-radius: 4px; }

/* Reveal */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } .js .sheet__panel:not([hidden]) { animation: none; } }

/* Responsive */
@media (max-width: 980px) {
  .nav__toggle { display: inline-flex; }
  .nav__links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 6px var(--gutter) 18px; }
  .nav.is-open .nav__links { display: flex; }
  .nav__links a { padding: 14px 0; border-bottom: 0; border-top: 1px solid var(--line); font-size: 15px; }
  .nav__links a[aria-current="page"] { color: var(--accent); }
}
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; padding-block: 52px 64px; gap: 48px; }
  .hero__art { justify-self: center; width: min(400px, 90%); }
  .abilities { grid-template-columns: 1fr 1fr; padding-bottom: 72px; }
  .section { padding-block: 72px; }
  .sheet__panel { grid-template-columns: 1fr; padding: 24px; gap: 24px; }
  .gm, .lore, .classes, .raven { grid-template-columns: 1fr; }
  .gm { gap: 32px; }
  .lore { padding: 40px 28px; gap: 20px; }
  .cta { padding-block: 72px 88px; }
}
@media (max-width: 520px) {
  body { font-size: 18px; }
  .brand span { font-size: 15px; }
  .nav__right .btn { display: none; }
  .ability__score { font-size: 30px; }
  .class { padding: 28px; }
  .dice { gap: 14px; }
  .d20 { width: 76px; height: 76px; }
}

/* Dice tray */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tray { display: grid; grid-template-columns: 5fr 7fr; background: var(--surface); }
.tray__controls { padding: 32px; display: flex; flex-direction: column; gap: 22px; border-right: 1px solid var(--line); }
.tray__label { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--bronze); }
.tray__dice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tray__add { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, transform .1s, background-color .15s; }
.tray__add:hover:not(:disabled) { border-color: var(--bronze); background: #2E231B; }
.tray__add:active:not(:disabled) { transform: translateY(1px) scale(.97); }
.tray__add:disabled { opacity: .45; cursor: not-allowed; }
.tray__add svg { width: 40px; height: 40px; }
.tray__add .s, .tray__die .s { fill: var(--bg); stroke: var(--bronze); stroke-width: 3; stroke-linejoin: round; }
.tray__add .e, .tray__die .e { fill: none; stroke: var(--bronze); stroke-width: 2; opacity: .6; stroke-linejoin: round; }
.tray__lbl { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.tray__count { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--accent-strong); color: var(--bg); font-weight: 700; font-size: 14px; line-height: 24px; text-align: center; }
.tray__chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; align-items: center; }
.tray__chip { background: transparent; border: 1px solid var(--bronze); border-radius: 999px; padding: 5px 12px; font-family: var(--font-display); font-weight: 700; font-size: 14px; cursor: pointer; }
.tray__chip span { color: var(--muted); margin-left: 4px; }
.tray__chip:hover { background: var(--raised); }
.tray__chip:hover span { color: var(--accent); }
.tray__hint { color: var(--muted); font-size: 16px; }
.tray__row { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.tray__mod { display: flex; align-items: center; gap: 10px; }
.tray__mod button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--bronze); background: var(--raised); font-size: 20px; line-height: 1; cursor: pointer; }
.tray__mod button:hover { background: #2E231B; }
.tray__modval { min-width: 44px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.tray__mode { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; transition: opacity .2s; }
.tray__mode.is-off { opacity: .45; }
.tray__mode button { background: none; border: 0; border-left: 1px solid var(--line); padding: 9px 12px; font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer; }
.tray__mode button:first-child { border-left: 0; }
.tray__mode button[aria-checked="true"] { background: var(--raised); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.tray__mode button:disabled { cursor: not-allowed; }
.tray__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.tray__roll { flex: 1 1 auto; white-space: normal; text-align: center; line-height: 1.25; min-height: 52px; }
.tray__roll:disabled, .tray__clear:disabled { opacity: .5; cursor: not-allowed; }
.tray__felt { padding: 32px; display: flex; flex-direction: column; gap: 24px; background: radial-gradient(90% 80% at 50% 30%, rgba(232,118,58,.08), transparent 70%), #15100D; border-radius: 0 var(--r-sm) var(--r-sm) 0; min-height: 420px; transition: background-color .3s; }
.tray.is-crit .tray__felt { background: radial-gradient(90% 80% at 50% 30%, rgba(232,118,58,.24), transparent 70%), #15100D; }
.tray__results { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; min-height: 170px; }
.tray__empty { margin: auto; color: var(--muted); font-style: italic; }
.tray__die { position: relative; width: 72px; height: 80px; display: flex; flex-direction: column; align-items: center; }
.tray__die svg { width: 64px; height: 64px; position: absolute; top: 0; left: 4px; }
.tray__val { position: relative; z-index: 1; height: 64px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 21px; font-variant-numeric: tabular-nums; }
.tray__type { position: relative; font-size: 12px; color: var(--muted); letter-spacing: .06em; margin-top: 2px; }
.tray__die.is-crit .s { stroke: var(--accent); fill: #2A160C; }
.tray__die.is-crit .tray__val { color: var(--accent); }
.tray__die.is-crit { filter: drop-shadow(0 0 10px rgba(232,118,58,.7)); }
.tray__die.is-fumble .tray__val { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.tray__pair { display: flex; gap: 2px; padding: 4px 6px 0; border: 1px dashed var(--line); border-radius: var(--r-sm); }
.tray__die.is-dropped { opacity: .35; transform: scale(.82); }
.tray__die.is-tumbling { animation: tumble .55s cubic-bezier(.2,.8,.25,1) both; }
.tray__pair .tray__die.is-tumbling { animation-name: tumble; }
@keyframes tumble { 0% { opacity: 0; transform: translate(-30px, -24px) rotate(-200deg) scale(.6); } 70% { opacity: 1; transform: translate(2px, 2px) rotate(10deg) scale(1.04); } 100% { opacity: 1; transform: none; } }
.tray__pair .tray__die.is-dropped.is-tumbling { animation-name: tumbleDrop; }
@keyframes tumbleDrop { 0% { opacity: 0; transform: translate(-30px, -24px) rotate(-200deg) scale(.5); } 100% { opacity: .35; transform: scale(.82); } }
.tray__total { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }
.tray__total-num { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; }
.tray.is-crit .tray__total-num { color: var(--accent); }
.tray__total-note { color: var(--muted); font-size: 17px; }
.tray__history { display: grid; gap: 10px; }
.tray__log { display: grid; gap: 6px; font-size: 16px; }
.tray__log li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid rgba(74,58,42,.6); color: var(--muted); }
.tray__log li:first-child { color: var(--ink); }
.tray__log strong { font-family: var(--font-display); font-weight: 800; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .tray__die.is-tumbling { animation: none; } }
@media (max-width: 900px) {
  .tray { grid-template-columns: 1fr; }
  .tray__controls { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px; }
  .tray__felt { border-radius: 0 0 var(--r-sm) var(--r-sm); padding: 24px; min-height: 0; }
}
@media (max-width: 520px) {
  .tray__dice { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .tray__add svg { width: 32px; height: 32px; }
  .tray__mode button { padding: 8px 9px; font-size: 14px; }
  .tray__die { width: 60px; height: 70px; }
  .tray__die svg { width: 54px; height: 54px; left: 3px; }
  .tray__val { height: 54px; font-size: 18px; }
  .tray__total-num { font-size: 44px; }
}
/* Quick rolls */
.tray__presets { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.tray__preset { background: var(--raised); border: 1px solid var(--bronze); border-radius: var(--r-sm); padding: 9px 14px; font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .04em; cursor: pointer; }
.tray__preset:hover:not(:disabled) { background: #2E231B; border-color: var(--accent); }
.tray__preset:disabled { opacity: .5; cursor: not-allowed; }
.tray__group { padding-bottom: 2px; }
.tray__group .tray__die.is-dropped { opacity: .35; transform: scale(.82); }
.tray__group .tray__die.is-dropped .tray__val { text-decoration: line-through; text-decoration-thickness: 2px; }