/* ══════════════════════════════════════════════════════════════
   NICHOLAS HINDMAN — ADVENTURER'S CHARACTER SHEET
   Gygax dark-tome aesthetic · Cinzel + IM Fell English
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #0d0910;
  --bg-deep: #09060c;
  --parchment: #e9dcc0;
  --parchment-dark: #d8c49d;
  --parchment-edge: #b89a63;
  --ink: #241a12;
  --gold: #c9a227;
  --gold-bright: #e8c96a;
  --gold-dim: #8a6d1f;
  --crimson: #8f1d1d;
  --crimson-bright: #b83030;
  --cerulean: #1487c4;
  --cerulean-bright: #3db4e8;
  --cerulean-dim: #0b5f8f;
  --bone-light: #fdf6e3;
  --text-dim: #a89474;
  --font-display: 'Cinzel', serif;
  --font-body: 'IM Fell English', Georgia, serif;
  --font-sc: 'IM Fell English SC', Georgia, serif;
  --shadow-tome: 0 4px 30px rgba(0,0,0,.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% -10%, #1c1226 0%, transparent 55%),
    radial-gradient(ellipse at 85% 30%, #141020 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.65;
  cursor: none !important;
  overflow-x: hidden;
}

a, button, .clickable, .summon-card, .btn, .badge, input, label, summary, .roll-mute {
  cursor: none !important;
}

::selection { background: var(--gold-dim); color: var(--bone-light); }

/* ══════════ XP BAR ══════════ */
.xp-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 8px 20px;
  background: linear-gradient(180deg, rgba(9,6,12,.95), rgba(9,6,12,.75));
  border-bottom: 1px solid rgba(201,162,39,.25);
  backdrop-filter: blur(6px);
}
.xp-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--gold-bright);
}
.xp-track {
  flex: 1;
  height: 10px;
  background: #1a1210;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.8);
}
.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cerulean-dim), var(--cerulean-bright));
  border-radius: 6px;
  transition: width .2s ease;
  box-shadow: 0 0 8px rgba(61,180,232,.6);
}
.xp-pct { min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.xp-label { color: var(--gold); }

/* ══════════ HERO ══════════ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 110px 24px 60px;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(20,135,196,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% -10%, rgba(61,180,232,.12) 0%, transparent 45%),
    radial-gradient(ellipse at 50% -20%, rgba(201,162,39,.10) 0%, transparent 50%);
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: min(900px, 92%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.hero::before { top: 84px; }
.hero::after { bottom: 40px; }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 60px;
  max-width: 1100px;
  width: 100%;
  align-items: center;
}

.portrait-frame { position: relative; }
.portrait-borders {
  position: relative;
  padding: 14px;
  background: linear-gradient(145deg, var(--gold-dim), var(--parchment-edge), var(--gold-dim));
  box-shadow: var(--shadow-tome), 0 0 40px rgba(201,162,39,.15);
  transform: rotate(-1.2deg);
}
.portrait-borders::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(36,26,18,.5);
  pointer-events: none;
}
.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  background: var(--parchment);
  filter: sepia(.18) contrast(1.02);
}
.portrait-caption {
  margin-top: 14px;
  text-align: center;
  font-style: italic;
  color: var(--text-dim);
  font-size: 15px;
  letter-spacing: .04em;
}

/* rubber-stamp "You Found Nik!" — cerulean ink, slapped on the portrait */
.found-stamp {
  position: absolute;
  top: -18px;
  right: -22px;
  z-index: 5;
  transform: rotate(8deg);
  padding: 10px 14px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--cerulean);
  border: 3px double var(--cerulean);
  border-radius: 4px;
  background: rgba(20,135,196,.08);
  box-shadow: 0 0 18px rgba(61,180,232,.35);
  text-shadow: 0 0 8px rgba(61,180,232,.5);
  mix-blend-mode: screen;
  animation: stamp-fade 2.4s ease-out forwards;
  pointer-events: none;
}
@keyframes stamp-fade {
  0% { opacity: 0; transform: rotate(8deg) scale(1.6); }
  18% { opacity: 1; transform: rotate(8deg) scale(.92); }
  28% { transform: rotate(8deg) scale(1.04); }
  40% { transform: rotate(8deg) scale(1); }
  100% { opacity: 1; transform: rotate(8deg) scale(1); }
}

