:root {
  --bg: #080b14;
  --surface: #111827;
  --surface-2: #1a2337;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --gold: #fbbf24;
  --accent: #38bdf8;
  --green: #34d399;
  --red: #fb7185;
  /* Fluid responsive sizing tokens */
  --chat-w: 300px;
  --card-w: 266px;
  --card-h: 432px;
  --card-h-compact: 392px;
  --portrait-h: 186px;
  --fan-stage-h: 452px;
  --fan-step: 100px;
  --fan-drop: 10px;
  --fan-deg: 4.5deg;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: clip;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: radial-gradient(circle at top center, #131c36 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 7px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 11, 20, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  box-sizing: border-box;
}
.topbar-spacer { display: none; }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #f97316, #ec4899, #6366f1);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.35);
}
.brand-title { font-weight: 900; letter-spacing: 0.08em; font-size: 18px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); line-height: 1.1; }

.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; min-width: 0; max-width: 100%; }
@media (max-width: 860px) {
  .topbar { justify-content: center; padding: 12px 14px; }
  .nav-actions { justify-content: center; }
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: #24304a; border-color: rgba(255,255,255,0.25); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-color: #fb923c;
  color: #fff;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #fb923c, #f97316); }

.btn-accent {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  border-color: #38bdf8;
  color: #fff;
}

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

/* Full-width breathing container */
.container {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 6px 20px 8px;
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 14px 14px 110px; }
}

/* Intro Splash Page with Subtle Greyed-Out Periodic Table & Floating Chemistry Visuals */
.intro-stage {
  position: relative;
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px 18px 22px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 25%, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.92) 62%, rgba(8, 11, 20, 0.98));
}
.intro-pt-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.11;
  filter: grayscale(0.75);
  z-index: 0;
}
.intro-pt-grid {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 5px;
  width: 96%;
  max-width: 1320px;
  padding: 20px;
}
.intro-pt-cell {
  aspect-ratio: 1 / 1.05;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #cbd5e1;
  font-family: monospace;
}
.intro-pt-cell.glow-pulse {
  animation: ptPulse 4.5s ease-in-out infinite;
  border-color: rgba(125, 211, 252, 0.65);
  background: rgba(56, 189, 248, 0.22);
}
@keyframes ptPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.intro-chem-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.chem-floater {
  position: absolute;
  opacity: 0.28;
  animation: chemDrift 9s ease-in-out infinite;
}
.chem-floater.f1 { top: 8%; left: 6%; animation-delay: 0s; }
.chem-floater.f2 { top: 14%; right: 7%; animation-delay: -2.4s; }
.chem-floater.f3 { bottom: 14%; left: 8%; animation-delay: -4.2s; }
.chem-floater.f4 { bottom: 10%; right: 9%; animation-delay: -6.1s; }
@keyframes chemDrift {
  0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.24; }
  50% { transform: translateY(-16px) rotate(8deg); opacity: 0.46; }
}
.chem-bubble {
  position: absolute;
  bottom: -24px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.45), rgba(56, 189, 248, 0.08));
  animation: bubbleRise 10s linear infinite;
}
@keyframes bubbleRise {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  15% { opacity: 0.55; }
  85% { opacity: 0.35; }
  100% { transform: translateY(-620px) scale(1.15); opacity: 0; }
}
.intro-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.intro-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.intro-title {
  font-size: clamp(42px, 6.2vw, 68px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 0.98;
  margin: 0 0 6px;
  background: linear-gradient(135deg, #ffffff 10%, #fde047 45%, #fb923c 72%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 28px rgba(249, 115, 22, 0.3));
}
.intro-sub {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #bae6fd;
  margin: 0 0 10px;
}
.intro-desc {
  font-size: 15px;
  color: #dbe5f1;
  line-height: 1.48;
  max-width: 600px;
  margin: 0 0 16px;
}
.intro-fan {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 4px 0 24px;
  padding-bottom: 12px;
  min-height: 156px;
}
.intro-poster-card {
  width: 120px;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.6);
  position: relative;
  margin: 0 -18px;
  transition: transform 0.25s ease, z-index 0.2s;
  background: #0b1120;
}
.intro-poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}
.intro-poster-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.92), transparent);
}
.intro-poster-card:hover {
  transform: translateY(-12px) scale(1.08) !important;
  z-index: 10 !important;
  border-color: var(--gold);
}
.intro-cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.intro-play-btn {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  border-radius: 13px;
}
.intro-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: #94a3b8;
}
.intro-pills span {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.card-alias {
  font-size: 10.5px;
  color: #cbd5e1;
  font-style: italic;
  line-height: 1.15;
}

/* Lobby */
.lobby-hero {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 24px;
}
.lobby-hero p {
  color: #cbd5e1;
  font-size: 15.5px;
  line-height: 1.55;
  margin: 0 auto;
}
.lobby-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 680px;
  margin: 14px auto 0;
  gap: 20px;
  width: 100%;
}

.panel {
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 28px;
}

.hero-headline {
  font-size: 36px;
  line-height: 1.14;
  margin: 0 0 12px;
  font-weight: 900;
  background: linear-gradient(135deg, #fff, #fdba74, #7dd3fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.disabled-group {
  opacity: 0.4;
  filter: grayscale(0.65);
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 20px;
}
@media (max-width: 760px) {
  .mode-grid { grid-template-columns: 1fr; }
}
.online-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}
@media (max-width: 640px) {
  .online-split { grid-template-columns: 1fr; }
}
.online-subpanel {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.online-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  border: 2px solid rgba(251, 191, 36, 0.55);
  border-radius: 14px;
  padding: 10px 22px;
  display: inline-block;
  user-select: all;
}
.online-seat-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.online-seat-chip {
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 13.5px;
  font-weight: 700;
  color: #e0f2fe;
}
.online-lock-banner {
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.pick-status-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.pick-status-pill.locked {
  background: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
}
.mode-card {
  border: 2px solid var(--border);
  background: var(--surface-2);
  border-radius: 13px;
  padding: 15px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.15s ease;
}
.mode-card.active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.11);
}
.mode-card .mode-title { font-weight: 800; font-size: 15px; }
.mode-card .mode-desc { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.4; }

.count-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}
.count-pill {
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.count-pill.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
}

