:root {
  color-scheme: dark;
  --ui: "Gowun Dodum", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --serif: "Cinzel", "Palatino", "Bodoni 72", "Baskerville", Georgia, serif;
  --korean-serif: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", var(--serif);

  /* Clavis Lacquer, Champagne Rose-Gold & Nacre Sidebar */
  --bg: #080c17;
  --surface: #111727;
  --panel-bg: #0b101d;
  --panel-card: #111728;
  --panel-card-elev: #171f35;
  --panel-well: #090d18;
  --text: #f3eee8;
  --muted: #989fb3;
  --accent: #e9c2ae;
  --accent-bright: #f6dfd2;
  --rose: #e3c2d2;
  --nacre-ice: #c8dce8;
  --line: #232b40;
  --line-strong: #323c56;
  --line-accent: rgba(233, 194, 174, 0.32);
  --line-accent-strong: rgba(233, 194, 174, 0.62);
  --active-bg: rgba(233, 194, 174, 0.14);
  --rule: rgba(233, 194, 174, 0.22);
  --radius-card: 10px;
  --radius-control: 7px;
  --radius-inner: 5px;

  /* Clavis reading table */
  --stage-bg: #0d1322;
  --stage-gold: #f0c8a9;
  --stage-text: #fbf4e6;
  --stage-muted: #c6c4d2;
  --paper: #f7ecd6;
  --ink: #271f29;

  --panel-width: 396px;
  font-family: var(--ui);
}

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

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

body {
  min-width: 300px;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: radial-gradient(ellipse at 32% -12%, rgba(28, 38, 66, 0.36) 0, transparent 48rem), var(--bg);
}

