/* ============================================================
   Tavern Roll v2 — Dark Fantasy Glassmorphism Design System
   ============================================================ */

:root {
  /* palette */
  --bg-0: #0a0613;
  --bg-1: #140b26;
  --bg-2: #1d1138;
  --gold: #fbbf24;
  --gold-soft: #fcd34d;
  --gold-dim: rgba(251, 191, 36, .55);
  --arcane: #a78bfa;
  --arcane-deep: #7c3aed;
  --ember: #fb7185;
  --blood: #ef4444;
  --life: #34d399;
  --frost: #60a5fa;
  --ink: #f3eefc;
  --ink-dim: #b9aed6;
  --ink-faint: #8678a8;

  /* glass */
  --glass: rgba(255, 255, 255, .055);
  --glass-strong: rgba(255, 255, 255, .09);
  --glass-border: rgba(255, 255, 255, .12);
  --glass-border-bright: rgba(251, 191, 36, .35);
  --blur: 18px;

  /* type */
  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* z scale */
  --z-nav: 30; --z-panel: 20; --z-modal: 50; --z-toast: 60; --z-overlay: 55;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255,255,255,.08);
  --shadow-glow-gold: 0 0 24px rgba(251, 191, 36, .25);
  --shadow-glow-arcane: 0 0 28px rgba(167, 139, 250, .3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; line-height: 1.25; }
a { color: var(--gold); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; }
::selection { background: rgba(167, 139, 250, .4); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(251,191,36,.35); border: 2px solid transparent; background-clip: content-box; }

/* ============ Ambient background layers ============ */
.bg-night {
  position: fixed; inset: 0; z-index: -4;
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(124, 58, 237, .22), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 110%, rgba(251, 146, 60, .12), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 90%, rgba(96, 165, 250, .08), transparent 60%),
    linear-gradient(165deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
}
.bg-stars { position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 28% 8%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 45% 30%, rgba(251,191,36,.6), transparent),
    radial-gradient(1px 1px at 62% 12%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 78% 25%, rgba(167,139,250,.7), transparent),
    radial-gradient(1px 1px at 90% 6%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 5% 55%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.5px 1.5px at 35% 65%, rgba(255,255,255,.3), transparent),
    radial-gradient(1px 1px at 85% 60%, rgba(167,139,250,.5), transparent),
    radial-gradient(1px 1px at 55% 85%, rgba(255,255,255,.35), transparent);
  animation: twinkle 8s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
.bg-glow { position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse 40% 30% at 50% 0%, rgba(251,191,36,.06), transparent 70%);
}
.bg-embers { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ember {
  position: absolute; bottom: -10px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold-soft), rgba(251,146,60,.6) 60%, transparent);
  animation: emberRise linear infinite;
  opacity: 0;
}
@keyframes emberRise {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  8% { opacity: .85; }
  60% { opacity: .5; }
  100% { transform: translateY(-105vh) translateX(var(--drift, 40px)) scale(.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .bg-embers { display: none; }
}

/* ============ Glass primitives ============ */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
}
.glass-strong { background: var(--glass-strong); }

.panel { position: relative; padding: 22px; }
.panel::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35) 50%, transparent);
  pointer-events: none;
}

/* ============ Buttons (glassmorphic) ============ */
.btn {
  --btn-glow: rgba(251, 191, 36, .35);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.04));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--ink); font-size: 15px; font-weight: 600;
  cursor: pointer; user-select: none;
  position: relative; overflow: hidden;
  transition: border-color .2s ease, box-shadow .25s ease, background .2s ease, color .2s ease, opacity .2s ease;
}
.btn::after { /* sheen sweep */
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-20deg); transition: left .45s ease; pointer-events: none;
}
.btn:hover { border-color: var(--glass-border-bright); box-shadow: 0 0 0 1px rgba(251,191,36,.15), 0 6px 24px var(--btn-glow); }
.btn:hover::after { left: 130%; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:active { box-shadow: inset 0 2px 8px rgba(0,0,0,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:disabled::after { display: none; }

.btn-gold {
  background: linear-gradient(135deg, rgba(251,191,36,.28), rgba(251,146,60,.14));
  border-color: rgba(251,191,36,.45); color: #fde68a;
}
.btn-gold:hover { box-shadow: 0 0 0 1px rgba(251,191,36,.3), 0 8px 30px rgba(251,191,36,.35); }
.btn-arcane {
  --btn-glow: rgba(167,139,250,.4);
  background: linear-gradient(135deg, rgba(167,139,250,.26), rgba(124,58,237,.14));
  border-color: rgba(167,139,250,.45); color: #ddd6fe;
}
.btn-arcane:hover { border-color: rgba(167,139,250,.7); }
.btn-danger {
  --btn-glow: rgba(239,68,68,.4);
  background: linear-gradient(135deg, rgba(239,68,68,.22), rgba(190,18,60,.12));
  border-color: rgba(239,68,68,.4); color: #fecaca;
}
.btn-danger:hover { border-color: rgba(239,68,68,.7); }
.btn-life {
  --btn-glow: rgba(52,211,153,.35);
  background: linear-gradient(135deg, rgba(52,211,153,.22), rgba(16,185,129,.1));
  border-color: rgba(52,211,153,.4); color: #a7f3d0;
}
.btn-sm { min-height: 34px; padding: 5px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 54px; padding: 14px 34px; font-size: 17px; font-family: var(--font-display); letter-spacing: .04em; }
.btn-icon { min-width: 44px; padding: 8px; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--glass); border-color: var(--glass-border); }
.btn svg { flex-shrink: 0; }

/* dice quick buttons */
.die-btn {
  width: 56px; height: 56px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(167,139,250,.16), rgba(255,255,255,.04));
  border: 1px solid var(--glass-border); border-radius: 14px;
  color: var(--ink); cursor: pointer; font-weight: 700; font-size: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .2s, box-shadow .25s, transform .15s;
  position: relative;
}
.die-btn:hover { border-color: var(--arcane); box-shadow: var(--shadow-glow-arcane); }
.die-btn:active { transform: scale(.93); }
.die-btn:focus-visible { outline: 2px solid var(--arcane); outline-offset: 2px; }
.die-btn svg { width: 24px; height: 24px; margin-bottom: 2px; }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .08em; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: rgba(0,0,0,.28);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(251,191,36,.12); }
.input::placeholder { color: var(--ink-faint); }
select.input { cursor: pointer; }
select.input option { background: var(--bg-1); color: var(--ink); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.input-sm { min-height: 34px; padding: 5px 10px; font-size: 13px; }

/* ============ Layout ============ */
.shell { max-width: 1280px; margin: 0 auto; padding: 88px 20px 48px; }
.topnav {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: var(--z-nav);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  max-width: 1420px; margin: 0 auto;
}
/* keep a long username from pushing the nav links off the bar */
.nav-actions .nav-link .nl-text { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav .brand { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; }
.brand-logo { width: 36px; height: 36px; filter: drop-shadow(0 0 8px rgba(251,191,36,.5)); animation: logoSpin 14s linear infinite; }
@keyframes logoSpin { from { transform: rotate(0); } 50% { transform: rotate(8deg); } to { transform: rotate(0); } }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--gold);
  text-shadow: 0 0 18px rgba(251,191,36,.4); white-space: nowrap; }