.hero-kicker {
  font-family: var(--font-sc);
  letter-spacing: .22em;
  color: var(--gold-bright);
  font-size: 14px;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(44px, 6.5vw, 84px);
  line-height: 1.05;
  color: var(--bone-light);
  text-shadow: 0 0 30px rgba(201,162,39,.35), 2px 2px 0 rgba(0,0,0,.6);
  letter-spacing: .02em;
}
.hero-class {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(17px, 2.2vw, 24px);
  color: var(--gold);
  margin: 10px 0 6px;
  letter-spacing: .1em;
}
.hero-race { color: var(--text-dim); font-style: italic; margin-bottom: 18px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.badge {
  display: inline-block;
  padding: 7px 14px;
  font-family: var(--font-display);
  font-size: 12.5px;
  letter-spacing: .08em;
  border: 1px solid var(--gold-dim);
  background: rgba(201,162,39,.08);
  color: var(--parchment);
  border-radius: 3px;
}
.badge-clearance {
  border-color: var(--cerulean-bright);
  background: rgba(20,135,196,.15);
  color: #a8dcf5;
}
.hero-tagline {
  font-style: italic;
  color: var(--parchment-dark);
  font-size: 17px;
  margin-bottom: 26px;
  border-left: 3px solid var(--cerulean-dim);
  padding-left: 14px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .1em;
  text-decoration: none;
  border-radius: 3px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-gold {
  background: linear-gradient(160deg, var(--gold-bright), var(--gold-dim));
  color: #1a1208;
  font-weight: 700;
  box-shadow: 0 3px 14px rgba(201,162,39,.35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(201,162,39,.5); }
.btn-ghost {
  border: 1px solid var(--cerulean-dim);
  color: var(--cerulean-bright);
}
.btn-ghost:hover { background: rgba(20,135,196,.12); transform: translateY(-2px); }

.hero-scrollhint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--cerulean-bright);
  font-family: var(--font-sc);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,6px); } }

/* ══════════ SECTIONS ══════════ */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 90px 24px;
  position: relative;
}
.section-head { text-align: center; margin-bottom: 46px; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3.6vw, 38px);
  color: var(--bone-light);
  letter-spacing: .06em;
  position: relative;
  display: inline-block;
  padding-bottom: 14px;
}
.section-head h2::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 120px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.section-sub { color: var(--text-dim); font-style: italic; margin-top: 12px; font-size: 17px; }

/* parchment panel */
.parchment-panel {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23p)' opacity='0.05'/%3E%3C/svg%3E"),
    linear-gradient(165deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  color: var(--ink);
  padding: 44px 48px;
  border-radius: 4px;
  border: 1px solid var(--parchment-edge);
  box-shadow: var(--shadow-tome), inset 0 0 60px rgba(138,109,31,.12);
  position: relative;
}
.parchment-panel::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(36,26,18,.28);
  pointer-events: none;
  border-radius: 2px;
}
.parchment-panel h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  font-size: 20px;
  margin-bottom: 8px;
  letter-spacing: .04em;
}
.parchment-panel p { margin-bottom: 12px; }
.parchment-panel em { color: #5a3d12; }

/* drop cap */
.dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 58px;
  float: left;
  line-height: .85;
  padding: 6px 10px 0 0;
  color: var(--crimson);
}

.background-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(36,26,18,.4);
  font-size: 16px;
}