button, select, input { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4, p, ol, ul { margin: 0; }
svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =========================================
   UNIFIED SHELL: LEFT 16:9 STAGE + SIDEBAR
   ========================================= */
.app-shell {
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  position: relative;
}

body[data-panel="collapsed"] {
  --panel-width: 0px;
}

.stage-shell {
  min-width: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}

.stage-frame {
  width: min(100%, calc((100vh - 28px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: none;
  box-shadow: 0 22px 54px #04050cc9;
  background: var(--stage-bg);
}

/* =========================================
   16:9 CLAVIS READING TABLE
   ========================================= */
.stage-canvas {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  container-type: inline-size;
  background: var(--stage-bg) url("../assets/stage/stage-background-corners-close.webp") center / contain no-repeat;
}

.table {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.table-heading {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: clamp(12px, 2.7cqw, 25px) clamp(18px, 14cqw, 220px) 0;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.table-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #f0c8a970;
  background: #172233e6;
  color: var(--stage-gold);
  font-family: var(--korean-serif);
  font-size: clamp(0.68rem, 0.9cqw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.table[data-phase="clarifying"] .stage-badge {
  border-color: #cda2ff99;
  background: #24414be6;
  color: #f0e3ff;
}

.table-heading h2 {
  color: var(--stage-text);
  font-family: var(--korean-serif);
  font-size: clamp(1.08rem, 2.25cqw, 1.54rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px #0b041aad;
}

.progress {
  text-align: right;
  color: var(--stage-gold);
  white-space: nowrap;
}

#progress-count {
  font: 400 clamp(1.1rem, 1.8cqw, 1.45rem)/1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0.025em;
}

#progress-track {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  max-width: 170px;
}

#progress-track i {
  width: 8px;
  height: 8px;
  border: 1px solid #f0c8a978;
  transform: rotate(45deg) scale(0.78);
}

#progress-track .filled {
  background: var(--stage-gold);
  border-color: var(--stage-gold);
  box-shadow: 0 0 6px #f0c8a966;
}

/* =========================================
   ARENA, 1-ROW / 2-ROW FAN & REMOTE POINTER
   ========================================= */
.arena {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  min-height: 0;
  container-type: inline-size;
}

.fan {
  position: absolute;
  inset: 0;
  --card-width: clamp(54px, 9.2cqw, 220px);
  touch-action: manipulation;
}

.table[data-fan-rows="2"] .fan {
  --card-width: clamp(42px, 6.2cqw, 145px);
}

.table[data-phase="waiting"] .fan {
  --card-width: clamp(78px, 10.8cqw, 240px);
}

.fan-card {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: var(--card-width);
  aspect-ratio: 1024 / 1751;
  transform: translate(-50%, -50%);
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 5px;
  background: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.fan-card:disabled { pointer-events: none; }
.fan-card.extracted { visibility: hidden; pointer-events: none; }
.fan-card:focus-visible { z-index: 140 !important; outline-offset: 2px; }
.fan[data-motion] .fan-card { will-change: transform, opacity; }

.card-back,
.card-front {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.card-back {
  display: grid;
  place-items: center;
  pointer-events: none;
  background: url("../card/master/back_card.webp") center / 100% 100% no-repeat, radial-gradient(ellipse at center, #263347, #0a121d);
  border: 1px solid #e6c274;
  color: var(--stage-gold);
  box-shadow: -2px 4px 12px #070312b8, 0 0 10px #9666ff24;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1), filter 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card-back > span { visibility: hidden; }
.card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, #ffeec312, transparent 33%, transparent 65%, #12082648);
}

.table[data-phase="waiting"] .fan-card .card-back {
  border-color: #d9b25e;
  border-bottom-color: #f0c8a9;
  border-left-color: #caa052;
  box-shadow: -1px 1px 0 #130829;
}

.table[data-phase="waiting"] .fan-card:first-child .card-back {
  box-shadow: -7px 14px 24px #05020ee8, -2px 6px 11px #090318cc;
}

.table[data-phase="waiting"] .fan-card:last-child .card-back {
  border-color: #f0c8a9;
  box-shadow: -1px 2px 4px #120726b8, 0 0 22px #f0c8a936;
}

.table[data-phase="drawing"] .fan-card:not(.extracted) .card-back {
  filter: brightness(0.72) saturate(0.76);
}

@media (hover: hover) {
  .fan-card:enabled:hover .card-back {
    transform: translateY(-16%) scale(1.03);
    border-color: #fff1bc;
    box-shadow:
      -3px 10px 20px #070312e0,
      0 0 16px #f0c8a988,
      0 0 28px #b78aff5e;
  }
}

.fan-card:enabled:focus-visible .card-back,
.fan-card.hand-hover .card-back,
.fan-card.remote-hover .card-back {
  transform: translateY(-16%) scale(1.03);
  border-color: #fff1bc;
  box-shadow:
    -3px 10px 20px #070312e0,
    0 0 16px #f0c8a988,
    0 0 28px #b78aff5e;
}

/* Synchronized Starlight Pointer on Broadcast Screen */
.remote-pointer {
  position: absolute;
  z-index: 200;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff5d4;
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 10px #f0c8a9, 0 0 18px #c39bff;
  background: radial-gradient(circle, #f0c8a94d 0%, #9b6cff24 46%, transparent 72%);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.75);
  transition: left 30ms linear, top 30ms linear, opacity 160ms ease, transform 160ms ease;
}

.remote-pointer[data-active="true"] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.fan-hover-indicator {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 3.2cqw, 26px);
  z-index: 160;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-family: var(--korean-serif);
  font-size: clamp(0.88rem, 1.5cqw, 1.18rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  color: rgba(255, 252, 255, 0.72);
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.36),
    0 0 16px rgba(236, 228, 255, 0.22);
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.97);
  transition:
    opacity 0.2s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.fan-hover-indicator::before {
  content: "";
  position: absolute;
  inset: -10px -28px;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 252, 255, 0.14) 0%,
    rgba(235, 226, 255, 0.06) 44%,
    transparent 74%
  );
  pointer-events: none;
}

.fan-hover-indicator[data-active="true"] {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.table[data-fan-rows="2"] .fan-hover-indicator {
  bottom: clamp(4px, 1.1cqw, 10px);
  font-size: clamp(0.76rem, 1.18cqw, 0.96rem);
}

.table:not([data-phase="ready"]):not([data-phase="clarifying"]) .fan-hover-indicator {
  opacity: 0 !important;
}

.fan-hover-num {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-size: 1.08em;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.04em;
  margin-right: 0.06em;
}

.fan-hover-row {
  color: rgba(244, 236, 255, 0.62);
  letter-spacing: 0.08em;
  margin-right: 0.14em;
}

.fan-hover-total {
  font-size: 0.84em;
  color: rgba(235, 228, 250, 0.48);
  letter-spacing: 0.06em;
  margin-left: 0.2em;
}

/* =========================================
   SPREAD TRAY & COMPLETE EXPANSION (BOTH VIEWS)
   ========================================= */
.spread-tray {
  flex: 0 0 28%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 22px 8px;
}

.slots-scroll {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.slots {
  --slot-width: clamp(38px, 4.4cqw, 64px);
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  width: max-content;
  gap: 10px clamp(10px, 1.8cqw, 26px);
  margin: 0 auto;
  padding: 2px 4px;
}

.slot-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.slot-cluster {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.slot {
  width: var(--slot-width);
  min-width: 0;
  text-align: center;
}

.slot.slot-detail { width: calc(var(--slot-width) * 0.9); }
.slot.slot-clarifier { width: calc(var(--slot-width) * 0.86); }

.slot-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1024 / 1751;
  border-radius: 5px;
  border: 1px solid #9677c852;
  background: #172236a6;
  color: #c6c4d2;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.slot-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid #f0c8a933;
  border-radius: 2px;
  pointer-events: none;
}

.slot-frame > span {
  font: 400 1.25rem/1 var(--serif);
}

.slot.next .slot-frame {
  border-color: var(--stage-gold);
  color: var(--stage-gold);
  background: #311b5d;
  box-shadow: 0 0 18px #f0c8a938;
}

.slot.slot-clarifier.slot-placeholder .slot-frame {
  border-style: dashed;
  border-color: var(--rose);
  color: #f3e4ff;
  background: #2f1a57;
  animation: pulseSlot 1.3s ease-in-out infinite;
}

@keyframes pulseSlot {
  0%, 100% { box-shadow: 0 0 0 0 #dbb5c62e; }
  50% { box-shadow: 0 0 16px 2px #dbb5c659; }
}

.slot.has-card .slot-frame {
  border: none;
  background: transparent;
  box-shadow: none;
}

.slot.has-card .slot-frame::before { display: none; }

.slot-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  color: var(--stage-muted);
  font-family: var(--korean-serif);
  font-size: clamp(0.68rem, 1.05cqw, 0.9rem);
  line-height: 1.3;
  letter-spacing: 0.03em;
  word-break: keep-all;
}

.slot.next .slot-name { color: var(--stage-gold); font-weight: 600; }

.slot-mini-tag {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #f0c8a952;
  color: var(--stage-gold);
  background: #192639;
}

.slot-clarifier .slot-mini-tag {
  border-color: #dbb5c666;
  color: #eadfff;
}

.slot.has-card .slot-frame {
  perspective: 780px;
}

.slot-card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: inherit;
  background: none;
  box-shadow: 0 6px 16px #050210bd, 0 0 12px #8e5cff22;
  transform: translateY(var(--ty, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.slot-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at var(--mx, 50%) var(--my, 50%), #fff8de70, #f0c8a92b 35%, transparent 68%);
  mix-blend-mode: screen;
  transition: opacity 0.18s ease;
}

.slot-card.is-tilting {
  transition: transform 0.08s ease-out, box-shadow 0.18s ease;
  box-shadow: 0 14px 28px #050210e6, 0 0 22px #f0c8a952;
}

.slot-card.is-tilting::after {
  opacity: 1;
}

@media (hover: hover) {
  .slot-card:not(.is-tilting):hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px #050210de, 0 0 16px #f0c8a940;
  }
}

.slot.is-facedown .slot-card {
  box-shadow: 0 8px 18px #050210cf, 0 0 14px #9d74ff38;
}

.slot-flip-badge {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #f0c8a99c;
  background: rgba(16, 9, 34, 0.88);
  color: #f9e4ab;
  font-size: clamp(0.56rem, 0.82cqw, 0.7rem);
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px #050210cc;
}

.slot-card.is-facedown:hover .slot-flip-badge {
  border-color: #fff1c2;
  color: #fff6db;
}

.reveal-all-button {
  flex: 1 1 100%;
  border: 1px solid rgba(200, 220, 232, 0.36);
  background: #1a2d3d;
  color: #f3ece4;
}

.reveal-all-button:enabled:hover {
  border-color: var(--nacre-ice);
  background: #233b50;
  color: #ffffff;
  transform: translateY(-1px);
}

.reveal-all-button:disabled { opacity: 0.55; }

.reveal-mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: var(--panel-well);
  padding: 3px;
  border: 1px solid rgba(233, 194, 174, 0.15);
  border-radius: var(--radius-control);
}

.reveal-mode-btn {
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-inner);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 560;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.reveal-mode-btn:enabled:hover {
  color: var(--text);
  background: rgba(233, 194, 174, 0.07);
}

.reveal-mode-btn.is-active {
  background: var(--active-bg);
  border-color: rgba(233, 194, 174, 0.44);
  color: var(--accent-bright);
  font-weight: 660;
}

.reveal-mode-btn:disabled { opacity: 0.55; }

.settings-card:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(233, 194, 174, 0.15);
  background: var(--panel-well);
  color: #dcd6d0;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 580;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.settings-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-toggle-icon {
  flex: none;
  width: 14px;
  height: 14px;
  opacity: 0.85;
}

.settings-toggle-state {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(233, 194, 174, 0.16);
  background: var(--panel-card);
  color: var(--muted);
}

.settings-toggle-btn:enabled:hover {
  border-color: var(--line-accent);
  background: var(--panel-card-elev);
  color: var(--text);
}

.settings-toggle-btn.is-on {
  border-color: var(--line-accent-strong);
  background: var(--active-bg);
  color: var(--accent-bright);
  box-shadow: none;
}

.settings-toggle-btn.is-on .settings-toggle-state {
  border-color: rgba(233, 194, 174, 0.45);
  background: rgba(233, 194, 174, 0.16);
  color: var(--accent-bright);
}

.settings-toggle-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.guide-card.is-facedown {
  border-left: 3px solid var(--nacre-ice);
  background: rgba(14, 20, 35, 0.92);
}

.guide-facedown-note {
  font-size: 0.75rem;
  line-height: 1.48;
  color: #c2c8d8;
  word-break: keep-all;
}

/* Complete phase expands drawn spread identically on Operator & Audience */
.table[data-phase="complete"] {
  flex: 0 0 auto;
  min-height: 0;
  background: transparent;
}

.table[data-phase="complete"] .arena {
  display: none;
}

.table[data-phase="complete"] .table-heading {
  padding: clamp(12px, 2.7cqw, 25px) clamp(18px, 14cqw, 220px) 0;
}

.table[data-phase="complete"] + .spread-tray {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 24px 16px;
}

.table[data-phase="complete"] + .spread-tray .slots-scroll {
  justify-content: center;
  overflow-y: auto;
}

.table[data-phase="complete"] + .spread-tray .slots {
  width: auto;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  --slot-width: clamp(64px, 9.2cqw, 140px);
  gap: 10px clamp(10px, 1.4cqw, 20px);
  animation: display-spread 0.3s cubic-bezier(0.15, 0.7, 0.25, 1) both;
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="1"] {
  --slot-width: clamp(132px, 20.5cqw, 296px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="2"] {
  --slot-width: clamp(124px, 19.5cqw, 282px);
  gap: 16px clamp(22px, 3.6cqw, 52px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="3"] {
  --slot-width: clamp(116px, 18.6cqw, 268px);
  gap: 14px clamp(18px, 3cqw, 44px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="4"] {
  --slot-width: clamp(108px, 17.5cqw, 250px);
  gap: 14px clamp(16px, 2.4cqw, 34px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="5"] {
  --slot-width: clamp(94px, 14.8cqw, 212px);
  gap: 12px clamp(14px, 2cqw, 28px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="6"] {
  --slot-width: clamp(82px, 12.6cqw, 182px);
  gap: 12px clamp(12px, 1.6cqw, 22px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-density="7"] {
  --slot-width: clamp(72px, 10.4cqw, 152px);
  gap: 10px clamp(10px, 1.3cqw, 18px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-spread="choice"] {
  width: max-content;
  display: grid;
  grid-template-columns: repeat(3, auto);
  align-items: center;
  justify-content: center;
  --slot-width: clamp(70px, 9.2cqw, 140px);
  gap: 10px clamp(14px, 2.2cqw, 32px);
}

.table[data-phase="complete"] + .spread-tray .slots[data-spread="choice"] .slot-group:first-child {
  grid-row: span 2;
}

.table[data-phase="complete"] + .spread-tray .slot-name {
  margin-top: 16px;
  gap: 6px;
  font-family: var(--korean-serif);
  font-size: clamp(0.82rem, 1.3cqw, 1.08rem);
  letter-spacing: 0.04em;
  color: #f6effe;
  font-weight: 700;
}

@keyframes display-spread {
  from { opacity: 1; transform: translateY(8px) scale(0.988); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================
   CARD FRONT ARTWORK & PIPS
   ========================================= */
.card-front {
  container-type: inline-size;
  aspect-ratio: 1024 / 1751;
  padding: 4.5%;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #d5ae68;
}

.card-front.reversed { transform: rotate(180deg); }
.card-front.has-original { padding: 0; border-color: #f0c8a966; background: #140b29; }
.original-art { display: block; width: 100%; height: 100%; object-fit: contain; }

.face-print {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 6.25fr 1.1fr;
  align-items: stretch;
  height: 100%;
  border: 1px solid #59397a;
  overflow: hidden;
  background: repeating-linear-gradient(101deg, transparent 0 2px, #351b5a08 2px 3px), #f6e9cf;
}

.face-rank {
  display: grid;
  place-items: center;
  font: 700 10cqw/1 var(--serif);
  letter-spacing: 0.07em;
}

.face-art {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-block: 1px solid #59397a;
  background: radial-gradient(ellipse at center, #263347, #160b2e);
}

.face-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
}

.face-art::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 3%;
  border: 1px solid #ffe4ad5c;
  pointer-events: none;
}

.narrow-art::before {
  content: "";
  position: absolute;
  inset: -5%;
  background: var(--card-image) center / cover;
  filter: blur(8px) brightness(0.28);
}

.narrow-art img {
  position: relative;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  object-fit: contain;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.pip-art img { filter: brightness(0.45) saturate(0.7); }

.face-pips {
  position: absolute;
  inset: 0;
  padding: 11% 8%;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  background: radial-gradient(ellipse at center, #180d31a6, #110824b3);
}

.pip-row { display: flex; align-items: center; justify-content: center; gap: 7%; }
.pip-row i {
  display: block;
  width: min(22%, 32cqw);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: var(--pip-image) center / 170% auto;
  box-shadow: 0 1px 4px #080416dc;
}
.pip-row:has(i:nth-child(4)) { gap: 4%; }

.face-name {
  display: grid;
  place-items: center;
  padding: 0 3%;
  text-align: center;
  font: 700 7.6cqw/1 var(--serif);
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.face-backup {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--stage-gold);
  font: 500 42cqw/1 var(--serif);
}

/* =========================================
   RIGHT COLLAPSIBLE DARK-STUDIO SIDEBAR
   ========================================= */
.edge-panel-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1px solid var(--line-accent);
  border-right: none;
  border-radius: var(--radius-card) 0 0 var(--radius-card);
  background: rgba(13, 19, 34, 0.94);
  color: var(--accent);
  box-shadow: -4px 6px 22px #04060cb8;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.edge-panel-tab:hover {
  background: var(--panel-card-elev);
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.edge-text {
  writing-mode: vertical-rl;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

body[data-panel="open"] .edge-panel-tab {
  opacity: 0;
  pointer-events: none;
  transform: translate(16px, -50%);
}

.streamer-panel {
  width: var(--panel-width);
  min-width: 0;
  border-left: 1px solid rgba(233, 194, 174, 0.18);
  background: linear-gradient(180deg, #0d1323 0%, #0a0f1c 100%);
  box-shadow: inset 1px 0 0 rgba(255, 245, 238, 0.04);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  transition: width 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

body[data-panel="collapsed"] .streamer-panel {
  border-left: none;
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  min-width: min(396px, 92vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(233, 194, 174, 0.16);
  background: linear-gradient(180deg, rgba(19, 26, 44, 0.96), rgba(13, 19, 34, 0.96));
  flex-shrink: 0;
}

.panel-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.wordmark {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #f6efe7;
  font: 650 0.92rem/1 var(--serif);
  letter-spacing: 0.16em;
}

.wordmark-star {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-accent);
  background: radial-gradient(circle, rgba(233, 194, 174, 0.18), rgba(14, 20, 36, 0.95));
  box-shadow: inset 0 0 0 2px rgba(11, 16, 29, 0.8), 0 0 10px rgba(233, 194, 174, 0.14);
  color: var(--accent);
  border-radius: 50%;
  font-size: 13px;
  letter-spacing: 0;
}

.version-pill {
  font-family: var(--ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 1px solid #363f59;
  background: #1a1f30;
  border-radius: 999px;
  padding: 2px 7px;
}

.off-air-badge {
  font-size: 0.66rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #3a4461;
  background: #1a2031;
  color: #b5c0de;
  white-space: nowrap;
}

.panel-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.panel-icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(233, 194, 174, 0.16);
  border-radius: var(--radius-control);
  background: rgba(17, 23, 40, 0.92);
  color: #cfc9c5;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.panel-icon-btn svg {
  width: 17px;
  height: 17px;
}

.panel-icon-btn:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
  transform: translateY(-0.5px);
}

.panel-view-broadcast-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(126, 214, 158, 0.45);
  background: rgba(20, 40, 36, 0.9);
  color: #bcefd0;
  font-family: inherit;
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}

.panel-view-broadcast-btn[hidden] {
  display: none;
}

.panel-view-broadcast-btn:hover {
  border-color: rgba(126, 214, 158, 0.76);
  background: rgba(26, 54, 48, 0.95);
  color: #e4ffef;
  transform: translateY(-0.5px);
}

.panel-broadcast-btn .status-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #616d8a;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.panel-broadcast-btn.is-connected {
  border-color: rgba(126, 214, 158, 0.5);
  background: rgba(20, 40, 36, 0.9);
  color: #bcefd0;
}

.panel-broadcast-btn.is-connected .status-dot {
  background: #7ed69e;
  box-shadow: 0 0 7px rgba(126, 214, 158, 0.8);
}

.panel-broadcast-btn.is-open,
.panel-audio-btn.is-open,
.panel-settings-btn.is-open {
  border-color: var(--line-accent-strong);
  background: var(--active-bg);
  color: var(--accent-bright);
  box-shadow: inset 0 1px 0 rgba(255, 245, 238, 0.08);
}

.panel-settings-btn {
  position: relative;
}

.panel-settings-btn .settings-dot {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(233, 194, 174, 0.8);
}

.panel-settings-btn.has-active-option .settings-dot {
  display: block;
}

.panel-audio-btn.is-muted {
  color: var(--muted);
}

.panel-audio-btn.is-muted .spk-waves {
  display: none;
}

.panel-audio-btn:not(.is-muted) .spk-mute {
  display: none;
}

.fallback-close-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #2e364f;
  border-radius: 4px;
  background: #161b29;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
}

.fallback-close-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-scroll {
  min-width: min(396px, 92vw);
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233, 194, 174, 0.24) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(233, 194, 174, 0.22);
  border-radius: 999px;
}

.panel-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(233, 194, 174, 0.42);
}

.panel-card {
  background: linear-gradient(180deg, rgba(21, 28, 46, 0.92), rgba(14, 19, 34, 0.96));
  border: 1px solid rgba(233, 194, 174, 0.15);
  border-radius: var(--radius-card);
  padding: 12px 13px;
  box-shadow: inset 0 1px 0 rgba(255, 244, 236, 0.045), 0 6px 18px rgba(4, 6, 14, 0.32);
}

.audio-card,
.settings-card,
.broadcast-drawer-card {
  border-top-color: rgba(233, 194, 174, 0.34);
}

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

.panel-section-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.tray-status-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.22);
  color: #e2dcd6;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Action Controls inside Sidebar */
.action-card {
  border-color: rgba(233, 194, 174, 0.24);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-status {
  font-size: 0.79rem;
  line-height: 1.45;
  min-height: calc(1.45em * 2);
  display: flex;
  align-items: center;
  color: #ddd6cf;
  word-break: keep-all;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.shuffle-button,
.reset-button,
.reveal-all-button,
.clarify-button,
.clarify-cancel-button {
  flex: 1 1 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-control);
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.16s, box-shadow 0.16s, transform 0.16s, border-color 0.16s, color 0.16s;
}

.shuffle-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #121520;
  box-shadow: none;
}

.shuffle-button:enabled:hover {
  border-color: #f4d8c8;
  background: #f4d8c8;
  box-shadow: none;
  transform: translateY(-1px);
}

.shuffle-button:enabled:active { transform: translateY(1px); }
.shuffle-button:disabled { opacity: 0.55; }

.reset-button {
  border: 1px solid var(--line-strong);
  background: rgba(18, 25, 42, 0.92);
  color: #dcd6d0;
}

.reset-button:enabled:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
  transform: translateY(-1px);
}

.reset-button:enabled:active { transform: translateY(1px); }
.reset-button:disabled { opacity: 0.42; }

.quick-action-wrap {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(233, 194, 174, 0.14);
}

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

.quick-action-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbc5c0;
  letter-spacing: 0.02em;
}

.quick-action-tip {
  font-size: 0.67rem;
  color: var(--muted);
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(233, 194, 174, 0.16);
  background: var(--panel-well);
  color: #e2dcd6;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.15;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.quick-action-btn kbd {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1px solid rgba(233, 194, 174, 0.28);
  background: #161e33;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
}

.quick-action-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action-btn:enabled:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: #ffffff;
  transform: translateY(-1px);
}

.quick-action-btn:enabled:active {
  transform: translateY(1px);
}

.quick-action-btn.is-active {
  border-color: var(--accent);
  background: var(--active-bg);
  color: var(--accent-bright);
  box-shadow: 0 0 12px rgba(233, 194, 174, 0.16);
}

.quick-action-btn.is-active kbd {
  border-color: var(--accent);
  background: var(--accent);
  color: #16111e;
}

.quick-action-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.quick-action-btn.is-locked-disabled {
  opacity: 0.34;
  border-color: #252b42;
}

.quick-action-btn.is-locked-disabled span {
  text-decoration: line-through;
}

body:not([data-view="audience"]) .table[data-phase="waiting"] .arena {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.arena.is-deck-dragging,
body:not([data-view="audience"]) .table[data-phase="waiting"] .arena.is-deck-dragging {
  cursor: grabbing;
}

.manual-shuffle-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 2.8cqw, 22px);
  transform: translateX(-50%);
  z-index: 160;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid #f0c8a93d;
  background: rgba(16, 9, 34, 0.72);
  color: #e6dcc7cc;
  font-size: clamp(0.72rem, 1.05cqw, 0.84rem);
  font-weight: 550;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

body:has(.table:is([data-phase="ready"], [data-phase="drawing"])) .shuffle-button {
  background: var(--panel-card-elev);
  border-color: var(--line-accent);
  color: var(--accent-bright);
  box-shadow: none;
}

.shuffle-button.is-stop-armed {
  border-color: #d65466;
  background: #c23f53;
  color: #fff7f5;
  box-shadow: none;
}

.shuffle-button.is-stop-armed:enabled:hover {
  border-color: #e46c7d;
  background: #d44d61;
  transform: translateY(-1px);
  box-shadow: none;
}

.shuffle-button.is-stop-armed:enabled:active {
  transform: translateY(1px);
}

.stop-shuffle-banner {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 3cqw, 26px);
  transform: translateX(-50%);
  z-index: 165;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #ff9c7acc;
  border-radius: 999px;
  background: rgba(42, 12, 28, 0.92);
  color: #fff4e8;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 24px #060212cc, 0 0 18px #ff5a6e4d;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.stop-shuffle-banner:hover {
  border-color: var(--stage-gold);
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 10px 26px #060212e0, 0 0 22px #ff5a6e7a;
}

.stop-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6e7f;
  box-shadow: 0 0 8px #ff6e7f;
  animation: stopDotPulse 0.9s ease-in-out infinite;
}

@keyframes stopDotPulse {
  0%, 100% { transform: scale(0.86); opacity: 0.72; }
  50% { transform: scale(1.18); opacity: 1; }
}

.clarify-button {
  flex: 1 1 100%;
  border: 1px solid rgba(227, 194, 210, 0.38);
  background: #221d33;
  color: #f8ece6;
}

.clarify-button:enabled:hover {
  border-color: var(--rose);
  background: #2c2540;
  color: #fff6f2;
  transform: translateY(-1px);
}

.clarify-button:disabled { opacity: 0.55; }

.clarify-cancel-button {
  border: 1px solid var(--line-strong);
  background: rgba(18, 25, 42, 0.92);
  color: #dcd6d0;
}

.clarify-cancel-button:enabled:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
}

/* Setup Card inside Sidebar */
.sidebar-details {
  display: flex;
  flex-direction: column;
}

.sidebar-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: var(--radius-control);
  cursor: pointer;
  user-select: none;
  transition: background 0.16s ease;
}
.sidebar-summary::-webkit-details-marker { display: none; }
.sidebar-summary:hover {
  background: rgba(233, 194, 174, 0.06);
}
.sidebar-summary .panel-section-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.sidebar-summary-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-summary-hint {
  font-size: 0.72rem;
  color: var(--muted);
  transition: color 0.16s ease;
}
.sidebar-summary:hover .sidebar-summary-hint {
  color: var(--text);
}

.summary-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-accent);
  background: rgba(233, 194, 174, 0.08);
  color: var(--accent);
  font-size: 0.71rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.summary-chevron-arrow {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transition: transform 0.2s ease;
}
.sidebar-summary:hover .summary-chevron {
  border-color: var(--line-accent-strong);
  background: var(--active-bg);
  color: var(--accent-bright);
  box-shadow: none;
}
.sidebar-details[open] .summary-toggle-closed {
  display: none;
}
.sidebar-details:not([open]) .summary-toggle-open {
  display: none;
}
.sidebar-details[open] .summary-chevron-arrow {
  transform: translateY(1.5px) rotate(-135deg);
}
.sidebar-details:not([open]) .summary-chevron-arrow {
  transform: translateY(-1.5px) rotate(45deg);
}

.setup-fields {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(233, 194, 174, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.control-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.deck-mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--panel-well);
  padding: 3px;
  border: 1px solid rgba(233, 194, 174, 0.15);
  border-radius: var(--radius-control);
}

.deck-mode-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-inner);
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 560;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.deck-mode-btn:enabled:hover {
  color: var(--text);
  background: rgba(233, 194, 174, 0.07);
}

.deck-mode-btn.is-active {
  background: var(--active-bg);
  border-color: rgba(233, 194, 174, 0.44);
  color: var(--accent-bright);
  font-weight: 660;
}

.deck-mode-btn:disabled { opacity: 0.55; }

.rec-badge {
  font-size: 0.58rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(233, 194, 174, 0.14);
  border: 1px solid rgba(233, 194, 174, 0.36);
  color: var(--accent-bright);
  font-weight: 650;
}

.question-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cut-row {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 6px;
  min-width: 0;
}

.setup-field select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 6px 24px 6px 9px;
  border: 1px solid rgba(233, 194, 174, 0.18);
  border-radius: var(--radius-control);
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) calc(100% - 13px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) calc(100% - 8px) 50% / 5px 5px no-repeat,
    var(--panel-well);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 34px;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.setup-field select:enabled:hover {
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.setup-field select:disabled { opacity: 0.58; cursor: default; }
.setup-field option { color: var(--text); background: var(--surface); }

.custom-mode-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: rgba(18, 25, 42, 0.92);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 620;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.custom-mode-btn:enabled:hover {
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.custom-mode-btn[aria-pressed="true"] {
  background: var(--active-bg);
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.custom-mode-btn:disabled { opacity: 0.55; }

.custom-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px;
  border-radius: var(--radius-control);
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.16);
}

.custom-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.custom-field label {
  font-size: 0.7rem;
  color: var(--muted);
}

.custom-field select,
.custom-field input {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid rgba(233, 194, 174, 0.18);
  border-radius: var(--radius-inner);
  background: #070b14;
  color: var(--text);
  font-size: 0.8rem;
}

.custom-field input::placeholder { color: #6c748d; }

.custom-pos-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.custom-pos-hint {
  font-size: 0.64rem;
  color: var(--muted);
}

.custom-positions-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-pos-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.custom-pos-num {
  font-size: 0.69rem;
  font-weight: 650;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.custom-pos-input {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(233, 194, 174, 0.18);
  border-radius: var(--radius-inner);
  background: #070b14;
  color: var(--text);
  font-size: 0.77rem;
}

.custom-pos-clarify {
  min-height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--line-strong);
  background: var(--panel-card);
  color: #b4bacb;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.custom-pos-clarify:enabled:hover {
  border-color: var(--line-accent);
  color: var(--text);
}

.custom-pos-clarify.is-on {
  border-color: var(--line-accent-strong);
  background: var(--active-bg);
  color: var(--accent-bright);
}

.custom-pos-clarify:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.custom-actions {
  display: flex;
  gap: 6px;
}

.custom-save-btn {
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-accent);
  background: var(--active-bg);
  color: var(--accent-bright);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.custom-save-btn:enabled:hover {
  border-color: var(--line-accent-strong);
  background: rgba(233, 194, 174, 0.22);
  color: #ffffff;
}

.custom-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.saved-custom-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(233, 194, 174, 0.14);
}

.saved-custom-wrap[hidden] {
  display: none;
}

.saved-custom-label {
  font-size: 0.69rem;
  color: var(--muted);
}

.saved-custom-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.saved-custom-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-card);
  overflow: hidden;
}

.saved-custom-chip.is-active {
  border-color: var(--line-accent-strong);
  background: var(--active-bg);
}

.saved-custom-apply {
  padding: 3px 8px;
  border: 0;
  background: transparent;
  color: #e4ded8;
  font-family: inherit;
  font-size: 0.71rem;
  cursor: pointer;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-custom-chip.is-active .saved-custom-apply {
  color: var(--accent-bright);
  font-weight: 620;
}

.saved-custom-apply:enabled:hover {
  color: var(--accent-bright);
}

.saved-custom-del {
  padding: 3px 7px 3px 4px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1;
  cursor: pointer;
}

.saved-custom-del:enabled:hover {
  color: #ff9aa7;
  background: rgba(255, 130, 148, 0.14);
}

.custom-note {
  font-size: 0.71rem;
  color: var(--rose);
  line-height: 1.4;
  word-break: keep-all;
}

.sidebar-spread-detail {
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

/* Broadcast Card */
.broadcast-drawer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.broadcast-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.broadcast-obs-block,
.broadcast-win-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.broadcast-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.broadcast-block-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: #e4ded8;
}

.broadcast-rec-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-accent);
  background: rgba(233, 194, 174, 0.14);
  color: var(--accent-bright);
  white-space: nowrap;
}

.broadcast-url-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.broadcast-url-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(233, 194, 174, 0.18);
  background: var(--panel-well);
  color: #d0cac6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.69rem;
  outline: none;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.broadcast-url-input:focus {
  border-color: var(--line-accent-strong);
  color: var(--text);
}

.broadcast-copy-btn {
  flex-shrink: 0;
  padding: 0 10px;
}

.broadcast-status {
  font-size: 0.71rem;
  color: var(--muted);
  text-align: right;
}

.broadcast-status.is-connected {
  color: #9ce6a8;
  font-weight: 600;
}

.broadcast-actions {
  display: flex;
  gap: 6px;
}

.broadcast-button {
  flex: 1;
  min-height: 35px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-accent);
  border-radius: var(--radius-control);
  padding: 5px 10px;
  color: var(--accent-bright);
  background: var(--active-bg);
  font-size: 0.8rem;
  font-weight: 650;
  transition: all 0.16s ease;
}

.broadcast-button:enabled:hover {
  border-color: var(--line-accent-strong);
  background: rgba(233, 194, 174, 0.22);
  color: #ffffff;
}

.broadcast-close-btn {
  min-height: 35px;
  padding: 0 11px;
  border: 1px solid rgba(226, 116, 116, 0.45);
  border-radius: var(--radius-control);
  background: rgba(44, 22, 28, 0.92);
  color: #f4b2b2;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.broadcast-close-btn:enabled:hover {
  border-color: #f28b8b;
  background: #3a1d26;
  color: #ffd6d6;
}

.broadcast-close-btn:disabled {
  opacity: 0.4;
  border-color: var(--line);
  background: var(--panel-well);
  color: var(--muted);
  cursor: not-allowed;
}

.broadcast-focus-btn {
  min-height: 35px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--panel-card-elev);
  color: var(--text);
  font-size: 0.76rem;
  white-space: nowrap;
}