.name-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1120;
  color: var(--text);
  font-size: 14px;
}

.rule-list {
  display: grid;
  gap: 12px;
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.45;
}
.rule-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 15px;
}
.rule-item strong { color: #fff; }

/* Scoreboard */
.scoreboard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 14px;
  margin-bottom: 8px;
}
.score-players { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 9px;
  font-size: 13px;
}
.player-chip.leader { border-color: var(--gold); box-shadow: 0 0 12px rgba(251, 191, 36, 0.25); }
.player-chip .pts { font-weight: 900; color: var(--gold); font-size: 14px; }

.round-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.meta-pill {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}
.meta-pill.proton {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

/* Top Stage: Big Tall Illustrated Arena + Always-Open Live Table Talk side by side (Zero overlap with 5 cards below OR Netlify's bottom bar!) */
.arena-chat-stage {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.arena-chat-stage.full-arena {
  grid-template-columns: 1fr;
}
@media (max-width: 980px) {
  .arena-chat-stage { grid-template-columns: 1fr; }
}

.arena-hero-banner {
  position: relative;
  border: 2px solid rgba(125, 211, 252, 0.42);
  border-radius: 18px;
  overflow: hidden;
  min-height: 262px;
  background: #0d1324;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
@media (max-width: 820px) {
  .arena-hero-banner { grid-template-columns: 1fr; }
}

.docked-chat {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(125, 211, 252, 0.36);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 262px;
  max-height: 285px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.docked-chat.needs-action {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35), 0 0 28px rgba(251, 191, 36, 0.28);
  animation: chatPulse 1.6s ease-in-out infinite alternate;
}
@keyframes chatPulse {
  from { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3), 0 0 20px rgba(251, 191, 36, 0.2); }
  to   { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.65), 0 0 34px rgba(251, 191, 36, 0.4); }
}
/* Step 1 Chat Spotlight: Gently dim non-chat sections so eyes snap to Table Talk (still readable!) */
.dim-during-chat {
  opacity: 0.48;
  filter: saturate(0.75);
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.dim-during-chat:hover {
  opacity: 0.85;
}

/* Sub-bullets inside How to Play */
.rule-subbullets {
  margin: 4px 0 2px;
  padding-left: 18px;
  list-style-type: circle;
  display: grid;
  gap: 3px;
  font-size: 13px;
  color: #cbd5e1;
}

/* Dedicated State + Trait bar ABOVE portrait so badges NEVER block a hero's face! */
.badge-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 6px 0 4px;
}
.ribbon-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
  white-space: nowrap;
}
.ribbon-pill.trait {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fde68a;
}

.action-bar.waiting-chat {
  opacity: 0.48;
  border-style: dashed;
  border-color: rgba(251, 191, 36, 0.45);
}
.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.chat-input-row .input {
  padding: 6px 9px;
  font-size: 12.5px;
  flex: 1;
}
.typing-indicator {
  font-size: 11.5px;
  color: #94a3b8;
  font-style: italic;
  padding: 2px 4px;
}

.arena-bg-art {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.arena-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.arena-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  display: block;
}
.arena-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 12, 26, 0.92) 0%, rgba(8, 12, 26, 0.78) 48%, rgba(8, 12, 26, 0.12) 100%);
  z-index: 1;
}

.arena-content {
  position: relative;
  z-index: 2;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.arena-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.arena-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #fff;
}
.arena-stat-pill {
  background: var(--gold);
  color: #111;
  font-weight: 900;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
}
.arena-badge {
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.2);
  border: 1px solid rgba(251, 113, 133, 0.5);
  color: #fecdd3;
}
.arena-bullets {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 14.5px;
  line-height: 1.45;
  color: #e2e8f0;
}
.arena-bullets li::marker { color: var(--gold); }

/* Floating Bottom-Right Chat Widget — lifted clear of Netlify's bottom-right bar! */
.floating-chat {
  position: fixed;
  bottom: 92px;
  right: 22px;
  width: 350px;
  max-width: calc(100vw - 28px);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(125, 211, 252, 0.45);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  z-index: 45;
  overflow: hidden;
}
.floating-chat.collapsed {
  width: auto;
  min-width: 240px;
}

