:root {
  color-scheme: light;
  --ground: #faf8f7;
  --surface: #fff;
  --ink: #241c1d;
  --muted: #62575a;
  --line: #e8e0df;
  --accent: #972b4e;
  --soft: #f8e8eb;
  --stage: #20191c;
  --light: #fff7f3;
  --peach: #fbbda7;
  --radius: 14px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
main, section, .workspace, .rail, .draw-content { min-width: 0; }
p, h1, h2, dl, dd, ul, ol { margin: 0; }
p, h1, h2, li, label, #header-event { overflow-wrap: anywhere; }
a { color: var(--accent); }
button, input, textarea { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 3px solid #b24367; outline-offset: 4px; }
svg { width: 1.2rem; height: 1.2rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 2; padding: 10px; background: var(--surface); transform: translateY(-150%); }
.skip:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sidebar { padding: 25px 16px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 38px; }
.brand { display: flex; align-items: center; gap: 11px; padding-inline: 7px; text-decoration: none; white-space: nowrap; font-weight: 750; font-size: 1.16rem; line-height: 1.25; color: var(--ink); }
.brand small { display: block; color: var(--muted); font-size: .81rem; margin-top: 4px; font-weight: 500; }
.brand-mark { background: var(--accent); color: #fff; border-radius: 10px; display: grid; place-items: center; width: 42px; height: 42px; flex: none; }
.brand-mark svg { width: 26px; height: 26px; transform: rotate(-16deg); }
nav { display: grid; gap: 4px; }
nav a, .home-link { min-height: 44px; display: flex; gap: 11px; align-items: center; padding: 8px 11px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .925rem; font-weight: 610; }
nav a:hover, .home-link:hover, .secondary:hover { background: #f0e8e7; }
nav a[aria-current] { background: var(--soft); color: #79203e; }
.home-link { margin-top: auto; font-size: .85rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 3.5vw, 52px); border-bottom: 1px solid var(--line); min-height: 69px; font-size: .94rem; font-weight: 650; }
.topbar button { flex: none; }
.workspace { padding: 31px clamp(16px, 3.5vw, 52px) 44px; max-width: 1540px; margin-inline: auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 23px; }
h1 { font-size: clamp(1.55rem, 2.55vw, 2rem); font-weight: 760; line-height: 1.14; letter-spacing: -.035em; }
.page-head p { color: var(--muted); margin-top: 7px; max-width: 62ch; }
h2 { font-size: 1.13rem; line-height: 1.25; letter-spacing: -.02em; }
.button { min-height: 44px; border-radius: 8px; border: 1px solid transparent; padding: 8px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .9rem; font-weight: 700; transition: background-color .16s ease; }
.secondary { color: var(--ink); background: var(--surface); border-color: #d7ccce; }
.dark { color: #fff; background: var(--ink); }
.dark:hover { background: #4b333c; }
.primary { color: #2a1a1d; background: var(--peach); padding-inline: 23px; }
.primary:hover:not(:disabled) { background: #ffd2c3; }
.demo { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--soft); color: #6a2b43; padding: 10px 16px; border-radius: 10px; margin-bottom: 19px; font-size: .925rem; }
.demo .button { flex: none; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); margin-bottom: 20px; }
.stats div { padding: 13px 19px 12px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dt { font-size: .87rem; color: var(--muted); }
.stats dd { font-size: 1.78rem; font-weight: 680; letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1.22; margin-top: 3px; }
.dashboard, .manage-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.draw-card { background: var(--stage); color: var(--light); text-align: center; border-radius: var(--radius); overflow: hidden; padding: 8px 18px 27px; min-height: 372px; }
.draw-art { height: 187px; position: relative; isolation: isolate; display: grid; place-items: center; }
.orbit { position: absolute; border: 1px solid #6b4c57; border-radius: 50%; width: min(88%, 390px); height: 105px; transform: rotate(-14deg); opacity: .68; }
.orbit-b { width: min(70%, 310px); height: 138px; transform: rotate(16deg); opacity: .45; }
.star { color: #eaa88f; position: absolute; z-index: 1; width: 21px; height: 21px; background: currentColor; clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%); }
.star-a { top: 43px; left: 22%; }.star-b { right: 21%; top: 63px; width: 14px; height: 14px; }.star-c { right: 25%; bottom: 33px; width: 16px; height: 16px; }
.ticket { --ticket-fill: #f5b49d; position: absolute; width: min(49%, 191px); aspect-ratio: 2 / 1; background: var(--ticket-fill); border-radius: 8px; color: #532938; transform: rotate(-11deg); display: flex; align-items: center; text-align: left; padding: 6px 12%; padding-left: clamp(10px, 4vw, 27px); }
.ticket::before, .ticket::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--stage); top: calc(50% - 8px); }
.ticket::before { left: -8px; }.ticket::after { right: -8px; }
.ticket-back { --ticket-fill: #a95772; transform: translate(17px, 2px) rotate(12deg); }
.ticket-back::before { display: none; }
.ticket-front { transform: translate(-9px, -4px) rotate(-13deg); }
.ticket-front span { display: block; font: italic 700 clamp(.94rem, 2vw, 1.45rem)/1 Georgia, serif; }
.ticket-front strong { display: block; font-size: clamp(1.05rem, 2.6vw, 1.85rem); line-height: 1.12; letter-spacing: -.02em; }
.ticket-front i { position: absolute; inset: 9px 21% 9px auto; border-right: 1px dashed #9d5060; }
.draw-label { font-size: .94rem; font-weight: 730; color: var(--peach); }
.draw-content h2 { font-size: clamp(1.45rem, 2.75vw, 2.05rem); margin-top: 3px; }
.draw-note { color: #d7c6ca; font-size: .925rem; margin: 6px 0 16px; }
.rail { display: grid; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.panel-head { padding: 8px 15px; border-bottom: 1px solid var(--line); min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head a { display: inline-flex; align-items: center; min-height: 44px; font-size: .87rem; text-underline-offset: 3px; font-weight: 650; white-space: nowrap; }
.panel-head span { color: var(--muted); font-size: .83rem; text-align: right; }
.rows { padding: 0 15px; list-style: none; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; min-height: 43px; font-size: .925rem; }
.rows li + li { border-top: 1px solid var(--line); }
.row-label { font-weight: 620; }
.row-meta { color: var(--muted); font-size: .84rem; }
.rows .empty { color: var(--muted); }
.next { flex: none; color: #79203e; background: var(--soft); padding: 2px 8px; border-radius: 5px; font-weight: 650; }
.editor { display: grid; gap: 12px; padding: 20px; }
.editor .button[type="submit"], .editor > button:not(.quiet) { justify-self: start; }
label { font-size: .94rem; font-weight: 640; }
textarea, input { width: 100%; border: 1px solid #948489; border-radius: 8px; padding: 8px 10px; color: var(--ink); background: var(--surface); }
textarea { resize: vertical; min-height: 100px; }
.scroll-list { max-height: 31rem; overflow-y: auto; }
.history time { flex: none; }
.notice:not(:empty) { background: var(--soft); color: #6a2b43; border-radius: 8px; padding: 9px 13px; margin-bottom: 13px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: min(460px, calc(100% - 32px)); padding: 0; max-height: calc(100% - 32px); }
dialog::backdrop { background: #20191cd9; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; }
.quiet { border: 0; background: transparent; color: var(--accent); min-height: 44px; justify-self: start; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.error { color: #8f2442; }
.error:empty { display: none; }
#stage { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; color: var(--light); background: var(--stage); }
#stage-screen { display: flex; flex-direction: column; min-height: 100%; }
#stage-screen:fullscreen { background: var(--stage); overflow: auto; }
.stage-bar { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 8px; padding: 14px clamp(14px, 3vw, 34px); border-bottom: 1px solid #60464f; }
.stage-bar p { flex: 1 1 12rem; font-weight: 700; min-width: 0; }
.stage-button { color: var(--light); background: #392b31; border-color: #85646f; }
.stage-button:hover { background: #59414b; }
.stage-body { flex: 1; display: grid; align-content: center; justify-items: center; gap: 15px; padding: 36px 18px; text-align: center; }
.stage-ticket { display: grid; place-items: center; transform: rotate(-12deg); color: var(--peach); }
.stage-ticket svg { width: clamp(52px, 10vw, 106px); height: auto; }
.stage-body h2 { font-size: clamp(2rem, 7.5vw, 7rem); line-height: 1.02; max-width: min(95vw, 24ch); }
#stage-prize { font-size: clamp(1rem, 3vw, 2rem); color: #e4cbd2; }
#stage-error { color: #ffbbd0; }
#stage-draw { margin-top: 9px; }
.revealed #stage-result { animation: reveal .3s ease-out; }
@keyframes reveal { from { opacity: .45; transform: scale(.94); } to { opacity: 1; transform: none; } }
@media (max-width: 960px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px clamp(16px, 3.5vw, 52px); gap: 12px; }
  nav { display: flex; flex-wrap: wrap; }
  nav a { padding-inline: 9px; gap: 6px; }
  .home-link { display: none; }
}
@media (max-width: 690px) {
  .manage-grid { grid-template-columns: minmax(0, 1fr); }
  nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  nav a { flex-direction: column; justify-content: center; padding: 5px 1px; font-size: .8rem; gap: 3px; }
  .topbar { min-height: 58px; padding-block: 7px; }
  .workspace { padding-top: 22px; }
  .page-head, .demo { flex-wrap: wrap; }
  #overview { display: flex; flex-direction: column; }
  .dashboard { display: contents; }
  .draw-card { order: 1; }
  .stats { order: 2; margin-top: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail { order: 3; }
  .stats div:nth-child(odd) { border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .draw-art { height: 146px; }
  .draw-card { min-height: min-content; }
  .history li { align-items: start; flex-direction: column; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
