/* Crowd Quest — bright, playful, readable across a room.
   (Deliberately NOT the gothic candlelight theme — that stays TrackXP D&D's.) */

:root {
  --bg: #140b2e;
  --bg-2: #1d1240;
  --panel: #241751;
  --panel-2: #2d1d63;
  --line: #453578;
  --text: #f4f0ff;
  --muted: #b3a8d9;
  --gold: #ffcf5c;
  --coral: #ff6b6b;
  --teal: #2ee6c8;
  --violet: #a78bfa;
  --danger: #ff5470;
  --ok: #4ade80;
  --warrior: #ff6b6b;
  --rogue: #2ee6c8;
  --bard: #ffcf5c;
  --mage: #a78bfa;
  --radius: 16px;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a1a5e 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .btn, .code-input { font-family: var(--font-display); }
button { font: inherit; cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

/* ---------- landing ---------- */
.landing-wrap { max-width: 640px; margin: 0 auto; padding: 42px 20px 28px; display: flex; flex-direction: column; gap: 20px; min-height: 100dvh; }
.landing-hero { text-align: center; position: relative; }
.hero-mark {
  width: 96px; height: 96px; animation: bob 2.8s ease-in-out infinite;
  filter: drop-shadow(0 6px 22px rgba(255, 107, 107, .3));
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-9px) rotate(5deg); } }
.chip-mark { width: 18px; height: 18px; vertical-align: -4px; margin-right: 2px; }
.game-logo { display: flex; flex-direction: column; line-height: .92; margin: 8px 0 14px; letter-spacing: .02em; }
.gl-crowd { font-size: clamp(40px, 9vw, 64px); font-weight: 700; color: var(--text); }
.gl-quest {
  font-size: clamp(52px, 12vw, 86px); font-weight: 700;
  background: linear-gradient(100deg, var(--gold), var(--coral) 55%, var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); font-size: 16px; }