/* Inline 1-line Table Talk Strip (lets you see bots talk & bluff right before picking!) */
.talk-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(125, 211, 252, 0.3);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.talk-strip-msg {
  color: #e2e8f0;
  flex: 1;
  min-width: 220px;
}
.talk-strip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.chat-header-title {
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}
.chat-mode-toggle {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.chat-mode-toggle:active {
  transform: scale(0.96);
}
.chat-mode-toggle.is-active {
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fde68a;
}
.chat-mode-toggle.is-active:hover {
  background: rgba(251, 191, 36, 0.28);
}
.chat-mode-toggle.is-watch {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}
.chat-mode-toggle.is-watch:hover {
  background: rgba(56, 189, 248, 0.28);
}
.chat-status-strip {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  flex-shrink: 0;
}
.chat-status-strip.is-step1 {
  background: rgba(251, 191, 36, 0.14);
  color: #fde68a;
}
.chat-status-strip.is-done {
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
}
.chat-status-strip.is-watch {
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
}
.chat-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.floating-chat.collapsed .chat-body { display: none; }

.talk-feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding-right: 4px;
}
.talk-feed > :first-child {
  margin-top: auto;
}
.talk-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12.5px;
  line-height: 1.38;
}
.talk-bubble strong { color: #7dd3fc; }
.talk-bubble.you {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.1);
}
.talk-bubble.you strong { color: var(--gold); }
.bluff-options { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tabletop Pick Layout: Centered Arena + Fanned Hand + Far-Right Chat */
.tabletop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-w);
  gap: 14px;
  align-items: start;
  width: 100%;
}
.tabletop-layout.no-chat {
  grid-template-columns: minmax(0, 1fr);
}
.tabletop-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: clip;
}
.arena-center-wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto 8px;
}
.arena-center-wrap .arena-hero-banner {
  min-height: 112px;
  border-radius: 15px;
}
.arena-center-wrap .arena-content {
  padding: 10px 16px;
}
.arena-center-wrap .arena-top-row {
  gap: 8px;
  margin-bottom: 4px;
}
.arena-center-wrap .arena-title {
  font-size: 20px;
}
.arena-center-wrap .arena-stat-pill {
  font-size: 12px;
  padding: 3px 10px;
}
.arena-center-wrap .arena-badge {
  font-size: 11.5px;
  padding: 3px 9px;
}
.arena-center-wrap .arena-bullets {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.32;
  gap: 2px;
}
.tabletop-chat-col {
  position: sticky;
  top: 56px;
}
.tabletop-chat-col .docked-chat {
  height: clamp(360px, calc(100vh - 150px), 620px);
  max-height: calc(100vh - 150px);
  min-height: 300px;
}
.tabletop-chat-col .docked-chat.reveal-docked-chat {
  height: clamp(320px, calc(100vh - 150px), 560px);
  max-height: calc(100vh - 150px);
}
.hand-zone {
  width: 100%;
}
.hand-view-toggle {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.hand-view-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.hand-view-btn.active {
  background: rgba(251, 191, 36, 0.2);
  color: var(--gold);
}

/* Fanned Real-Life Card Hand — Fluid CSS-Variable Scaling for Every Screen Size */
.hand-fan-stage {
  position: relative;
  width: 100%;
  height: calc(var(--fan-stage-h) + 6px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: visible;
  padding-top: 6px;
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.fan-card-slot {
  position: absolute;
  bottom: 20px;
  width: var(--card-w);
  transform-origin: center 125%;
  transform:
    translateX(calc(var(--fan-offset, 0) * var(--fan-step)))
    translateY(calc(var(--fan-abs, 0) * var(--fan-drop) - 2px))
    rotate(calc(var(--fan-offset, 0) * var(--fan-deg)))
    scale(calc(0.92 - var(--fan-abs, 0) * 0.035));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, filter 0.22s ease;
}
.fan-card-slot.is-front {
  transform: translateX(0px) translateY(-4px) rotate(0deg) scale(1.015);
}
.fan-card-slot.is-side {
  filter: grayscale(0.82) brightness(0.62);
  opacity: 0.85;
}
.fan-card-slot.is-side:hover {
  filter: grayscale(0.35) brightness(0.86);
  opacity: 0.96;
}
.fan-card-slot.is-front .hero-card-outer {
  box-shadow: 0 0 0 3px var(--gold), 0 18px 38px rgba(0, 0, 0, 0.65), 0 0 26px rgba(251, 191, 36, 0.3);
}
.fan-card-slot .hero-card-outer:hover {
  transform: none;
}
.card-carbon-switch {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
}
.card-carbon-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}
.card-carbon-btn.active-diamond {
  background: rgba(249, 115, 22, 0.26);
  border-color: #fb923c;
  color: #fed7aa;
}
.card-carbon-btn.active-graphite {
  background: rgba(56, 189, 248, 0.24);
  border-color: #38bdf8;
  color: #bae6fd;
}
.react-bar-minimal {
  position: relative;
  z-index: 35;
  margin-top: 6px;
  padding-bottom: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.btn-react-main {
  padding: 10px 28px;
  font-size: 15px;
}

/* Hand & Hero Trading Cards — Keep all 5 cards on ONE row on desktop! */
.hand-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hand-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.hand-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1120px) {
  .hand-grid, .hand-grid.cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  }
}

.hero-card-outer {
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  perspective: 1100px;
  min-height: var(--card-h);
}
.hero-card-outer.compact-card {
  min-height: var(--card-h-compact);
}
.hero-card-outer:hover { transform: translateY(-4px); }
.hero-card-outer.selected {
  transform: translateY(-7px);
  box-shadow: 0 0 0 3px var(--gold), 0 14px 32px rgba(251, 191, 36, 0.35);
}
.hero-card-outer.proton-ready {
  box-shadow: 0 0 0 2px #38bdf8, 0 8px 20px rgba(56, 189, 248, 0.28);
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  border-radius: 15px;
  padding: 2.5px;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}
.hero-card-outer.is-flipped .card-flip-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 2.5px;
  border-radius: 13px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f1f5f9;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card-face-front {
  transform: rotateY(0deg);
  transition: visibility 0s linear 0s;
  container-type: inline-size;
}
.card-face-back {
  transform: rotateY(180deg);
}
.hero-card-outer.is-flipped .card-face-front {
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.24s;
}
.hero-card-outer.is-flipped .card-face-front .portrait-vfx-video,
.hero-card-outer.is-flipped .card-face-front img {
  opacity: 0;
  transition: opacity 0.16s ease 0.12s;
}
.back-scroll-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.back-section {
  font-size: 11.4px;
  line-height: 1.38;
  color: #e2e8f0;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.back-section ul {
  margin: 2px 0 0;
  padding-left: 14px;
  display: grid;
  gap: 5px;
}
.back-section li::marker { color: var(--gold); }
.back-friends-sub {
  margin: 4px 0 0;
  padding-left: 2px;
  display: grid;
  gap: 4px;
  list-style-type: none;
  font-size: 11px;
  color: #e2e8f0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.card-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.num-box {
  width: 54px;
  height: 46px;
  border-radius: 9px;
  background: rgba(251, 191, 36, 0.14);
  border: 2px solid rgba(251, 191, 36, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.18);
}
.num-box .at-num { font-size: 16px; font-weight: 900; color: var(--gold); font-family: monospace; letter-spacing: -0.03em; }
.num-box .at-sym { font-size: 13.5px; font-weight: 800; color: #fff; }
.card-name { font-size: 14.5px; font-weight: 800; color: #fff; line-height: 1.12; }
.card-fam { font-size: 11px; line-height: 1.15; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mini-pt {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}

.portrait-box {
  position: relative;
  flex: 1 1 var(--portrait-h);
  min-height: 120px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  margin: 0 0 6px;
  background: #090d16;
}
.portrait-box img,
.portrait-box .portrait-vfx-video { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; display: block; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.portrait-box.vfx-wait-video::after { animation: none !important; opacity: 0 !important; }
.portrait-box canvas.hero-vfx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* Subtle one-shot 2.5D heroic step-forward & settle when a Hero Card enters focus, then rests completely still */
@keyframes heroPortraitSettle {
  0%   { transform: perspective(520px) scale(1.09) translateY(5px) rotateY(-4deg) rotateX(2.5deg); filter: brightness(1.1); }
  45%  { transform: perspective(520px) scale(1.035) translateY(-2px) rotateY(1.8deg) rotateX(-1deg); filter: brightness(1.04); }
  100% { transform: perspective(520px) scale(1) translateY(0) rotateY(0deg) rotateX(0deg); filter: brightness(1); }
}
@keyframes heroFoilSheen {
  0%   { transform: translateX(-140%) skewX(-22deg); opacity: 0; }
  25%  { opacity: 0.45; }
  100% { transform: translateX(240%) skewX(-22deg); opacity: 0; }
}
@keyframes heroAuraFlash {
  0%   { opacity: 0; transform: scale(0.92); }
  30%  { opacity: 0.72; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.08); }
}
.fan-card-slot.is-front .portrait-box::after,
.codex-inspect-card .portrait-box::after,
.reveal-slot.focus-hero .portrait-box::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.fan-card-slot.is-front .portrait-box.vfx-alloy::after,
.codex-inspect-card .portrait-box.vfx-alloy::after,
.reveal-slot.focus-hero .portrait-box.vfx-alloy::after {
  width: 48%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.36), transparent);
  animation: heroFoilSheen 0.85s cubic-bezier(0.22, 1, 0.36, 1) 1 forwards;
}
.fan-card-slot.is-front .portrait-box.vfx-spark::after,
.codex-inspect-card .portrait-box.vfx-spark::after,
.reveal-slot.focus-hero .portrait-box.vfx-spark::after {
  width: 44%;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.52), rgba(56, 189, 248, 0.45), transparent);
  animation: heroFoilSheen 0.78s cubic-bezier(0.22, 1, 0.36, 1) 1 forwards;
}
.fan-card-slot.is-front .portrait-box.vfx-fire::after,
.codex-inspect-card .portrait-box.vfx-fire::after,
.reveal-slot.focus-hero .portrait-box.vfx-fire::after {
  background: radial-gradient(ellipse at 50% 95%, rgba(249, 115, 22, 0.62), rgba(251, 191, 36, 0.25) 42%, transparent 74%);
  animation: heroAuraFlash 1.05s ease-out 1 forwards;
}
.fan-card-slot.is-front .portrait-box.vfx-neon::after,
.codex-inspect-card .portrait-box.vfx-neon::after,
.reveal-slot.focus-hero .portrait-box.vfx-neon::after {
  background: radial-gradient(circle at 50% 50%, rgba(217, 70, 239, 0.38), rgba(56, 189, 248, 0.26) 48%, transparent 76%);
  animation: heroAuraFlash 1.0s ease-out 1 forwards;
}
.fan-card-slot.is-front .portrait-box.vfx-mist::after,
.codex-inspect-card .portrait-box.vfx-mist::after,
.reveal-slot.focus-hero .portrait-box.vfx-mist::after {
  background: radial-gradient(ellipse at 50% 85%, rgba(125, 211, 252, 0.48), rgba(192, 132, 252, 0.2) 50%, transparent 78%);
  animation: heroAuraFlash 1.1s ease-out 1 forwards;
}
.fan-card-slot.is-front .portrait-box.vfx-rad::after,
.codex-inspect-card .portrait-box.vfx-rad::after,
.reveal-slot.focus-hero .portrait-box.vfx-rad::after {
  background: radial-gradient(circle at 50% 50%, rgba(132, 204, 22, 0.48), rgba(34, 211, 238, 0.22) 48%, transparent 74%);
  animation: heroAuraFlash 1.0s ease-out 1 forwards;
}
.fan-card-slot.is-front .portrait-box img,
.codex-inspect-card .portrait-box img,
.reveal-slot.focus-hero .portrait-box img {
  animation: heroPortraitSettle 0.9s cubic-bezier(0.22, 1, 0.36, 1) 1 forwards;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .fan-card-slot.is-front .portrait-box::after,
  .codex-inspect-card .portrait-box::after,
  .reveal-slot.focus-hero .portrait-box::after,
  .fan-card-slot.is-front .portrait-box img,
  .codex-inspect-card .portrait-box img,
  .reveal-slot.focus-hero .portrait-box img {
    animation: none !important;
  }
}
.portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.portrait-glyph { font-size: 42px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6)); }
.portrait-subtitle { font-size: 12px; font-weight: 700; opacity: 0.92; margin-top: 3px; }