.nav-links { display: flex; gap: 3px; margin-left: 8px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 8px 9px; border-radius: 10px; color: var(--ink-dim); cursor: pointer; font-weight: 500; font-size: 13.5px;
  border: 1px solid transparent; background: none; transition: color .2s, background .2s, border-color .2s;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; white-space: nowrap; flex-shrink: 0;
}
.topnav .nav-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: nowrap; }
.nav-chip { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.nav-chip .tag { white-space: nowrap; }
/* crowded laptops: below the nav's max-width the labels won't fit, so collapse the
   main links (and username) to icons — tooltips still name each one. */
@media (max-width: 1420px) {
  .nav-link .nl-text { display: none; }
  .nav-link { padding: 8px 10px; }
  .nav-chip .tag { font-size: 11px; padding: 3px 7px; }
}
.nav-link:hover { color: var(--ink); background: var(--glass); }
.nav-link.active { color: var(--gold-soft); background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.25); }
.nav-spacer { flex: 1; }

/* mobile hamburger menu (hidden on desktop; replaces the scrolling nav on phones) */
.nav-burger { display: none; }
.nav-drawer { display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-modal);
  width: min(280px, calc(100vw - 24px)); flex-direction: column; gap: 2px; padding: 8px; animation: menuIn .18s ease; }
.nav-drawer.open { display: flex; }
.nav-drawer-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 11px 13px;
  border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink); font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; text-align: start; transition: background .15s, color .15s; }
.nav-drawer-item:hover { background: var(--glass); }
.nav-drawer-item.active { color: var(--gold-soft); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.25); }
.nav-drawer-item.danger { color: #fecaca; }
.nav-drawer-item svg { flex-shrink: 0; }

/* page transition */
.page { animation: pageIn .4s cubic-bezier(.2,.8,.3,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--ink-dim); font-size: 14px; }
.tiny { font-size: 12px; color: var(--ink-faint); }
.gold-text { color: var(--gold-soft); }
.arcane-text { color: var(--arcane); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.center { text-align: center; }
.clickable { cursor: pointer; }

/* cards */
.card { padding: 18px; transition: border-color .25s, box-shadow .25s, background .25s; position: relative; }
.card.clickable:hover { border-color: var(--glass-border-bright); box-shadow: var(--shadow-glow-gold); background: var(--glass-strong); }
.card-title { font-size: 17px; margin-bottom: 4px; color: var(--ink); }

/* hero (auth) */
.hero-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px; animation: authIn .6s cubic-bezier(.2,.9,.3,1.1); }
@keyframes authIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-logo svg { width: 72px; height: 72px; filter: drop-shadow(0 0 18px rgba(251,191,36,.55)); animation: heroFloat 5s ease-in-out infinite; }
@keyframes heroFloat { 0%,100% { transform: translateY(0) rotate(-2deg);} 50% { transform: translateY(-9px) rotate(2deg);} }
.auth-title { font-size: 30px; color: var(--gold); text-shadow: 0 0 24px rgba(251,191,36,.45); text-align: center; }
.auth-sub { color: var(--ink-dim); font-size: 14px; text-align: center; margin-top: -4px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; background: rgba(0,0,0,.25); padding: 5px; border-radius: 12px; }
.auth-tabs button { flex: 1; padding: 9px; border: none; border-radius: 9px; background: none; color: var(--ink-dim); font-weight: 600; cursor: pointer; transition: all .2s; min-height: 40px; }
.auth-tabs button.active { background: linear-gradient(135deg, rgba(251,191,36,.25), rgba(251,146,60,.1)); color: var(--gold-soft); box-shadow: 0 2px 12px rgba(251,191,36,.2); }

/* ============ Stat blocks / character sheet ============ */
.ability-hex {
  position: relative; text-align: center; padding: 14px 8px 10px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid var(--glass-border); cursor: pointer; transition: border-color .2s, box-shadow .25s;
}
.ability-hex:hover { border-color: var(--arcane); box-shadow: var(--shadow-glow-arcane); }
.ability-hex .ab-name { font-size: 11px; letter-spacing: .14em; color: var(--ink-faint); text-transform: uppercase; font-weight: 700; }
.ability-hex .ab-mod { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--gold-soft); line-height: 1.2; }
.ability-hex .ab-score { font-size: 13px; color: var(--ink-dim); }

