/* Scrae! Soulmates ♡ — Plush Velvet Table Realms & Full-Height Layout */
:root,
html[data-realm="velvet"] {
  color-scheme: dark;
  --bg: #14091b;
  --panel: rgba(31, 15, 42, 0.92);
  --panel-solid: #1f0f2a;
  --felt: radial-gradient(circle at 50% 45%, #371645 0%, #200c2b 72%, #15071d 100%);
  --felt-rim: rgba(255, 196, 128, 0.42);
  --tile: #291437;
  --line: rgba(255, 255, 255, 0.14);
  --text: #fff7fb;
  --muted: #cab3d8;
  --accent: #ffd075;
  --soul: #fb7185;
  --rival: #38bdf8;
  --cta-grad: linear-gradient(120deg, #f43f5e, #fb7185 52%, #ffd075);
  --cta-ink: #1a0817;
  --aura-a: #f43f5e;
  --aura-b: #9333ea;
  --aura-c: #ffd075;
}

html[data-realm="midnight"] {
  color-scheme: dark;
  --bg: #070d1f;
  --panel: rgba(14, 24, 52, 0.92);
  --panel-solid: #0e1834;
  --felt: radial-gradient(circle at 50% 45%, #162b5c 0%, #0d1a3b 72%, #071024 100%);
  --felt-rim: rgba(56, 189, 248, 0.45);
  --tile: #14244a;
  --line: rgba(148, 197, 255, 0.18);
  --text: #f0f7ff;
  --muted: #9ab7d9;
  --accent: #38bdf8;
  --soul: #f472b6;
  --rival: #38bdf8;
  --cta-grad: linear-gradient(120deg, #ec4899, #a855f7 52%, #38bdf8);
  --cta-ink: #070d1f;
  --aura-a: #38bdf8;
  --aura-b: #a855f7;
  --aura-c: #ec4899;
}

html[data-realm="emerald"] {
  color-scheme: dark;
  --bg: #061813;
  --panel: rgba(11, 37, 30, 0.92);
  --panel-solid: #0b251e;
  --felt: radial-gradient(circle at 50% 45%, #14533c 0%, #0b3325 72%, #062118 100%);
  --felt-rim: rgba(253, 224, 71, 0.45);
  --tile: #10362a;
  --line: rgba(167, 243, 208, 0.16);
  --text: #f2fff9;
  --muted: #9ccdb9;
  --accent: #fde047;
  --soul: #fb7185;
  --rival: #34d399;
  --cta-grad: linear-gradient(120deg, #34d399, #a3e635 52%, #fde047);
  --cta-ink: #061813;
  --aura-a: #10b981;
  --aura-b: #f59e0b;
  --aura-c: #06b6d4;
}

html[data-realm="ivory"] {
  color-scheme: light;
  --bg: #fdf6ec;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-solid: #ffffff;
  --felt: radial-gradient(circle at 50% 45%, #fff9f0 0%, #f5e7d3 76%, #ead6bb 100%);
  --felt-rim: rgba(214, 45, 100, 0.42);
  --tile: #fffaf2;
  --line: rgba(28, 18, 41, 0.14);
  --text: #1c1229;
  --muted: #65567a;
  --accent: #d62d64;
  --soul: #d62d64;
  --rival: #0284c7;
  --cta-grad: linear-gradient(120deg, #d62d64, #eb5c3b 55%, #e59300);
  --cta-ink: #ffffff;
  --aura-a: #ffb703;
  --aura-b: #eb577e;
  --aura-c: #02bfd2;
}

html[data-realm="blush"] {
  color-scheme: light;
  --bg: #fdf2f8;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-solid: #ffffff;
  --felt: radial-gradient(circle at 50% 45%, #fff5fa 0%, #fce1ef 76%, #f5cbe0 100%);
  --felt-rim: rgba(147, 51, 234, 0.4);
  --tile: #fff7fb;
  --line: rgba(59, 17, 52, 0.14);
  --text: #2a0f25;
  --muted: #75506d;
  --accent: #9333ea;
  --soul: #e11d48;
  --rival: #2563eb;
  --cta-grad: linear-gradient(120deg, #e11d48, #c026d3 55%, #7c3aed);
  --cta-ink: #ffffff;
  --aura-a: #f472b6;
  --aura-b: #a855f7;
  --aura-c: #38bdf8;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  transition: background 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

button, a, input { font: inherit; color: inherit; text-decoration: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.realm-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aura { position: absolute; border-radius: 50%; filter: blur(95px); opacity: 0.24; }
html[data-realm="ivory"] .aura, html[data-realm="blush"] .aura { opacity: 0.14; }
.aura-a { width: 45vw; height: 45vw; max-width: 500px; max-height: 500px; top: -15%; left: -10%; background: var(--aura-a); }
.aura-b { width: 44vw; height: 44vw; max-width: 500px; max-height: 500px; top: 8%; right: -12%; background: var(--aura-b); }
.aura-c { width: 42vw; height: 42vw; max-width: 460px; max-height: 460px; bottom: -16%; left: 32%; background: var(--aura-c); opacity: 0.16; }

/* Compact Topbar */
.game-topbar {
  max-width: 1520px;
  margin: 0 auto;
  padding: 8px clamp(12px, 2vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 9px; }

.back-pill, .top-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.back-pill:hover, .top-pill:hover { transform: translateY(-1px); border-color: var(--accent); }
.primary-pill { border: 0; background: var(--cta-grad); color: var(--cta-ink); font-weight: 800; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }

.title-cluster { display: flex; align-items: center; gap: 8px; }
.title-cluster h1 { margin: 0; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 21px; font-weight: 800; }
.title-sub { font-weight: 600; font-size: 0.78em; color: var(--accent); }

.alpha-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.1px;
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid var(--soul);
  color: var(--soul);
}

.top-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 800;
}

#btn-mute[aria-pressed="false"] .icon-sound-off { display: none; }
#btn-mute[aria-pressed="true"] .icon-sound-on { display: none; }

/* 3-Column Full-Height Table Layout */
.play-layout {
  max-width: 1520px;
  margin: 0 auto;
  padding: 2px clamp(10px, 1.8vw, 22px) 12px;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr) 265px;
  align-items: stretch;
  gap: 14px;
  min-height: calc(100dvh - 58px);
}

.left-rail, .right-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dock-card {
  padding: 12px 13px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.dock-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.dock-sub, .rules-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

/* Scoreboard */
.score-duo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.team-pill {
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--tile);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.team-pill.team-soul { border-color: color-mix(in srgb, var(--soul) 60%, transparent); }
.team-pill.team-rival { border-color: color-mix(in srgb, var(--rival) 55%, transparent); }
.team-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.team-pill strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 26px; line-height: 1.05; }
.team-soul strong { color: var(--soul); }
.team-rival strong { color: var(--rival); }

/* Secret Signal Reminder */
.signal-hero {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sig-big {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--tile);
  border: 1.5px solid var(--accent);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
}

.signal-hero strong { display: block; font-size: 13.5px; }
.signal-hero small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--muted); }

.table-tip-copy {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* Plush Velvet Card Table */
.table-stage {
  display: flex;
  flex-direction: column;
}

.table-felt {
  flex: 1;
  min-height: 540px;
  border-radius: 30px;
  border: 2.5px solid var(--felt-rim);
  background: var(--felt);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), inset 0 0 60px rgba(0, 0, 0, 0.28);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.seat.is-turn .seat-plate {
  border-color: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}

.seat-plate {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--panel-solid);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.seat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tile);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.seat-meta { display: flex; flex-direction: column; line-height: 1.15; }
.seat-meta strong { font-size: 12.5px; font-weight: 600; }
.seat-meta small { font-size: 10px; color: var(--muted); }

/* Floating Signal Bubble over Player Avatar */
.signal-bubble {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1.5px solid var(--accent);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 20;
  animation: bubble-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bubble-pop {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.75); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.table-mid {
  flex: 1;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 10px;
}

.center-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.turn-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}

.center-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(64px, 86px));
  gap: 8px;
  justify-content: center;
}

.seat-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.seat-hand.is-opponent { gap: 5px; }
.seat-hand.is-vertical {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 5px;
}

/* Crisp Pure-White Etched Playing Cards */
.playing-card {
  position: relative;
  width: clamp(72px, 7.2vw, 96px);
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  border: 1px solid rgba(17, 17, 17, 0.16);
  background: #ffffff;
  color: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.seat-hand.is-you .playing-card {
  width: clamp(84px, 8.6vw, 112px);
}

.playing-card.is-suit-dark {
  color: #111111;
}

.playing-card.is-suit-red {
  color: #c81e3a;
}

.card-inner-frame {
  position: absolute;
  inset: 5px;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: 0.72;
  pointer-events: none;
  z-index: 1;
}

.playing-card.is-mini {
  width: 46px;
  border-radius: 7px;
  padding: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.playing-card.is-mini .card-inner-frame {
  inset: 3px;
  border-radius: 4px;
}

.playing-card.is-mini .card-corner.is-br { display: none; }

.playing-card.is-back {
  background: linear-gradient(145deg, #2d163f, #1b0d29);
  border-color: rgba(255, 208, 117, 0.55);
  box-shadow: inset 0 0 0 4px rgba(255, 208, 117, 0.14), 0 6px 14px rgba(0, 0, 0, 0.35);
}

.playing-card.is-back::after {
  content: "◆";
  font-size: 16px;
  color: rgba(255, 208, 117, 0.72);
}

.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1px 2.5px 2px;
  background: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 0.94;
  z-index: 3;
}

.card-corner.is-tl { top: 3px; left: 3px; }
.card-corner.is-br { bottom: 3px; right: 3px; transform: rotate(180deg); }
.idx-suit { font-size: 10px; line-height: 1.05; }

.playing-card.is-mini .card-corner.is-tl {
  top: 1.5px;
  left: 1.5px;
  padding: 0.5px 1.5px;
  font-size: 9px;
}
.playing-card.is-mini .idx-suit { display: none; }

.card-art-wrap {
  position: relative;
  z-index: 2;
  width: 84%;
  height: 86%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.card-art-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.playing-card.is-mini .card-art-wrap {
  width: 82%;
  height: 82%;
}

/* Placeholder while dealing center cards */
.card-slot-placeholder {
  width: clamp(66px, 6.5vw, 88px);
  aspect-ratio: 5 / 7;
  border-radius: 11px;
  border: 1.5px dashed rgba(255, 208, 117, 0.22);
  background: rgba(0, 0, 0, 0.12);
}

/* Riffle Shuffle Overlay & Flying Cards */
.shuffle-deck-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.shuffle-stack {
  position: relative;
  width: 78px;
  height: 108px;
}

.shuffle-half {
  position: absolute;
  inset: 0;
  width: 100% !important;
}

.shuffle-half.is-left {
  animation: riffle-left 0.28s ease-in-out infinite alternate;
}

.shuffle-half.is-right {
  animation: riffle-right 0.28s ease-in-out infinite alternate;
}

@keyframes riffle-left {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(-34px) rotate(-10deg); }
}

@keyframes riffle-right {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(34px) rotate(10deg); }
}

.shuffle-label {
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.flying-card-wrap {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 80;
  pointer-events: none;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.55));
}

.playing-card.is-interactive:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
}

.playing-card.is-selected {
  transform: translateY(-10px) scale(1.04);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent), 0 14px 28px rgba(0, 0, 0, 0.48);
}

.playing-card.just-swapped {
  animation: card-pop 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.playing-card.is-scrae-match {
  box-shadow: 0 0 0 2.5px #32d583, 0 0 18px rgba(50, 213, 131, 0.55);
}

@keyframes card-pop {
  0% { transform: scale(0.76) rotate(-5deg); opacity: 0.6; }
  65% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.scrae-ready-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--cta-grad);
  color: var(--cta-ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 22px rgba(244, 63, 94, 0.4);
  animation: ready-pulse 1.5s ease-in-out infinite;
}

@keyframes ready-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.south-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reveal-banner {
  padding: 12px 16px;
  border-radius: 18px;
  border: 2px solid var(--accent);
  background: var(--panel-solid);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 420px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.reveal-banner strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 18px; color: var(--accent); }
.reveal-banner p { margin: 0; font-size: 12.5px; color: var(--muted); }

/* Right Rail: Call Scrae & Signals */
.scrae-btns { display: grid; gap: 8px; }

.scrae-btn {
  padding: 11px 12px;
  border-radius: 15px;
  border: 1.5px solid var(--line);
  background: var(--tile);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.scrae-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); }
.scrae-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.scrae-btn span { font-family: "Bricolage Grotesque", sans-serif; font-size: 15px; font-weight: 800; }
.scrae-btn small { font-size: 11px; color: var(--muted); }
.scrae-btn em { font-style: normal; }

.scrae-btn.is-partner {
  border-color: color-mix(in srgb, var(--soul) 75%, transparent);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.24), var(--tile));
}

.scrae-btn.is-double {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 208, 117, 0.22), rgba(244, 63, 94, 0.2));
}