.broadcast-focus-btn:hover {
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.broadcast-sub-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.broadcast-sub-btn {
  min-height: 30px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(233, 194, 174, 0.18);
  border-radius: var(--radius-control);
  background: var(--panel-well);
  color: #dcd6d0;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.broadcast-sub-btn:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
}

.broadcast-sub-btn.is-copied {
  border-color: rgba(126, 214, 158, 0.55);
  background: rgba(20, 40, 36, 0.9);
  color: #bcefd0;
}

.broadcast-sub-btn.is-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 194, 174, 0.24);
  color: var(--accent-bright);
}

.broadcast-hint {
  margin-top: 2px;
  font-size: 0.71rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

/* Combined Audio & BGM Card */
.audio-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-sfx-row,
.bgm-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle,
.bgm-toggle-btn {
  min-height: 30px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid rgba(233, 194, 174, 0.16);
  border-radius: var(--radius-control);
  background: var(--panel-well);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 620;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.sound-toggle:hover,
.bgm-toggle-btn:hover {
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.sound-toggle[aria-pressed="true"],
.bgm-toggle-btn[aria-pressed="true"] {
  background: var(--active-bg);
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

:is(.sound-toggle, .bgm-toggle-btn)[aria-pressed="false"] .sound-on,
:is(.sound-toggle, .bgm-toggle-btn)[aria-pressed="true"] .sound-off {
  display: none;
}

.volume-slider {
  flex: 1;
  width: auto;
  min-width: 60px;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.volume-label {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 32px;
  text-align: right;
}

.audio-divider {
  height: 1px;
  background: rgba(233, 194, 174, 0.14);
}

.bgm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bgm-track-name {
  font-size: 0.71rem;
  color: var(--muted);
  max-width: 215px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
}

.bgm-track-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--panel-well);
  padding: 3px;
  border: 1px solid rgba(233, 194, 174, 0.15);
  border-radius: var(--radius-control);
}

.bgm-track-btn {
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-inner);
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 560;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.bgm-track-btn:hover {
  color: var(--text);
  background: rgba(233, 194, 174, 0.07);
}

.bgm-track-btn.is-active {
  background: var(--active-bg);
  border-color: rgba(233, 194, 174, 0.44);
  color: var(--accent-bright);
  font-weight: 660;
}

.bgm-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bgm-mini-btn {
  min-height: 28px;
  padding: 2px 9px;
  border: 1px solid rgba(233, 194, 174, 0.16);
  border-radius: var(--radius-inner);
  background: var(--panel-well);
  color: var(--muted);
  font-size: 0.72rem;
  transition: all 0.16s ease;
}

.bgm-mini-btn:hover {
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
}

.bgm-mini-btn.is-active {
  background: var(--active-bg);
  border-color: var(--line-accent-strong);
  color: var(--accent-bright);
  font-weight: 640;
}

/* Mode Banner & Balance Summary */
.mode-banner-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: linear-gradient(180deg, rgba(21, 28, 46, 0.92), rgba(14, 19, 34, 0.96));
  border-color: rgba(233, 194, 174, 0.18);
}

.mode-banner-card.is-custom {
  border-color: rgba(227, 194, 210, 0.44);
  background: linear-gradient(180deg, rgba(31, 25, 42, 0.92), rgba(16, 19, 34, 0.96));
}

.mode-banner-title {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--text);
}

.mode-banner-desc {
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-headline {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #f4e6dd;
  font-weight: 600;
  word-break: keep-all;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.summary-chip {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.18);
  color: #cbc5c0;
}

.element-bars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 10px;
}

.el-bar-item { display: flex; flex-direction: column; gap: 3px; }
.el-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: var(--muted);
}
.el-bar-track {
  height: 5px;
  border-radius: 999px;
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.1);
  overflow: hidden;
}
.el-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--rose));
}