/* ══════════ ABILITY SCORES ══════════ */
.ability-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.ability {
  text-align: center;
  padding: 22px 10px 18px;
  background: linear-gradient(170deg, #171019, #0e0a12);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ability:hover {
  transform: translateY(-4px);
  border-color: var(--cerulean-bright);
  box-shadow: 0 8px 26px rgba(61,180,232,.25);
}
.ability-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .14em;
  color: var(--gold);
  display: block;
}
.ability-score {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 52px;
  color: var(--bone-light);
  display: block;
  line-height: 1.15;
  text-shadow: 0 0 18px rgba(201,162,39,.4);
}
.ability-skill {
  font-size: 13px;
  font-style: italic;
  color: var(--text-dim);
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

/* ══════════ SKILLS / FEATS ══════════ */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
  align-items: start;
}
.skill-col h3, .feat-col h3 { font-family: var(--font-display); }
.skill-list { list-style: none; margin-top: 14px; }
.skill-list li {
  padding: 7px 0;
  border-bottom: 1px dotted rgba(36,26,18,.35);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.skill-list li:last-child { border-bottom: none; }
.pip { color: var(--crimson); font-size: 11px; }
.feat-card {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(36,26,18,.3);
  border-radius: 3px;
}
.feat-icon { font-size: 26px; }
.feat-card strong { font-family: var(--font-display); font-size: 15px; }

/* ══════════ QUEST LOG ══════════ */
.quest {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 22px;
  margin-bottom: 14px;
}
.quest-rail { display: flex; flex-direction: column; align-items: center; }
.quest-dice {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  color: var(--ink);
  background: linear-gradient(150deg, var(--bone-light), var(--parchment-dark));
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  transform: rotate(12deg);
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
  flex-shrink: 0;
}
.quest-line { flex: 1; width: 2px; background: linear-gradient(180deg, var(--gold-dim), transparent); margin-top: 6px; }
.quest-body {
  background: rgba(20,14,24,.55);
  border: 1px solid rgba(201,162,39,.22);
  border-left: 3px solid var(--gold-dim);
  border-radius: 4px;
  padding: 26px 30px;
  transition: border-color .2s ease, background .2s ease;
}
.quest:hover .quest-body { border-color: rgba(61,180,232,.55); background: rgba(17,28,40,.7); }
.quest-body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  color: var(--bone-light);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
}
.quest-xp {
  font-size: 12.5px;
  color: var(--gold-bright);
  font-weight: 600;
  letter-spacing: .08em;
}
.quest-meta { color: var(--text-dim); font-style: italic; font-size: 15.5px; margin: 4px 0 12px; }
.quest-body ul { list-style: none; }
.quest-body li {
  padding: 6px 0 6px 20px;
  position: relative;
}
.quest-body li::before {
  content: '◆';
  position: absolute;
  left: 0;
  color: var(--gold-dim);
  font-size: 10px;
  top: 13px;
}

/* ══════════ SERVICE ══════════ */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}
.service .parchment-panel ul { margin-top: 10px; list-style: none; }
.service .parchment-panel li { padding: 6px 0 6px 20px; position: relative; }
.service .parchment-panel li::before { content: '⚓'; position: absolute; left: 0; font-size: 11px; top: 10px; }

/* ══════════ SUMMON ══════════ */
.summon-panel {
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(20,135,196,.14), transparent 60%),
    linear-gradient(170deg, #16101c, #0c0911);
  border: 1px solid rgba(61,180,232,.35);
  border-radius: 6px;
  padding: 56px 40px;
  box-shadow: var(--shadow-tome);
}
.summon-panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3.6vw, 38px);
  color: var(--bone-light);
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.summon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 36px 0 26px;
}
.summon-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(201,162,39,.25);
  border-radius: 4px;
  text-decoration: none;
  color: var(--parchment);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
a.summon-card:hover {
  transform: translateY(-3px);
  border-color: var(--cerulean-bright);
  background: rgba(20,135,196,.1);
}
.summon-icon { font-size: 30px; }
.summon-label { font-family: var(--font-sc); letter-spacing: .14em; font-size: 13px; color: var(--gold); text-transform: uppercase; }
.summon-value { font-size: 17px; }
.summon-note { color: var(--text-dim); font-style: italic; }

/* ══════════ FOOTER ══════════ */
.footer {
  text-align: center;
  padding: 50px 24px 90px;
  border-top: 1px solid rgba(201,162,39,.18);
  color: var(--text-dim);
  font-size: 15px;
}
.footer-roll { color: var(--cerulean-bright); font-style: italic; }
.footer-small { margin-top: 8px; font-size: 13.5px; }
.footer-fine { font-size: 12px; opacity: .6; margin-top: 4px; }

/* ══════════ ROLL TRAY ══════════ */
.roll-tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 800;
  width: 190px;
  background: rgba(14,9,18,.92);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  padding: 12px 14px;
  backdrop-filter: blur(4px);
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  transition: opacity .3s ease, transform .3s ease;
}
.roll-tray.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
.roll-tray-head {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--gold-bright);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.roll-tray-list { list-style: none; }
.roll-tray-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 3px 0;
  color: var(--parchment-dark);
  border-bottom: 1px dotted rgba(201,162,39,.15);
}
.roll-tray-list li:last-child { border-bottom: none; }
.roll-tray-list .crit20 { color: var(--gold-bright); font-weight: bold; }
.roll-tray-list .fumble1 { color: var(--crimson-bright); font-weight: bold; }
.roll-mute {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 14px;
  padding: 2px;
  opacity: .8;
}

