:root {
  color-scheme: dark;
  --ink: #0a0a0d;
  --ink-soft: #111118;
  --paper: #f4f1ed;
  --paper-strong: #fffdf9;
  --muted: #9a9aa8;
  --muted-dark: #6c6970;
  --line: rgba(255, 255, 255, 0.12);
  --line-dark: rgba(13, 12, 16, 0.12);
  --pink: #ff2d76;
  --pink-dark: #d81658;
  --mint: #63e6be;
  --yellow: #ffd166;
  --violet: #7c5cff;
  --white: #fff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  --radius: 24px;
  --radius-small: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); touch-action: pan-x pan-y; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pink) 72%, white);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--pink);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(135deg, #fff 0 44%, #ff4d8c 45% 62%, #7c5cff 63% 100%);
  color: #060608;
  font-size: 25px;
  font-weight: 1000;
  letter-spacing: -0.09em;
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.08);
}

.brand-copy {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.86;
}

.brand-copy small {
  color: #aaa9b6;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brand-lockup-dark { color: var(--ink); }
.brand-lockup-dark .brand-mark { border-color: rgba(10, 10, 13, 0.14); }
.brand-lockup-dark .brand-copy small { color: #77737c; }

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.file-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--pink);
  color: white;
  font-weight: 850;
  box-shadow: 0 12px 34px rgba(255, 45, 118, 0.26);
}

.primary-button:hover:not(:disabled) { transform: translateY(-2px); background: #ff4384; }
.primary-button-wide { width: 100%; }

.secondary-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 13px;
  font-weight: 750;
}

.secondary-button:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.1); }

.icon-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: white;
  font-size: 12px;
  font-weight: 750;
}

.text-button {
  padding: 5px;
  background: transparent;
  color: #b6b5c0;
  font-size: 13px;
  font-weight: 700;
}

.text-button:hover:not(:disabled) { color: white; }

.glass-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 14, 20, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #777784;
  box-shadow: 0 0 0 5px rgba(119, 119, 132, 0.1);
}