.counter-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.scrae-btn.is-counter { padding: 9px 10px; }
.scrae-btn.is-counter span { font-size: 13px; }

.signal-actions { display: grid; gap: 7px; }

.sig-action-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--tile);
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.sig-action-btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--accent); }
.sig-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sig-action-btn.is-secret { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--tile)); }
.sig-action-btn .sa-icon { font-size: 20px; }
.sig-action-btn strong { display: block; font-size: 12.5px; }
.sig-action-btn small { display: block; font-size: 10.5px; color: var(--muted); }

/* Modals (Anchored Sticky Footers matching Ludo & Sudoku) */
.modal {
  width: min(540px, calc(100% - 24px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
  overflow: auto;
}
.modal-wide { width: min(740px, calc(100% - 24px)); }
.modal::backdrop { background: rgba(6, 4, 14, 0.76); backdrop-filter: blur(7px); }
.modal-inner { position: relative; padding: 24px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--tile); font-size: 20px; }
.modal-inner h2 { margin: 6px 0 0; font-family: "Bricolage Grotesque", sans-serif; font-size: 26px; font-weight: 800; }

.setup-group, .settings-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.setup-group h3, .settings-section h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; }

.signal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sig-choice-btn {
  padding: 10px 6px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--tile);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}
.sig-choice-btn span { font-size: 22px; }
.sig-choice-btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--tile)); }