.stat-pill { display: inline-flex; flex-direction: column; align-items: center; padding: 10px 16px; border-radius: 12px;
  background: rgba(0,0,0,.25); border: 1px solid var(--glass-border); min-width: 84px; }
.stat-pill .sp-val { font-family: var(--font-display); font-size: 21px; font-weight: 800; color: var(--ink); }
.stat-pill .sp-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); }

.hp-bar { height: 10px; border-radius: 6px; background: rgba(0,0,0,.45); overflow: hidden; position: relative; }
.hp-bar > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #059669, var(--life)); transition: width .45s cubic-bezier(.2,.8,.3,1); }
.hp-bar.low > div { background: linear-gradient(90deg, #b45309, var(--gold)); }
.hp-bar.critical > div { background: linear-gradient(90deg, #991b1b, var(--blood)); animation: hpPulse 1.2s ease-in-out infinite; }
@keyframes hpPulse { 0%,100% { filter: brightness(1);} 50% { filter: brightness(1.5);} }

.slot-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--arcane); cursor: pointer; transition: all .2s; background: transparent; padding: 0; }
.slot-dot.full { background: radial-gradient(circle at 35% 30%, #ddd6fe, var(--arcane-deep)); box-shadow: 0 0 8px rgba(167,139,250,.7); }
.slot-dot:hover { transform: scale(1.2); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); color: var(--ink-dim); }
.tag-gold { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); color: var(--gold-soft); }
.tag-arcane { background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.4); color: #ddd6fe; }
.tag-danger { background: rgba(239,68,68,.13); border-color: rgba(239,68,68,.4); color: #fecaca; }
.tag-life { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: #a7f3d0; }
.tag.clickable:hover { border-color: var(--gold); color: var(--gold-soft); }

/* skill rows */
.skill-row { display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-radius: 8px; font-size: 14px; transition: background .15s; cursor: pointer; }
.skill-row:hover { background: rgba(255,255,255,.05); }
.skill-row .prof-dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink-faint); flex-shrink: 0; }
.skill-row .prof-dot.prof { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(251,191,36,.6); }
.skill-row .prof-dot.expert { background: var(--arcane); border-color: var(--arcane); box-shadow: 0 0 8px rgba(167,139,250,.8); }
.skill-row .sk-bonus { margin-left: auto; font-weight: 700; color: var(--gold-soft); font-variant-numeric: tabular-nums; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--glass-border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--ink-dim);
  font-weight: 600; font-size: 14px; cursor: pointer; transition: color .2s, border-color .2s; white-space: nowrap; min-height: 44px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--gold-soft); border-bottom-color: var(--gold); }

/* ============ Modal ============ */
.modal-veil { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(5,2,12,.7); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; animation: veilIn .25s ease; overflow-y: auto; }
@keyframes veilIn { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 26px; animation: modalIn .35s cubic-bezier(.2,.9,.3,1.08); margin: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-wide { max-width: 860px; }
.modal h3 { color: var(--gold-soft); margin-bottom: 14px; font-size: 21px; }

/* ============ Toasts ============ */
.toast-stack { position: fixed; top: 76px; right: 16px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { padding: 13px 18px; border-radius: 13px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px;
  background: rgba(20, 12, 40, .85); backdrop-filter: blur(16px); border: 1px solid var(--glass-border);
  box-shadow: 0 10px 36px rgba(0,0,0,.5); animation: toastIn .4s cubic-bezier(.2,.9,.3,1.15); }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }
.toast.gold { border-color: rgba(251,191,36,.45); box-shadow: 0 8px 30px rgba(251,191,36,.15); }
.toast.danger { border-color: rgba(239,68,68,.5); }
.toast.life { border-color: rgba(52,211,153,.45); }
.toast svg { flex-shrink: 0; margin-top: 2px; }

/* ============ Dice overlay animation ============ */
.dice-overlay { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; pointer-events: none; }
.dice-spin {
  font-family: var(--font-display); font-size: 64px; font-weight: 800; color: var(--gold);
  width: 150px; height: 150px; display: grid; place-items: center;
  filter: drop-shadow(0 0 30px rgba(251,191,36,.65));
  animation: diceTumble .85s cubic-bezier(.3,.9,.4,1.1);
}
@keyframes diceTumble {
  0% { transform: scale(.2) rotate(-260deg); opacity: 0; }
  55% { transform: scale(1.18) rotate(18deg); opacity: 1; }
  75% { transform: scale(.94) rotate(-7deg); }
  100% { transform: scale(1) rotate(0); }
}
.dice-result-big { position: absolute; font-family: var(--font-display); font-size: 46px; font-weight: 800; color: var(--ink);
  text-shadow: 0 0 22px rgba(251,191,36,.9); }
.dice-spin.crit { color: var(--life); filter: drop-shadow(0 0 40px rgba(52,211,153,.9)); }
.dice-spin.fumble { color: var(--blood); filter: drop-shadow(0 0 40px rgba(239,68,68,.9)); }

/* chat roll cards */
.roll-card { border-left: 3px solid var(--arcane); padding: 8px 12px; border-radius: 8px; background: rgba(167,139,250,.07); }
.roll-card.crit { border-left-color: var(--life); background: rgba(52,211,153,.08); }
.roll-card.fumble { border-left-color: var(--blood); background: rgba(239,68,68,.08); }
.roll-total { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--gold-soft); }
.roll-breakdown { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* ============ Room layout ============ */
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .room-grid { grid-template-columns: minmax(0, 1fr); } }
.chat-box { display: flex; flex-direction: column; height: 540px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 14px; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.chat-msg .who { font-weight: 700; color: var(--gold-soft); margin-right: 6px; }
.chat-msg.system { color: var(--ink-faint); font-style: italic; font-size: 13px; text-align: center; }
.chat-msg.whisper { color: var(--arcane); }
.chat-msg .when { font-size: 11px; color: var(--ink-faint); margin-left: 6px; }

.presence-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); display: inline-block; flex-shrink: 0; }
.presence-dot.on { background: var(--life); box-shadow: 0 0 7px rgba(52,211,153,.9); animation: presencePulse 2.4s ease-in-out infinite; }
@keyframes presencePulse { 0%,100% { box-shadow: 0 0 4px rgba(52,211,153,.5);} 50% { box-shadow: 0 0 10px rgba(52,211,153,1);} }