.pill-tl, .pill-tr {
  position: absolute;
  top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255,255,255,0.2);
}
.pill-tl { left: 6px; color: #fff; }
.pill-tr { right: 6px; color: #fde68a; }
.real-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.25;
  color: #e2e8f0;
  background: linear-gradient(to top, rgba(0,0,0,0.94), rgba(0,0,0,0.68), transparent);
  white-space: normal;
}

/* Sleek 1-Row 3-Stat Bar so hero art gets maximum space! */
.stats-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 0.9fr);
  gap: 3px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px 3px;
}
.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 1px;
  border-radius: 5px;
  min-width: 0;
  overflow: hidden;
}
.stat-cell.active-stat {
  background: rgba(251, 191, 36, 0.22);
  outline: 1px solid rgba(251, 191, 36, 0.65);
  outline-offset: -1px;
}
.stat-label {
  font-size: clamp(7.2px, 3.55cqi, 9.2px);
  letter-spacing: -0.02em;
  color: #cbd5e1;
  white-space: nowrap;
  font-weight: 700;
  max-width: 100%;
  line-height: 1.15;
}
.pips {
  display: flex;
  gap: 2px;
  justify-content: center;
  max-width: 100%;
}
.pip {
  width: clamp(6px, 3.2cqi, 9px);
  height: 5px;
  border-radius: 2px;
  flex-shrink: 1;
}
@container (max-width: 185px) {
  .stats-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 4px 6px;
  }
  .stat-cell {
    flex-direction: row;
    justify-content: space-between;
    padding: 2px 5px;
    gap: 4px;
  }
  .stat-label {
    font-size: 9.5px;
  }
  .pip {
    width: 8px;
  }
}

/* Concise Front Power Strip */
.power-box {
  margin-top: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.32;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}