.connection-dot[data-connected="true"] {
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(99, 230, 190, 0.1), 0 0 18px rgba(99, 230, 190, 0.55);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9d8e0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.status-pill[data-tone="open"] { border-color: rgba(99, 230, 190, 0.35); background: rgba(99, 230, 190, 0.1); color: var(--mint); }
.status-pill[data-tone="locked"] { border-color: rgba(255, 209, 102, 0.35); background: rgba(255, 209, 102, 0.1); color: var(--yellow); }
.status-pill[data-tone="completed"] { color: #9998a4; }

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: #94929d;
  font-size: 13px;
  line-height: 1.5;
}

.form-message[data-tone="error"] { color: #ff6c91; }
.field-note { margin: -2px 0 0; color: #77747e; font-size: 12px; line-height: 1.55; }
.empty-row { color: #777681 !important; text-align: center !important; }

.tool-footer {
  padding: 20px 24px 28px;
  color: #757581;
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.tool-footer a { margin-left: 8px; color: inherit; text-underline-offset: 3px; }

/* 投屏页 */
.display-page {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 52% 42%, rgba(124, 92, 255, 0.12), transparent 33%),
    linear-gradient(160deg, #08080c 0%, #0e0d15 52%, #07070a 100%);
  color: white;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one { top: -20vw; right: -8vw; background: var(--pink); }
.ambient-two { bottom: -24vw; left: -10vw; background: var(--violet); }

.display-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1600px, calc(100% - 56px));
  margin: 0 auto;
  padding: 24px 0 10px;
}

.display-head-actions { display: flex; align-items: center; gap: 10px; color: #9d9ca8; font-size: 12px; }
.display-main { position: relative; z-index: 1; width: min(1600px, calc(100% - 56px)); margin: 0 auto; }

.code-entry {
  width: min(580px, 100%);
  margin: 12vh auto 18vh;
  padding: clamp(34px, 5vw, 64px);
  text-align: center;
}

.code-entry h1 { margin: 0; font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.055em; }
.code-entry > p:not(.eyebrow, .form-message) { margin: 14px 0 26px; color: #a8a6b1; }
.code-entry-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-entry-form input {
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.display-stage { padding: 18px 0 20px; }
.stage-meta { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 18px 2px 24px; }
.stage-meta h1 { margin: 0; max-width: 1000px; font-size: clamp(28px, 4vw, 58px); letter-spacing: -0.045em; line-height: 1.05; }
.stage-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stage-stats span { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: #a9a8b4; font-size: 12px; white-space: nowrap; }
.stage-stats strong { margin-left: 5px; color: white; font-size: 14px; }

.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); gap: 18px; }
.draw-arena { position: relative; display: flex; flex-direction: column; min-height: min(68vh, 760px); padding: clamp(24px, 3vw, 44px); overflow: hidden; }
.draw-arena::before {
  content: "117";
  position: absolute;
  right: -1vw;
  bottom: -8vw;
  color: rgba(255, 255, 255, 0.022);
  font-size: clamp(240px, 33vw, 620px);
  font-weight: 1000;
  letter-spacing: -0.12em;
  line-height: 0.7;
  pointer-events: none;
}

.prize-heading { position: relative; z-index: 1; text-align: center; }
.prize-heading span { color: var(--pink); font-size: 12px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.prize-heading h2 { margin: 8px 0 0; font-size: clamp(30px, 4.3vw, 72px); letter-spacing: -0.055em; line-height: 1; }

.winner-board {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 1;
  gap: 14px;
  width: 100%;
  padding: clamp(26px, 4vw, 70px) 0;
}

.winner-board.is-rolling,
.winner-board.is-revealed { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; }
.winner-board.slots-1 { grid-template-columns: minmax(0, 0.84fr); justify-content: center; }
.winner-board.slots-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.winner-board.slots-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.idle-copy { position: relative; z-index: 1; display: grid; gap: 12px; text-align: center; }
.idle-copy strong { color: rgba(255, 255, 255, 0.88); font-size: clamp(60px, 10vw, 150px); font-weight: 1000; letter-spacing: -0.08em; line-height: 0.8; }
.idle-copy span { color: #8d8b97; font-size: clamp(13px, 1.4vw, 18px); }
.idle-orbit { position: absolute; width: min(36vw, 460px); aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%; animation: orbit 12s linear infinite; }
.idle-orbit::before, .idle-orbit::after { content: ""; position: absolute; inset: 13%; border: 1px dashed rgba(255, 45, 118, 0.16); border-radius: inherit; }
.idle-orbit::after { inset: 30%; border-style: solid; border-color: rgba(124, 92, 255, 0.2); }
.idle-orbit i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 20px var(--pink); }
.idle-orbit i:nth-child(1) { top: 9%; left: 33%; }
.idle-orbit i:nth-child(2) { right: 8%; top: 51%; background: var(--mint); box-shadow: 0 0 20px var(--mint); }
.idle-orbit i:nth-child(3) { left: 20%; bottom: 8%; background: var(--violet); box-shadow: 0 0 20px var(--violet); }

.rolling-card,
.winner-card {
  position: relative;
  width: 100%;
  min-height: 180px;
  padding: clamp(20px, 2.6vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.rolling-card::after,
.winner-card::after { content: "117"; position: absolute; right: -10px; bottom: -22px; color: rgba(255, 255, 255, 0.045); font-size: 100px; font-weight: 1000; letter-spacing: -0.1em; }
.rolling-card { display: grid; align-content: center; animation: cardPulse 760ms ease-in-out infinite alternate; }
.rolling-label, .winner-crown { color: var(--pink); font-size: 10px; font-weight: 900; letter-spacing: 0.14em; }
.rolling-card strong { position: relative; z-index: 1; display: block; max-width: 100%; margin: 9px 0; overflow: hidden; color: white; font-size: clamp(24px, 3.4vw, 50px); font-weight: 950; letter-spacing: -0.045em; text-overflow: ellipsis; white-space: nowrap; filter: blur(1.2px); }
.rolling-card small { color: #898894; }

.winner-card {
  display: grid;
  align-content: center;
  min-height: 210px;
  border-color: rgba(255, 45, 118, 0.45);
  background: linear-gradient(145deg, rgba(255, 45, 118, 0.14), rgba(124, 92, 255, 0.08));
  box-shadow: inset 0 0 50px rgba(255, 45, 118, 0.05), 0 0 45px rgba(255, 45, 118, 0.08);
  animation: winnerIn 600ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: calc(var(--order) * 120ms);
}

.winner-card strong { position: relative; z-index: 1; margin: 12px 0 8px; font-size: clamp(32px, 5vw, 78px); font-weight: 1000; letter-spacing: -0.055em; line-height: 1; overflow-wrap: anywhere; }
.winner-card small { position: relative; z-index: 1; color: #c2c0c9; font-size: 13px; }

.draw-progress { position: relative; z-index: 1; height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.draw-progress span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--pink), var(--violet), var(--mint)); transform-origin: left; animation: drawProgress 5.2s linear both; }

.join-rail { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 18px; }
.qr-card { padding: 24px; text-align: center; transition: opacity 180ms ease; }
.qr-card[data-closed="true"] .qr-frame { opacity: 0.28; filter: grayscale(1); }
.qr-frame { display: grid; place-items: center; width: min(100%, 232px); aspect-ratio: 1; margin: 12px auto 18px; padding: 12px; border-radius: 18px; background: white; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25); }
.qr-frame img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.qr-card h2 { margin: 0; font-size: 21px; }
.qr-card > p:not(.eyebrow) { margin: 7px 0 16px; color: #8e8d99; font-size: 12px; line-height: 1.5; }
.session-code-large { display: block; color: var(--pink); font-size: 30px; font-weight: 950; letter-spacing: 0.14em; }

.recent-card { min-height: 0; padding: 22px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-title-row .eyebrow { margin: 0; }
.recent-winners { display: grid; gap: 0; margin: 14px 0 0; padding: 0; list-style: none; }
.recent-winners li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.recent-winners li:last-child { border-bottom: 0; }
.recent-winners span { display: grid; gap: 2px; }
.recent-winners strong { font-size: 13px; }
.recent-winners small { color: #6f6e79; font-size: 10px; letter-spacing: 0.07em; }
.recent-winners em { color: #b1afba; font-size: 11px; font-style: normal; text-align: right; }

.confetti-layer { position: fixed; z-index: 10; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; top: -20px; left: var(--x); width: 9px; height: 15px; border-radius: 2px; background: var(--color); animation: confettiFall var(--duration) var(--delay) cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* 扫码加入页 */
.join-page { background: var(--paper); color: var(--ink); }
.mobile-header { display: flex; align-items: center; justify-content: space-between; width: min(720px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0; }
.secure-label { padding: 8px 11px; border: 1px solid var(--line-dark); border-radius: 999px; color: #77737c; font-size: 11px; font-weight: 750; }
.join-main { width: min(720px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 60px; }
.join-hero { padding: 30px 4px 38px; }
.join-hero h1 { margin: 0; max-width: 650px; font-size: clamp(44px, 10.8vw, 76px); letter-spacing: -0.07em; line-height: 0.98; }
.join-hero > p:not(.eyebrow) { margin: 20px 0 0; color: var(--muted-dark); font-size: 15px; line-height: 1.7; }

.join-card { padding: clamp(24px, 6vw, 44px); border: 1px solid var(--line-dark); border-radius: 28px; background: var(--paper-strong); box-shadow: 0 24px 70px rgba(32, 23, 28, 0.1); }
.stack-form { display: grid; gap: 14px; }
.stack-form label { display: grid; gap: 8px; color: #3d3a40; font-size: 13px; font-weight: 800; }
.stack-form input, .stack-form textarea, .stack-form select, .inline-field input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid rgba(15, 13, 17, 0.15);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.stack-form textarea { min-height: 120px; padding-top: 12px; resize: vertical; line-height: 1.6; }
.stack-form input:focus, .stack-form textarea:focus, .inline-field input:focus { border-color: var(--pink); outline: 0; box-shadow: 0 0 0 4px rgba(255, 45, 118, 0.09); }
.inline-field { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.join-card .secondary-button { border-color: var(--line-dark); background: #efebe7; color: var(--ink); }
.session-summary-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.session-summary-head h2 { margin: 12px 0 0; font-size: clamp(24px, 6vw, 36px); letter-spacing: -0.04em; }
.participant-total { color: #77737c; font-size: 12px; text-align: right; white-space: nowrap; }
.participant-total strong { display: block; color: var(--pink); font-size: 30px; line-height: 1; }
.join-card .status-pill { border-color: var(--line-dark); color: #77737c; }
.join-card .status-pill[data-tone="open"] { border-color: rgba(19, 152, 111, 0.25); color: #0e8d69; }
.join-card .status-pill[data-tone="locked"] { border-color: rgba(178, 123, 0, 0.26); color: #9a6900; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.join-closed { padding: 26px; border-radius: 16px; background: #f0ece8; text-align: center; }
.join-closed strong { font-size: 18px; }
.join-closed p { margin: 8px 0 0; color: #77737c; font-size: 13px; line-height: 1.6; }
.join-success { text-align: center; }
.success-spark { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 20px; border-radius: 50%; background: var(--pink); color: white; font-size: 27px; font-weight: 900; box-shadow: 0 15px 40px rgba(255, 45, 118, 0.25); }
.join-success h2 { margin: 0; font-size: clamp(28px, 7vw, 42px); letter-spacing: -0.05em; }
.join-success > p:not(.eyebrow, .field-note) { color: #69666e; }
.entry-ticket { display: grid; gap: 8px; margin: 28px 0 18px; padding: 22px; border: 1px dashed rgba(255, 45, 118, 0.4); border-radius: 16px; background: rgba(255, 45, 118, 0.045); }
.entry-ticket span { color: #7b767e; font-size: 12px; }
.entry-ticket strong { color: var(--pink); font-size: 34px; letter-spacing: 0.12em; }
.join-notes { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; margin: 34px 6px 0; }
.join-notes span { color: var(--pink); font-size: 11px; font-weight: 900; }
.join-notes p { margin: 0; color: #77737c; font-size: 13px; }
.tool-footer-light { background: var(--paper); color: #928e95; }

/* 主持控制页 */
.control-page { background: #0a0a0e; color: #f7f6f9; }
.login-gate { display: grid; place-items: center; min-height: 100vh; padding: 28px; background: radial-gradient(circle at 50% 25%, rgba(255, 45, 118, 0.11), transparent 38%), #09090d; }
.login-card { width: min(440px, 100%); padding: clamp(28px, 5vw, 46px); border: 1px solid var(--line); border-radius: 28px; background: #101016; box-shadow: var(--shadow); }
.login-card .brand-lockup { margin-bottom: 54px; }
.login-card h1 { margin: 0; font-size: clamp(34px, 8vw, 46px); letter-spacing: -0.055em; line-height: 1; }
.login-card > p:not(.eyebrow, .form-message) { margin: 16px 0 28px; color: #85838e; font-size: 13px; line-height: 1.7; }
.dark-form label { color: #c9c7cf; }
.dark-form input { border-color: var(--line); background: rgba(255, 255, 255, 0.055); color: white; }

.control-shell { min-height: 100vh; }
.control-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 78px;
  padding: 12px max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 13, 0.9);
  backdrop-filter: blur(18px);
}
.control-header-center { display: flex; align-items: center; justify-content: center; gap: 10px; }
.control-header-center label { color: #777681; font-size: 11px; font-weight: 700; }
.control-header select { width: min(380px, 45vw); height: 40px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #15151c; color: white; }
.control-header-actions { display: flex; align-items: center; gap: 9px; color: #8b8a95; font-size: 12px; }
.control-main { width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 70px; }

.empty-control { max-width: 680px; margin: 14vh auto; text-align: center; }
.empty-control h1 { margin: 0; font-size: clamp(42px, 7vw, 74px); letter-spacing: -0.065em; }
.empty-control > p:not(.eyebrow) { margin: 18px auto 30px; max-width: 580px; color: #85838f; line-height: 1.7; }

.session-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.toolbar-kicker { display: flex; align-items: center; gap: 10px; color: #7b7984; font-size: 12px; font-weight: 750; letter-spacing: 0.08em; }
.session-toolbar h1 { margin: 11px 0 0; font-size: clamp(34px, 4vw, 58px); letter-spacing: -0.055em; line-height: 1; }
.toolbar-actions { display: flex; gap: 10px; }

.control-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.control-metrics article { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #101016; }
.control-metrics span { display: block; margin-bottom: 7px; color: #777681; font-size: 11px; }
.control-metrics strong { color: white; font-size: 30px; letter-spacing: -0.05em; }
.control-metrics small { margin-left: 4px; color: #6d6c77; font-size: 11px; }

.control-panel { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #101016; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
.panel-heading h2 { margin: 0; font-size: 22px; letter-spacing: -0.035em; }
.panel-heading > p { max-width: 330px; margin: 2px 0 0; color: #74727d; font-size: 12px; line-height: 1.5; text-align: right; }
.compact-heading { margin-bottom: 16px; }

.status-control { display: grid; grid-template-columns: minmax(220px, 0.6fr) minmax(0, 1.4fr); gap: 24px; margin-bottom: 14px; }
.status-control .panel-heading { display: block; margin: 0; }
.status-control .panel-heading > p { margin-top: 8px; text-align: left; }
.status-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.status-action { display: grid; gap: 5px; min-height: 72px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.035); color: #d7d5dd; text-align: left; }
.status-action span { font-size: 13px; font-weight: 820; }
.status-action small { color: #6f6e79; font-size: 10px; line-height: 1.4; }
.status-action:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.3); }
.status-action.is-current { border-color: rgba(99, 230, 190, 0.42); background: rgba(99, 230, 190, 0.08); }
.danger-action.is-current, .danger-action:hover:not(:disabled) { border-color: rgba(255, 45, 118, 0.4); background: rgba(255, 45, 118, 0.08); }

.control-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; }
.control-primary-column, .control-side-column { display: grid; align-content: start; gap: 14px; }
.draw-console { background: linear-gradient(135deg, rgba(255, 45, 118, 0.08), #101016 48%); }
.live-indicator { color: var(--mint); font-size: 11px; font-weight: 800; }
.draw-form { display: grid; grid-template-columns: minmax(180px, 1fr) 100px minmax(190px, 0.7fr); gap: 10px; align-items: end; }
.draw-form label { display: grid; gap: 7px; color: #888691; font-size: 11px; font-weight: 750; }
.draw-form select, .draw-form input { width: 100%; height: 54px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #181820; color: white; }
.draw-button { display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border: 0; border-radius: 12px; background: var(--pink); color: white; font-weight: 900; box-shadow: 0 15px 40px rgba(255, 45, 118, 0.2); }
.draw-button span { font-size: 10px; letter-spacing: 0.12em; opacity: 0.7; }
.draw-button:hover:not(:disabled) { background: #ff4384; transform: translateY(-1px); }
.draw-console-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; }
.draw-console-footer p { margin: 0; color: #777681; font-size: 11px; line-height: 1.5; }

.panel-tools { display: flex; align-items: center; gap: 9px; }
.panel-tools input { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #17171e; color: white; font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: #696873; font-size: 10px; font-weight: 750; text-align: left; white-space: nowrap; }
.data-table td { padding: 12px 9px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); color: #a7a5ae; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td strong { display: block; color: #ecebf0; font-size: 12px; }
.data-table td small { display: block; margin-top: 3px; color: #686772; font-size: 9px; letter-spacing: 0.03em; }
.data-table tr.is-muted { opacity: 0.5; }
.source-tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: rgba(124, 92, 255, 0.11); color: #a99aff; font-size: 9px; font-weight: 800; white-space: nowrap; }
.source-tag[data-source="scan"] { background: rgba(99, 230, 190, 0.09); color: var(--mint); }
.table-action { padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: #aaa8b2; font-size: 9px; white-space: nowrap; }
.table-action:hover:not(:disabled) { border-color: var(--pink); color: white; }
.void-label { color: #a77d88; font-size: 10px; }

.join-link-panel { text-align: center; }
.qr-frame-control { width: 210px; margin-top: 4px; }
.control-code { display: block; color: var(--pink); font-size: 29px; letter-spacing: 0.12em; }
.join-link-panel > p { margin: 7px 0 16px; color: #74727d; font-size: 11px; }
.split-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.compact-form { gap: 11px; }
.compact-form label { color: #aaa8b1; font-size: 11px; }
.control-panel .stack-form input, .control-panel .stack-form textarea { min-height: 42px; border-color: var(--line); background: #17171e; color: white; font-size: 12px; }
.control-panel .stack-form textarea { min-height: 120px; }
.file-button { min-height: 40px; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: 10px; background: rgba(255, 255, 255, 0.03); color: #8d8b96; font-size: 11px; }
.file-button:hover { border-color: rgba(255, 255, 255, 0.34); color: white; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.prize-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.prize-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.prize-list li > div:first-child { display: grid; gap: 4px; }
.prize-list strong { font-size: 12px; }
.prize-list small { color: #6e6d78; font-size: 9px; }
.list-actions { display: flex; gap: 6px; }
.list-actions button { padding: 3px; border: 0; background: transparent; color: #7f7e89; font-size: 9px; }
.list-actions button:hover { color: white; }
.divider-top { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-two-columns { display: grid; grid-template-columns: 1fr 100px; gap: 9px; }
.toggle-row { display: grid !important; grid-template-columns: auto 1fr; align-items: start; gap: 10px !important; }
.toggle-row > input { width: 18px !important; min-height: 18px !important; margin-top: 2px; accent-color: var(--pink); box-shadow: none !important; }
.toggle-row span { display: grid; gap: 4px; }
.toggle-row strong { color: inherit; font-size: 12px; }
.toggle-row small { color: #6e6c77; font-size: 9px; font-weight: 500; line-height: 1.5; }

.control-dialog { width: min(470px, calc(100% - 32px)); padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: #121218; color: white; box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6); }
.control-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.control-dialog h2 { margin: 0 0 24px; font-size: 30px; letter-spacing: -0.04em; }
.dialog-close-form { position: absolute; top: 14px; right: 14px; }
.dialog-close-form button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: #8d8b95; font-size: 19px; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; max-width: calc(100% - 36px); padding: 12px 18px; border: 1px solid rgba(99, 230, 190, 0.3); border-radius: 999px; background: #15151b; color: var(--mint); font-size: 12px; font-weight: 750; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast[data-tone="error"] { border-color: rgba(255, 45, 118, 0.35); color: #ff6b97; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes cardPulse { from { border-color: rgba(255,255,255,.08); transform: translateY(-2px); } to { border-color: rgba(255,45,118,.35); transform: translateY(2px); } }
@keyframes winnerIn { from { opacity: 0; transform: scale(0.78) translateY(24px); filter: blur(10px); } to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); } }
@keyframes drawProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes confettiFall { 0% { opacity: 0; transform: translate3d(0, -20px, 0) rotate(0deg); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--drift), 105vh, 0) rotate(var(--spin)); } }

@media (max-width: 1100px) {
  .stage-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .draw-arena { min-height: 610px; }
  .winner-board.slots-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .status-control { grid-template-columns: 1fr; }
  .control-header { grid-template-columns: auto 1fr; }
  .control-header-actions { display: none; }
}

@media (max-width: 820px) {
  .display-header, .display-main { width: min(100% - 28px, 680px); }
  .display-header { padding-top: 16px; }
  .stage-meta { display: grid; align-items: start; }
  .stage-stats { justify-content: flex-start; }
  .stage-grid { grid-template-columns: 1fr; }
  .draw-arena { min-height: 560px; }
  .join-rail { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .qr-frame { width: 190px; }
  .control-header { position: static; grid-template-columns: 1fr; gap: 12px; padding: 16px 20px; }
  .control-header-center { justify-content: flex-start; flex-wrap: wrap; }
  .control-header select { width: min(100%, 380px); }
  .control-main { width: min(100% - 28px, 720px); padding-top: 24px; }
  .session-toolbar { align-items: start; flex-direction: column; }
  .control-metrics { grid-template-columns: repeat(2, 1fr); }
  .control-grid { grid-template-columns: 1fr; }
  .control-side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .join-link-panel { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .brand-mark { width: 54px; height: 41px; font-size: 22px; }
  .display-head-actions > span:not(.connection-dot) { display: none; }
  .code-entry { margin-top: 8vh; padding: 28px 20px; }
  .code-entry-form { grid-template-columns: 1fr; }
  .stage-meta h1 { font-size: 34px; }
  .stage-grid { gap: 12px; }
  .draw-arena { min-height: 500px; padding: 22px 16px; }
  .winner-board.is-rolling, .winner-board.is-revealed, .winner-board.slots-3, .winner-board.slots-4 { grid-template-columns: 1fr; }
  .winner-board { padding: 24px 0; }
  .rolling-card, .winner-card { min-height: 140px; }
  .winner-card strong { font-size: 38px; }
  .join-rail { grid-template-columns: 1fr; }
  .qr-card { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 0 18px; text-align: left; }
  .qr-card .eyebrow { grid-column: 1 / -1; }
  .qr-card .qr-frame { grid-row: 2 / 6; width: 130px; margin: 0; padding: 8px; border-radius: 13px; }
  .qr-card h2, .qr-card > p:not(.eyebrow), .qr-card .session-code-large { grid-column: 2; }
  .qr-card h2 { font-size: 17px; }
  .qr-card > p:not(.eyebrow) { margin: 5px 0 10px; }
  .session-code-large { font-size: 23px; }
  .inline-field { grid-template-columns: 1fr; }
  .session-summary-head { display: grid; }
  .participant-total { text-align: left; }
  .participant-total strong { display: inline; margin-right: 4px; }
  .join-main { padding-top: 5px; }
  .join-hero { padding-top: 18px; }
  .join-card { padding: 24px 20px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions a { flex: 1; }
  .control-metrics { gap: 8px; }
  .control-metrics article { padding: 14px; }
  .status-actions { grid-template-columns: 1fr; }
  .draw-form { grid-template-columns: 1fr 90px; }
  .draw-button { grid-column: 1 / -1; }
  .draw-console-footer { align-items: flex-start; flex-direction: column; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading > p { text-align: left; }
  .panel-tools { width: 100%; }
  .panel-tools input { flex: 1; min-width: 0; }
  .control-side-column { grid-template-columns: 1fr; }
  .join-link-panel { grid-column: auto; }
  .control-panel { padding: 18px 15px; }
  .split-buttons { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