/* combat tracker */
.combatant { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px;
  background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); transition: all .3s; }
.combatant.current { border-color: var(--gold); background: rgba(251,191,36,.08); box-shadow: var(--shadow-glow-gold); transform: scale(1.015); }
.combatant.dead { opacity: .45; filter: grayscale(.8); }
.combatant .init-badge { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--gold-soft);
  background: rgba(0,0,0,.35); border: 1px solid var(--glass-border); flex-shrink: 0; }
.cond-icon { width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; font-size: 12px;
  background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); cursor: pointer; }

/* battle map */
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--glass-border); background: #0d0a18; }
.map-wrap canvas { display: block; width: 100%; cursor: grab; touch-action: none; }
.map-wrap canvas:active { cursor: grabbing; }
.map-toolbar { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 5; max-width: calc(100% - 20px); }
.map-tool { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
  background: rgba(12, 8, 26, .82); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); color: var(--ink-dim); transition: all .2s; }
.map-tool:hover { color: var(--gold-soft); border-color: var(--glass-border-bright); }
.map-tool.active { color: var(--gold); border-color: var(--gold); background: rgba(251,191,36,.15); box-shadow: 0 0 12px rgba(251,191,36,.3); }
.map-tool svg { width: 20px; height: 20px; }

/* hamburger map menu (works in fullscreen since it lives inside .map-wrap) */
.map-burger { position: absolute; top: 10px; right: 10px; z-index: 7; }
.map-menu { position: absolute; top: 58px; right: 10px; z-index: 8; width: 230px; max-height: calc(100% - 70px);
  overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 3px;
  background: rgba(12, 8, 26, .94); animation: menuIn .18s ease; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } }
.map-menu-item { text-align: left; padding: 9px 12px; border-radius: 9px; background: none; border: 1px solid transparent;
  color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; min-height: 40px; }
.map-menu-item:hover { background: var(--glass); border-color: var(--glass-border); color: var(--gold-soft); }
.map-menu-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint);
  padding: 8px 12px 4px; border-top: 1px solid var(--glass-border); margin-top: 4px; }

/* ============ Guided tutorial (spotlight + arrow + box) ============ */
.tut-overlay { position: fixed; inset: 0; z-index: 80; display: none; }
.tut-hole { position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(6, 3, 14, .74), 0 0 0 2px var(--gold), 0 0 22px 4px rgba(251,191,36,.55) inset;
  transition: all .3s cubic-bezier(.2,.8,.3,1); animation: tutPulse 1.8s ease-in-out infinite; }
@keyframes tutPulse { 0%,100% { box-shadow: 0 0 0 9999px rgba(6,3,14,.74), 0 0 0 2px var(--gold), 0 0 18px 2px rgba(251,191,36,.4) inset; } 50% { box-shadow: 0 0 0 9999px rgba(6,3,14,.74), 0 0 0 2px var(--gold-soft), 0 0 30px 6px rgba(251,191,36,.7) inset; } }
.tut-box { position: fixed; z-index: 81; width: 340px; max-width: calc(100vw - 24px); max-height: 88vh; padding: 18px 20px;
  background: linear-gradient(160deg, rgba(28,18,52,.98), rgba(16,10,32,.98));
  border: 1px solid var(--glass-border-bright); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6), var(--shadow-glow-gold); animation: modalIn .3s cubic-bezier(.2,.9,.3,1.05); }
