:root {
  color-scheme: dark;
  --font-heading: "FZLantingUltraLight", sans-serif;
  --font-body: "FZLantingUltraLight", sans-serif;
  font-family: var(--font-body);
  --serif: var(--font-heading);
  --stage-light: var(--font-body);
  --ink: #080f20;
  --white: #f3f4fb;
  --muted: #b2c0d9;
  --ice: #e2ebfb;
  --warm: #e3c99b;
  --line: #9cb5df38;
  --card: #142139b8;
  --field: #0b162bdc;
  --field-line: #667fa77a;
  --danger: #ffbebd;
}

@font-face {
  font-family: "FZLantingUltraLight";
  src: url("font/方正兰亭超细黑简体.TTF") format("truetype");
  font-style: normal;
  font-weight: 100 400;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--white);
  background: var(--ink);
}
body { font-size: 14px; }
p, h1, h2, h3, h4, ul, ol, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button, select { -webkit-tap-highlight-color: transparent; }
:where(button, input, select, textarea, .scroll-region):focus-visible {
  outline: 2px solid #ccd4ff;
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Moonlight, ribbons, and falling snow */
.theatre, .stage { position: fixed; inset: 0; overflow: hidden; }
.stage {
  --stage-axis: 68%;
  container-type: inline-size;
  isolation: isolate;
}
.stage:focus { outline: none; }
.moon-scenery, .stage-shade, .snowfield, .reveal-light, .ribbon-bed {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.moon-scenery {
  background: #111c39 url("assets/moon-stage.png") center / cover no-repeat;
  filter: saturate(.84);
  transform: scale(1.008);
  animation: stage-breathe 27s ease-in-out infinite alternate;
}
@keyframes stage-breathe {
  to { transform: scale(1.045) translateX(-.3%); }
}
.stage-shade {
  z-index: 1;
  background:
    radial-gradient(ellipse at 70% 48%, #27306145, transparent 62%),
    linear-gradient(180deg, #030919aa, transparent 26%, #09133013 57%, #070b20a6 100%),
    linear-gradient(90deg, #080f2626 28%, #070c2152 66%, #080f267a 100%);
}
.snowfield { z-index: 3; overflow: hidden; }
.snowfield span {
  position: absolute;
  left: var(--snow-x);
  top: -24px;
  opacity: 0;
  animation: snow-fall var(--snow-duration) var(--snow-delay) linear infinite;
}
.snow-crystal {
  color: #dce8fb;
  font: 400 var(--snow-size)/1 "Apple Symbols", "Segoe UI Symbol", serif;
  text-shadow: 0 0 8px #adc9fa96;
}
.snow-speck {
  width: var(--snow-size);
  height: var(--snow-size);
  border-radius: 50%;
  background: #d6ddf9;
  box-shadow: 0 0 7px #9bb6fbcc;
  filter: blur(.35px);
}
@keyframes snow-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12% { opacity: .59; }
  70% { opacity: .45; }
  90% { opacity: .26; }
  100% {
    transform: translate3d(var(--snow-drift), calc(100dvh + 50px), 0) rotate(var(--snow-turn));
    opacity: 0;
  }
}
.ribbon-bed {
  z-index: 2;
  inset: auto -4% -20% -3%;
  height: min(41vh, 27cqw);
  background: url("assets/silk-veil.png") center / 100% 100% no-repeat;
  opacity: .21;
  mix-blend-mode: screen;
  animation: silk-drift 18s ease-in-out infinite alternate;
}
@keyframes silk-drift {
  to { transform: translate3d(1.6%, -4%, 0) rotate(-1.5deg); opacity: .32; }
}
.reveal-light {
  z-index: 4;
  opacity: 0;
  background: radial-gradient(ellipse at var(--stage-axis) 48%, #93b2fd80 0%, #7669e64a 28%, transparent 60%);
  mix-blend-mode: screen;
}
.stage[data-premier="true"] .reveal-light {
  background: radial-gradient(ellipse at var(--stage-axis) 48%, #ffddb985 0%, #a58bd248 32%, transparent 63%);
}
.stage-frame {
  position: absolute;
  z-index: 4;
  inset: clamp(18px, 3.25cqw, 55px);
  pointer-events: none;
}
.stage-frame i {
  position: absolute;
  width: clamp(11px, 1.25cqw, 19px);
  height: clamp(11px, 1.25cqw, 19px);
  border: 0 solid #d5e0fa51;
}
.stage-frame i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.stage-frame i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.stage-frame i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.stage-frame i:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.stage-brand {
  position: absolute;
  z-index: 5;
  top: clamp(26px, 4.5cqw, 73px);
  color: var(--ice);
  font-family: var(--serif);
  font-size: clamp(11px, 1.02cqw, 16px);
  letter-spacing: .12em;
  line-height: 1.5;
  text-shadow: 0 2px 12px #030819;
}
.stage-event-title {
  position: absolute;
  z-index: 5;
  top: clamp(28px, 4.65cqw, 75px);
  right: clamp(28px, 5cqw, 85px);
  max-width: 34vw;
  color: var(--ice);
  font: 400 clamp(11px, 1.02cqw, 16px)/1.5 var(--serif);
  letter-spacing: .14em;
  text-align: right;
  text-shadow: 0 2px 12px #030819;
  overflow-wrap: anywhere;
}
.stage-brand {
  left: clamp(28px, 5cqw, 85px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 34vw;
  overflow-wrap: anywhere;
}
.emblem {
  width: clamp(21px, 2.05cqw, 34px);
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background: #832c40 url("主题图概念稿.png") no-repeat;
  background-size: 2253% 1311%;
  background-position: 39.94% 5.28%;
}
.stage-brand[data-size="small"], .stage-event-title[data-size="small"] { font-size: clamp(10px, .78cqw, 13px); }
.stage-brand[data-size="medium"], .stage-event-title[data-size="medium"] { font-size: clamp(11px, 1.02cqw, 16px); }
.stage-brand[data-size="large"], .stage-event-title[data-size="large"] { font-size: clamp(13px, 1.28cqw, 20px); }
.cursor-trail {
  position: fixed;
  z-index: 9;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* Stage layout */
.stage-content {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: var(--stage-axis);
  width: var(--scene-width, min(50cqw, 760px));
  transform: translate(-50%, -50%);
  text-align: center;
}
.stage-opening {
  --scene-width: min(49cqw, 1360px);
  top: 48%;
  mix-blend-mode: screen;
}
.opening-title {
  color: #faf7f4;
  font: 300 clamp(42px, 5.05cqw, 87px)/1.22 var(--serif);
  letter-spacing: .14em;
  text-wrap: nowrap;
  text-shadow: 0 0 38px #9caefe72, 0 6px 42px #070d23;
}
.title-art {
  display: none;
  position: relative;
  width: 100%;
  aspect-ratio: 825 / 353;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 3% 100%, 3% 76%, 0 76%);
  overflow: hidden;
}
.title-art img {
  position: absolute;
  left: -72.7273%;
  top: -58.6402%;
  width: 196.6061%;
  height: auto;
  max-width: none;
  filter: grayscale(1) brightness(.58) contrast(10);
}
.has-calligraphy .title-art { display: block; }
.has-calligraphy .title-fallback { display: none; }
.opening-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(11px, 1.28cqw, 26px);
  margin-top: clamp(12px, 2vh, 23px);
  color: #ced8f0;
  font: 400 clamp(13px, 1.25cqw, 20px)/1.4 var(--serif);
  letter-spacing: .2em;
}
.opening-kicker::before, .opening-kicker::after {
  content: "";
  width: clamp(16px, 3.1cqw, 48px);
  height: 1px;
  background: linear-gradient(90deg, transparent, #c4cee18a);
}
.opening-kicker::after { transform: scaleX(-1); }
.opening-start {
  min-width: 164px;
  min-height: 44px;
  margin-top: clamp(24px, 5vh, 54px);
  padding: 9px 24px;
  border: 1px solid #e3c99b91;
  border-radius: 2px;
  background: linear-gradient(132deg, #b9b6ee14, #212a4e4d 70%);
  box-shadow: inset 0 0 17px #e3c99b0c, 0 5px 22px #02061347;
  color: #f2dfba;
  font: 400 clamp(13px, 1.1cqw, 17px)/1.35 var(--serif);
  letter-spacing: .22em;
  text-indent: .22em;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.opening-start:hover {
  border-color: var(--warm);
  background-color: #a2836b30;
  box-shadow: 0 0 30px #d6b99829;
}
.stage-guidance {
  color: #c1cdea;
  font: 300 clamp(12px, 1.03cqw, 16px)/1.6 var(--stage-light);
  letter-spacing: .14em;
}
.stage-opening .stage-guidance { margin-top: clamp(13px, 2.1vh, 22px); }
.stage-opening button[hidden] + .stage-guidance { margin-top: clamp(28px, 5vh, 50px); }

.framed-surface {
  --art-ring: 46px;
  --art-strength: .69;
  isolation: isolate;
  border: 1px solid #9fb6db3b;
  border-radius: 5px;
  background: linear-gradient(145deg, #162440f5, #101b31f5 58%, #131d35f8);
  box-shadow: 0 18px 64px #02061475, inset 0 0 45px #9aabe410;
}
.framed-surface::before, .framed-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.framed-surface::before {
  z-index: -2;
  border-radius: inherit;
  background: url("assets/panel-frost.png") center / cover no-repeat;
  mix-blend-mode: screen;
  opacity: .22;
}
.framed-surface::after {
  z-index: -1;
  inset: 2px;
  border: 1px solid transparent;
  border-image: url("assets/dialog-frame.png") 155 195 / var(--art-ring) stretch;
  opacity: var(--art-strength);
}

.stage-panel {
  --art-ring: 52px;
  --art-strength: .66;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(16px, 3.2vh, 34px);
  max-height: 79dvh;
  padding: clamp(24px, 4.5vh, 50px) clamp(22px, 4cqw, 62px);
}
.stage-brief { --scene-width: min(41cqw, 960px); }
.round-index {
  color: var(--warm);
  font-family: var(--serif);
  font-size: clamp(11px, .92cqw, 19px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: .16em;
  line-height: 1.4;
}
.stage-award {
  color: #f7f4f6;
  font: 300 clamp(23px, 2.65cqw, 65px)/1.26 var(--stage-light);
  letter-spacing: .15em;
  text-indent: .15em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 25px #a9b8ef35;
}
.stage[data-premier="true"] .stage-award { color: #f5e7cc; }
.stage-award.long-copy {
  font-size: clamp(17px, 1.65cqw, 29px);
  letter-spacing: .067em;
}
.brief-details {
  display: grid;
  min-height: 0;
  overflow: auto;
  grid-template-columns: minmax(0, 1fr) minmax(85px, .55fr);
  align-items: stretch;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #13213a72;
}
.brief-details > div {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  gap: 9px;
  padding: clamp(10px, 2.05vh, 24px) 12px;
}
.brief-details > div + div { border-inline-start: 1px solid var(--line); }
.brief-details dt {
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(11px, .9cqw, 18px);
  line-height: 1.3;
  letter-spacing: .13em;
}
.brief-details dd {
  color: var(--ice);
  font: 300 clamp(16px, 1.36cqw, 29px)/1.38 var(--stage-light);
  letter-spacing: .08em;
  overflow-wrap: anywhere;
}
.brief-details #stage-round-count {
  color: var(--warm);
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-size: clamp(17px, 1.55cqw, 32px);
}
.stage-gift {
  color: #d2def5;
  font: 300 clamp(13px, 1.24cqw, 28px)/1.45 var(--stage-light);
  letter-spacing: .09em;
  overflow-wrap: anywhere;
}
.stage-gift.long-copy, .brief-details dd.long-copy {
  font-size: clamp(13px, 1.04cqw, 17px);
  letter-spacing: .045em;
}

/* Draw and winner lists */
.stage-draw {
  --scene-width: min(48cqw, 1120px);
  --reel-height: clamp(164px, 28dvh, 440px);
  --name-size: clamp(27px, 3.2cqw, 74px);
}
.draw-head { display: grid; gap: clamp(6px, 1.15vh, 13px); }
.draw-display {
  position: relative;
  display: grid;
  place-items: center;
  min-height: var(--reel-height);
  margin-top: clamp(8px, 1.6vh, 19px);
  isolation: isolate;
}
.reel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at center, #26355455, #17223c07 62%, transparent 79%);
  mask-image: linear-gradient(transparent 1%, #0009 25%, #000 36%, #000 64%, #0009 75%, transparent 99%);
}
.reel-cells { position: absolute; inset: 0; }
.reel-window {
  position: absolute;
  inset: 50% 7% auto;
  min-height: clamp(56px, 8.5dvh, 132px);
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, #7894cb1c 28%, #9ca8ea20 57%, transparent);
  border-block: 1px solid #c1d3f844;
  pointer-events: none;
}
.reel-window::before, .reel-window::after {
  content: "";
  position: absolute;
  top: calc(50% - 3px);
  width: 6px;
  aspect-ratio: 1;
  transform: rotate(45deg);
  border: 1px solid #e6cf9fa6;
}
.reel-window::before { left: -3px; }
.reel-window::after { right: -3px; }
.stage[data-phase="hold"] .reel-window {
  border-color: #d8c39c89;
  background: linear-gradient(90deg, transparent, #ab96d430 28%, #c2b0d030 63%, transparent);
}
.reel-cell, .settled-name {
  width: 80%;
  color: #fcf9f6;
  font: 300 clamp(12px, calc(var(--scene-width) / var(--glyphs, 3) * .65), var(--name-size))/1.26 var(--stage-light);
  letter-spacing: .15em;
  text-indent: .15em;
  text-shadow: 0 2px 19px #adc4fd63, 0 5px 25px #040817;
}
.reel-cell {
  position: absolute;
  top: 50%;
  left: 50%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transform: translate3d(-50%, calc(-50% + var(--wheel-y, 0px)), 0) scale(var(--wheel-scale, 1));
  will-change: transform, opacity;
}
.settled-name {
  z-index: 1;
  overflow-wrap: anywhere;
}
.stage[data-premier="true"] .settled-name { color: #fff3da; }
.draw-foot {
  display: grid;
  justify-items: center;
  gap: 9px;
  margin-top: clamp(2px, .8vh, 9px);
}
.draw-marks { display: flex; gap: 12px; padding-block: 4px; }
.draw-marks:empty { display: none; }
.draw-marks i {
  width: 6px;
  aspect-ratio: 1;
  transform: rotate(45deg);
  border: 1px solid #a8bde47f;
}
.draw-marks [data-status="current"] { border-color: #c8bcff; box-shadow: 0 0 9px #bea8ff89; }
.draw-marks [data-status="done"] { border-color: #f1d4a6; background: #e3c99b; }
.stage-progress {
  color: #c2d0ec;
  font-size: clamp(11px, .94cqw, 15px);
  font-variant-numeric: tabular-nums;
  letter-spacing: .12em;
  line-height: 1.35;
}

.stage-round-result { --scene-width: min(52cqw, 1220px); }
.stage[data-wide="true"] .stage-round-result {
  --stage-axis: 57%;
  --scene-width: min(83cqw, 1640px);
}
.scroll-region {
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #7486ad #0c172d;
}
.winner-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  justify-content: center;
  gap: clamp(7px, .82cqw, 14px);
  padding: 3px;
  list-style: none;
  overflow: auto;
}
.winner {
  position: relative;
  flex: 0 1 clamp(90px, 7.5cqw, 208px);
  min-width: 0;
  min-height: clamp(48px, 6.8vh, 74px);
  display: grid;
  place-items: center;
  padding: 8px 8px 14px;
  color: #f0edf8;
  font: 300 clamp(16px, 1.56cqw, 37px)/1.32 var(--stage-light);
  letter-spacing: .095em;
  overflow-wrap: anywhere;
}
.winner::after {
  content: "";
  position: absolute;
  right: 17%;
  bottom: 4px;
  left: 17%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #a9b8df83 20%, #d9d0ffdc 50%, #a9b8df83 80%, transparent);
  box-shadow: 0 0 7px #a59bff35;
}
.winner:only-child {
  flex-basis: clamp(138px, 15cqw, 252px);
  min-height: clamp(52px, 8vh, 94px);
}
.stage[data-premier="true"] .winner { color: #f6e7cd; }
.stage[data-premier="true"] .winner::after {
  background: linear-gradient(90deg, transparent, #e4c89983 20%, #f4dfb7e0 50%, #e4c89983 80%, transparent);
}
.winner-grid[data-dense="true"] .winner {
  flex-basis: clamp(78px, 7.2cqw, 168px);
  min-height: clamp(34px, 5.15vh, 60px);
  font-size: clamp(14px, 1.26cqw, 30px);
}
.stage-total {
  --stage-axis: 63%;
  --scene-width: min(65cqw, 1500px);
}
.stage-total[data-dense="true"] {
  --stage-axis: 57%;
  --scene-width: min(83cqw, 1640px);
}
.stage-total .stage-award { font-size: clamp(24px, 2.45cqw, 62px); }
.stage-total .round-index { color: var(--muted); }
.stage-results-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1cqw, 16px);
  overflow: auto;
  padding: 3px;
}
.stage-result-group {
  min-width: 0;
  padding: clamp(11px, 1.3cqw, 21px);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(135deg, #263453a8, #131f37c4);
  text-align: start;
}
.stage-result-group[data-wide="true"], .stage-result-group:only-child { grid-column: 1 / -1; }
.stage-result-group header, .result-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.stage-result-group h3, .result-card h3, .history-card h4 {
  color: var(--warm);
  font: 300 clamp(16px, 1.42cqw, 28px)/1.32 var(--stage-light);
  letter-spacing: .1em;
  overflow-wrap: anywhere;
}
.stage-result-group header span, .result-card header span {
  color: var(--muted);
  flex: none;
  font-size: clamp(10px, .82cqw, 13px);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stage-result-prize, .result-card .gift-caption {
  margin-top: 4px;
  color: #c3cee5;
  font: 300 clamp(12px, 1cqw, 16px)/1.4 var(--stage-light);
  letter-spacing: .045em;
  overflow-wrap: anywhere;
}
.stage-result-names {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(62px, 100%), 1fr));
  gap: 5px 8px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}
.stage-result-names:empty { display: none; }
.stage-result-group[data-wide="true"] .stage-result-names {
  grid-template-columns: repeat(auto-fill, minmax(min(clamp(125px, 9.4cqw, 240px), 100%), 1fr));
}
.stage-total[data-dense="true"] .stage-result-group[data-wide="true"] .stage-result-names {
  grid-template-columns: repeat(auto-fill, minmax(min(clamp(74px, 6cqw, 133px), 100%), 1fr));
}
.stage-result-names li {
  min-width: 0;
  padding: 5px 2px;
  border-top: 1px solid #aabbe93b;
  color: #edf0fb;
  font: 300 clamp(14px, 1.23cqw, 28px)/1.4 var(--stage-light);
  letter-spacing: .065em;
  overflow-wrap: anywhere;
}

/* Tools and modal surfaces */
.stage-tools {
  position: fixed;
  z-index: 10;
  right: calc(max(20px, env(safe-area-inset-right)) + 39px);
  bottom: max(15px, env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  opacity: .58;
  transition: opacity .18s ease;
}
.stage-tools:hover, .stage-tools:focus-within { opacity: 1; }
.stage-tool {
  display: grid;
  place-items: center;
  width: 39px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #adbfe337;
  border-radius: 3px;
  background: #101b344f;
  color: #dde7fb;
  transition: background .18s ease, border-color .18s ease;
}
.stage-tool:hover, .stage-tool:focus-visible { background: #243452; border-color: #d0bb97; }
.stage-tool img { display: block; width: 25.6px; height: 25.6px; object-fit: contain; }
body.projector #show-settings { display: none; }

.overlay {
  --art-ring: 50px;
  --art-strength: .78;
  --modal-pad: clamp(27px, 4.15vw, 57px);
  --modal-foot: clamp(25px, 3.8vh, 37px);
  width: min(clamp(960px, 52vw, 1250px), calc(100% - 36px));
  max-width: none;
  max-height: min(87dvh, 845px);
  padding: 0;
  overflow: hidden;
  color: var(--white);
}
.overlay[open] { animation: modal-appear .23s ease-out both; }
@keyframes modal-appear { from { opacity: 0; translate: 0 8px; } }
.overlay::backdrop { background: #050a19ba; backdrop-filter: blur(6px); }
.overlay > .cursor-trail { position: absolute; z-index: 0; }
.overlay > :not(.cursor-trail) { position: relative; z-index: 1; }
.settings-dialog[open], .results-dialog[open] { display: flex; flex-direction: column; }
.settings-dialog { height: min(clamp(700px, 58vh, 820px), 87dvh); }
.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: clamp(22px, 3.7vh, 42px) var(--modal-pad) 12px;
}
.overlay-header h2, .confirm-dialog h2 {
  color: #fcf6ee;
  font: 400 clamp(21px, 1.9vw, 29px)/1.26 var(--serif);
  letter-spacing: .15em;
}
.major-tabs {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.2vw, 30px);
  flex: none;
  margin-inline: var(--modal-pad);
  border-bottom: 1px solid var(--line);
}
.major-tabs button {
  padding: 9px 2px 11px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--serif);
  letter-spacing: .1em;
  white-space: nowrap;
}
.major-tabs button[aria-selected="true"] { color: var(--warm); border-bottom-color: var(--warm); }
.major-tabs button:hover:not([aria-selected="true"]) { color: var(--white); }
.overlay-scroll {
  min-height: 0;
  margin-bottom: var(--modal-foot);
  padding: 18px var(--modal-pad) 6px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #7186ab #101c32;
}
.settings-dialog .overlay-scroll { flex: 1; margin-bottom: 10px; }
.overlay-notice {
  flex: none;
  margin: 0 var(--modal-pad) 10px;
  padding: 9px 12px;
  border: 1px solid #869bc363;
  border-radius: 3px;
  background: #1a2844;
  color: var(--ice);
  overflow-wrap: anywhere;
}
.overlay-notice[data-error="true"], .toast[data-error="true"] { color: var(--danger); }
.settings-footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin: 0 var(--modal-pad) var(--modal-foot);
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.autosave-status { flex: none; color: #aab9d4; font-size: 11px; letter-spacing: .04em; }
.autosave-status[data-error="true"] { color: var(--danger); }
.settings-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-heading h3, .settings-card h3, .batch-form h3 {
  color: #ebe9fa;
  font: 500 16px/1.32 var(--serif);
  letter-spacing: .08em;
}
.section-heading .hint, .settings-card > .hint, .batch-form > .hint { margin-top: 5px; }

.secondary-button, .primary-button, .quiet-button, .icon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--white);
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.secondary-button, .icon-button { background: #1c2a47b8; border-color: #7891bf73; }
.secondary-button:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #2b3b5b; border-color: #a3b9e3; }
.primary-button { background: #ddc59e; color: #1a2135; border-color: #f0d8b1; font-weight: 600; }
.primary-button:hover:not(:disabled) { background: #f2ddba; }
.quiet-button { color: #c4d0e8; }
.quiet-button:hover:not(:disabled) { background: #293857; border-color: #63799d; }
.icon-button { min-width: 34px; padding-inline: 6px; }
.overlay-close {
  min-height: 34px;
  background: #1522379c;
  color: var(--ice);
  font-size: 20px;
  font-weight: 300;
}
.panel-actions, .form-footer, .import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}
.panel-actions { justify-content: flex-end; margin-top: 12px; }
.form-footer { justify-content: space-between; }
.reset-button:hover:not(:disabled) { color: #ffd3cf; }

.field, .award-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #dce5f6;
}
input:not([type="range"], [type="checkbox"], [type="file"], [type="radio"]), select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--field-line);
  border-radius: 3px;
  background: var(--field);
  color: var(--white);
}
input:not([type="range"], [type="checkbox"], [type="file"], [type="radio"]), select {
  height: 36px;
  padding: 0 9px;
}
input::placeholder, textarea::placeholder { color: #9eaed0; }
input[data-field="name"], input[data-field="prize"], textarea { font-family: var(--stage-light); font-weight: 300; }
input[type="range"] { width: 100%; margin: 0; accent-color: #bcb0ee; }
input[type="checkbox"] { accent-color: #c2b5f6; }
.award-editor { display: grid; gap: 8px; }
.award-card, .settings-card, .batch-form, .people-form, .result-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.award-card {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 10px 12px;
}
.award-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(54px, 82px) minmax(0, 1.2fr);
  gap: 9px;
}
.award-fields label { font-size: 12px; }
.award-card .quiet-button { font-size: 12px; }
.empty-state {
  padding: 13px;
  border: 1px dashed #849ec275;
  border-radius: 3px;
  background: var(--field);
  color: var(--muted);
}

.order-layout, .sound-layout, .speed-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.order-layout { grid-template-columns: minmax(0, 1.47fr) minmax(0, 1fr); }
.queue-progress {
  margin-bottom: 8px;
  padding: 8px 10px;
  color: #e7e3fa;
  border: 1px solid #8499c079;
  border-radius: 2px;
  background: #30355787;
  font-size: 12px;
}
.queue-list { padding: 0; list-style: none; display: grid; gap: 6px; }
.queue-row {
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr) max-content max-content;
  align-items: center;
  gap: 7px;
  padding: 5px 7px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
}
.queue-row[data-status="done"] { color: #adbad4; }
.queue-row[data-status="active"], .queue-row[data-status="next"] { border-color: #d5ba8990; background: #49405078; }
.queue-row[data-status="active"] .queue-status, .queue-row[data-status="next"] .queue-status { color: #f3dcb3; }
.queue-row[draggable="true"] { cursor: grab; }
.queue-row[data-drop="before"] { box-shadow: inset 0 2px #d7cbff; }
.queue-row[data-drop="after"] { box-shadow: inset 0 -2px #d7cbff; }
.queue-row[data-dragging="true"] { opacity: .5; }
.drag-grip { color: #a5b6d9; font-size: 15px; line-height: 1; }
.queue-title { font-family: var(--stage-light); font-weight: 300; overflow-wrap: anywhere; }
.queue-title small { margin-inline-start: 7px; color: #c0cbe4; white-space: nowrap; }
.queue-status { color: var(--muted); white-space: nowrap; font-size: 11px; }
.queue-buttons { display: flex; gap: 3px; }
.queue-buttons .icon-button { min-width: 26px; min-height: 27px; padding-inline: 4px; }
.batch-form, .settings-card { padding: clamp(13px, 1.55vw, 21px); }
.batch-fields { display: grid; gap: 7px; margin: 13px 0; }
.batch-fields label { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 6px; align-items: center; }
.batch-fields label span { font-family: var(--stage-light); font-weight: 300; overflow-wrap: anywhere; }

.people-form { display: grid; gap: 9px; padding: 13px; }
.people-form > label { font-weight: 500; }
.checkbox-label { display: flex; align-items: center; gap: 6px; color: var(--ice); font-size: 13px; }
textarea { min-height: 78px; padding: 9px 10px; resize: vertical; }
.people-heading { margin-top: 20px; }
.people-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  list-style: none;
}
.people-list li {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3px;
  padding: 3px 4px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
}
.people-list li span { min-width: 0; font-family: var(--stage-light); font-weight: 300; overflow-wrap: anywhere; }
.people-list .quiet-button { min-height: 28px; padding-inline: 6px; font-size: 11px; }

.speed-settings { align-items: stretch; }
.speed-settings .panel-actions { grid-column: 1 / -1; margin-top: 0; }
.range-ticks { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 11px; }
.speed-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.speed-options label {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 10px 3px;
  border: 1px solid var(--field-line);
  border-radius: 3px;
  background: var(--field);
  color: var(--ice);
  cursor: pointer;
}
.speed-options input { position: absolute; opacity: 0; }
.speed-options label:has(input:checked) { color: #f8e5bd; border-color: #d9bc82a3; background: #4b405283; }
.speed-options label:has(input:focus-visible) { outline: 2px solid #ccd4ff; outline-offset: 3px; }
.speed-options label:has(input:disabled) { cursor: default; opacity: .56; }
.speed-options label span { font: 400 14px/1.2 var(--serif); white-space: nowrap; }
.speed-options label small { color: var(--muted); font-size: 10px; }

.switch-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 13px 0 10px; }
.switch-line input { width: 17px; height: 17px; }
.range-label { display: flex; justify-content: space-between; gap: 10px; margin: 11px 0 7px; color: var(--muted); }
.range-label output { color: var(--ice); white-space: nowrap; }
#test-effect { margin-top: 13px; }
.music-form .form-footer { margin-top: 12px; }
.music-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.music-controls button { min-width: 64px; }
#music-status { margin: 0; }
.import-actions { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }

.theme-layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(20px, 2.4vw, 34px);
  align-items: start;
}
.theme-fields { display: grid; gap: 15px; }
.theme-fields .field { font-size: 12px; }
.title-size-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-image-controls.logo-controls { padding-top: 0; border-top: 0; }
.theme-image-controls {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#theme-background, #theme-logo {
  height: auto;
  min-height: 42px;
  padding: 7px;
  font-size: 12px;
}
#theme-background::file-selector-button, #theme-logo::file-selector-button {
  margin-inline-end: 9px;
  padding: 6px 9px;
  border: 1px solid #7891bf73;
  border-radius: 2px;
  background: #1c2a47b8;
  color: var(--ice);
  font: inherit;
}
.theme-image-actions { margin-top: 8px; }
.logo-preview-row { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
.logo-preview-row .emblem { width: 28px; height: 28px; }
.logo-preview-row .hint { flex: 1; min-width: 0; }
.logo-preview-row .secondary-button { min-height: 31px; font-size: 11px; }
.theme-preview-wrap { min-width: 0; }
.field-label {
  margin-bottom: 6px;
  color: #dce5f6;
  font-size: 12px;
}
.theme-preview {
  position: relative;
  min-height: clamp(165px, 20vh, 242px);
  overflow: hidden;
  border: 1px solid #9caed23b;
  background: #111c39 url("assets/moon-stage.png") center / cover no-repeat;
  box-shadow: inset 0 0 0 999px #08112762;
}
.theme-preview::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #d5e0fa4a;
  pointer-events: none;
}
.theme-preview-brand {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 17px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 45%;
  color: #f6f1ea;
  font: 400 10px/1.45 var(--serif);
  letter-spacing: .1em;
  text-shadow: 0 2px 9px #030819;
}
.theme-preview-brand .emblem { width: 19px; height: 19px; }
.theme-preview > small {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 17px;
  max-width: 42%;
  color: #f6f1ea;
  font: 400 10px/1.45 var(--serif);
  letter-spacing: .1em;
  text-align: right;
  text-shadow: 0 2px 9px #030819;
}
.theme-preview .theme-preview-title {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #f6f1ea;
  font: 400 clamp(20px, 2.3vw, 31px)/1.2 var(--serif);
  letter-spacing: .3em;
  text-shadow: 0 2px 18px #030819;
}
.theme-preview-wrap > .hint { margin-top: 7px; }

.history-layout {
  display: grid;
  grid-template-columns: minmax(180px, .6fr) minmax(0, 1.4fr);
  align-items: start;
  gap: clamp(20px, 2.4vw, 35px);
}
.history-heading {
  color: var(--ice);
  font: 400 17px/1.35 var(--serif);
  letter-spacing: .1em;
}
.history-runs, .history-names { padding: 0; list-style: none; }
.history-runs, .history-results { display: grid; gap: 8px; margin-top: 12px; }
.history-run {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
  color: var(--ice);
  font-variant-numeric: tabular-nums;
}
.history-run:hover { border-color: #a7b9dd84; }
.history-run[aria-pressed="true"] { color: #f3dcb3; border-color: #d5ba8990; background: #49405078; }
.history-summary { margin-top: 4px; }
.history-names {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(87px, 100%), 1fr));
  gap: 6px;
  margin-top: 10px;
}
.history-names .result-slot {
  position: relative;
  min-height: 34px;
  padding: 6px 3px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ice);
  font: 300 14px/1.35 var(--stage-light);
}
.history-names .result-slot::after {
  content: "";
  position: absolute;
  right: 17%;
  bottom: 2px;
  left: 17%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #a9b8df83 20%, #d9d0ffcf 50%, #a9b8df83 80%, transparent);
}

.results-dialog { width: min(clamp(840px, 47vw, 1120px), calc(100% - 36px)); }
.results-progress { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.result-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-card { padding: 13px; }
.result-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.result-slots {
  display: grid;
  grid-template-columns: repeat(var(--slot-columns, 3), minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}
.result-slot {
  min-width: 0;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 4px 3px;
  border: 1px solid var(--field-line);
  border-radius: 2px;
  background: var(--field);
  color: #f2effb;
  font: 300 14px/1.35 var(--stage-light);
  letter-spacing: .05em;
  text-align: center;
  overflow-wrap: anywhere;
}
.result-slot[data-empty="true"] { border-color: var(--line); background: #101930a0; }
.result-slot[data-empty="true"]::after {
  content: "";
  width: min(60%, 24px);
  border-bottom: 1px solid #a0b5dc4f;
}
.confirm-dialog { --art-ring: 35px; width: min(440px, calc(100% - 36px)); padding: 34px; }
.confirm-dialog p { margin-top: 12px; color: var(--ice); line-height: 1.65; }
.confirm-dialog .panel-actions { margin-top: 18px; }
.toast {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: 25px;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 9px 14px;
  transform: translateX(-50%);
  border: 1px solid #879dc28a;
  border-radius: 3px;
  background: #14223bf5;
  box-shadow: 0 7px 22px #020614aa;
  color: var(--ice);
}

@media (max-height: 555px) {
  .stage-brand, .stage-event-title { top: 23px; }
  .stage-content { top: 51%; }
  .stage-panel { gap: 10px; max-height: 76dvh; padding-block: 18px; }
  .stage-opening { --scene-width: min(49cqw, 90vh); }
  .stage-draw { --reel-height: clamp(106px, 34dvh, 178px); }
  .opening-start { margin-top: 17px; }
  .stage-opening .stage-guidance { margin-top: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .snowfield, .cursor-trail { display: none; }
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