.front-power-line {
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.3;
}
.friends-inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
}
.friend-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
  font-size: 10px;
  font-weight: 700;
}
.card-bullets {
  margin: 0;
  padding-left: 14px;
  display: grid;
  gap: 5px;
}
.card-bullets li::marker { color: var(--gold); }
.power-sublist {
  margin: 2px 0 0;
  padding-left: 14px;
  display: grid;
  gap: 2px;
  list-style-type: circle;
  font-size: 10.8px;
  line-height: 1.28;
  color: #e2e8f0;
}
.bond-sublist {
  margin: 2px 0 0;
  padding-left: 14px;
  display: grid;
  gap: 2px;
  list-style-type: circle;
  font-size: 10.6px;
  line-height: 1.26;
  color: #fde68a;
}
.bond-sublist li {
  white-space: normal;
}
.ribbon-pill.new-draw {
  background: rgba(52, 211, 153, 0.22);
  border-color: rgba(52, 211, 153, 0.7);
  color: #6ee7b7;
}
.ribbon-pill.rarity-rare {
  background: rgba(251, 191, 36, 0.24);
  border-color: rgba(251, 191, 36, 0.85);
  color: #fde68a;
}
.ribbon-pill.rarity-radioactive {
  background: rgba(132, 204, 22, 0.22);
  border-color: rgba(163, 230, 53, 0.85);
  color: #d9f99d;
}
.ribbon-pill.rarity-uncommon {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  color: #bae6fd;
}
.ribbon-pill.align-hero {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}
.ribbon-pill.align-villain {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(251, 113, 133, 0.72);
  color: #fecdd3;
}
.ribbon-pill.align-neutral {
  background: rgba(192, 132, 252, 0.2);
  border-color: rgba(216, 180, 254, 0.65);
  color: #f3e8ff;
}
.codex-row {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.codex-btn {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.codex-btn:hover { background: rgba(56, 189, 248, 0.34); }

/* Action Bar */
.action-bar {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Suspense Step-by-Step Reveal Stage */
.narrator-banner {
  background: linear-gradient(135deg, #172554, #312e81);
  border: 2px solid rgba(251, 191, 36, 0.55);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.narrator-text {
  font-size: 15.5px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}
.narrator-sub {
  font-size: 12px;
  color: #fde68a;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.reveal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.reveal-grid.rcols-2 { grid-template-columns: repeat(2, minmax(0, 320px)); justify-content: center; }
.reveal-grid.rcols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reveal-grid.rcols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.reveal-grid.rcols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.reveal-grid.rcols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reveal-grid.rcols-7, .reveal-grid.rcols-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) {
  .reveal-grid, .reveal-grid.rcols-2, .reveal-grid.rcols-3, .reveal-grid.rcols-4,
  .reveal-grid.rcols-5, .reveal-grid.rcols-6, .reveal-grid.rcols-7, .reveal-grid.rcols-8 {
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  }
}

/* Single Unified Live Points Box sitting RIGHT ABOVE each revealed card! */
.live-score-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
}
.live-score-box.pulse-active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.14);
}
.live-score-box.negative-score {
  border-color: #fb7185;
  background: rgba(244, 63, 94, 0.18);
}
.points-label { font-size: 11px; font-weight: 800; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.05em; }
.points-val { font-size: 17px; font-weight: 900; color: var(--gold); display: flex; align-items: center; gap: 6px; }
.points-val.is-neg { color: #fda4af; }
.delta-pill {
  font-size: 11.5px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 999px;
  animation: deltaPop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.delta-pill.pos { background: rgba(52, 211, 153, 0.22); color: #6ee7b7; border: 1px solid #34d399; }
.delta-pill.neg { background: rgba(251, 113, 133, 0.22); color: #fda4af; border: 1px solid #fb7185; }
.delta-pill.gold { background: rgba(251, 191, 36, 0.24); color: #fde68a; border: 1px solid #fbbf24; }
@keyframes deltaPop {
  from { opacity: 0; transform: scale(0.65) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.reveal-slot {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 9px 10px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}
.reveal-slot.focus-hero {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.55), 0 18px 40px rgba(251, 191, 36, 0.35);
  z-index: 2;
}
.reveal-slot.partner-glow {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45), 0 10px 26px rgba(56, 189, 248, 0.22);
}
.reveal-slot.dimmed-slot {
  opacity: 0.48;
  filter: saturate(0.75);
}
.reveal-slot.winner-glow {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.65), 0 18px 44px rgba(251, 191, 36, 0.42);
}
.active-hero-banner {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  color: #111;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 2px 7px;
  border-radius: 6px;
  margin-bottom: 5px;
}

/* Clean Bulleted Step Text for Top Narrator & Bottom Chain Log */
.step-bullets {
  margin: 2px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 2px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.32;
  color: #fff;
}
.step-bullets li::marker { color: var(--gold); }
.log-bullets {
  margin: 2px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 2px;
  font-size: 12.5px;
  line-height: 1.32;
}
.log-bullets li::marker { color: var(--gold); }

.reveal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-size: 12.5px;
  gap: 6px;
}
.speed-order-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}
.power-badge {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  padding: 3px 9px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12.5px;
  transition: transform 0.2s ease;
}

/* Face-Down Uniform Card Back during Suspense Reveal */
.facedown-card {
  height: var(--card-h-compact);
  border-radius: 13px;
  background: linear-gradient(135deg, #0f172a, #1e1b4b, #0f172a);
  border: 2px solid rgba(129, 140, 248, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.facedown-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(129, 140, 248, 0.28);
  border-radius: 9px;
  pointer-events: none;
}
.flip-in {
  animation: cardFlipIn 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cardFlipIn {
  from { opacity: 0; transform: rotateY(-78deg) scale(0.94); }
  to   { opacity: 1; transform: rotateY(0deg) scale(1); }
}

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag-chip {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.16);
}

.event-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.event-row {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  background: rgba(255,255,255,0.04);
  border-left: 4px solid var(--accent);
  animation: slideFade 0.28s ease;
}
@keyframes slideFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.event-row.intro {
  border-left-color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}
.event-row.bond { border-left-color: var(--gold); background: rgba(251, 191, 36, 0.1); }
.event-row.hazard { border-left-color: var(--red); background: rgba(251, 113, 133, 0.1); }
.event-row.save { border-left-color: var(--green); background: rgba(52, 211, 153, 0.1); }
.event-row.win { border-left-color: #a855f7; background: rgba(168, 85, 247, 0.16); font-weight: 700; }

/* Privacy Curtain for Pass-and-Play */
.curtain {
  text-align: center;
  padding: 52px 24px;
  background: var(--surface);
  border: 2px dashed rgba(251, 191, 36, 0.45);
  border-radius: 18px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  max-width: 980px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.modal-box.codex-inspect-mode {
  height: min(690px, 88vh);
  overflow: hidden;
}
.modal-box.codex-inspect-mode #modalBody {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codex-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.codex-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.codex-nav-count {
  font-size: 12.5px;
  font-weight: 800;
  color: #94a3b8;
}
.codex-carousel-shell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 16px;
  padding: 0 6px;
  align-items: center;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.codex-arrow-btn {
  width: 48px;
  height: 76px;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.34);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 0 4px;
  user-select: none;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.codex-arrow-btn:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.28);
  transform: scale(1.04);
}
.codex-inspect-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  height: 100%;
  min-height: 0;
}
.codex-inspect-card {
  width: 270px;
  margin: 0 auto;
  flex-shrink: 0;
}
.codex-inspect-card .hero-card-outer {
  height: clamp(390px, 62vh, 452px);
}
.codex-details-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 2px 10px 6px 2px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.42) transparent;
}
.codex-details-panel::-webkit-scrollbar {
  width: 6px;
}
.codex-details-panel::-webkit-scrollbar-track {
  background: transparent;
}
.codex-details-panel::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.38);
  border-radius: 999px;
}
.pt-grid-scroll {
  width: 100%;
  overflow-x: auto;
  padding: 8px 12px 10px;
}
.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(34px, 1fr));
  min-width: 660px;
  gap: 3px;
  margin: 4px 0 6px;
}
.codex-periodic-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

