/* ===========================================================
   Dice — styles
   Mobile-first, touch-friendly, dark theme.
   =========================================================== */

:root {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --bg-elevated-2: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --danger: #ef4444;
  --pip: #0f172a;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --tap-min: 44px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* The HTML `hidden` attribute MUST hide. Page-level `display: flex` on
   classes like `.results-row` would otherwise win over the UA stylesheet's
   `[hidden] { display: none }` (same specificity, author beats UA). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior-y: contain;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* -------------------- Header -------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Header dropdown menu (article links etc) */
.header-menu {
  position: absolute;
  top: 100%;
  right: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 200px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  animation: menuIn 0.14s ease-out;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.header-menu a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.1s;
}

.header-menu a:hover,
.header-menu a:focus-visible {
  background: var(--bg-elevated-2);
  outline: none;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.55);
}

.install-btn {
  background: var(--accent);
  color: #1a1300;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 36px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.icon-btn[aria-pressed="false"] {
  color: var(--text-muted);
  opacity: 0.6;
}

/* -------------------- Main / sections -------------------- */
.app-main {
  flex: 1;
  padding: 16px 18px 140px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.presets-section,
.dice-config-section,
.results-section {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border);
}

.preset-select {
  width: 100%;
  background: var(--bg-elevated-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  min-height: var(--tap-min);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2394a3b8' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* -------------------- Dice config rows -------------------- */

/* Customize toggle — collapses the config by default */
.customize-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.customize-icon {
  font-size: 16px;
  color: var(--text-muted);
}

.customize-label {
  font-weight: 600;
}

.customize-summary {
  flex: 1;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customize-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.customize-toggle[aria-expanded="true"] .customize-chevron {
  transform: rotate(180deg);
}

.customize-body {
  margin-top: 12px;
}

.config-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.config-actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  transition: transform 0.05s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--bg-elevated-2);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.dice-config-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.die-row {
  display: grid;
  grid-template-columns: 56px 56px 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.die-row .count-input,
.die-row .faces-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 15px;
  text-align: center;
  min-height: 40px;
  width: 100%;
  appearance: none;
}

.die-row .faces-select {
  padding-right: 22px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2394a3b8' d='M5 6L0 0h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.die-row .die-label {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.die-row .color-input {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
}

.die-row .remove-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.die-row .remove-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* -------------------- Results / dice stage -------------------- */
.dice-stage {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  padding: 36px 8px 30px;
  perspective: 800px;
  position: relative;
}

/* -------------------- Event banner (special rolls) -------------------- */
.event-banner {
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  animation: bannerIn 0.35s ease-out;
}

.event-banner.event-bad {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.2);
}

.event-banner.event-good {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.2);
}

.event-banner.event-great {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(251, 191, 36, 0.18));
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 32px rgba(245, 158, 11, 0.35);
  font-size: 18px;
  letter-spacing: 0.06em;
}

@keyframes bannerIn {
  0%   { opacity: 0; transform: translateY(-12px) scale(0.96); }
  60%  { opacity: 1; transform: translateY(2px)   scale(1.02); }
  100% { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* Brief stage flash overlay when an event fires */
.dice-stage.flash-bad::after,
.dice-stage.flash-good::after,
.dice-stage.flash-great::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: flashFade 0.7s ease-out;
}
.dice-stage.flash-bad::after   { background: rgba(239, 68, 68, 0.22); }
.dice-stage.flash-good::after  { background: rgba(59, 130, 246, 0.22); }
.dice-stage.flash-great::after { background: rgba(245, 158, 11, 0.28); }

@keyframes flashFade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.empty-hint {
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  font-size: 14px;
}

.results-summary {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.results-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.results-label {
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.results-list {
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}

.results-total {
  font-size: 44px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.results-total-row .results-label {
  font-size: 14px;
  align-self: center;
}

.results-modifier {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

/* -------------------- History -------------------- */
.history-section {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.history-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.history-count {
  margin-left: auto;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.history-chevron {
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.2s;
  margin-left: 4px;
}

.history-toggle[aria-expanded="true"] .history-chevron {
  transform: rotate(180deg);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated-2);
  border-radius: 8px;
  font-size: 13px;
}

.history-item .h-config {
  color: var(--text-muted);
  white-space: nowrap;
}

.history-item .h-rolls {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex: 1;
  text-align: center;
  word-break: break-word;
}

.history-item .h-total {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

.history-item .h-time {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.history-item-event {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

.history-item-event .h-rolls {
  color: var(--accent);
}

/* -------------------- Footer / Roll button -------------------- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, rgba(15, 23, 42, 0));
  display: flex;
  justify-content: center;
  z-index: 5;
}

.footer-row {
  width: 100%;
  max-width: 540px;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.modifier-control {
  display: flex;
  align-items: stretch;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.mod-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 36px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.mod-btn:hover {
  background: var(--bg-elevated-2);
}

.mod-input {
  background: transparent;
  border: none;
  color: var(--text);
  width: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0;
  /* Hide spinners */
  -moz-appearance: textfield;
}

.mod-input::-webkit-outer-spin-button,
.mod-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-roll {
  flex: 1;
  background: var(--accent);
  color: #1a1300;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  box-shadow: var(--shadow-md);
}

.btn-roll:hover {
  background: var(--accent-hover);
}

.btn-roll:disabled {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  cursor: not-allowed;
}

.roll-icon {
  font-size: 22px;
}

/* ===========================================================
   Dice rendering
   =========================================================== */

/* Wrapper that holds a die + its readable value label */
.die-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.die-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.die-cell.is-crit .die-value {
  color: #4ade80;
  border-color: #16a34a;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}

.die-cell.is-fumble .die-value {
  color: #fca5a5;
  border-color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.die {
  --size: 80px;
  --face-color: #f8fafc;
  --face-text: #0f172a;
  width: var(--size);
  height: var(--size);
  position: relative;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.die-cell.is-crit .die-poly .poly-shape,
.die-cell.is-crit .cube-face {
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.6);
}
.die-cell.is-fumble .die-poly .poly-shape,
.die-cell.is-fumble .cube-face {
  box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.6);
}

.die.rolling {
  animation: tumble 0.7s ease-out;
}

@keyframes tumble {
  0%   { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0); }
  20%  { transform: rotateX(180deg) rotateY(120deg) rotateZ(40deg) translateY(-20px); }
  50%  { transform: rotateX(360deg) rotateY(280deg) rotateZ(180deg) translateY(-30px); }
  80%  { transform: rotateX(540deg) rotateY(420deg) rotateZ(280deg) translateY(-10px); }
  100% { transform: rotateX(720deg) rotateY(540deg) rotateZ(360deg) translateY(0); }
}

/* Polyhedral dice are flat SVGs — 3D rotation just shows the back.
   Use 2D rotation + a bouncy throw arc instead. Layered with a wobble. */
.die-poly.rolling {
  animation: tumblePoly 0.8s cubic-bezier(0.4, 1.4, 0.5, 1);
  transform-origin: 50% 60%;
}

@keyframes tumblePoly {
  0%   { transform: translateY(0)   rotate(0deg)    scale(1); }
  18%  { transform: translateY(-38px) rotate(170deg) scale(0.88); }
  38%  { transform: translateY(-12px) rotate(330deg) scale(1.06); }
  55%  { transform: translateY(-26px) rotate(490deg) scale(0.94); }
  72%  { transform: translateY(-6px)  rotate(610deg) scale(1.03); }
  88%  { transform: translateY(-2px)  rotate(700deg) scale(0.99); }
  100% { transform: translateY(0)     rotate(720deg) scale(1); }
}

/* While cycling values during a roll, slightly dim the chip so the
   user perceives it as "in motion" rather than a final result. */
.die-cell.is-cycling .die-value {
  color: var(--text-muted);
  opacity: 0.85;
}

/* ---------- d6 cube (CSS 3D) ---------- */
.die-d6 {
  transform-style: preserve-3d;
  transform: rotateX(-25deg) rotateY(35deg);
}

.die-d6.rolling {
  animation: tumbleCube 0.8s ease-out;
}

@keyframes tumbleCube {
  0%   { transform: rotateX(-25deg) rotateY(35deg); }
  25%  { transform: rotateX(195deg) rotateY(155deg); }
  50%  { transform: rotateX(415deg) rotateY(295deg); }
  75%  { transform: rotateX(635deg) rotateY(455deg); }
  100% { transform: rotateX(-25deg) rotateY(35deg); }
}

.cube-face {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background: var(--face-color);
  color: var(--face-text);
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 10px;
  /* Bolder, more defined edge */
  box-shadow:
    inset 0 0 0 2.5px rgba(0, 0, 0, 0.55),
    inset 0 -4px 0 0 rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.pip {
  width: 12px;
  height: 12px;
  background: var(--pip);
  border-radius: 50%;
  align-self: center;
  justify-self: center;
}

.cube-face.face-1 { transform: translateZ(calc(var(--size) / 2)); }
.cube-face.face-2 { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.cube-face.face-3 { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.cube-face.face-4 { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.cube-face.face-5 { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.cube-face.face-6 { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }

/* Pip patterns by face */
.pip.p-tl { grid-column: 1; grid-row: 1; }
.pip.p-tc { grid-column: 2; grid-row: 1; }
.pip.p-tr { grid-column: 3; grid-row: 1; }
.pip.p-ml { grid-column: 1; grid-row: 2; }
.pip.p-mc { grid-column: 2; grid-row: 2; }
.pip.p-mr { grid-column: 3; grid-row: 2; }
.pip.p-bl { grid-column: 1; grid-row: 3; }
.pip.p-bc { grid-column: 2; grid-row: 3; }
.pip.p-br { grid-column: 3; grid-row: 3; }

/* ---------- Polyhedral dice (SVG-based) ---------- */
.die-poly {
  width: var(--size);
  height: var(--size);
  position: relative;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4));
}

.die-poly svg {
  width: 100%;
  height: 100%;
  display: block;
}

.die-poly .poly-shape {
  fill: var(--face-color);
  stroke: rgba(0, 0, 0, 0.6);
  stroke-width: 4;
  stroke-linejoin: round;
}

.die-poly .poly-inner {
  fill: none;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-width: 2.25;
}

.die-poly .poly-text {
  fill: var(--face-text);
  font-size: 28px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.die-poly.d100 .poly-text {
  font-size: 22px;
}

/* Slight bounce when settled */
.die.settled {
  animation: settle 0.25s ease-out;
}

@keyframes settle {
  0%   { transform: translateY(-4px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

/* -------------------- Responsive -------------------- */
@media (min-width: 720px) {
  .app-main {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
  }

  .app-footer {
    background: transparent;
  }

  .btn-roll {
    max-width: 360px;
  }

  .die {
    --size: 108px;
  }

  .dice-stage {
    min-height: 320px;
    padding: 48px 8px 40px;
  }

  .results-total {
    font-size: 56px;
  }
}

/* -------------------- Page nav (discrete footer links) --------------------
   On the main app, the .app-footer is `position: fixed` and overlays the
   document bottom. The bottom padding here ensures these links can scroll
   fully into view above the footer. On content pages (no fixed footer)
   the extra padding is harmless. */
.page-nav {
  text-align: center;
  padding: 32px 18px calc(140px + env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.page-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 4px;
  transition: color 0.15s;
}

.page-nav a:hover { color: var(--text); }

/* -------------------- Content page (about, privacy, terms, articles) ------- */
.content-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 22px 80px;
  color: var(--text);
}

.content-page a { color: var(--accent); text-decoration: none; }
.content-page a:hover { text-decoration: underline; }

.content-page h1 {
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.content-page .lead {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0 0 24px;
}

.content-page h2 {
  font-size: 20px;
  margin: 32px 0 10px;
}

.content-page h3 {
  font-size: 16px;
  margin: 22px 0 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.content-page p, .content-page li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.content-page ul, .content-page ol { padding-left: 22px; }

.content-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.content-page th, .content-page td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.content-page th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.content-page code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.content-page .meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.content-page .back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .die.rolling,
  .die-d6.rolling,
  .die.settled {
    animation: none !important;
  }
}