.tut-box[dir="rtl"] { text-align: right; font-family: var(--font-body); }
.tut-arrow { position: absolute; width: 0; height: 0; border: 11px solid transparent; }
.tut-arrow.top { top: -22px; border-bottom-color: var(--gold); }
.tut-arrow.bottom { bottom: -22px; border-top-color: var(--gold); }
.tut-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tut-step { font-size: 12px; color: var(--ink-faint); font-weight: 700; letter-spacing: .05em; }
.tut-lang { display: flex; gap: 4px; }
.tut-lang button { padding: 3px 10px; border-radius: 8px; border: 1px solid var(--glass-border); background: rgba(0,0,0,.25);
  color: var(--ink-dim); font-size: 12px; font-weight: 700; cursor: pointer; transition: all .2s; }
.tut-lang button.active { background: rgba(251,191,36,.18); border-color: var(--gold); color: var(--gold-soft); }
.tut-icon { font-size: 34px; text-align: center; margin: 2px 0 6px; }
.tut-box h3 { font-size: 21px; color: var(--gold-soft); margin-bottom: 8px; }
.tut-text { color: var(--ink-dim); font-size: 14.5px; line-height: 1.7; }
.tut-dots { display: flex; gap: 5px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.tut-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); transition: all .25s; }
.tut-dot.on { background: var(--gold); width: 18px; border-radius: 4px; box-shadow: 0 0 8px rgba(251,191,36,.7); }
.tut-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tut-box[dir="rtl"] .tut-nav, .tut-box[dir="rtl"] .tut-head { flex-direction: row-reverse; }

/* token stat popup */
.token-popup { position: absolute; z-index: 9; width: 276px; padding: 12px 14px;
  background: rgba(14, 9, 30, .96); animation: modalIn .2s ease; }
.token-popup .field { margin-bottom: 0; }
.token-popup .field label { font-size: 10px; letter-spacing: .04em; }
.token-popup input.input-sm { min-height: 32px; padding: 4px 6px; text-align: center; font-size: 14px; }
.token-popup .ability-hex { padding: 7px 2px; }
.token-popup .ability-hex .ab-name { letter-spacing: .04em; font-size: 10px; }
.token-popup .ability-hex .ab-mod { font-size: 17px; }
.token-popup .ability-hex .ab-score { font-size: 12px; }

/* number inputs: drop the spinner so digits never get clipped in tight fields */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* fullscreen battle map */
.map-wrap:fullscreen { width: 100vw; height: 100vh; border-radius: 0; border: none; }
.map-wrap:fullscreen canvas { width: 100vw; height: 100vh; }
.map-wrap:-webkit-full-screen { width: 100vw; height: 100vh; }

@keyframes pingRing {
  0% { transform: scale(.2); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* death saves */
.ds-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-faint); cursor: pointer; background: transparent; padding: 0; transition: all .2s; }
.ds-dot.success { background: var(--life); border-color: var(--life); box-shadow: 0 0 8px rgba(52,211,153,.8); }
.ds-dot.fail { background: var(--blood); border-color: var(--blood); box-shadow: 0 0 8px rgba(239,68,68,.8); }

/* exhaustion */
.exh-step { flex: 1; height: 9px; border-radius: 5px; background: rgba(255,255,255,.08); cursor: pointer; transition: all .2s; }
.exh-step.on { background: linear-gradient(90deg, var(--gold), var(--ember)); box-shadow: 0 0 9px rgba(251,113,133,.5); }

/* wizard steps */
.wiz-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.wiz-step { flex: 1; text-align: center; padding: 9px 4px; border-radius: 10px; font-size: 12px; font-weight: 600;
  color: var(--ink-faint); background: rgba(255,255,255,.04); border: 1px solid transparent; transition: all .3s; }
.wiz-step.active { color: var(--gold-soft); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.35); box-shadow: var(--shadow-glow-gold); }
.wiz-step.done { color: var(--life); }

.choice-card { padding: 14px; border-radius: 13px; cursor: pointer; text-align: center; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.04); transition: all .2s; }
.choice-card:hover { border-color: var(--glass-border-bright); background: rgba(255,255,255,.07); }
.choice-card.selected { border-color: var(--gold); background: rgba(251,191,36,.1); box-shadow: var(--shadow-glow-gold); }
.choice-card .cc-name { font-weight: 700; font-family: var(--font-display); }
.choice-card .cc-sub { font-size: 12px; color: var(--ink-dim); }

/* spell cards */
.spell-row { padding: 10px 13px; border-radius: 11px; background: rgba(255,255,255,.035); border: 1px solid var(--glass-border);
  transition: border-color .2s; }
.spell-row:hover { border-color: rgba(167,139,250,.5); }
.spell-school { font-size: 11px; color: var(--arcane); text-transform: uppercase; letter-spacing: .08em; }

/* portrait */
.portrait { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; border: 2px solid var(--glass-border-bright);
  box-shadow: 0 0 18px rgba(251,191,36,.2); background: var(--bg-2); }
.portrait-lg { width: 120px; height: 120px; }
.portrait-placeholder { display: grid; place-items: center; color: var(--ink-faint); }

/* notifications bell */
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
  background: var(--blood); color: white; font-size: 10px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 8px rgba(239,68,68,.7); animation: bellPop .3s cubic-bezier(.3,1.6,.5,1); }
@keyframes bellPop { from { transform: scale(0);} }
.notif-panel { position: absolute; right: 0; top: 50px; width: 330px; max-height: 420px; overflow-y: auto; padding: 12px; z-index: var(--z-modal); }
.notif-item { padding: 9px 11px; border-radius: 10px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.05); }
.notif-item.unread { background: rgba(251,191,36,.06); }