/* ══════════ RESULT BURST ══════════ */
.result-burst {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(.6);
  z-index: 950;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4.5vw, 52px);
  letter-spacing: .12em;
  color: var(--bone-light);
  text-shadow: 0 0 24px rgba(201,162,39,.7), 2px 2px 0 rgba(0,0,0,.6);
  pointer-events: none;
  opacity: 0;
  text-align: center;
  white-space: nowrap;
}
.result-burst.show {
  animation: burst-pop 1s ease-out forwards;
}
.result-burst .sub {
  display: block;
  font-size: .45em;
  letter-spacing: .3em;
  margin-top: 6px;
  font-weight: 600;
}
.result-burst.nat20 { color: var(--gold-bright); }
.result-burst.nat1 { color: var(--crimson-bright); text-shadow: 0 0 24px rgba(184,48,48,.7), 2px 2px 0 rgba(0,0,0,.6); }
@keyframes burst-pop {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
  30% { transform: translate(-50%,-50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-55%) scale(1.02); }
}

/* ══════════ FIREWORKS CANVAS (nat 20 magic missiles) ══════════ */
#fx-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999990;
}

/* ══════════ D20 CURSOR (bone & gold re-skin) ══════════ */
#d20-cursor-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999999;
}
#d20-pointer {
  position: absolute;
  width: 60px;
  height: 60px;
  transform: translate(-15px, -15px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform;
}
.sparkle-arrow {
  position: absolute;
  top: -2px; left: -2px;
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 17px solid var(--gold-bright);
  transform: rotate(-45deg);
  filter: drop-shadow(0 0 4px rgba(232,201,106,.8));
  animation: arrow-flicker .5s infinite alternate;
  z-index: 10;
}
.d20-container {
  position: absolute;
  top: 15px; left: 15px;
  width: 45px; height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease;
}
.d20-svg {
  position: absolute;
  width: 100%; height: 100%;
  top: 0; left: 0;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.5));
}
.d20-center-face {
  position: absolute;
  top: 18px;
  width: 24px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a2a12;
  font-weight: 900;
  font-size: 13px;
  font-family: var(--font-display);
  user-select: none;
  z-index: 5;
}
.rolling { animation: dice-spin .35s linear infinite; }
.rolling-fast { animation: dice-spin .18s linear infinite; }
.hover-rising {
  transform: translate(-15px, -15px) scale(1.8) !important;
  filter: drop-shadow(0 15px 10px rgba(0,0,0,.7));
}
.click-dropping {
  transform: translate(-15px, -15px) scale(.7) !important;
}
.particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  animation: fade-out .7s forwards ease-out;
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(232,201,106,.9);
}
@keyframes arrow-flicker {
  0% { opacity: .7; filter: drop-shadow(0 0 2px rgba(232,201,106,.7)); }
  100% { opacity: 1; filter: drop-shadow(0 0 8px #fff); }
}
@keyframes dice-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes fade-out {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--mx), var(--my)) scale(0); opacity: 0; }
}

/* die tumble on click */
.d20-tumble {
  animation: d20-tumble .65s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes d20-tumble {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(130deg) scale(.85) translateY(-6px); }
  45%  { transform: rotate(300deg) scale(1.15) translateY(-12px); }
  70%  { transform: rotate(430deg) scale(.9) translateY(-4px); }
  85%  { transform: rotate(500deg) scale(1.05); }
  100% { transform: rotate(540deg) scale(1); }
}

/* ══════════ REVEAL ANIMATIONS ══════════ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease, transform .7s ease;
  transition-delay: calc(var(--i, 0) * 90ms);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ══════════ SR ONLY ══════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .portrait-frame { max-width: 380px; margin: 0 auto; }
  .hero-badges, .hero-cta { justify-content: center; }
  .ability-grid { grid-template-columns: repeat(3, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr; }
  .summon-grid { grid-template-columns: 1fr; }
  .parchment-panel { padding: 34px 26px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .ability-grid { grid-template-columns: repeat(2, 1fr); }
  .quest { grid-template-columns: 1fr; }
  .quest-rail { display: none; }
  .roll-tray { width: 160px; }
  .found-stamp { top: -10px; right: -8px; font-size: 13px; padding: 7px 10px; }
}

/* ══════════ REDUCED MOTION ══════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-scrollhint, .rolling, .rolling-fast, .d20-tumble { animation: none !important; }
  .result-burst.show { animation: none; opacity: 1; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Hide custom cursor & tray on touch devices */
@media (pointer: coarse) {
  body, a, button, .clickable, .summon-card, .btn, .badge, .roll-mute { cursor: auto !important; }
  #d20-cursor-container { display: none; }
}
