/* =========================================================================
   123DiceRoller — styles.

   Mobile first. Below 761px the roller is an app screen: a top bar, the 3D
   table filling the viewport with the result floating over it, a dock with
   the dice and a big Roll button in thumb reach, and a bottom sheet for
   everything else. The article follows when you scroll. From 761px up the
   same markup becomes a page: table and result side by side, the drawer
   inline below.

   The roller is always dark, like a game table under a lamp; the rest of the
   page follows the system light/dark preference.
   ========================================================================= */

/* ---- tokens ------------------------------------------------------------- */

:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #f0edf7;
  --text: #1c1828;
  --muted: #5d586c;
  --line: #e3dfec;
  --link: #5a3ccf;
  --accent: #e23d3d;
  --gold: #f5c04a;
  --good: #2f9e44;
  --focus: #7c5cff;

  --app-bg: #15121f;
  --app-surface: #1d1a2a;
  --app-surface-2: #282338;
  --app-surface-3: #332d46;
  --app-text: #f4f1fb;
  --app-muted: #aaa3bf;
  --app-line: rgba(255, 255, 255, .09);
  --app-accent: #a58cff;

  --radius: 14px;
  --header-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --gutter: max(16px, var(--safe-l), var(--safe-r));
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100e17;
    --surface: #191623;
    --surface-2: #221e2f;
    --text: #ece9f4;
    --muted: #a7a1b8;
    --line: #2d283c;
    --link: #b8a5ff;
    color-scheme: dark;
  }
}

@media (max-width: 760px) {
  :root { --header-h: 52px; }
}

/* ---- base ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--safe-t) + 12px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html.sheet-lock, html.sheet-lock body { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
code, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .35em; border-radius: 5px; text-align: center;
  border: 1px solid currentColor; border-bottom-width: 2px; font-size: .75em; line-height: 1.5; opacity: .75;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(20px, var(--safe-l));
  padding-right: max(20px, var(--safe-r));
}
.muted { color: var(--muted); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px;
}
.skip-link:focus { top: calc(10px + var(--safe-t)); }

@media (max-width: 760px) { .only-wide { display: none !important; } }
@media (min-width: 761px) { .only-phone { display: none !important; } }

/* ---- header ------------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(21, 18, 31, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  color: #f4f1fb;
  padding-top: var(--safe-t);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-weight: 750; font-size: 1.12rem; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.brand-name b { color: #ff6b6b; font-weight: 800; }

.main-nav { margin-left: auto; }
.main-nav > ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.main-nav a, .main-nav summary {
  display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 10px;
  color: rgba(244, 241, 251, .82); text-decoration: none; font-size: .94rem; font-weight: 550;
  cursor: pointer; list-style: none; white-space: nowrap;
}
.main-nav summary::-webkit-details-marker { display: none; }
.main-nav a:hover, .main-nav summary:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.main-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-more { position: relative; }
.nav-more details[open] summary svg { transform: rotate(180deg); }
.mega {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(560px, 92vw);
  background: #1d1a2a; border: 1px solid rgba(255, 255, 255, .09); border-radius: 18px;
  padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.mega-title { margin: 4px 6px 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #aaa3bf; }
.mega-dice { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-bottom: 12px; }
.mega-dice a { flex-direction: row; gap: 8px; padding: 8px 10px; background: rgba(255, 255, 255, .04); }
.mega-dice .die-icon { width: 26px; height: 26px; }
.mega-links { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 0; padding: 0; list-style: none; }

.nav-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav-toggle span { width: 20px; height: 2px; border-radius: 2px; background: #f4f1fb; transition: transform .2s, opacity .2s; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* the flat die icons used in menus and cards */
.die-icon { width: 28px; height: 28px; flex: none; }
.die-icon polygon, .die-icon rect, .die-icon circle { fill: #f2ede2; stroke: rgba(0, 0, 0, .35); stroke-width: 1.2; stroke-linejoin: round; }
.die-icon .ln { fill: none; stroke: rgba(0, 0, 0, .18); stroke-width: 1; }
.die-icon text { fill: #1c1828; font: 800 7.5px var(--font); }

@media (max-width: 760px) {
  .site-header { background: #15121f; }
  .brand { font-size: 1.04rem; }
  .brand-mark { width: 27px; height: 27px; }
  .nav-toggle { display: flex; }
  .main-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #15121f; border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 8px var(--gutter) 16px; max-height: calc(100svh - var(--header-h) - var(--safe-t)); overflow-y: auto;
    box-shadow: 0 24px 40px rgba(0, 0, 0, .45);
    display: none;
  }
  .nav-open .main-nav { display: block; }
  .main-nav > ul { flex-direction: column; align-items: stretch; }
  .main-nav a, .main-nav summary { padding: 12px; font-size: 1rem; }
  .mega { position: static; width: auto; border: 0; box-shadow: none; padding: 4px 0 0; background: transparent; }
  .mega-dice { grid-template-columns: repeat(3, 1fr); }
  .mega-dice a { flex-direction: column; gap: 4px; font-size: .85rem; text-align: center; }
  .mega-links { grid-template-columns: 1fr; }
}

/* ---- breadcrumbs and hero ------------------------------------------------------ */

.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 14px 0 0; list-style: none; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 4px; opacity: .6; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--link); text-decoration: underline; }