.tagline strong { color: var(--text); }
.landing-actions { display: flex; flex-direction: column; gap: 12px; }
.landing-footer { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; }
.landing-footer a { color: var(--muted); } .landing-footer b { color: var(--gold); }
.landing-footer-meta { display: block; margin-top: 4px; opacity: .8; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 3px; opacity: .5; animation: fall 9s linear infinite; }
.confetti i:nth-child(1) { left: 6%;  background: var(--coral);  animation-delay: 0s; }
.confetti i:nth-child(2) { left: 16%; background: var(--teal);   animation-delay: 1.2s; }
.confetti i:nth-child(3) { left: 26%; background: var(--gold);   animation-delay: 2.4s; }
.confetti i:nth-child(4) { left: 36%; background: var(--violet); animation-delay: .7s; }
.confetti i:nth-child(5) { left: 48%; background: var(--teal);   animation-delay: 3.4s; }
.confetti i:nth-child(6) { left: 58%; background: var(--coral);  animation-delay: 1.9s; }
.confetti i:nth-child(7) { left: 68%; background: var(--gold);   animation-delay: 4.2s; }
.confetti i:nth-child(8) { left: 78%; background: var(--violet); animation-delay: .3s; }
.confetti i:nth-child(9) { left: 88%; background: var(--teal);   animation-delay: 2.9s; }
.confetti i:nth-child(10){ left: 95%; background: var(--coral);  animation-delay: 5s; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.landing-wrap, .panel { position: relative; z-index: 1; }

/* ---------- panels & forms ---------- */
.panel { max-width: 560px; margin: 0 auto; padding: 28px 20px 40px; }
.panel.narrow { max-width: 480px; }
.panel h2 { font-size: 28px; margin-bottom: 6px; }
.btn-back { background: none; border: none; color: var(--muted); font-size: 15px; margin-bottom: 14px; }
label { display: block; margin: 16px 0 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
input[type="text"] {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 17px; outline: none;
}
input[type="text"]:focus { border-color: var(--teal); }
.code-input { text-transform: uppercase; letter-spacing: .35em; font-size: 24px !important; text-align: center; }
.error { color: var(--danger); margin-top: 10px; min-height: 1.2em; font-weight: 700; }
.hint { color: var(--muted); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; border-radius: 14px; padding: 12px 18px; font-weight: 600; font-size: 17px;
  background: var(--panel-2); color: var(--text); transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn small { font-size: 12px; font-weight: 400; opacity: .75; font-family: var(--font-body); }
.btn-big { width: 100%; padding: 16px 18px; font-size: 20px; }
.btn-primary { background: linear-gradient(100deg, var(--gold), #ffb14e); color: #3a2400; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-join { background: linear-gradient(100deg, var(--teal), #24bfd8); color: #003a33; }
.btn-ghosted { background: transparent; border: 2px solid var(--line); color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; flex-direction: row; gap: 6px; }
.btn.danger { background: #4a1030; color: #ffb3c7; }

/* ---------- quest picker / mode picker ---------- */
.quest-list { display: flex; flex-direction: column; gap: 10px; }
.quest-card {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.quest-card.selected { border-color: var(--gold); background: var(--panel-2); }
.qc-art { font-size: 34px; }
.qc-body strong { display: block; font-family: var(--font-display); font-size: 17px; }
.qc-body .qc-desc { color: var(--muted); font-size: 13px; }
.qc-meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.qc-premium { color: var(--gold); }
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  text-align: left; padding: 12px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--panel); color: var(--text); display: flex; flex-direction: column; gap: 4px;
}
.mode-card.selected { border-color: var(--teal); background: var(--panel-2); }
.mode-card strong { font-family: var(--font-display); }
.mode-card span { font-size: 12.5px; color: var(--muted); }
#btn-create-game { margin-top: 20px; }

/* ---------- TrackXP hub banners ---------- */
.txp-account { margin: 4px 0; }
.txp-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.txp-seal {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(135deg, var(--teal), var(--violet)); color: #10082b; font-weight: 900; font-size: 13px;
}
.txp-pitch { flex: 1; min-width: 160px; font-size: 14px; }
.txp-pitch small { display: block; color: var(--muted); }
.txp-cta-row { display: flex; align-items: center; gap: 10px; }
.txp-signup {
  background: linear-gradient(100deg, var(--teal), #24bfd8); color: #003a33;
  padding: 9px 14px; border-radius: 10px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.txp-user strong { color: var(--gold); }
.txp-tag { margin-left: auto; font-size: 12px; color: var(--muted); }
.txp-guest-note { color: var(--muted); font-size: 13px; }

/* =========================================================
   BIG SCREEN
   ========================================================= */
.screen.big { display: none; flex-direction: column; min-height: 100dvh; }
.screen.big.active { display: flex; }
.big-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1.5px solid var(--line); background: rgba(20, 11, 46, .7);
}
.brand-chip { font-family: var(--font-display); color: var(--muted); font-size: 14px; }
.brand-chip b { color: var(--gold); }
.beat-chip { font-family: var(--font-display); background: var(--panel); padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.omen-chip { background: #3a2a12; color: var(--gold); padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.big-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.room-pill { background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.room-pill strong { color: var(--gold); letter-spacing: .12em; }
.room-pill.small { font-size: 12px; }

.bs-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 14px; }
.bs-quest-title { font-size: clamp(26px, 4vw, 44px); }
.bs-join-line { color: var(--muted); font-size: clamp(15px, 2vw, 22px); }
.bs-join-line strong { color: var(--teal); }
/* the join "screen": a framed panel that spotlights the code + QR across the room */
.bs-join-frame {
  display: flex; align-items: center; gap: clamp(20px, 4vw, 48px);
  padding: clamp(18px, 3vw, 34px) clamp(24px, 4vw, 52px);
  background: linear-gradient(180deg, rgba(45, 29, 99, .55), rgba(20, 11, 46, .8));
  border: 2.5px solid rgba(255, 207, 92, .45); border-radius: 26px;
  box-shadow: 0 0 0 1px rgba(255, 207, 92, .12), 0 0 44px rgba(255, 207, 92, .14),
              inset 0 0 60px rgba(255, 207, 92, .05);
}
.bs-join-left { text-align: center; }
.bs-code-hero {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .28em;
  font-size: clamp(56px, 10vw, 110px); color: var(--gold); line-height: 1.05;
  text-shadow: 0 0 34px rgba(255, 207, 92, .35);
}
.bs-qr {
  width: clamp(140px, 17vw, 210px); height: clamp(140px, 17vw, 210px); flex: none;
  background: #0d0720; border: 1.5px solid rgba(255, 207, 92, .4);
  border-radius: 16px; padding: 10px;
}
.bs-qr svg { width: 100% !important; height: 100% !important; display: block; }
.bs-qr:empty { display: none; }
@media (max-width: 640px) { .bs-join-frame { flex-direction: column; } }
.bs-chip-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 900px; }
.bs-player-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel);
  border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 17px; font-weight: 700;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.bs-player-chip .cls { font-size: 20px; }
.bs-player-chip.c-warrior { border-color: var(--warrior); }
.bs-player-chip.c-rogue { border-color: var(--rogue); }
.bs-player-chip.c-bard { border-color: var(--bard); }
.bs-player-chip.c-mage { border-color: var(--mage); }
.verified-spark { color: var(--gold); }

/* live beat */
#bs-play { justify-content: flex-start; padding-top: 3vh; overflow-y: auto; min-height: 0; }
.bs-stage { overflow-y: auto; min-height: 0; }
.bs-scene { max-width: 1100px; }
.bs-art { font-size: clamp(64px, 10vw, 120px); line-height: 1; filter: drop-shadow(0 6px 24px rgba(0,0,0,.4)); }
.bs-beat-title { font-size: clamp(24px, 3.4vw, 40px); color: var(--gold); margin: 8px 0 4px; }
.bs-narration { font-size: clamp(18px, 2.4vw, 30px); line-height: 1.5; max-width: 950px; margin: 0 auto; }
/* once choosing/rolling/resolving starts, the scene condenses to a header line so
   votes / dice / outcomes own the screen — full narration already had its moment
   (and stays as captions on every phone) */
#bs-play.compact .bs-art { font-size: clamp(30px, 4vw, 44px); display: inline-block; vertical-align: middle; margin-right: 10px; filter: none; }
#bs-play.compact .bs-beat-title { display: inline-block; vertical-align: middle; margin: 0; font-size: clamp(20px, 2.6vw, 30px); }
#bs-play.compact .bs-narration { display: none; }
#bs-play.compact .bs-phase { margin-top: 10px; }
.bs-phase { width: min(950px, 94vw); margin-top: 18px; }
.timerbar { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; margin-bottom: 14px; }
.timerbar i { display: block; height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .25s linear; }

.vote-rows { display: flex; flex-direction: column; gap: 10px; }
.vote-row { display: grid; grid-template-columns: 44px 1fr 60px; align-items: center; gap: 12px; }
.vote-row .vr-emoji { font-size: 26px; }
.vr-bar { position: relative; height: 40px; background: var(--panel); border-radius: 12px; overflow: hidden; }
.vr-bar i { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 12px; transition: width .35s ease; opacity: .85; }
.vr-fight i { background: var(--warrior); } .vr-sneak i { background: var(--rogue); }
.vr-talk i { background: var(--bard); } .vr-weird i { background: var(--mage); }
.vr-bar span { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 14px; font-weight: 800; font-size: clamp(14px, 1.8vw, 20px); text-shadow: 0 1px 4px rgba(0,0,0,.55); }
.vr-count { font-family: var(--font-display); font-size: 24px; text-align: right; }
.bs-phase-label { font-family: var(--font-display); font-size: clamp(18px, 2.4vw, 26px); color: var(--teal); margin-bottom: 10px; }

.roll-flurry { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 60px; }
.roll-chip {
  font-family: var(--font-display); background: var(--panel); border: 2px solid var(--line);
  border-radius: 12px; padding: 8px 14px; font-size: clamp(15px, 1.9vw, 21px);
  animation: pop .3s cubic-bezier(.2, 1.6, .4, 1);
}
.roll-chip .rc-total { font-size: 1.25em; font-weight: 700; }
.roll-chip.ok { border-color: var(--ok); } .roll-chip.bad { border-color: var(--line); opacity: .8; }
.roll-chip.crit { border-color: var(--gold); background: #3a2a12; box-shadow: 0 0 18px rgba(255,207,92,.45); }
.roll-chip.fumble { border-color: var(--danger); background: #3a1020; }

.outcome-card { max-width: 950px; margin: 0 auto; animation: pop .4s cubic-bezier(.2,1.5,.4,1); }
.outcome-tier { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 5vw, 54px); letter-spacing: .04em; }
.outcome-tier.triumph { color: var(--ok); } .outcome-tier.messy { color: var(--gold); } .outcome-tier.disaster { color: var(--danger); }
.outcome-text { font-size: clamp(17px, 2.2vw, 27px); margin: 10px 0 6px; }
.outcome-flavor { color: var(--violet); font-style: italic; font-size: clamp(14px, 1.8vw, 20px); }
.outcome-wilds { margin-top: 10px; color: var(--muted); font-size: clamp(13px, 1.6vw, 18px); }
.outcome-wilds b { color: var(--teal); }
.outcome-hearts { margin-top: 8px; font-size: clamp(13px, 1.7vw, 18px); color: var(--coral); }

/* fill-in-the-blank judging — entries as big tappable cards */
.judge-grid { display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; }
.judge-card {
  background: var(--panel); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 16px 20px; color: var(--text); text-align: left;
  font-family: var(--font-display); font-size: clamp(16px, 2.2vw, 26px); font-weight: 500;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.judge-card:not(:disabled):hover { border-color: var(--gold); background: var(--panel-2); }
.judge-card:disabled { cursor: default; }

/* boss finale — the slumber bar */
.slumber { max-width: 750px; margin: 0 auto 14px; }
.slumber-label { font-family: var(--font-display); color: var(--violet); font-size: clamp(14px, 1.9vw, 20px); margin-bottom: 6px; }
.slumber-bar { height: 26px; border-radius: 999px; background: var(--panel); overflow: hidden; border: 1.5px solid var(--line); }
.slumber-bar i { display: block; height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.2, 1, .4, 1);
  background: linear-gradient(90deg, var(--violet), #6d28d9); box-shadow: 0 0 18px rgba(167, 139, 250, .5); }
.slumber-num { font-family: var(--font-display); color: var(--muted); margin-top: 6px; font-size: clamp(13px, 1.7vw, 18px); }

.bs-spotlight {
  position: fixed; left: 50%; top: 16%; transform: translateX(-50%);
  background: var(--panel-2); border: 2px solid var(--gold); color: var(--text);
  border-radius: 16px; padding: 14px 26px; font-family: var(--font-display);
  font-size: clamp(17px, 2.4vw, 28px); box-shadow: 0 10px 40px rgba(0,0,0,.5); z-index: 40;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); max-width: 90vw;
}
.bs-spotlight.fumble { border-color: var(--danger); }
.bs-spotlight.ghost { border-color: var(--violet); }

.bs-party {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 10px 16px 14px; border-top: 1.5px solid var(--line); background: rgba(20,11,46,.7);
}
.party-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700;
  background: var(--panel); border-radius: 999px; padding: 4px 12px; border: 1.5px solid var(--line);
}
.party-chip .hearts { color: var(--coral); letter-spacing: .05em; }
.party-chip.ghost { opacity: .55; filter: grayscale(.7); }
.party-chip .glory { color: var(--gold); font-size: 12px; }
.party-chip.offline { opacity: .4; }

/* pre-game how-to slides */
.howto-card {
  max-width: 900px; padding: clamp(24px, 4vw, 48px) clamp(28px, 5vw, 64px);
  background: linear-gradient(180deg, rgba(45, 29, 99, .55), rgba(20, 11, 46, .8));
  border: 2.5px solid var(--line); border-radius: 26px;
  animation: pop .4s cubic-bezier(.2, 1.5, .4, 1);
}
.howto-icon { font-size: clamp(56px, 9vw, 96px); line-height: 1.1; }
.howto-title { font-size: clamp(26px, 4.2vw, 46px); color: var(--gold); margin: 10px 0 8px; }
.howto-text { font-size: clamp(17px, 2.3vw, 28px); line-height: 1.5; color: var(--text); }
.howto-dots { display: flex; gap: 10px; }
.howto-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.howto-dots i.on { background: var(--gold); transform: scale(1.25); }

/* ending */
.ending-card { max-width: 950px; }
.ending-eyebrow { color: var(--muted); font-size: clamp(14px, 1.8vw, 19px); letter-spacing: .2em; text-transform: uppercase; }
.ending-title { font-size: clamp(32px, 5.4vw, 60px); color: var(--gold); margin: 6px 0 10px; }
.ending-text { font-size: clamp(16px, 2.1vw, 26px); }
.ending-stats { margin-top: 14px; color: var(--muted); font-size: clamp(14px, 1.7vw, 19px); }
.ending-board { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.ending-mvp { margin-top: 12px; font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 30px); color: var(--teal); }

/* =========================================================
   PHONE
   ========================================================= */
.screen.phone { display: none; flex-direction: column; min-height: 100dvh; }
.screen.phone.active { display: flex; }
.ph-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1.5px solid var(--line); }
.class-chip { font-family: var(--font-display); font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line); font-size: 14px; }
.class-chip.c-warrior { border-color: var(--warrior); } .class-chip.c-rogue { border-color: var(--rogue); }
.class-chip.c-bard { border-color: var(--bard); } .class-chip.c-mage { border-color: var(--mage); }
.hearts { color: var(--coral); font-size: 18px; letter-spacing: .08em; }
.ph-top .room-pill { margin-left: auto; }
.ph-main { flex: 1; display: flex; flex-direction: column; padding: 16px; overflow-y: auto; }
.ph-card { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; text-align: center; }
.ph-eyebrow { color: var(--muted); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; }
.ph-big-art { font-size: 64px; }
.ph-title { font-family: var(--font-display); font-size: 24px; color: var(--gold); }
.ph-text { font-size: 15px; color: var(--muted); }
.ph-caption { font-size: 14.5px; color: var(--text); background: var(--panel); border-radius: 12px; padding: 12px; text-align: left; }

.class-card { background: var(--panel); border: 2.5px solid var(--line); border-radius: 20px; padding: 22px 16px; }
.class-card .cc-emoji { font-size: 62px; }
.class-card h3 { font-size: 28px; margin: 6px 0 2px; }
.class-card .cc-hint { color: var(--muted); font-size: 15px; }
.class-card .cc-special { margin-top: 10px; font-size: 13.5px; color: var(--violet); }
.class-card.c-warrior { border-color: var(--warrior); } .class-card.c-rogue { border-color: var(--rogue); }
.class-card.c-bard { border-color: var(--bard); } .class-card.c-mage { border-color: var(--mage); }

.approach-grid { display: flex; flex-direction: column; gap: 10px; }
.approach-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 15px 14px; font-size: 16.5px; font-weight: 700; color: var(--text);
}
.approach-btn .ap-emoji { font-size: 26px; }
.approach-btn.mine { box-shadow: inset 0 0 0 2px rgba(255,255,255,.06); }
.approach-btn.k-fight.selected { border-color: var(--warrior); background: #3d1b2c; }
.approach-btn.k-sneak.selected { border-color: var(--rogue); background: #103a38; }
.approach-btn.k-talk.selected { border-color: var(--bard); background: #3a2a12; }
.approach-btn.k-weird.selected { border-color: var(--mage); background: #2a1c4e; }
.approach-btn .ap-lane { margin-left: auto; font-size: 11px; color: var(--gold); white-space: nowrap; }
.wild-input { margin-top: 8px; }
.ph-timer { font-family: var(--font-display); font-size: 15px; color: var(--teal); }

.roll-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
/* the TrackXP d20: tap to roll → tumble → land */
.die-roll-btn {
  background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: pulse 1.4s ease-in-out infinite;
}
.die-roll-btn .die-cta { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--gold); }
.die-roll-btn .die-hex text { font-size: 13px; }
.die-hex { width: 170px; height: 170px; filter: drop-shadow(0 12px 34px rgba(255, 207, 92, .3)); }
.die-wrap { display: inline-block; }
.die-wrap.tumbling .die-hex { animation: tumble .55s linear infinite; }
@keyframes tumble {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(.92) translateY(-6px); }
  50% { transform: rotate(180deg) scale(1.04); }
  75% { transform: rotate(270deg) scale(.95) translateY(4px); }
  100% { transform: rotate(360deg) scale(1); }
}
.die-wrap.landed .die-hex { animation: land .5s cubic-bezier(.2, 1.6, .4, 1); }
.die-wrap.landed .die-num { font-size: 26px; }
.die-wrap.landed.crit .die-hex { filter: drop-shadow(0 0 34px rgba(255, 207, 92, .8)); }
.die-wrap.landed.fumble .die-hex { filter: drop-shadow(0 0 26px rgba(255, 84, 112, .7)) grayscale(.3); }
@keyframes land { from { transform: rotate(220deg) scale(.5); } to { transform: rotate(0) scale(1); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.my-roll { font-family: var(--font-display); }
.my-roll .die-hex { width: 130px; height: 130px; }
.my-roll.ok .die-num { fill: var(--ok); } .my-roll.bad .die-num { fill: var(--danger); }
.my-roll .mr-note { font-size: 16px; color: var(--muted); }
.my-roll .mr-crit { color: var(--gold); font-size: 22px; }

/* lobby class picker — the deal is a default, not a destiny */
.class-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.class-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel); color: var(--muted); font-family: var(--font-display); font-size: 12.5px;
}
.class-pick-btn span { font-size: 22px; }
.class-pick-btn.selected { color: var(--text); background: var(--panel-2); }
.class-pick-btn.c-warrior.selected { border-color: var(--warrior); }
.class-pick-btn.c-rogue.selected { border-color: var(--rogue); }
.class-pick-btn.c-bard.selected { border-color: var(--bard); }
.class-pick-btn.c-mage.selected { border-color: var(--mage); }

.ph-achievement { font-size: 14.5px; color: var(--gold); background: rgba(255, 207, 92, .08); border: 1px solid rgba(255, 207, 92, .3); border-radius: 10px; padding: 8px 12px; }

/* ending awards — the laugh track, revealed one by one */
.award-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.award-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border: 2px solid rgba(255, 207, 92, .35); border-radius: 16px;
  padding: 14px 22px; min-width: 150px; opacity: 0;
  animation: award-pop .5s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
@keyframes award-pop { from { opacity: 0; transform: scale(.4) rotate(-6deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
.award-chip .aw-icon { font-size: clamp(28px, 4vw, 44px); }
.award-chip .aw-title { font-family: var(--font-display); color: var(--gold); font-size: clamp(14px, 1.8vw, 19px); }
.award-chip .aw-name { font-weight: 800; font-size: clamp(14px, 1.8vw, 19px); }
.award-chip .aw-detail { color: var(--muted); font-size: clamp(11px, 1.3vw, 14px); max-width: 230px; }

.special-btn {
  width: 100%; background: linear-gradient(100deg, #6d28d9, var(--violet)); color: #fff;
  border-radius: 14px; padding: 12px;
}
.special-btn.armed { background: linear-gradient(100deg, var(--gold), #ffb14e); color: #3a2400; }
.special-btn:disabled { opacity: .35; }
.ph-foot { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.ph-status { text-align: center; color: var(--muted); font-size: 13px; min-height: 1.2em; }

.ghost-veil { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(180deg, rgba(80, 60, 160, .18), rgba(20, 11, 46, .5)); }
.ghost-note { font-size: 15px; color: var(--violet); }

.xp-award { font-family: var(--font-display); font-size: 24px; color: var(--ok); }
.xp-award small { display: block; font-size: 13px; color: var(--muted); font-family: var(--font-body); }

/* ---------- TrackXP global session chip (txp-session.js appends it to <body>) ---------- */
.txp-session-chip { position: fixed; top: 12px; right: 12px; z-index: 90; }
.txp-session-chip a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 15px; border-radius: 999px;
  background: var(--panel); border: 1.5px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 700;
  text-decoration: none; transition: border-color .15s;
}
.txp-session-chip a:hover { border-color: var(--teal); color: var(--text); }
.txp-session-chip.signed-in a { border-color: rgba(255, 207, 92, .55); }
.txp-session-chip.signed-in strong { color: var(--gold); font-family: var(--font-display); }
/* in-game surfaces have their own chrome — the floating chip would collide with
   the big-screen header / phone vitals bar */
body.in-game .txp-session-chip { display: none; }
@media (max-width: 560px) {
  .txp-session-chip { top: 8px; right: 8px; }
  .txp-session-chip a { padding: 5px 11px; font-size: 12px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel-2); border: 1.5px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 11px 18px; font-size: 15px; z-index: 60; max-width: 92vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}

@media (max-width: 720px) {
  .mode-picker { grid-template-columns: 1fr; }
  .big-top { flex-wrap: wrap; }
}