.summary-tip {
  font-size: 0.74rem;
  line-height: 1.48;
  color: #d9d3ce;
  padding-top: 6px;
  border-top: 1px solid rgba(233, 194, 174, 0.14);
  word-break: keep-all;
}

/* Guide Cards */
.guide-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-count { font-size: 0.74rem; color: var(--muted); }
.guide-list { display: flex; flex-direction: column; gap: 9px; }

.guide-empty {
  padding: 16px 13px;
  border: 1px dashed rgba(233, 194, 174, 0.22);
  border-radius: var(--radius-card);
  background: rgba(9, 13, 24, 0.55);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
  word-break: keep-all;
}

.guide-card {
  background: linear-gradient(180deg, rgba(21, 28, 46, 0.92), rgba(14, 19, 34, 0.96));
  border: 1px solid rgba(233, 194, 174, 0.14);
  border-radius: var(--radius-card);
  padding: 11px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 244, 236, 0.04), 0 4px 14px rgba(4, 6, 14, 0.26);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.guide-card.is-detail { border-left: 3px solid var(--accent); }
.guide-card.is-clarifier { border-left: 3px solid var(--rose); }

.guide-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.guide-pos-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.guide-pos-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-inner);
  background: rgba(233, 194, 174, 0.14);
  border: 1px solid rgba(233, 194, 174, 0.24);
  color: var(--accent-bright);
}