/* offline banner */
.offline-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 14px; font-size: 14px; font-weight: 600;
  background: rgba(120, 20, 30, .85); backdrop-filter: blur(14px); border: 1px solid rgba(239,68,68,.5); color: #fecaca;
  animation: bannerIn .4s ease; box-shadow: 0 10px 40px rgba(239,68,68,.25); }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, 20px); } }

/* loading shimmer */
.shimmer { position: relative; overflow: hidden; background: rgba(255,255,255,.05); border-radius: var(--radius-sm); min-height: 60px; }
.shimmer::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmerSweep 1.4s infinite; }
@keyframes shimmerSweep { to { transform: translateX(100%); } }

/* session timer */
.session-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold-soft); }

/* kbd hints */
kbd { padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.4); border: 1px solid var(--glass-border);
  font-family: var(--font-body); font-size: 11px; color: var(--ink-dim); box-shadow: 0 2px 0 rgba(0,0,0,.4); }

/* level-up burst */
.levelup-burst { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; pointer-events: none; }
.levelup-text { font-family: var(--font-display); font-size: clamp(38px, 7vw, 84px); font-weight: 800; color: var(--gold);
  text-shadow: 0 0 40px rgba(251,191,36,.9), 0 0 80px rgba(251,146,60,.5);
  animation: levelUpAnim 2.4s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes levelUpAnim {
  0% { opacity: 0; transform: scale(.3) translateY(50px); }
  18% { opacity: 1; transform: scale(1.12) translateY(0); }
  30% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.06) translateY(-32px); }
}
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-soft);
  animation: sparkFly 1.4s ease-out forwards; }
@keyframes sparkFly { to { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; } }