/* =====================================================================
   COMPREHENSIVE RESPONSIVE BREAKPOINTS (Width + Height Viewports)
   ===================================================================== */

/* Single-screen desktop/laptop fluid height scaling (MacBook Air/Pro & desktops) */
@media (min-width: 900px) {
  :root {
    --card-h: clamp(336px, calc(100vh - 350px), 432px);
    --card-h-compact: clamp(278px, calc(100vh - 446px), 372px);
    --fan-stage-h: calc(var(--card-h) + 22px);
    --portrait-h: clamp(114px, calc(var(--card-h) - 210px), 192px);
  }
}

/* Medium laptops & narrower desktops (1081px–1400px) */
@media (max-width: 1400px) and (min-width: 1081px) {
  :root {
    --chat-w: 276px;
    --card-w: 252px;
    --fan-step: 84px;
  }
  .container { padding: 6px 16px 8px; }
  .reveal-grid.rcols-5, .reveal-grid.rcols-7, .reveal-grid.rcols-8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .reveal-grid.rcols-3, .reveal-grid.rcols-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) and (min-width: 1081px) {
  .reveal-grid.rcols-4, .reveal-grid.rcols-5, .reveal-grid.rcols-7, .reveal-grid.rcols-8 {
    grid-template-columns: repeat(2, minmax(225px, 310px));
    justify-content: center;
  }
}

/* MacBook & laptop screens (<= 880px tall, e.g. 13" Air / 14" Pro / 15" Air) */
@media (max-height: 880px) and (min-width: 900px) {
  :root {
    --card-w: 244px;
    --fan-step: 82px;
    --fan-drop: 4px;
    --fan-deg: 3.8deg;
  }
  .topbar { padding: 5px 18px; }
  .brand-logo { width: 30px; height: 30px; font-size: 15px; }
  .brand-title { font-size: 16.5px; }
  .brand-sub { font-size: 10.5px; }
  .container { padding: 5px 18px 6px; }
  .scoreboard { padding: 5px 12px; margin-bottom: 6px; gap: 6px; }
  .player-chip { padding: 3px 9px; font-size: 12.5px; }
  .player-chip .pts { font-size: 13.5px; }
  .meta-pill { padding: 3px 9px; font-size: 11.5px; }
  .arena-center-wrap { margin-bottom: 6px; }
  .arena-center-wrap .arena-hero-banner { min-height: 98px; }
  .arena-center-wrap .arena-content { padding: 8px 14px; }
  .arena-center-wrap .arena-title { font-size: 18px; }
  .arena-center-wrap .arena-bullets { font-size: 12px; line-height: 1.28; gap: 1px; }
  .tabletop-chat-col { top: 48px; }
  .tabletop-chat-col .docked-chat {
    height: clamp(320px, calc(100vh - 126px), 590px);
    max-height: calc(100vh - 126px);
  }
  .hand-fan-stage { padding-top: 4px; padding-bottom: 2px; margin-bottom: 2px; }
  .fan-card-slot { bottom: 18px; }
  .react-bar-minimal { margin-top: 4px; padding-bottom: 0; }
  .btn-react-main { padding: 8px 24px; font-size: 14px; }
  .narrator-banner { padding: 8px 14px; margin-bottom: 8px; gap: 6px; }
  .step-bullets { font-size: 13px; line-height: 1.28; }
  .reveal-slot { padding: 7px 8px; }
  .live-score-box { padding: 4px 8px; margin-bottom: 5px; }
  .points-val { font-size: 16px; }
  .event-log { max-height: 76px; padding: 6px 10px; gap: 4px; }
  .site-footer { padding: 3px 12px 6px; font-size: 11px; }
  .intro-stage { min-height: calc(100vh - 82px); padding: 12px 14px 14px; }
  .intro-title { font-size: clamp(38px, 5.4vw, 56px); }
  .intro-sub { font-size: 14.5px; margin-bottom: 6px; }
  .intro-desc { font-size: 14px; margin-bottom: 12px; }
  .intro-fan { min-height: 126px; margin: 2px 0 18px; padding-bottom: 10px; }
  .intro-poster-card { width: 104px; height: 128px; }
  .intro-cta-row { margin-bottom: 10px; }
  .panel { padding: 18px 22px; }
  .lobby-grid { margin-top: 6px; }
}