.setup-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sub-label { margin: 0 0 7px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.segmented-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tri-grid { grid-template-columns: repeat(3, 1fr); }
.seg-btn { min-height: 36px; border-radius: 11px; border: 1px solid var(--line); background: var(--tile); font-size: 12px; font-weight: 700; }
.seg-btn[aria-pressed="true"] { background: var(--cta-grad); color: var(--cta-ink); border-color: transparent; }

.seats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seat-input-card { padding: 9px 11px; border-radius: 14px; border: 1px solid var(--line); background: var(--tile); display: grid; gap: 6px; font-size: 12px; font-weight: 600; }
.seat-input-card input { width: 100%; padding: 6px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-solid); font-size: 12.5px; font-weight: 500; }

.realm-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.realm-card-btn { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 14px; border: 1px solid var(--line); background: var(--tile); font-size: 12.5px; font-weight: 600; }
.realm-card-btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--tile)); }
.realm-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--swatch); flex: none; }

.toggle-list { display: grid; gap: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--tile); cursor: pointer; }
.toggle-row span { display: flex; flex-direction: column; gap: 2px; }
.toggle-row strong { font-size: 13px; }
.toggle-row small { font-size: 11px; color: var(--muted); }
.toggle-row input { width: 20px; height: 20px; accent-color: #f43f5e; }
.slider-row { margin-top: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--tile); }
.slider-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.slider-row input { width: 100%; accent-color: #f43f5e; }

.modal-actions { margin-top: 18px; display: grid; gap: 9px; }
.full-btn { width: 100%; min-height: 44px; }

#setup-dialog .modal-actions,
#settings-dialog .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 20px -24px -24px;
  padding: 14px 24px 18px;
  background: var(--panel-solid);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.32);
}