.hero { padding: 22px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); font-weight: 800; }
.hero .lead { margin: 0; max-width: 72ch; color: var(--muted); font-size: 1.06rem; }
.hero-plain { padding-bottom: 8px; }

.roller-wrap { margin-bottom: 36px; }
.roller-heading { font-size: 1.5rem; margin: 8px 0 14px; }

/* ---- the roller: shared --------------------------------------------------------- */

.roller {
  position: relative;
  background: var(--app-bg);
  color: var(--app-text);
  color-scheme: dark;
  --link: #c4b5ff;
}
.roller a { color: var(--link); }
.roller code { background: rgba(255, 255, 255, .08); }

.roller-stage { position: relative; }

.tray {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 35%, rgba(255, 255, 255, .08), transparent 60%),
    #1f5a43;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  isolation: isolate;
}
.roller[data-table="navy"] .tray { background-color: #22406a; }
.roller[data-table="burgundy"] .tray { background-color: #5e1d2b; }
.roller[data-table="slate"] .tray { background-color: #353a42; }
.roller[data-table="walnut"] .tray { background-color: #6b4329; }
.tray-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: manipulation; }
.tray-frame {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 70px rgba(0, 0, 0, .45);
}

.tray-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: rgba(255, 255, 255, .8); font-size: .92rem; text-align: center; padding: 20px;
}
.has-3d .tray-loading, .no-3d .tray-loading { display: none; }
.loader-die {
  position: relative; width: 44px; height: 44px; border-radius: 10px; background: #f2ede2;
  box-shadow: inset -4px -5px 0 rgba(0, 0, 0, .12), 0 8px 18px rgba(0, 0, 0, .35);
  animation: loader 1.1s cubic-bezier(.5, 0, .5, 1) infinite;
}
.loader-die i { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #1c1828; }
.loader-die i:nth-child(1) { left: 7px; top: 7px; }
.loader-die i:nth-child(2) { left: 17.5px; top: 17.5px; }
.loader-die i:nth-child(3) { right: 7px; bottom: 7px; }
@keyframes loader {
  0% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-14px) rotate(90deg); }
  100% { transform: translateY(0) rotate(180deg); }
}
.noscript { display: block; max-width: 34ch; }

.tray-hint {
  position: absolute; left: 50%; bottom: 14px; z-index: 2; transform: translateX(-50%);
  margin: 0; padding: 6px 12px; border-radius: 99px; white-space: nowrap;
  background: rgba(10, 8, 16, .45); color: rgba(255, 255, 255, .85); font-size: .8rem;
  pointer-events: none; transition: opacity .4s;
}
.tray-hint.is-gone { opacity: 0; }
.tray-banner {
  position: absolute; left: 50%; top: 14px; z-index: 3; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 120px); margin: 0; padding: 8px 14px; border-radius: 12px;
  background: rgba(245, 192, 74, .95); color: #2a1e00; font-size: .85rem; font-weight: 600; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.tray-tools { position: absolute; top: 12px; right: 12px; z-index: 4; display: flex; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px;
  background: rgba(14, 11, 22, .5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 1.4rem; line-height: 1;
  transition: background .15s, transform .1s;
}
.icon-btn:hover { background: rgba(14, 11, 22, .7); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .off { display: none; }
.icon-btn.is-off .on { display: none; }
.icon-btn.is-off .off { display: inline; }
.icon-btn.is-off { color: rgba(255, 255, 255, .55); }
.icon-btn[data-shake][aria-pressed="true"] { background: var(--app-accent); color: #160f2e; }

/* the flat 2D tray (no WebGL, too many dice, or odd sizes) */
.tray-2d {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 12px;
  padding: 70px 20px 60px;
}
.flat-die { width: 68px; height: 68px; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .4)); transition: opacity .2s; }
.flat-die .die-svg { width: 100%; height: 100%; }
.tray-2d.is-many { gap: 6px; }
.tray-2d.is-many .flat-die { width: 40px; height: 40px; }
.flat-die.is-tumbling { animation: tumble .28s linear infinite; animation-delay: var(--d, 0s); }
.flat-die.is-dropped { opacity: .35; }
.flat-die.is-held { filter: drop-shadow(0 0 0 #000) drop-shadow(0 0 6px var(--gold)); }
@keyframes tumble {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-6px, -10px) rotate(90deg); }
  50% { transform: translate(4px, 2px) rotate(180deg); }
  75% { transform: translate(-2px, -6px) rotate(270deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}

.confetti { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.confetti span {
  position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px;
  animation: confetti 1.9s cubic-bezier(.25, .6, .4, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x), 110vh) rotate(var(--r)); opacity: .2; }
}

/* the result */
.result-head { min-width: 0; }
.result-kicker { margin: 0; color: var(--app-muted); font-size: .82rem; font-weight: 600; letter-spacing: .02em; }
.result-total {
  display: block; font-size: clamp(3rem, 2.2rem + 3vw, 4.4rem); line-height: 1.02; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}
.result-total:empty::before { content: "?"; opacity: .22; }
.result-total.is-list { font-size: 1.7rem; letter-spacing: 0; line-height: 1.2; }
.result-total.is-pop { animation: pop .42s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.82); } 100% { transform: none; } }
.result-expr { margin: 2px 0 0; color: var(--app-muted); font-size: .9rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-expr strong { color: var(--app-text); }
.result-expr s { opacity: .55; }
.result-expr .eq { opacity: .6; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badges:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; letter-spacing: .01em;
  background: rgba(255, 255, 255, .12); color: #fff;
}
.badge-crit { background: linear-gradient(135deg, #ffd66b, #f0a92f); color: #2a1900; }
.badge-jackpot { background: linear-gradient(135deg, #ffd66b, #ff6b6b 55%, #a58cff); color: #1b0f00; }
.badge-fail { background: #c92a2a; }
.badge-good { background: #2b8a3e; }
.badge-note { background: rgba(255, 255, 255, .14); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; width: 42px; height: 42px; padding: 3px; border: 0; border-radius: 10px;
  background: transparent; transition: transform .12s, opacity .2s;
}
.chip .die-svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.chip:hover:not(:disabled) { transform: translateY(-2px); }
.chip:disabled { cursor: default; }
.chip.is-dropped { opacity: .38; }
.chip.is-held { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(245, 192, 74, .45); transform: translateY(-3px); }
.chip.is-held::after {
  content: "HOLD"; position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%);
  font-size: .56rem; font-weight: 800; letter-spacing: .08em; color: var(--gold);
}
.stat-set { display: flex; align-items: center; gap: 2px; padding: 4px 8px 4px 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.stat-set strong { min-width: 30px; text-align: center; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stat-set .chip { width: 28px; height: 28px; padding: 1px; }

.result-odds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.result-odds:empty { display: none; }
.result-odds div, .odds-summary div { padding: 8px 10px; border-radius: 10px; background: var(--app-surface-2); min-width: 0; }
.result-odds dt, .odds-summary dt { color: var(--app-muted); font-size: .74rem; }
.result-odds dd, .odds-summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-soft {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--app-line); border-radius: 11px; background: var(--app-surface-2); color: var(--app-text);
  font-size: .9rem; font-weight: 600; transition: background .15s;
}
.btn-soft:hover { background: var(--app-surface-3); }
.btn-soft svg { width: 18px; height: 18px; }
.btn-link { border: 0; background: none; padding: 6px 0; color: var(--link); font-size: .9rem; text-decoration: underline; text-underline-offset: .18em; }

/* the dock: dice picker, modifier and Roll */
.dock { background: var(--app-surface); -webkit-user-select: none; user-select: none; }
.turn { margin: 0; text-align: center; color: var(--gold); font-size: .85rem; font-weight: 700; }
/* Yahtzee is always five d6: the turn counter takes the picker's place. */
.mode-yahtzee .picker, .mode-yahtzee .mod, .mode-yahtzee [data-clear] { display: none; }
.mode-yahtzee .turn { padding: 6px 0; font-size: .95rem; }
.picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pick { position: relative; min-width: 0; }
.pick-add {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; height: 60px; padding: 4px 0; border: 1px solid var(--app-line); border-radius: 13px;
  background: var(--app-surface-2); color: var(--app-text);
  transition: background .15s, transform .08s, border-color .15s;
}
.pick-add:hover { background: var(--app-surface-3); }
.pick-add:active { transform: scale(.94); }
.pick-add .die-icon { width: 27px; height: 27px; }
.pick-name { font-size: .72rem; font-weight: 700; color: var(--app-muted); line-height: 1; }
.pick.is-on .pick-add { border-color: rgba(165, 140, 255, .55); background: #2f2745; }
.pick.is-on .pick-name { color: var(--app-text); }
.pick-count {
  position: absolute; top: -6px; right: -4px; min-width: 21px; height: 21px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 11px;
  background: var(--accent); color: #fff; font-size: .74rem; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.pick-sub {
  position: absolute; top: -6px; left: -4px; width: 21px; height: 21px; padding: 0;
  display: none; place-items: center; border: 0; border-radius: 50%;
  background: #4a4360; color: #fff; font-size: .95rem; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.pick-sub::after { content: ""; position: absolute; inset: -7px; }
.pick.is-on .pick-sub { display: grid; }

.dock-row { display: flex; align-items: stretch; gap: 8px; }
.dock-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 48px; padding: 0 12px;
  border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface-2); color: var(--app-text);
  font-weight: 600; transition: background .15s, transform .08s;
}
.dock-btn:hover { background: var(--app-surface-3); }
.dock-btn:active { transform: scale(.95); }
.dock-btn[aria-expanded="true"] { background: var(--app-accent); color: #160f2e; }

.mod { display: flex; align-items: center; border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface-2); overflow: hidden; }
.mod-label { padding-left: 12px; color: var(--app-muted); font-size: .8rem; font-weight: 600; }
.mod button { width: 38px; align-self: stretch; border: 0; background: transparent; color: var(--app-text); font-size: 1.25rem; font-weight: 600; }
.mod button:hover { background: rgba(255, 255, 255, .06); }
.mod button:active { background: rgba(255, 255, 255, .12); }
.mod output { min-width: 36px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.btn-roll {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 56px; padding: 6px 18px; border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #f25858, #d42a35);
  color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 22px rgba(226, 61, 61, .35);
  transition: transform .08s, filter .15s, box-shadow .15s;
}
.btn-roll:hover { filter: brightness(1.07); }
.btn-roll:active { transform: scale(.97); box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 3px 10px rgba(226, 61, 61, .35); }
.btn-roll:disabled { filter: grayscale(.7) brightness(.7); box-shadow: none; }
.btn-roll[aria-busy="true"] { filter: brightness(.9); }
.btn-roll-main { display: inline-flex; align-items: center; gap: 8px; font-size: 1.22rem; font-weight: 800; letter-spacing: .01em; line-height: 1.1; }
.btn-roll-main kbd { border-color: rgba(255, 255, 255, .6); opacity: .8; }
.btn-roll-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }

/* the drawer: notation, quick rolls and the panels */
.drawer { background: var(--app-bg); }
.drawer-grip { display: flex; align-items: center; justify-content: center; }

.notation { display: block; }
.notation > span:first-child { display: block; margin-bottom: 6px; font-size: .8rem; font-weight: 700; color: var(--app-muted); text-transform: uppercase; letter-spacing: .07em; }
.notation-field {
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border: 1px solid var(--app-line); border-radius: 13px; background: var(--app-surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.notation-field:focus-within { border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(165, 140, 255, .25); }
.notation-field svg { color: var(--app-muted); flex: none; }
.notation-field input {
  flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; outline: none;
  font-family: var(--mono); font-size: 1.1rem; font-weight: 600; color: var(--app-text);
}
.notation-help { margin: 8px 0 0; font-size: .84rem; color: var(--app-muted); }
.notation-error { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(201, 42, 42, .18); color: #ffb3b3; font-size: .88rem; }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
.presets-label { width: 100%; font-size: .8rem; font-weight: 700; color: var(--app-muted); text-transform: uppercase; letter-spacing: .07em; }
.preset {
  min-height: 40px; padding: 7px 14px; border: 1px solid var(--app-line); border-radius: 99px;
  background: var(--app-surface-2); color: var(--app-text); font-size: .9rem; font-weight: 600;
  transition: background .15s, transform .08s;
}
.preset:hover { background: var(--app-surface-3); }
.preset:active { transform: scale(.95); }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--app-surface); }
.tabs [role="tab"] {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--app-muted); font-size: .9rem; font-weight: 650;
  transition: background .15s, color .15s;
}
.tabs [role="tab"] svg { width: 18px; height: 18px; flex: none; }
.tabs [role="tab"]:hover { color: var(--app-text); }
.tabs [role="tab"][aria-selected="true"] { background: var(--app-surface-3); color: var(--app-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.panel { padding-top: 16px; }
.panel-label { margin: 14px 0 8px; font-size: .8rem; font-weight: 700; color: var(--app-muted); text-transform: uppercase; letter-spacing: .07em; }
.panel-label:first-child { margin-top: 0; }

.odds-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 0 0 14px; }
.odds-summary:empty { display: none; }
.chart-wrap { min-height: 120px; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: rgba(255, 255, 255, .08); stroke-width: 1; }
.chart-ylab, .chart-xlab { fill: var(--app-muted); font: 11px var(--font); }
.chart-xlab.is-hit { fill: var(--gold); font-weight: 800; }
.chart-bar { fill: #7f68e0; }
.chart-bar.is-hit { fill: var(--gold); }
.chart-area { fill: rgba(127, 104, 224, .55); stroke: #a58cff; stroke-width: 1.5; }
.chart-mark { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 4 3; }

.target { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--app-surface-2); }
.target label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .92rem; }
.target input {
  width: 88px; height: 42px; padding: 0 10px; border: 1px solid var(--app-line); border-radius: 10px;
  background: var(--app-bg); color: var(--app-text); font-size: 16px; font-weight: 700; text-align: center;
}
.target output { font-size: 1.3rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

.odds-details { margin-top: 12px; }
.odds-details summary { cursor: pointer; padding: 8px 0; font-weight: 650; color: var(--link); }
.odds-details .table-wrap { max-height: 360px; overflow: auto; border-radius: 10px; }
.odds-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.odds-table th, .odds-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--app-line); }
.odds-table thead th { position: sticky; top: 0; background: var(--app-surface); color: var(--app-muted); font-weight: 650; }
.odds-table tbody th { text-align: left; }
.odds-table tr.is-hit { background: rgba(245, 192, 74, .16); color: var(--gold); }

.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-head p { margin: 0; font-size: .88rem; }
.history { margin: 8px 0 0; padding: 0; list-style: none; max-height: 380px; overflow-y: auto; }
.history li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 4px 12px;
  padding: 8px 4px; border-bottom: 1px solid var(--app-line); font-variant-numeric: tabular-nums;
}
.history li.muted { display: block; color: var(--app-muted); border: 0; }
.h-expr { padding: 4px 10px; border: 1px solid var(--app-line); border-radius: 8px; background: var(--app-surface-2); color: var(--app-text); font-family: var(--mono); font-size: .85rem; font-weight: 600; }
.h-expr:hover { border-color: var(--app-accent); }
.h-vals { color: var(--app-muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-vals s { opacity: .55; }
.h-total { font-size: 1.1rem; }
.history time { color: var(--app-muted); font-size: .78rem; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.swatch {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2); color: var(--app-text);
  font-size: .86rem; font-weight: 600; text-align: left;
}
.swatch:hover { background: var(--app-surface-3); }
.swatch[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.swatch-die {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--sw); color: var(--sw-ink, #fff); font-weight: 800; font-size: .95rem;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .18), inset 2px 2px 0 rgba(255, 255, 255, .18);
}
.swatch-table .swatch-die { border-radius: 6px; box-shadow: inset 0 0 10px rgba(0, 0, 0, .4); }

.options { display: grid; gap: 8px; }
.toggle {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2); color: var(--app-text);
  font-size: .95rem; font-weight: 600; text-align: left;
}
.toggle-ui { position: relative; flex: none; width: 42px; height: 24px; border-radius: 12px; background: #4a4360; transition: background .2s; }
.toggle-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.toggle[aria-pressed="true"] .toggle-ui { background: var(--good); }
.toggle[aria-pressed="true"] .toggle-ui::after { transform: translateX(18px); }
.install-tip { margin: 4px 0 0; font-size: .88rem; color: var(--app-muted); }

/* share sheet */
.share-sheet {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 6, 14, .6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.share-card {
  width: min(440px, 100%); padding: 18px; border-radius: 20px;
  background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
}
.share-head { display: flex; align-items: center; justify-content: space-between; }
.share-head h2 { margin: 0; font-size: 1.15rem; }
.share-preview { margin: 10px 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--app-bg); color: var(--app-muted); font-size: .85rem; overflow-wrap: anywhere; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-grid a, .share-grid button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 8px;
  border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2);
  color: var(--app-text); font-size: .9rem; font-weight: 650; text-decoration: none;
}
.share-grid a:hover, .share-grid button:hover { background: var(--app-surface-3); }
.share-grid button { grid-column: 1 / -1; }
.share-grid svg { width: 18px; height: 18px; }

/* ---- the roller on a phone: an app screen ----------------------------------------- */

@media (max-width: 760px) {
  html { overscroll-behavior-y: none; }

  /* The app first, the hero and article after it. DOM order is unchanged,
     so search engines and screen readers still meet the h1 first. */
  .site-main { display: flex; flex-direction: column; }
  .roller-wrap.app-first { order: -1; }
  .breadcrumbs { display: none; }
  .hero { padding: 26px 0 6px; }
  .hero h1 { font-size: 1.65rem; }
  .hero .lead { font-size: 1rem; }

  .roller-wrap {
    max-width: none; margin: 0; padding: 0;
    height: calc(100vh - var(--header-h) - var(--safe-t));
    height: calc(100svh - var(--header-h) - var(--safe-t));
    min-height: 440px;
  }
  .roller-wrap .roller-heading { display: none; }
  .roller { display: flex; flex-direction: column; height: 100%; }

  .roller-stage { flex: 1 1 auto; min-height: 0; }
  .tray { position: absolute; inset: 0; }
  .tray-tools { flex-direction: column; top: 10px; right: max(10px, var(--safe-r)); }
  .tray-hint { bottom: 64px; }
  .tray-banner { top: auto; bottom: 64px; max-width: calc(100% - 32px); }

  /* the result floats over the table as a HUD */
  .result {
    position: absolute; inset: 0; z-index: 3; pointer-events: none;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 10px max(12px, var(--safe-l)) 10px;
  }
  .result-head { max-width: calc(100% - 56px); text-shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 0 18px rgba(0, 0, 0, .35); }
  .result-kicker { color: rgba(255, 255, 255, .78); }
  .result-total { font-size: 3.4rem; color: #fff; }
  .result-total.is-list { font-size: 1.45rem; }
  .result-expr { color: rgba(255, 255, 255, .8); font-size: .85rem; max-height: 2.9em; overflow: hidden; }
  .result-expr strong { color: #fff; }
  .badges { text-shadow: none; }
  .result-odds, .result-actions { display: none; }

  /* the dice of the roll as a row along the bottom of the table */
  .chips {
    flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 6px 2px 14px; margin: 0 -4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chips > * { flex: none; pointer-events: auto; }
  .chips > :first-child { margin-left: auto; }
  .chips > :last-child { margin-right: auto; }
  .chip { width: 40px; height: 40px; background: rgba(10, 8, 16, .35); }
  .chips:has(.stat-set) { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding-bottom: 4px; overflow: visible; }
  .chips:has(.stat-set) > * { margin: 0; }
  .stat-set { background: rgba(10, 8, 16, .5); justify-content: space-between; }
  .stat-set .chip { width: 24px; height: 24px; background: none; }

  .dock {
    flex: none; display: flex; flex-direction: column; gap: 8px;
    padding: 10px max(10px, var(--safe-l)) calc(10px + var(--safe-b)) max(10px, var(--safe-r));
    border-top: 1px solid var(--app-line);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, .25);
    position: relative; z-index: 5;
  }
  .picker { gap: 5px; }
  .pick-add { height: 56px; border-radius: 12px; }
  .pick-add .die-icon { width: 25px; height: 25px; }
  .dock-row { height: 54px; }
  .dock-btn { min-width: 50px; padding: 0; }
  .mod button { width: 34px; }
  .mod output { min-width: 32px; font-size: .95rem; }
  .btn-roll { min-height: 0; padding: 4px 10px; }

  /* the drawer as a bottom sheet */
  .drawer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: min(74svh, 680px); overflow-y: auto; overscroll-behavior: contain;
    padding: 0 max(16px, var(--safe-l)) calc(20px + var(--safe-b)) max(16px, var(--safe-r));
    background: var(--app-bg); border-radius: 22px 22px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 -16px 50px rgba(0, 0, 0, .5);
    transform: translateY(105%); visibility: hidden;
    transition: transform .3s cubic-bezier(.2, .85, .25, 1), visibility 0s linear .3s;
  }
  .drawer-open .drawer { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .85, .25, 1); }
  .drawer.is-dragging { transition: none; }
  .drawer-grip {
    position: sticky; top: 0; z-index: 2; height: 40px; margin: 0 -16px 6px;
    background: var(--app-bg); touch-action: none; cursor: grab;
  }
  .drawer-grip > span { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
  .drawer-grip .icon-btn { position: absolute; right: 10px; top: 6px; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; background: var(--app-surface-2); }
  .drawer-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(8, 6, 14, .55);
    animation: fade .25s ease;
  }
  @keyframes fade { from { opacity: 0; } }
  .roller:not(.sheet-custom) .custom { display: none; }
  .custom { padding-top: 18px; }
  .tabs { position: sticky; top: 40px; z-index: 1; box-shadow: 0 8px 12px -6px var(--app-bg); }
  .tabs [role="tab"] { flex-direction: column; gap: 2px; font-size: .74rem; min-height: 50px; }
  .history { max-height: none; }
  .odds-details .table-wrap { max-height: none; }

  .share-sheet { place-items: end center; padding: 0; }
  .share-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + var(--safe-b)); }
}

/* very short screens (landscape phones): keep the dock compact */
@media (max-width: 760px) and (max-height: 560px) {
  .roller-wrap { min-height: 0; }
  .pick-add { height: 46px; }
  .pick-name { display: none; }
  .dock-row { height: 48px; }
  .result-total { font-size: 2.4rem; }
}
@media (max-width: 360px) {
  .mod button { width: 30px; }
  .dock-btn { min-width: 44px; }
  .pick-name { font-size: .66rem; }
}

/* ---- the roller on a wide screen: a page card ----------------------------------------- */

@media (min-width: 761px) {
  .roller {
    border-radius: 22px; overflow: clip;
    box-shadow: 0 24px 60px -20px rgba(21, 18, 31, .55), 0 0 0 1px rgba(255, 255, 255, .05) inset;
  }
  .roller-stage { display: grid; grid-template-columns: minmax(0, 1fr); }
  .tray { height: clamp(360px, 54vh, 540px); }
  .result { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; background: var(--app-surface); border-top: 1px solid var(--app-line); }
  .result-actions { margin-top: auto; }

  .dock {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
    padding: 14px 20px; border-top: 1px solid var(--app-line);
  }
  .turn { width: 100%; text-align: left; }
  .picker { display: flex; flex: 1 1 520px; gap: 8px; }
  .pick { flex: 1 1 0; max-width: 78px; }
  .pick-add { height: 66px; }
  .pick-add .die-icon { width: 30px; height: 30px; }
  .pick-name { font-size: .78rem; }
  .dock-row { flex: 1 1 340px; height: 58px; }
  .btn-roll { min-width: 150px; }

  .drawer {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "custom" "tabs" "panels";
    padding: 22px 20px 24px; border-top: 1px solid var(--app-line);
  }
  .custom { grid-area: custom; margin-bottom: 22px; }
  .tabs { grid-area: tabs; }
  .panels { grid-area: panels; min-width: 0; }
}

@media (min-width: 980px) {
  .roller-stage { grid-template-columns: minmax(0, 1fr) 330px; }
  /* tall enough to be a table, short enough that the dock is above the fold */
  .tray { height: clamp(400px, calc(100vh - 380px), 580px); }
  .result { border-top: 0; border-left: 1px solid var(--app-line); padding: 24px 22px; }
  .drawer { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "custom tabs" "custom panels"; column-gap: 32px; }
  .custom { margin-bottom: 0; border-right: 1px solid var(--app-line); padding-right: 32px; }
}

/* full screen (the whole roller, dock included) */
.roller:fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: 0; overflow: hidden; }
.roller:fullscreen .roller-stage { flex: 1 1 auto; min-height: 0; }
.roller:fullscreen .tray { height: 100%; min-height: 0; }
@media (min-width: 761px) { .roller:fullscreen .drawer { display: none; } }

/* ---- articles --------------------------------------------------------------------------- */

.prose { max-width: 760px; margin: 0 auto; padding: 8px 0 24px; font-size: 1.04rem; }
.prose-guide { padding-top: 0; }
.prose h2 { margin: 2em 0 .6em; font-size: 1.55rem; font-weight: 780; }
.prose h3 { margin: 1.6em 0 .4em; font-size: 1.15rem; }
.prose > :first-child { margin-top: .4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--muted); }

.answer {
  padding: 16px 18px; border-radius: var(--radius); border-left: 4px solid var(--accent);
  background: var(--surface); box-shadow: 0 1px 0 var(--line);
  font-size: 1.08rem;
}

.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { position: relative; padding-left: 46px; margin-bottom: 14px; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--text); color: var(--bg); font-weight: 800; font-size: .92rem;
}

.features { list-style: none; padding: 0; display: grid; gap: 10px; }
.features li { position: relative; padding: 12px 14px 12px 44px; margin: 0; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.features li::before {
  content: ""; position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
.data-table caption { caption-side: top; text-align: left; padding: 12px 14px 4px; font-weight: 700; color: var(--muted); font-size: .85rem; }
.data-table th, .data-table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th { font-weight: 650; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }

.facts { margin: 1.4em 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.prose .facts-title { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dl { margin: 0; display: grid; gap: 8px; }
.facts dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.facts dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
@media (max-width: 520px) { .facts dl > div { grid-template-columns: 1fr; gap: 0; } }

.roll-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--link) 12%, transparent); font-family: var(--mono); font-size: .9em; font-weight: 700; text-decoration: none;
}
.roll-link::before {
  --pip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M6 2h12a4 4 0 014 4v12a4 4 0 01-4 4H6a4 4 0 01-4-4V6a4 4 0 014-4zm2 4.5a1.6 1.6 0 100 3.2 1.6 1.6 0 000-3.2zm4 4a1.6 1.6 0 100 3.2 1.6 1.6 0 000-3.2zm4 4a1.6 1.6 0 100 3.2 1.6 1.6 0 000-3.2z'/%3E%3C/svg%3E");
  content: ""; width: .85em; height: .85em; background: currentColor;
  -webkit-mask: var(--pip) center / contain no-repeat; mask: var(--pip) center / contain no-repeat;
}
.roll-link:hover { background: color-mix(in srgb, var(--link) 22%, transparent); }

.faq { padding-top: 0; }
.faq-item { padding: 14px 0; border-top: 1px solid var(--line); }
.faq-item h3 { margin: 0 0 6px; font-size: 1.08rem; }
.faq-item p { margin: 0; color: var(--muted); }

/* the no-JavaScript server roll */
.server-total { display: flex; align-items: baseline; gap: 14px; }
.server-total span { color: var(--muted); }
.server-total strong { font-size: 3.4rem; line-height: 1; }
.server-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 1.4em 0; }
.server-form label { display: grid; gap: 4px; font-weight: 600; }
.server-form input { height: 50px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-family: var(--mono); font-size: 1.05rem; }
.server-form .btn-roll { flex: none; min-width: 160px; height: 50px; min-height: 0; }

/* ---- more dice, games ------------------------------------------------------------------------ */

.more-dice { margin-top: 24px; padding: 40px 0 28px; background: var(--surface); border-top: 1px solid var(--line); }
.more-dice h2 { margin: 0 0 16px; font-size: 1.4rem; }
.dice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.dice-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .12s, border-color .12s;
}
.dice-card:hover { transform: translateY(-2px); border-color: var(--link); }
.dice-card .die-icon { grid-row: 1 / 3; width: 36px; height: 36px; }
.dice-card-title { font-weight: 750; line-height: 1.2; }
.dice-card-sub { color: var(--muted); font-size: .82rem; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.game-card {
  display: grid; gap: 4px; padding: 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .12s, border-color .12s;
}
.game-card:hover { transform: translateY(-2px); border-color: var(--link); }
.game-card span { color: var(--muted); font-size: .9rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.updated { margin: 22px 0 0; color: var(--muted); font-size: .85rem; }

/* ---- footer ------------------------------------------------------------------------------------- */

.site-footer { background: #15121f; color: #c9c3d9; padding-top: 40px; font-size: .92rem; }
.site-footer a { color: #e6e1f3; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.footer-about .brand { color: #fff; margin-bottom: 10px; }
.footer-about p { margin: 0 0 10px; max-width: 40ch; }
.footer-fair { display: flex; gap: 8px; align-items: flex-start; color: #aaa3bf; }
.footer-fair svg { flex: none; margin-top: 3px; color: #69db7c; }
.footer-col h2 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #8f88a6; }
.footer-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.footer-bottom { margin-top: 32px; padding: 16px 0 calc(16px + var(--safe-b)); border-top: 1px solid rgba(255, 255, 255, .08); color: #8f88a6; font-size: .85rem; }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.footer-bottom p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---- installed app ---------------------------------------------------------------------------- */

@media (display-mode: standalone) {
  .breadcrumbs { display: none; }
}

/* ---- motion ----------------------------------------------------------------------------------- */

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