.guide-dir-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-inner);
  border: 1px solid rgba(233, 194, 174, 0.18);
  color: #d7d1cc;
}

.guide-dir-badge.is-reversed {
  border-color: rgba(227, 194, 210, 0.45);
  color: #f4dce7;
  background: rgba(227, 194, 210, 0.13);
}

.guide-el-badge { font-size: 0.68rem; color: var(--muted); }
.guide-card-names {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.guide-card-title { font-family: var(--korean-serif); font-size: 0.96rem; font-weight: 700; letter-spacing: 0.01em; color: #f7f1ea; }
.guide-card-top .guide-card-title { margin-top: 3px; }
.guide-card-eng { font-size: 0.72rem; font-family: var(--serif); color: var(--muted); }
.guide-card-actions { display: flex; gap: 5px; flex-shrink: 0; }

.guide-mini-btn {
  min-height: 25px;
  padding: 2px 8px;
  border: 1px solid rgba(233, 194, 174, 0.2);
  border-radius: var(--radius-inner);
  background: var(--panel-well);
  color: var(--text);
  font-size: 0.7rem;
  white-space: nowrap;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.guide-mini-btn:enabled:hover {
  border-color: var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
}
.guide-mini-btn:disabled { opacity: 0.45; }

.guide-keywords { display: flex; flex-wrap: wrap; gap: 4px; }
.guide-keyword {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.2);
  color: #ecd2c2;
}

.guide-block {
  font-size: 0.77rem;
  line-height: 1.5;
  color: #dcd6d0;
  word-break: keep-all;
}

.guide-block-label {
  display: block;
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--rose);
  margin-bottom: 2px;
}

.guide-reading-text {
  line-height: 1.54;
}

.guide-advice {
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: var(--radius-inner);
  background: rgba(233, 194, 174, 0.06);
  border-left: 2px solid rgba(233, 194, 174, 0.52);
  color: #f2e5db;
  line-height: 1.52;
}

.guide-advice-label {
  display: inline-block;
  margin-right: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

.guide-script {
  padding: 7px 9px;
  border-radius: var(--radius-control);
  background: var(--panel-well);
  border: 1px solid rgba(233, 194, 174, 0.2);
  font-size: 0.75rem;
  line-height: 1.48;
  color: #f4e2d6;
  word-break: keep-all;
}

/* =========================================
   FLIGHT ANIMATION & SPOTLIGHT DIALOG
   ========================================= */
#flight-layer {
  position: fixed;
  z-index: 40;
  inset: 0;
  pointer-events: none;
  perspective: 1000px;
}

#flight-layer.is-skippable {
  pointer-events: auto;
  cursor: pointer;
}