.win-inner { text-align: center; }
.win-summary { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }
.win-scores { margin-top: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.win-scores div { padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--tile); display: flex; flex-direction: column; gap: 3px; }
.win-scores span { font-size: 12px; color: var(--muted); }
.win-scores strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 28px; color: var(--accent); }

/* Tutorial & Rulebook Styles */
.help-mode-bar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; padding-right: 40px; }
.help-mode-btn { padding: 9px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--tile); color: var(--muted); font-size: 13px; font-weight: 600; }
.help-mode-btn.is-active { background: var(--cta-grad); color: var(--cta-ink); border-color: transparent; font-weight: 700; }
.tut-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.tut-tab { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--tile); color: var(--muted); font-size: 11px; font-weight: 700; }
.tut-tab.is-done { border-color: #32d583; color: #32d583; }
.tut-tab.is-active { background: var(--cta-grad); color: var(--cta-ink); border-color: transparent; }
.tut-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.mini-replay { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--tile); color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tut-copy { margin: 8px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tut-sandbox { margin-top: 14px; padding: 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tut-feedback { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--accent); text-align: center; }
.tut-feedback.is-complete { color: #32d583; }
.tut-nav { margin-top: 16px; display: flex; justify-content: space-between; gap: 10px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.guide-card { padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--tile); display: flex; flex-direction: column; gap: 4px; }
.guide-card strong { font-size: 13.5px; }
.guide-card p { margin: 0; font-size: 12.5px; line-height: 1.48; color: var(--muted); }

/* Confetti */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-piece { position: absolute; top: -14px; width: 10px; height: 14px; border-radius: 3px; animation: confetti-fall 2.1s ease forwards; }
@keyframes confetti-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(540deg); opacity: 0; } }

@media (max-width: 1100px) {
  .play-layout { grid-template-columns: 1fr; }
  .table-felt { min-height: 480px; }
  .signal-grid { grid-template-columns: repeat(3, 1fr); }
  .setup-split, .guide-grid { grid-template-columns: 1fr; }
}