/* Compact 13" MacBook Air & shorter windows (<= 780px tall) */
@media (max-height: 780px) and (min-width: 900px) {
  :root {
    --card-w: 230px;
    --card-h: clamp(310px, calc(100vh - 332px), 390px);
    --card-h-compact: clamp(268px, calc(100vh - 392px), 344px);
    --fan-stage-h: calc(var(--card-h) + 18px);
    --portrait-h: clamp(106px, calc(var(--card-h) - 186px), 172px);
    --fan-step: 76px;
    --fan-drop: 2px;
    --fan-deg: 3.2deg;
  }
  .card-face { padding: 8px 9px; }
  .num-box { width: 46px; height: 40px; }
  .num-box .at-num { font-size: 14.5px; }
  .num-box .at-sym { font-size: 12.5px; }
  .card-name { font-size: 13.5px; }
  .card-alias { font-size: 10px; }
  .card-fam { font-size: 10.5px; }
  .badge-ribbon { margin: 4px 0 3px; }
  .ribbon-pill { font-size: 10px; padding: 1px 6px; }
  .portrait-box { min-height: 100px; margin-bottom: 4px; }
  .card-carbon-switch { margin-bottom: 4px; }
  .card-carbon-btn { padding: 2px 5px; font-size: 10px; }
  .stats-row { padding: 3px 2px; }
  .stat-cell { gap: 2px; padding: 2px 1px; }
  .power-box { margin-top: 4px; padding: 4px 7px; font-size: 10.2px; line-height: 1.24; }
  .front-power-line { font-size: 10.2px; line-height: 1.24; }
  .arena-center-wrap .arena-hero-banner { min-height: 86px; }
  .arena-center-wrap .arena-content { padding: 6px 12px; }
  .arena-center-wrap .arena-title { font-size: 16.5px; }
  .arena-center-wrap .arena-bullets { font-size: 11.5px; }
  .tabletop-chat-col .docked-chat {
    height: clamp(300px, calc(100vh - 114px), 540px);
    max-height: calc(100vh - 114px);
  }
  .event-log { max-height: 66px; }
}

/* Tablets & narrow split-screen windows (<= 1080px) */
@media (max-width: 1080px) {
  :root {
    --card-w: 252px;
    --card-h: 436px;
    --card-h-compact: 400px;
    --portrait-h: 180px;
    --fan-stage-h: 472px;
    --fan-step: 76px;
  }
  .tabletop-layout { grid-template-columns: 1fr; }
  .tabletop-chat-col { position: static; width: 100%; max-width: 780px; margin: 6px auto 0; }
  .tabletop-chat-col .docked-chat,
  .tabletop-chat-col .docked-chat.reveal-docked-chat { height: 290px; max-height: 320px; }
  .hand-grid, .hand-grid.cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  }
  .reveal-grid, .reveal-grid.rcols-2, .reveal-grid.rcols-3, .reveal-grid.rcols-4,
  .reveal-grid.rcols-5, .reveal-grid.rcols-6, .reveal-grid.rcols-7, .reveal-grid.rcols-8 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* Small tablets & large phones (<= 720px) */
@media (max-width: 720px) {
  :root {
    --card-w: 238px;
    --card-h: 424px;
    --portrait-h: 168px;
    --fan-stage-h: 454px;
    --fan-step: 50px;
    --fan-deg: 4deg;
  }
  .container { padding: 10px 12px 32px; }
  .modal-box.codex-inspect-mode { height: auto; max-height: 88vh; overflow-y: auto; }
  .modal-box.codex-inspect-mode #modalBody { overflow: visible; }
  .codex-carousel-shell { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 8px; height: auto; align-items: start; }
  .codex-arrow-btn { width: 36px; height: 60px; font-size: 28px; border-radius: 10px; margin-top: 165px; }
  .codex-inspect-grid { grid-template-columns: 1fr; height: auto; align-items: start; }
  .codex-inspect-card { width: min(270px, 100%); }
  .codex-details-panel { height: auto; max-height: none; overflow-y: visible; padding: 0; }
  .intro-fan { min-height: 132px; margin: 6px 0 36px; padding-bottom: 16px; }
  .intro-poster-card { width: 96px; height: 122px; margin: 0 -14px; }
  .arena-top-row { gap: 6px; }
  .arena-title { font-size: 18px; }
}

/* Compact mobile phones (<= 460px) */
@media (max-width: 460px) {
  :root {
    --card-w: 222px;
    --card-h: 412px;
    --portrait-h: 152px;
    --fan-stage-h: 440px;
    --fan-step: 32px;
    --fan-deg: 3.5deg;
  }
  .brand-title { font-size: 17px; }
  .intro-poster-card { width: 82px; height: 108px; margin: 0 -16px; }
  .intro-play-btn { width: 100%; }
  .modal-box { padding: 14px; }
}
.pt-tile {
  aspect-ratio: 1;
  border-radius: 5px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(148,163,184,0.07);
  color: rgba(148,163,184,0.52);
  padding: 0;
}
.pt-tile.locked {
  cursor: not-allowed;
  opacity: 0.56;
  filter: grayscale(1);
}
.pt-tile.pt-marker {
  background: transparent;
  border: 1px dashed rgba(148,163,184,0.22);
  color: rgba(148,163,184,0.62);
  font-size: 7.5px;
  font-weight: 700;
}
.pt-tile.unlocked {
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  border-color: rgba(255,255,255,0.42);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.pt-tile.unlocked:hover { transform: scale(1.12); z-index: 2; }
.pt-fblock-gap {
  grid-column: 1 / -1;
  height: 8px;
}
.pt-fblock-label {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.02em;
}
.codex-pack-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.codex-pack-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  text-align: left;
  color: #e2e8f0;
}
.codex-pack-pill.active-pack {
  border-color: rgba(251, 191, 36, 0.72);
  background: rgba(251, 191, 36, 0.12);
}
.codex-pack-pill.toggle-pack {
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}
.codex-pack-pill.toggle-pack:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.85);
}
.codex-pack-pill.toggle-pack.exp-on {
  border-color: rgba(45, 212, 191, 0.8);
  background: rgba(20, 184, 166, 0.16);
}
.codex-pack-pill.toggle-pack.exp-on .codex-pack-meta {
  color: #5eead4;
}
.codex-pack-pill.toggle-pack.exp-off {
  opacity: 0.78;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.45);
}
.codex-pack-pill.locked-pack {
  opacity: 0.48;
  cursor: not-allowed;
  border-style: dashed;
  filter: grayscale(0.8);
}
.codex-pack-title {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}
.codex-pack-meta {
  font-size: 11px;
  color: #94a3b8;
}
.codex-pack-pill.active-pack .codex-pack-meta {
  color: #fde68a;
}
@media (max-width: 680px) {
  .codex-pack-bar { grid-template-columns: 1fr; }
}