/* print: character sheet PDF export */
@media print {
  body { background: white !important; color: #111 !important; font-size: 12px; }
  .bg-night, .bg-stars, .bg-embers, .bg-glow, .topnav, .toast-stack, .no-print, .offline-banner { display: none !important; }
  .glass { background: white !important; border: 1px solid #ccc !important; box-shadow: none !important; backdrop-filter: none !important; }
  .shell { padding: 0; max-width: 100%; }
  h1, h2, h3, h4, .gold-text, .ability-hex .ab-mod, .stat-pill .sp-val { color: #222 !important; text-shadow: none !important; }
  .muted, .tiny, .ability-hex .ab-name { color: #555 !important; }
  .skill-row .sk-bonus, .roll-total { color: #333 !important; }
  .tag { border-color: #999 !important; color: #333 !important; background: #f3f3f3 !important; }
  .print-only { display: block !important; }

  /* ---- printable sheet themes (set via body.print-<theme>) ---- */
  body.print-parchment { background: #f4e8d0 !important; }
  body.print-parchment .glass { background: #faf3e2 !important; border: 1px solid #c9b083 !important; }
  body.print-parchment h1, body.print-parchment h2, body.print-parchment h3, body.print-parchment .gold-text { color: #6b3f12 !important; font-family: 'Cinzel', serif; }
  body.print-parchment .print-only { border: 2px solid #b9945a; padding: 14px; border-radius: 8px; }

  body.print-ink { background: #fff !important; }
  body.print-ink .glass { background: #fff !important; border: 1px solid #222 !important; }
  body.print-ink h1, body.print-ink h2, body.print-ink h3, body.print-ink .gold-text { color: #111 !important; }

  body.print-arcane { background: #f3f0fb !important; }
  body.print-arcane .glass { background: #fbfaff !important; border: 1px solid #8b5cf6 !important; }
  body.print-arcane h1, body.print-arcane h2, body.print-arcane h3, body.print-arcane .gold-text { color: #5b21b6 !important; font-family: 'Cinzel', serif; }
  body.print-arcane .tag { border-color: #a78bfa !important; color: #5b21b6 !important; }

  body.print-royal { background: #fbf7ea !important; }
  body.print-royal .glass { background: #fffdf6 !important; border: 1.5px solid #caa53a !important; }
  body.print-royal h1, body.print-royal h2, body.print-royal h3, body.print-royal .gold-text { color: #8a6a12 !important; font-family: 'Cinzel', serif; letter-spacing: .04em; }
  body.print-royal .print-only { border: 3px double #caa53a; padding: 16px; border-radius: 6px; }
}
.print-only { display: none; }

/* ============================================================
   Battle Pass showcase page
   ============================================================ */
.bp-page { max-width: 1200px; margin: 0 auto; }
.bp-stage {
  position: relative; overflow: hidden; border-radius: 20px; padding: 40px 44px 30px;
  min-height: 340px; border: 1px solid var(--glass-border-bright);
  background: radial-gradient(ellipse 70% 90% at 50% 20%, rgba(124,58,237,.18), transparent 60%), linear-gradient(160deg, #140d28, #0b0717);
  box-shadow: var(--shadow-glass), inset 0 0 80px rgba(124,58,237,.1);
}
.bp-stage-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(251,191,36,.6), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 85% 60%, rgba(251,191,36,.5), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(167,139,250,.6), transparent);
}
.bp-stage::before {
  content: ''; position: absolute; left: 50%; top: 8%; width: 320px; height: 320px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(251,191,36,.22), transparent 65%);
  pointer-events: none; animation: bpGlow 4s ease-in-out infinite;
}
@keyframes bpGlow { 0%,100% { opacity:.55; transform: translateX(-50%) scale(1);} 50% { opacity:.9; transform: translateX(-50%) scale(1.08);} }
.bp-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.bp-season { text-align: center; min-width: 120px; }
.bp-season-label { font-family: var(--font-display); letter-spacing: .42em; font-size: 13px; color: var(--ink-dim); }
.bp-season-num { font-family: var(--font-display); font-size: 72px; font-weight: 800; line-height: .9;
  background: linear-gradient(180deg, #fde68a, #b8860b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(251,191,36,.4)); }
.bp-title-wrap { flex: 1; text-align: center; max-width: 360px; margin: 0 auto; }
.bp-title { font-family: var(--font-display); font-size: 30px; color: var(--gold); text-shadow: 0 0 24px rgba(251,191,36,.4); margin-bottom: 8px; }
.bp-desc { color: var(--ink-dim); font-size: 14px; line-height: 1.6; }
.bp-cta { text-align: right; min-width: 200px; }
.bp-perks { margin-bottom: 16px; }
.bp-perk { color: var(--gold-soft); font-size: 14px; margin-bottom: 5px; }
.bp-buy {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .04em; color: #1a1003;
  padding: 14px 26px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, #fde68a, #d4a017); box-shadow: 0 6px 26px rgba(251,191,36,.4), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .15s, box-shadow .25s; position: relative; overflow: hidden;
}
.bp-buy:hover { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(251,191,36,.55); }
.bp-buy:disabled { opacity: .6; cursor: not-allowed; }
.bp-buy .bp-price { background: rgba(0,0,0,.18); padding: 2px 8px; border-radius: 6px; font-size: 14px; }
.bp-owned { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  background: rgba(52,211,153,.15); border: 1px solid rgba(52,211,153,.5); color: #a7f3d0; font-weight: 700; }
.bp-hero { position: relative; z-index: 1; text-align: center; margin-top: 6px; min-height: 150px; display: grid; place-items: center; }
.bp-hero img { max-height: 230px; max-width: 80%; object-fit: contain; filter: drop-shadow(0 10px 30px rgba(251,191,36,.35)); animation: bpFloat 5s ease-in-out infinite; }
.bp-hero-ph { font-size: 80px; opacity: .4; animation: bpFloat 5s ease-in-out infinite; }
@keyframes bpFloat { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-12px);} }

.bp-track-wrap { margin-top: 18px; overflow-x: auto; padding: 8px 4px 16px; scrollbar-width: thin; }
.bp-track { display: flex; gap: 14px; min-width: min-content; padding: 0 4px; }
.bp-card { flex: 0 0 110px; text-align: center; }
.bp-card-inner {
  position: relative; height: 130px; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--glass-border); transition: border-color .2s, box-shadow .25s, transform .2s;
}
.bp-card:hover .bp-card-inner { transform: translateY(-4px); }
.bp-card.free .bp-card-inner { border-color: rgba(96,165,250,.4); }
.bp-card.premium .bp-card-inner { border-color: rgba(251,191,36,.5); box-shadow: inset 0 0 24px rgba(251,191,36,.12); }
.bp-card.premium:hover .bp-card-inner { box-shadow: 0 6px 22px rgba(251,191,36,.3), inset 0 0 24px rgba(251,191,36,.12); }
.bp-card-inner img { width: 100%; height: 100%; object-fit: cover; }
.bp-card-ph { font-size: 38px; color: var(--gold-dim); }
.bp-card.locked .bp-card-inner img, .bp-card.locked .bp-card-ph { filter: grayscale(.7) brightness(.6); }
.bp-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; background: rgba(8,4,18,.45); }
.bp-card-name { font-size: 12px; color: var(--ink-dim); margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-tier { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--gold-soft);
  margin-top: 2px; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; display: inline-block;
  background: rgba(0,0,0,.35); border: 1px solid var(--glass-border-bright); }

@media (max-width: 760px) {
  .bp-stage { padding: 24px 18px; }
  .bp-top { flex-direction: column; align-items: center; text-align: center; }
  .bp-cta { text-align: center; }
  .bp-season-num { font-size: 56px; }
  .bp-title { font-size: 24px; }
}

/* mobile */
@media (max-width: 760px) {
  .shell { padding: 76px 12px 90px; }
  .topnav { padding: 8px 12px; gap: 8px; }
  .brand-name { display: none; }
  /* phones: hide the inline link row + desktop actions, use the hamburger drawer */
  .nav-links { display: none; }
  .nav-desktop { display: none !important; }
  .nav-burger { display: inline-flex; }
  .nav-link { padding: 8px 10px; }
  .chat-box { height: 420px; }
  .modal { padding: 18px; }
  .auth-card { padding: 26px 20px; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
  /* map: smaller tools + roomier menu so fat fingers can hit them */
  .map-tool { width: 36px; height: 36px; }
  .map-tool svg { width: 18px; height: 18px; }
  .map-menu { width: min(260px, calc(100vw - 32px)); }
  .map-menu-item { min-height: 44px; }
  .token-popup { width: min(290px, calc(100vw - 24px)); }
  /* combat rows wrap their action buttons instead of overflowing */
  .combatant { flex-wrap: wrap; }
  .combatant .init-badge { width: 34px; height: 34px; font-size: 15px; }
  /* stat blocks breathe a bit on small screens */
  .stat-pill { min-width: 70px; padding: 8px 10px; }
  .die-btn { width: 48px; height: 48px; }
  .shell { padding-bottom: 110px; }
  .grid { gap: 12px; }
  /* keep ability hexes in a clean 3-up row on phones */
  #tab-body .grid[style*="repeat(6"] { grid-template-columns: repeat(3, 1fr) !important; }
  .modal-wide { max-width: 100%; }

  /* any wide table becomes horizontally scrollable instead of breaking the layout */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; max-width: 100%; }

  /* tighter, no horizontal overflow anywhere */
  .shell { padding-left: 10px; padding-right: 10px; }
  .panel { padding: 16px; }
  .card { padding: 14px; }
  h2 { font-size: 22px !important; }
  h3 { font-size: 18px; }
  /* nav: compact actions so they fit beside the scrollable links */
  .topnav { gap: 6px; padding: 8px 10px; }
  .topnav .nav-actions { gap: 4px; }
  .nav-actions .nav-link span.nl-text { display: none; }   /* username → crown icon only */
  .nav-chip .tag { font-size: 10px; padding: 2px 6px; }
  #logout-btn { padding: 6px 10px; }
  /* page wrappers that set inline max-width still need side breathing room */
  .page { width: 100%; }
  /* battle pass cards a touch smaller */
  .bp-card { flex: 0 0 92px; }
  .bp-card-inner { height: 108px; }
  .bp-season-num { font-size: 48px; }
  /* forms / rows never exceed the screen */
  .row { row-gap: 8px; }
  .input, select.input, textarea.input { font-size: 16px; } /* avoid iOS zoom-on-focus */
  /* grids inside modals/pages go single-column for readability */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .ability-hex .ab-mod { font-size: 22px; }
  .btn-lg { font-size: 15px; padding: 12px 20px; }
  .auth-title { font-size: 26px; }
  .die-btn { width: 44px; height: 44px; font-size: 12px; }
  .bp-card { flex: 0 0 80px; }
  .chat-box { height: 360px; }
  .stat-pill { min-width: 0; flex: 1; }
}

/* ============================ v2 FEATURE COMPONENTS ============================ */
.btn-xs { padding: 3px 8px; font-size: 12px; line-height: 1; border-radius: 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-xs { margin-top: 3px; }

/* shared tiny ability grid (monster card + popups) */
.ab-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.ab-cell { text-align: center; background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); border-radius: 8px; padding: 5px 2px; }
.ab-cell .ab-k { display: block; font-size: 10px; color: var(--ink-faint); font-weight: 700; }
.ab-cell .ab-v { display: block; font-size: 15px; font-weight: 700; }
.ab-cell .ab-m { display: block; font-size: 11px; color: var(--gold-soft); }

/* monster / creature card */
.monster-card { margin-top: 6px; }
.monster-art { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1px solid var(--glass-border-bright); }
.monster-art-none { display: flex; align-items: center; justify-content: center; font-size: 34px; background: rgba(255,255,255,.05); }

/* level stepper (sheet + token popup) */
.level-stepper { display: inline-flex; align-items: center; gap: 6px; }

/* bestiary browser (in-room modal list) */
.bestiary-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bestiary-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); border-radius: 10px; color: var(--ink); cursor: pointer; transition: all .15s; }
.bestiary-row:hover { background: rgba(167,139,250,.14); border-color: var(--arcane); }
.bestiary-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.bestiary-thumb-none { display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(255,255,255,.05); }

/* bestiary page grid */
.bestiary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.bestiary-card { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 12px;
  border-radius: 14px; cursor: pointer; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.bestiary-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow-gold); }
.bestiary-card-art { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.bestiary-card-art-none { display: flex; align-items: center; justify-content: center; font-size: 46px; background: rgba(255,255,255,.05); }

/* map gallery */
.map-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.map-gallery-card { padding: 8px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.map-gallery-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.map-thumb { position: relative; aspect-ratio: 16/10; border-radius: 8px; background-size: cover; background-position: center;
  background-color: rgba(255,255,255,.05); display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-size: 12px; }
.map-thumb-add { font-size: 34px; color: var(--gold-soft); }
.map-add { cursor: pointer; transition: transform .15s; }
.map-add:hover { transform: translateY(-3px); }
.map-active-badge { position: absolute; top: 5px; right: 5px; background: var(--gold); color: #1a1206; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }

/* jukebox playlist */
.jukebox-list { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.jukebox-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.04); font-size: 13px; }
.jukebox-row.active { background: rgba(251,191,36,.15); border: 1px solid var(--gold); }

/* voice panel — Discord-style roster + speaking ring */
.voice-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px;
  background: rgba(52,211,153,.06); border: 1px solid rgba(52,211,153,.25); border-radius: 12px; }
.voice-panel-label { font-size: 12px; font-weight: 700; color: var(--life, #34d399); letter-spacing: .03em; }
.voice-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 2px solid transparent; transition: border-color .12s, box-shadow .12s; max-width: 180px; }
.voice-chip.speaking { border-color: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.35), 0 0 14px rgba(52,211,153,.5); }
.voice-chip.muted { opacity: .65; }
.voice-ava { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; background: linear-gradient(150deg, var(--arcane, #a78bfa), var(--gold, #fbbf24)); color: #15102b; flex: 0 0 auto; }
.voice-chip.speaking .voice-ava { animation: voicePulse 1s ease-in-out infinite; }
.voice-name { font-size: 13px; }
.voice-mic { font-size: 13px; }
@keyframes voicePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .voice-chip.speaking .voice-ava { animation: none; } }

@media (max-width: 640px) {
  .bestiary-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .map-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .voice-chip { max-width: 140px; }
  .ab-cell .ab-v { font-size: 13px; }
}