.flight-veil { position: absolute; inset: 0; opacity: 0; background: #080514de; }
.flying-card {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 7px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  will-change: transform;
}
.flying-card .card-front { border-radius: inherit; }
.flying-card .original-art,
.flying-card .face-art img { image-rendering: auto; }
.flight-face { position: absolute; inset: 0; border-radius: inherit; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flight-front { transform: rotateY(180deg); box-shadow: 0 12px 38px #050210bd; }
.flight-front::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 26%, #fff4cf 49%, transparent 66%);
  opacity: var(--foil-active, 0);
  mix-blend-mode: screen;
}

.flight-title {
  position: absolute;
  transform: translate(-50%, 0);
  color: #fbf4e6;
  text-align: center;
  text-shadow: 0 3px 12px #090316;
  font-family: var(--korean-serif);
  font-size: clamp(1.12rem, 1.8vw, 1.46rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.flight-title small {
  display: block;
  margin-top: 5px;
  font-family: var(--ui);
  color: var(--stage-gold);
  font-size: clamp(0.8rem, 1.15vw, 0.96rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.flight-skip-hint {
  display: block;
  margin-top: 8px;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 500;
  color: #c6c4d2cc;
  letter-spacing: 0.01em;
}

body[data-view="audience"] .flight-skip-hint {
  display: none;
}

.reveal-ring {
  position: absolute;
  border-radius: 50%;
  aspect-ratio: 1;
  opacity: 0;
  border: 1px solid #f0c8a99f;
  box-shadow: 0 0 18px #a67bff3d, inset 0 0 20px #8d5cff29;
  background: radial-gradient(circle, #f0c8a924 0%, transparent 66%);
  will-change: transform, opacity;
}

.reveal-ring::before,
.reveal-ring::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px dashed #f0c8a994;
  border-radius: 50%;
}

.reveal-ring::after { inset: 15%; border-style: solid; opacity: 0.5; }

.reveal-ring-inner {
  position: absolute;
  border-radius: 50%;
  aspect-ratio: 1;
  opacity: 0;
  border: 1.5px solid #f6dc99b5;
  box-shadow: 0 0 14px #f0c8a94d;
  background: radial-gradient(circle, #f0c8a918 0%, transparent 68%);
  pointer-events: none;
  will-change: transform, opacity;
}

.reveal-ring-inner::before {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px dashed #ffe6a89c;
  border-radius: 50%;
}

.reveal-pillar {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.reveal-pillar.theme-major {
  background: radial-gradient(ellipse at center, rgba(255, 240, 190, 0.52) 0%, rgba(185, 134, 255, 0.24) 46%, transparent 74%);
}
.reveal-pillar.theme-fire {
  background: radial-gradient(ellipse at center, rgba(255, 196, 118, 0.54) 0%, rgba(255, 92, 54, 0.24) 46%, transparent 74%);
}
.reveal-pillar.theme-water {
  background: radial-gradient(ellipse at center, rgba(164, 232, 255, 0.5) 0%, rgba(84, 152, 255, 0.22) 46%, transparent 74%);
}
.reveal-pillar.theme-air {
  background: radial-gradient(ellipse at center, rgba(235, 244, 255, 0.52) 0%, rgba(168, 178, 255, 0.22) 46%, transparent 74%);
}
.reveal-pillar.theme-earth {
  background: radial-gradient(ellipse at center, rgba(212, 245, 168, 0.5) 0%, rgba(108, 194, 132, 0.22) 46%, transparent 74%);
}

/* Element & Grade Ring Overrides */
.reveal-ring.theme-major {
  border-color: #ffe399d4;
  box-shadow: 0 0 22px #b48aff52, inset 0 0 22px #f0c8a93b;
  background: radial-gradient(circle, #ffe7a62e, transparent 66%);
}
.reveal-ring.theme-fire {
  border-color: #ffb26bb5;
  box-shadow: 0 0 18px #ff6e3b4d, inset 0 0 18px #ffae4730;
  background: radial-gradient(circle, #ff9f4d29, transparent 66%);
}
.reveal-ring.theme-fire::before { border-color: #ffd089b0; }
.reveal-ring.theme-water {
  border-color: #8fdcffb3;
  box-shadow: 0 0 18px #57b5ff47, inset 0 0 18px #83e1ff2e;
  background: radial-gradient(circle, #82d8ff24, transparent 66%);
}
.reveal-ring.theme-water::before { border-color: #b4edffad; border-style: solid; }
.reveal-ring.theme-air {
  border-color: #d6e4ffc7;
  box-shadow: 0 0 18px #9faeff4a, inset 0 0 18px #e3efff2e;
  background: radial-gradient(circle, #e2ecff24, transparent 66%);
}
.reveal-ring.theme-air::before { border-color: #e9f2ffb5; }
.reveal-ring.theme-earth {
  border-color: #b5e89cc4;
  box-shadow: 0 0 18px #72c98547, inset 0 0 18px #f0c8a92b;
  background: radial-gradient(circle, #b4e89924, transparent 66%);
}
.reveal-ring.theme-earth::before { border-color: #e6f2b3b0; }

.reveal-spark {
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 30%;
  opacity: 0;
  background: #fff2c4;
  box-shadow: 0 0 6px 1px #f0c8a970;
  will-change: transform, opacity;
}
.reveal-spark.theme-major {
  background: #fff5cb;
  box-shadow: 0 0 11px 3px #f0c8a9b8, 0 0 18px #b98aff88;
}
.reveal-spark.theme-fire {
  border-radius: 50% 50% 25% 25%;
  background: #ffcf86;
  box-shadow: 0 0 10px 2px #ff7b399e;
}
.reveal-spark.theme-water {
  border-radius: 50%;
  background: #ccf2ff;
  box-shadow: 0 0 10px 2px #66c2ff9c;
}
.reveal-spark.theme-air {
  border-radius: 2px;
  background: #f2f7ff;
  box-shadow: 0 0 9px 2px #b8c7ff99;
}
.reveal-spark.theme-earth {
  border-radius: 2px;
  background: #ddf6b6;
  box-shadow: 0 0 9px 2px #84cf8e96;
}

.landing-light {
  position: absolute;
  width: 85px;
  aspect-ratio: 1;
  border: 1px solid #f0c8a9;
  border-radius: 50%;
  box-shadow: 0 0 19px #f0c8a966, inset 0 0 18px #dbb5c666;
  animation: landing 0.5s ease-out both;
}

@keyframes landing {
  from { transform: translate(-50%, -50%) scale(0.5); opacity: 0.6; }
  to { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.card-dialog {
  position: absolute;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 18px;
  border: none;
  background: #080514eb;
  color: var(--text);
  display: grid;
  place-items: center;
}

.card-dialog:focus,
.card-dialog:focus-visible {
  outline: none;
}

.card-dialog:not([open]) {
  display: none !important;
}

.card-dialog-box {
  position: relative;
  width: min(820px, 96%);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 46px 24px;
  border: 1px solid #f0c8a952;
  border-radius: 8px;
  background: radial-gradient(ellipse at 25% 15%, #231445, #120c24 72%);
  color: var(--text);
  box-shadow: 0 24px 80px #04010ed6;
}

.guide-card.is-spotlighted {
  border-color: #f0c8a9c4;
  box-shadow: 0 0 0 1px #f0c8a945, 0 8px 24px #06031299;
}

.guide-mini-btn.js-spotlight.is-active {
  border-color: var(--accent);
  background: #2c2547;
  color: var(--accent);
}
.dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-right: 28px; margin-bottom: 16px; }
.dialog-top form {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  margin: 0;
}
.dialog-top-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
#inspect-position { color: var(--stage-gold); font-size: 0.92rem; font-weight: 650; }
.inspect-counter {
  font-family: var(--serif);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid #f0c8a959;
  background: #1a1033;
  color: var(--accent-bright);
}
.inspect-nav-btn {
  position: absolute;
  top: 52%;
  transform: translateY(-50%);
  z-index: 4;
  width: 32px;
  height: 48px;
  padding: 0;
  outline: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #e7dcf8b8;
  font-size: 2.15rem;
  line-height: 1;
  text-shadow: 0 2px 10px #05020ecc;
  display: grid;
  place-items: center;
  transition: color 0.16s ease, text-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}
.inspect-prev { left: 10px; }
.inspect-next { right: 10px; }
.inspect-nav-btn:is(:hover, :focus, :focus-visible, :active) {
  outline: none !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.inspect-nav-btn:enabled:hover {
  color: var(--stage-gold);
  text-shadow: 0 0 14px #f0c8a980;
  transform: translateY(-50%) scale(1.15);
}
.inspect-nav-btn:enabled:active {
  transform: translateY(-50%) scale(0.95);
}
.inspect-nav-btn:disabled {
  opacity: 0.24;
  cursor: default;
}
.icon-button.close {
  width: 28px;
  height: 28px;
  padding: 0;
  outline: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #c6c4d2b3;
  font: 400 1.45rem/1 var(--serif);
  display: grid;
  place-items: center;
  transition: color 0.16s ease, transform 0.16s ease;
}
.icon-button.close:is(:hover, :focus, :focus-visible, :active) {
  outline: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.icon-button.close:hover {
  color: var(--stage-gold);
  transform: scale(1.12);
}
.inspect-body {
  display: grid;
  grid-template-columns: minmax(245px, 1.15fr) 1fr;
  gap: 28px;
  align-items: center;
  touch-action: pan-y;
  user-select: none;
}
.inspect-art { position: relative; perspective: 850px; border-radius: 7px; width: 100%; max-width: 340px; margin-inline: auto; }
.inspect-foil {
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  aspect-ratio: 1024 / 1751;
  backface-visibility: hidden;
  transition: transform 0.22s ease;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  box-shadow: 0 14px 34px #060212cc, 0 0 24px #8d5cff24;
}
.inspect-foil::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at var(--mx, 50%) var(--my, 50%), #fff8de66, #f0c8a928 34%, transparent 66%);
  mix-blend-mode: screen;
  transition: opacity 0.2s;
}
@media (hover: hover) { .inspect-foil:hover::after { opacity: 1; } }
.inspect-art.is-tilting .inspect-foil {
  transition: transform 0.08s ease-out;
}
.inspect-art.is-tilting .inspect-foil::after {
  opacity: 1;
}
.inspect-foil.is-opening {
  animation: inspectCardOpen 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.inspect-foil.is-leaving {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  will-change: transform, opacity;
}
.inspect-foil.is-leaving[data-dir="next"] {
  animation: inspectCardOutNext 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.inspect-foil.is-leaving[data-dir="prev"] {
  animation: inspectCardOutPrev 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.inspect-foil.is-entering {
  position: relative;
  z-index: 2;
  will-change: transform, opacity;
}
.inspect-foil.is-entering[data-dir="next"] {
  animation: inspectCardInNext 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.inspect-foil.is-entering[data-dir="prev"] {
  animation: inspectCardInPrev 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes inspectCardOpen {
  from { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.95); }
  to { opacity: 1; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
}
@keyframes inspectCardOutNext {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0; transform: translate3d(-104%, 0, 0); }
}
@keyframes inspectCardOutPrev {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0; transform: translate3d(104%, 0, 0); }
}
@keyframes inspectCardInNext {
  from { opacity: 0; transform: translate3d(104%, 0, 0); }
  to { opacity: 1; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
}
@keyframes inspectCardInPrev {
  from { opacity: 0; transform: translate3d(-104%, 0, 0); }
  to { opacity: 1; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
}
@keyframes inspectTextSlideNext {
  from { opacity: 0; transform: translate3d(26px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes inspectTextSlidePrev {
  from { opacity: 0; transform: translate3d(-26px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.dialog-top-meta.is-switching[data-dir="next"] {
  animation: inspectTextSlideNext 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.dialog-top-meta.is-switching[data-dir="prev"] {
  animation: inspectTextSlidePrev 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.inspect-copy.is-switching[data-dir="next"] h2 {
  animation: inspectTextSlideNext 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
}
.inspect-copy.is-switching[data-dir="prev"] h2 {
  animation: inspectTextSlidePrev 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
}
.inspect-copy.is-switching[data-dir="next"] .inspect-subtitle {
  animation: inspectTextSlideNext 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.inspect-copy.is-switching[data-dir="prev"] .inspect-subtitle {
  animation: inspectTextSlidePrev 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.inspect-copy.is-switching[data-dir="next"] .inspect-keywords span {
  animation: inspectTextSlideNext 0.3s cubic-bezier(0.22, 1, 0.36, 1) calc(0.11s + var(--kw-idx, 0) * 0.035s) both;
}
.inspect-copy.is-switching[data-dir="prev"] .inspect-keywords span {
  animation: inspectTextSlidePrev 0.3s cubic-bezier(0.22, 1, 0.36, 1) calc(0.11s + var(--kw-idx, 0) * 0.035s) both;
}
.inspect-copy h2 { margin-top: 4px; font-family: var(--korean-serif); font-size: clamp(1.6rem, 4.2vw, 2.45rem); line-height: 1.25; letter-spacing: 0.01em; color: #fbf5ff; }
.inspect-subtitle { font: 500 1rem/1.45 var(--serif); color: var(--stage-muted); margin-top: 4px; }
.inspect-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.inspect-keywords span {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: #1d1438;
  border: 1px solid #49387a;
  color: #f4dfae;
}

.inspect-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inspect-actions[hidden] {
  display: none;
}

.inspect-clarify-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-accent-strong);
  background: var(--panel-card-elev);
  color: var(--accent-bright);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.inspect-clarify-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #1f2944;
  box-shadow: none;
  color: #ffffff;
}

.inspect-clarify-btn:active {
  transform: translateY(0);
}

/* =========================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ========================================= */
@media (max-width: 960px) {
  body:not([data-view="audience"]) {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body:not([data-view="audience"]) .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body:not([data-view="audience"]) :is(.edge-panel-tab, #panel-collapse) {
    display: none !important;
  }

  body:not([data-view="audience"]) .stage-shell {
    height: auto;
    min-height: 0;
    width: 100%;
    display: block;
    padding: 8px 8px 0;
    overflow: visible;
  }

  body:not([data-view="audience"]) .stage-frame {
    width: 100%;
    aspect-ratio: auto;
    border-radius: 10px;
  }

  body:not([data-view="audience"]) .stage-canvas {
    height: auto;
    overflow: hidden;
  }

  body:not([data-view="audience"]) .table {
    flex: none;
  }

  body:not([data-view="audience"]) .table-heading {
    min-height: 50px;
    padding: 12px 14px 0;
  }

  body:not([data-view="audience"]) .arena {
    flex: none;
    height: clamp(220px, 53vw, 310px);
  }

  body:not([data-view="audience"]) .table[data-fan-rows="2"] .arena {
    height: clamp(265px, 64vw, 355px);
  }

  body:not([data-view="audience"]) .fan {
    --card-width: clamp(46px, 12.2cqw, 76px);
  }

  body:not([data-view="audience"]) .table[data-fan-rows="2"] .fan {
    --card-width: clamp(36px, 9.2cqw, 58px);
  }

  body:not([data-view="audience"]) .table[data-phase="waiting"] .fan {
    --card-width: clamp(70px, 17.5cqw, 106px);
  }

  body:not([data-view="audience"]) .spread-tray {
    flex: none;
    padding: 10px 10px 14px;
  }

  body:not([data-view="audience"]) .slots-scroll {
    overflow-x: auto;
    overflow-y: visible;
  }

  body:not([data-view="audience"]) .slots {
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
    --slot-width: clamp(50px, 13.8vw, 72px);
    gap: 10px 8px;
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray {
    padding: 14px 10px 20px;
    min-height: 220px;
  }

  body:not([data-view="audience"]) .streamer-panel {
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--line);
    margin-top: 8px;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    box-shadow: none;
    overflow: visible;
  }

  body:not([data-view="audience"]) .panel-header {
    min-width: 0;
    width: 100%;
    padding: 10px 12px;
  }

  body:not([data-view="audience"]) .panel-scroll {
    overflow: visible;
    padding: 10px 8px 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body:not([data-view="audience"]) .audio-card,
  body:not([data-view="audience"]) .settings-card { order: 1; }
  body:not([data-view="audience"]) .broadcast-drawer-card { order: 2; }
  body:not([data-view="audience"]) .action-card { order: 3; }
  body:not([data-view="audience"]) .setup-card { order: 4; }
  body:not([data-view="audience"]) .summary-card { order: 5; }
  body:not([data-view="audience"]) .guide-section { order: 6; }

  body:not([data-view="audience"]) .card-dialog {
    position: fixed;
    inset: 0;
    z-index: 60;
    padding: 14px;
  }

  body:not([data-view="audience"]) .card-dialog-box {
    width: min(640px, 100%);
    max-height: calc(100dvh - 28px);
    padding: 18px 40px 20px;
  }

  body:not([data-view="audience"]) .inspect-nav-btn {
    width: 28px;
    height: 44px;
    font-size: 1.85rem;
  }
  body:not([data-view="audience"]) .inspect-prev { left: 6px; }
  body:not([data-view="audience"]) .inspect-next { right: 6px; }
}

@media (max-width: 640px) {
  body:not([data-view="audience"]) .table-heading {
    padding: 10px 12px 0;
    gap: 8px;
  }

  body:not([data-view="audience"]) .table-heading h2 {
    font-size: clamp(0.98rem, 4.3vw, 1.24rem);
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slots[data-density="1"] {
    --slot-width: clamp(132px, 44vw, 184px);
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slots[data-density="2"] {
    --slot-width: clamp(108px, 37vw, 156px);
    gap: 12px 16px;
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slots[data-density="3"] {
    --slot-width: clamp(84px, 26.5vw, 126px);
    gap: 12px 10px;
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slots[data-density="4"] {
    --slot-width: clamp(68px, 20.5vw, 102px);
    gap: 12px 8px;
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slots:is([data-density="5"], [data-density="6"], [data-density="7"]) {
    --slot-width: clamp(64px, 18.5vw, 92px);
    gap: 10px 8px;
  }

  body:not([data-view="audience"]) .table[data-phase="complete"] + .spread-tray .slot-name {
    margin-top: 10px;
    font-size: clamp(0.74rem, 3.1vw, 0.9rem);
  }

  .inspect-body {
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: center;
  }

  .inspect-art {
    width: min(68vw, 250px);
    max-width: 250px;
    margin-inline: auto;
  }

  .inspect-keywords {
    justify-content: center;
  }
}

/* =========================================
   DUAL-WINDOW SEPARATED AUDIENCE VIEW (16:9)
   ========================================= */
body[data-view="audience"] {
  background: #080d17;
  height: 100vh;
  overflow: hidden;
}

body[data-view="audience"] .app-shell {
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
}

body[data-view="audience"] :is(
  .dialog-top form,
  .inspect-nav-btn,
  .slot-flip-badge,
  .stop-shuffle-banner,
  .manual-shuffle-hint,
  .streamer-panel,
  .edge-panel-tab
) {
  display: none !important;
}

body[data-view="audience"] .card-dialog-box {
  padding: 20px 26px;
}

body[data-view="audience"] .stage-shell {
  height: 100vh;
  padding: 0;
}

body[data-view="audience"] .stage-frame {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body[data-view="audience"] .slot-card { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
