:root {
  color-scheme: light;
  --blue: #2563eb;
  --ink: #0f172a;
  --slate: #475569;
  --quiet: #64748b;
  --line: #e2e8f0;
  --page: #f1f5f9;
  --pale-blue: #eff6ff;
  --green: #166534;
  --red: #be123c;
  font: 16px/1.5 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
h1, h2, h3, p, ul, ol, dl { margin: 0; }
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button, a.button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #3b82f6; outline-offset: 3px; }
svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--quiet); }
.detail { font-size: .875rem; margin-top: 9px; }
.sidebar, .main { height: 100vh; height: 100dvh; }
.sidebar { width: 222px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; background: var(--ink); color: #cbd5e1; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px; color: white; font-size: 1.125rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.brand-icon { display: block; flex: none; width: 39px; height: 39px; border-radius: 9px; }
.sidebar nav { display: grid; gap: 6px; padding: 16px 12px; border-top: 1px solid #ffffff15; }
.sidebar nav button { display: flex; gap: 12px; align-items: center; border: 0; color: inherit; background: transparent; border-radius: 8px; padding: 11px 13px; font-size: .94rem; white-space: nowrap; }
.sidebar nav button:hover, .sidebar nav [aria-current] { background: #1e293b; color: #fff; }
.sidebar nav [aria-current] svg { color: #7fb0ff; }
.profile { margin-top: auto; border-top: 1px solid #ffffff15; padding: 17px 20px; display: flex; gap: 10px; align-items: center; font-size: .875rem; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 50%; color: #bfdbfe; background: #243650; }
.main { margin-left: 222px; overflow: auto; }
.content { padding: 28px; max-width: 1510px; margin-inline: auto; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr); gap: 19px; align-items: start; }
.settings-column { display: grid; gap: 17px; min-width: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 11px; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 17px; min-height: 54px; border-bottom: 1px solid #edf1f6; }
.panel-heading h2 { font-size: 1.06rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-heading h2 svg { color: var(--blue); }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px 9px; }
.panel-tools .button { min-height: 34px; }
.live .panel-heading h2, .brief .panel-heading h2 { flex: none; }
.panel-content { padding: 16px 17px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; background: transparent; border: 1px solid transparent; border-radius: 7px; min-height: 38px; padding: 7px 11px; font-weight: 600; font-size: .875rem; color: var(--ink); white-space: nowrap; line-height: 1.3; }
.button svg { width: 17px; height: 17px; }
.button.outline { border-color: var(--line); background: #fff; color: #334155; }
.button.outline:hover, .button.outline:focus-within { border-color: #aac6f7; color: #1d4ed8; background: #f8fbff; }
.button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button.primary:hover:enabled { background: #1d4ed8; }
.button.primary.stop { background: var(--red); border-color: var(--red); }
.button.primary.stop:hover:enabled { background: #9f1239; }
.button.text { color: #1d4ed8; padding: 4px 6px; min-height: 32px; }
.button.text:hover { background: var(--pale-blue); }
.input { width: 100%; border: 1px solid #cbd5e1; border-radius: 7px; background: white; min-height: 42px; padding: 8px 10px; color: var(--ink); }
.input::placeholder { color: var(--quiet); }
textarea.input { resize: vertical; }
.field { display: grid; gap: 7px; margin-top: 15px; color: #334155; font-weight: 600; font-size: .9rem; }
.field .input { font-weight: 400; }
.field.compact .input { max-width: 115px; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 7px; color: #334155; font-size: .9rem; }
#draw-modes[hidden] + .field { margin-top: 0; }
.mode-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.mode-choice legend { padding: 0; margin-bottom: 8px; color: #334155; font-size: .9rem; font-weight: 600; }
.mode-choice label { display: grid; cursor: pointer; }
.mode-choice input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.mode-choice label span { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fafcff; font-size: .875rem; }
.mode-choice label svg { color: #386bc4; }
.mode-choice input:checked + span { border-color: #80adff; background: var(--pale-blue); color: #123b87; }
.mode-choice input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.prize-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 62px 32px; gap: 7px 6px; align-items: end; margin-bottom: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.prize-fields .field { margin: 0; font-size: .78rem; }
.prize-image-field { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.prize-image-field .upload { min-height: 34px; }
.prize-image-field .upload:has(input:disabled) { opacity: .6; cursor: wait; }
.prize-image-field > .muted { font-size: .85rem; }
.prize-thumbnail { display: block; width: 45px; height: 45px; flex: none; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; object-fit: contain; }
.icon-button { display: grid; place-items: center; width: 33px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--slate); }
.icon-button:hover { background: var(--page); color: var(--ink); }
.count { display: inline-block; background: var(--pale-blue); color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: .78rem; white-space: nowrap; }
.roster-tools { display: flex; flex-wrap: wrap; gap: 7px; }
.upload { position: relative; cursor: pointer; }
.upload input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.empty { color: var(--quiet); font-size: .9rem; padding: 21px 14px; text-align: center; }
.people { padding-left: 0; list-style: none; display: flex; align-content: flex-start; flex-wrap: wrap; max-height: 210px; overflow: auto; gap: 6px; margin-top: 13px; }
.people li { min-width: 0; display: inline-flex; align-items: center; gap: 5px; background: #f1f5f9; border-radius: 6px; padding: 3px 4px 3px 8px; font-size: .875rem; }
.people li > span { overflow-wrap: anywhere; }
.people .icon-button { width: 27px; height: 27px; flex: none; }
.people .icon-button svg { width: 13px; height: 13px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.facts dt, .stats dt { color: var(--quiet); font-size: .82rem; }
.facts dd { margin: 4px 0 0; font-weight: 700; }
.brief-prizes { padding: 12px 0 0; margin-top: 12px; border-top: 1px solid var(--line); list-style: none; }
.brief-prizes li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; overflow-wrap: anywhere; }
.brief-prize-detail { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brief-prizes li > span { flex: none; font-size: .875rem; color: var(--quiet); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.status.online { color: var(--green); }
.stage { color: #edf5ff; border-radius: 9px; background: radial-gradient(ellipse at 50% 29%, #1e4589 0%, #152d56 40%, #101e39 75%); position: relative; isolation: isolate; overflow: hidden; }
.stage::before { content: ""; position: absolute; z-index: -1; inset: 0; background: repeating-radial-gradient(ellipse at 50% 119%, transparent 0 35px, #78a4ff17 36px 37px, transparent 38px 54px); pointer-events: none; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px; color: #c5dafa; font-size: .78rem; font-weight: 600; }
.stage-mode { border: 1px solid #80aeff4d; border-radius: 999px; padding: 4px 9px; color: #e5efff; background: #91b7ff18; white-space: nowrap; }
.stage-main { padding: 9px 15px 25px; min-height: 233px; display: grid; align-content: center; justify-items: center; text-align: center; }
.stage-title { max-width: 100%; margin-bottom: 4px; font-size: 1.22rem; overflow-wrap: anywhere; }
.stage-label { color: #bfdbfe; font-size: .93rem; font-weight: 650; overflow-wrap: anywhere; }
.stage-prize-image { display: block; width: min(100%, 180px); height: 106px; margin-top: 9px; border-radius: 8px; object-fit: contain; }
.stage-message, .reel { width: min(100%, 340px); margin: 10px 0; min-height: 66px; border: 1px solid #a4caff61; border-radius: 10px; background: #b9d4ff13; box-shadow: inset 0 0 28px #9fcaff13, 0 10px 34px #050f2b5e; }
.stage-message { padding: 7px 12px; display: grid; place-items: center; font-size: clamp(1.55rem, 2.6vw, 2.45rem); font-weight: 750; overflow-wrap: anywhere; }
.reel { display: none; height: 82px; overflow: hidden; position: relative; }
.reel span { width: 100%; padding: 0 8px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: absolute; top: 50%; font-weight: 800; font-size: clamp(1.5rem, 3.1vw, 2.4rem); animation: slide-name .145s linear forwards; }
@keyframes slide-name { from { transform: translateY(-22%); opacity: .45; } 35%, 70% { opacity: 1; } to { transform: translateY(-73%); opacity: .5; } }
.stage[data-phase=rolling] .reel { display: block; }
.stage[data-phase=rolling] .stage-message, .stage[data-phase=revealed] .stage-message { display: none; }
.stage-note { font-size: .82rem; color: #bed1ed; overflow-wrap: anywhere; }
.stage[data-phase=revealed] { background: radial-gradient(ellipse at 50% 28%, #244582 0%, #192e53 48%, #101e39 84%); }
.winners { list-style: none; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; overflow: auto; align-content: flex-start; width: 100%; gap: 6px; margin: 9px 0; max-height: 170px; }
.winners li { border: 1px solid #f6d58c70; border-radius: 8px; min-width: 0; padding: 6px 11px; background: #efce8217; color: #ffebbf; font-size: clamp(1rem, 2vw, 1.55rem); font-weight: 750; overflow-wrap: anywhere; }
.winners li small { margin-right: .4em; color: #f9d68a; font-size: .69em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0; text-align: center; padding: 10px 0; border: 1px solid #e7edf5; border-radius: 8px; background: #f8fafc; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dd { margin: 1px 0 0; font-size: 1.24rem; line-height: 1.35; font-weight: 750; font-variant-numeric: tabular-nums; }
.action-buttons { display: flex; gap: 8px; }
.action-buttons .primary { flex: 1; min-height: 46px; font-size: 1rem; }
.next { margin: 0 0 8px; font-size: .85rem; color: var(--slate); overflow-wrap: anywhere; }
.results { margin-top: 17px; }
.result-round + .result-round { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.result-round h3 { margin: 0 0 6px; font-size: 1rem; overflow-wrap: anywhere; }
.result-round ol { padding-left: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 5px 24px; color: #334155; overflow-wrap: anywhere; }
.history-list { padding: 5px 15px; }
.activity { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 7px; color: var(--ink); }
.activity:last-child { border-bottom: 0; }
.activity:hover { background: #f8fafc; }
.activity span { display: block; overflow-wrap: anywhere; }
.activity small { color: var(--quiet); }
.activity .count { flex: none; }
.login { max-width: 520px; margin: 8vh auto; padding: 24px; }
.login p { margin: 8px 0 16px; color: var(--slate); }
dialog { width: min(485px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); box-shadow: 0 18px 66px #0f172a38; }
dialog::backdrop { background: #0f172a80; }
dialog header, dialog footer { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 17px; }
dialog h2 { font-size: 1.15rem; }
dialog header { border-bottom: 1px solid var(--line); }
dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-content { padding: 14px 17px; }
.dialog-content .field { margin: 0 0 7px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.directory-list { min-height: 84px; max-height: 37vh; overflow: auto; margin-top: 8px; }
.directory-list > * { display: flex; gap: 8px; align-items: center; width: 100%; min-height: 40px; text-align: left; padding: 4px 8px; overflow-wrap: anywhere; }
.directory-list .button { white-space: normal; justify-content: flex-start; }
.directory-list label { cursor: pointer; border-bottom: 1px solid #eef2f6; }
.directory-list input { width: 17px; height: 17px; accent-color: var(--blue); }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 20px; max-width: calc(100% - 40px); background: var(--ink); color: white; border-radius: 8px; padding: 10px 14px; box-shadow: 0 14px 25px #0f172a44; }
.toast.error { background: #9f1239; }
dialog .inline-notice { margin: 0 17px 12px; padding: 7px 9px; background: #fff1f2; color: #9f1239; border-radius: 6px; font-size: .875rem; }
.noscript { padding: 1rem; }

.projection { background: #101e39; }
.screen-stage { border-radius: 0; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.projection-header, .projection-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px clamp(15px, 4vw, 60px); }
.projection-header { border-bottom: 1px solid #adcbfa25; }
.projection-header .brand { padding: 0; }
.projection-footer { border-top: 1px solid #adcbfa25; color: #c5dafa; font-size: .88rem; }
.screen-tools { display: flex; align-items: center; gap: 12px; }
.screen-tools .status.online { color: #86efac; }
.screen-tools .button { color: #e8f1ff; border-color: #a2c4fa59; background: #ffffff13; }
.screen-tools .button:hover { background: #ffffff28; }
.projection-body { align-self: center; padding: 22px 20px; text-align: center; }
.projection-body .stage-head { justify-content: center; padding: 0 0 12px; font-size: clamp(.8rem, 1.2vw, 1.12rem); }
.projection-body h1 { font-size: clamp(1.95rem, 6vw, 5rem); line-height: 1.13; max-width: 94vw; overflow-wrap: anywhere; margin: auto; }
.projection-body .stage-main { padding: 21px 0 11px; min-height: 0; }
.projection-body .stage-label { font-size: clamp(1.05rem, 2vw, 1.8rem); }
.projection-body .stage-prize-image { width: min(72vw, 460px); height: clamp(90px, 24vh, 265px); }
.projection-body .stage-main:has(.stage-prize-image:not([hidden])) .winners { max-height: 29vh; }
.projection-body .stage-message, .projection-body .reel { width: min(84vw, 660px); min-height: clamp(92px, 20vh, 174px); margin: 16px 0; }
.projection-body .stage-message, .projection-body .reel span { font-size: clamp(2.1rem, 6vw, 5.35rem); }
.projection-body .stage-note { font-size: clamp(.9rem, 1.55vw, 1.32rem); }
.projection-body .winners { max-height: 47vh; max-width: 1120px; gap: 9px; margin: 15px auto; }
.projection-body .winners li { padding-inline: clamp(10px, 2vw, 26px); font-size: clamp(1.28rem, 3.6vw, 3.15rem); }
.projection-body .winners:has(> :nth-child(13)) li { font-size: clamp(1.05rem, 2vw, 1.75rem); }

@media (min-width: 761px) and (max-width: 1120px) {
  .sidebar { width: 174px; }
  .main { margin-left: 174px; }
  .content { padding-inline: 17px; }
  .dashboard { gap: 11px; }
  .panel-content, .panel-heading { padding-inline: 11px; }
}
@media (max-width: 760px) {
  .sidebar { position: relative; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 12px 15px; font-size: 1rem; }
  .brand-icon { width: 33px; height: 33px; }
  .profile { margin: 0 0 0 auto; padding: 0 14px 0 0; border: 0; }
  .avatar { display: none; }
  .sidebar nav { order: 3; flex-basis: 100%; display: flex; padding: 5px 10px; }
  .sidebar nav button { padding: 6px 9px; min-height: 38px; font-size: .875rem; }
  .sidebar nav svg { width: 16px; height: 16px; }
  .main { margin: 0; height: auto; overflow: visible; }
  .content { padding: 15px 12px calc(84px + env(safe-area-inset-bottom)); }
  .dashboard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .settings-column { gap: 12px; }
  #workspace.active-room .live { grid-row: 1; }
  .panel-heading { padding: 8px 11px; min-height: 45px; }
  .panel-content { padding: 11px; }
  .live-actions { position: fixed; inset: auto 0 0; z-index: 3; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
  .stage-main { min-height: 173px; padding-bottom: 16px; }
  .stats { margin: 9px 0 0; }
  .toast { right: 12px; bottom: calc(90px + env(safe-area-inset-bottom)); }
  .projection-header { padding-block: 9px; }
}
@media (max-width: 350px) {
  .mode-choice label span { padding: 7px 5px; }
  .roster-tools .button { padding-inline: 7px; gap: 4px; }
  .screen-tools { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .reel span { animation: none; transform: translateY(-50%); }
}