.feedback-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.feedback-tweak-box {
  margin: 14px auto 0;
  max-width: 560px;
  text-align: left;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feedback-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.feedback-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.feedback-tag.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #e0f2fe;
}
.feedback-textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1120;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
}
.feedback-textarea:focus {
  outline: none;
  border-color: #38bdf8;
}
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.print-only { display: none; }
@page {
  size: letter portrait;
  margin: 0.25in;
}
.site-footer {
  text-align: center;
  padding: 5px 14px 8px;
  font-size: 11.5px;
  color: #64748b;
}
.site-footer a {
  color: #94a3b8;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}
.site-footer a:hover {
  color: #7dd3fc;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-sizing: border-box !important;
  }
  html, body {
    background: #fff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
  }
  .topbar, #app, .modal-backdrop, .floating-chat, .site-footer { display: none !important; }
  .print-only { display: block !important; }

  /* Explicit fixed single-sheet pages so NO card ever splits across two pages */
  .print-page {
    width: 7.62in;
    margin: 0 auto;
    break-after: page;
    page-break-after: always;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-page-last {
    break-after: auto;
    page-break-after: auto;
  }
  .print-page-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 9px;
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
    padding: 0 2px 3px;
    margin-bottom: 0.08in;
    height: 0.2in;
  }

  /* 3 × 3 Poker-Size Hero Cards (2.46in × 3.16in) — 9 complete cards per page */
  .print-grid-heroes {
    display: grid;
    grid-template-columns: repeat(3, 2.46in);
    grid-template-rows: repeat(3, 3.16in);
    gap: 0.07in;
    justify-content: center;
  }
  .print-card {
    width: 2.46in;
    height: 3.16in;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 2px;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    background: #fff;
  }

  /* Flatten 3D flip wrapper so Safari/Chrome print cleanly with zero ghosting or clipping */
  .print-card .hero-card-outer {
    perspective: none !important;
    transform: none !important;
    min-height: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
    border-radius: 8px !important;
  }
  .print-card .card-flip-inner {
    transform-style: flat !important;
    transform: none !important;
    position: static !important;
    min-height: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 2px !important;
    border-radius: 8px !important;
  }
  .print-card .card-face-back { display: none !important; }
  .print-card .card-face-front {
    position: static !important;
    inset: auto !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    container-type: normal !important;
    width: 100% !important;
    height: 100% !important;
    padding: 6px !important;
    border-radius: 7px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 3px !important;
    overflow: hidden !important;
  }

  /* Crisp print typography scaled to true 2.48in × 3.26in trading card proportions */
  .print-card .card-head { gap: 4px !important; }
  .print-card .card-id { gap: 5px !important; }
  .print-card .num-box {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 6px !important;
  }
  .print-card .at-num { font-size: 7.5px !important; }
  .print-card .at-sym { font-size: 13px !important; }
  .print-card .card-name { font-size: 11px !important; line-height: 1.05 !important; }
  .print-card .card-alias { font-size: 7.8px !important; line-height: 1.05 !important; }
  .print-card .card-fam { font-size: 7px !important; line-height: 1.05 !important; }
  .print-card .mini-pt { transform: scale(0.76); transform-origin: right top; margin-left: -10px; }

  .print-card .badge-ribbon { gap: 3px !important; margin: 0 !important; }
  .print-card .ribbon-pill { font-size: 7px !important; padding: 1.5px 4.5px !important; }

  .print-card .portrait-box {
    height: 1.22in !important;
    min-height: 1.22in !important;
    max-height: 1.22in !important;
    margin: 0 !important;
    border-radius: 6px !important;
  }
  .print-card .portrait-box img { width: 100% !important; height: 100% !important; object-fit: cover !important; }

  .print-card .stats-row { gap: 3px !important; margin: 0 !important; container-type: normal !important; }
  .print-card .stat-cell { padding: 2.5px 2px !important; border-radius: 5px !important; }
  .print-card .stat-label { font-size: 6.4px !important; margin-bottom: 2px !important; }
  .print-card .pip { width: 5.5px !important; height: 5.5px !important; }

  .print-card .power-box {
    flex: 1 1 auto !important;
    padding: 4px 5px !important;
    margin: 0 !important;
    border-radius: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
  }
  .print-card .front-power-line { font-size: 7.4px !important; line-height: 1.22 !important; }
  .print-card .friends-inline-row { font-size: 7px !important; gap: 2.5px !important; margin-top: 2px !important; }
  .print-card .friend-chip { font-size: 6.6px !important; padding: 1px 4px !important; }

  /* 2 × 3 Landscape Arena Cards (3.72in × 3.12in) — 6 complete arenas per page */
  .print-grid-arenas {
    display: grid;
    grid-template-columns: repeat(2, 3.72in);
    grid-template-rows: repeat(3, 3.12in);
    gap: 0.08in;
    justify-content: center;
  }
  .print-arena-slot {
    width: 3.72in;
    height: 3.12in;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 3px;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    background: #fff;
  }
  .print-arena-card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    color: #f1f5f9;
    border: 1.5px solid #38bdf8;
    display: flex;
    flex-direction: column;
  }
  .print-arena-art {
    position: relative;
    height: 1.44in;
    width: 100%;
    overflow: hidden;
    background: #020617;
    flex-shrink: 0;
  }
  .print-arena-img,
  .print-arena-art svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    display: block;
  }
  .print-arena-stat {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #fbbf24;
    color: #fde68a;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
  }
  .print-arena-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(125, 211, 252, 0.55);
    color: #bae6fd;
    font-size: 7.5px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
  }
  .print-arena-body {
    flex: 1;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
  }
  .print-arena-title {
    font-size: 11.5px;
    font-weight: 900;
    color: #fff;
    line-height: 1.15;
  }
  .print-arena-bullets {
    margin: 0;
    padding-left: 13px;
    display: grid;
    gap: 2.5px;
    font-size: 7.8px;
    line-height: 1.25;
    color: #e2e8f0;
  }
}
