/* Spin the Wheel: the wheel on its own board, choices beside it, everything else folded away. */
@media screen {
.wheel-page { --tool: var(--c-coral); --stage: #ffd9c8; --stage-dot: #eba98d; --wheel-edge: #14160f; --wheel-empty: #f1e9dc; --hub-lip: #7f9d14; }
[data-theme=dark] .wheel-page { --stage: #241a15; --stage-dot: #4b372d; --wheel-edge: #756f62; --wheel-empty: #2c2924; }

.layout { display: grid; grid-template-columns: minmax(0, 1.34fr) minmax(320px, 1fr); gap: clamp(20px, 3vw, 44px); align-items: start; }

/* Stage ─ the board the wheel sits on. Coral is this tool's color. */
.stage { --board: var(--stage); --board-dot: var(--stage-dot); position: sticky; top: 16px; display: flex; flex-direction: column; min-width: 0; padding: 12px clamp(12px, 2vw, 20px) clamp(12px, 2vw, 20px); border: 1.5px solid var(--edge); border-radius: var(--r-l); }
.stage-bar { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.stage-bar h2 { min-width: 0; margin-right: auto; padding-left: 4px; font-size: 1.125rem; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stage-bar .btn { min-height: 40px; color: var(--fg); font-size: .875rem; }
.stage-bar .btn:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); }
.to-editor { display: none; }

/* Sized so the title, the wheel and its result fit one desktop screen without scrolling. */
.wheel-wrap { --size: min(100%, 540px, max(260px, 100svh - 406px)); position: relative; width: var(--size); aspect-ratio: 1; margin: 24px auto 20px; container-type: inline-size; }
/* A solid edge under the wheel gives it thickness, like the lip under the primary button. */
.wheel-wrap::before { content: ""; position: absolute; inset: 1.1%; border-radius: 50%; background: #000; transform: translateY(2.4%); }
.disc { position: absolute; inset: 0; overflow: hidden; border-radius: 50%; }
#wheel { display: block; width: 100%; height: 100%; cursor: pointer; will-change: transform; }
.pointer { position: absolute; z-index: 2; top: -5.6%; left: 50%; width: 9.4%; margin-left: -4.7%; transform-origin: 50% 36%; filter: drop-shadow(0 2px 0 #14160f55); pointer-events: none; }
.pointer svg { display: block; width: 100%; height: auto; overflow: visible; }

/* The hub is the one primary action on this page. */
#spin { position: absolute; z-index: 1; top: 50%; left: 50%; display: grid; place-items: center; width: 23%; aspect-ratio: 1; margin: 0; padding: 0; transform: translate(-50%, -50%); border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-lime); color: var(--c-ink); box-shadow: 0 5px 0 var(--hub-lip); font: 900 1.125rem/1 var(--font); font-size: clamp(.875rem, 4.8cqi, 1.625rem); letter-spacing: .05em; text-transform: uppercase; cursor: pointer; transition: transform .08s, box-shadow .08s, background-color .12s; -webkit-tap-highlight-color: transparent; }
#spin:hover:enabled { background: #d6fc55; }
#spin:active:enabled { transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 1px 0 var(--hub-lip); }
#spin:focus-visible { outline: 3px solid var(--c-cream); outline-offset: 3px; }
#spin:disabled { background: #d7d6c5; color: #7c7b6a; box-shadow: 0 5px 0 #9c9b89; cursor: default; }
.is-spinning #spin { background: var(--c-lime); color: #14160f66; box-shadow: 0 2px 0 var(--hub-lip); transform: translate(-50%, calc(-50% + 3px)); }
.is-spinning #wheel { cursor: default; }

/* Result ─ a plain ticket while waiting, a lime one when there is a winner. */
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 86px; padding: 12px 12px 12px 18px; border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--surface); color: var(--fg); overflow-wrap: anywhere; }
/* One small line of labels, then the name. The box keeps its height so a win does not move the page. */
.result > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px .45em; min-width: 0; }
.result small, .result span { font: 700 .6875rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--fg-muted); }
.result span::before { content: "· "; }
.result span:empty { display: none; }
.result strong { order: 1; flex: 0 0 100%; font-size: clamp(1.25rem, 2.3vw, 1.75rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; transform-origin: 0 50%; }
.result:not(.is-win) strong { font-weight: 650; color: var(--fg-muted); }
/* A single short name is set large. Batches and long labels keep the regular size. */
.result.is-win:not(.is-long) strong { font-size: clamp(1.5rem, 3vw, 2.25rem); }
.result .btn { flex: none; }
.result.is-win { border-color: var(--c-ink); background: var(--c-lime); color: var(--c-ink); }
.result.is-win small, .result.is-win span { color: #39440d; }
.result.is-win .btn { border-color: var(--c-ink); background: var(--c-ink); color: var(--c-cream); }
.result.is-win .btn:disabled { opacity: .35; }

/* Landing burst ─ small pins thrown from the pointer. Pinned to the window so it can never add scroll. */
.burst { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }
.burst i, .burst b { position: absolute; }
.burst i { width: 18px; height: 18px; margin: -9px; border: 1.5px solid var(--c-ink); border-radius: 50% 50% 50% 0; background: radial-gradient(circle, var(--c-ink) 0 2.6px, transparent 3.2px) var(--p); }
.burst i.dot { width: 9px; height: 9px; margin: -4.5px; border-radius: 50%; background: var(--p); }
.burst b { width: 30px; height: 30px; margin: -15px; border: 3px solid var(--fg); border-radius: 50%; }

.stage:fullscreen { position: static; justify-content: center; padding: 3vmin; border: 0; border-radius: 0; overflow: auto; }
.stage:fullscreen .wheel-wrap { --size: min(100%, max(240px, 100svh - 284px)); }
.stage:fullscreen .result { width: min(100%, 760px); min-height: 112px; margin-inline: auto; }
.stage:fullscreen .result.is-win:not(.is-long) strong { font-size: clamp(2rem, 5.6vmin, 3.75rem); }
.stage:fullscreen .to-editor { display: none; }

/* Editor ─ the list comes first. Occasional things are folded below it. */
.editor { min-width: 0; padding-top: 6px; scroll-margin-top: 16px; }
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.editor-head h2 { font-size: 1.375rem; }
.count { min-width: 30px; padding: 3px 7px; border: 1.5px solid var(--edge); border-radius: 6px; font: 700 .8125rem/1.2 var(--font); font-variant-numeric: tabular-nums; text-align: center; }
.count:empty { display: none; }
.to-wheel { display: none; margin-left: auto; font-size: .875rem; font-weight: 600; }
#entries { min-height: 214px; resize: vertical; line-height: 1.5; scroll-margin-top: 72px; }
.hint b { font-weight: 700; color: var(--fg); white-space: nowrap; }
#status:not(:empty) { margin-top: 10px; padding: 9px 12px; border-left: 3px solid var(--tool); border-radius: 0 var(--r-s) var(--r-s) 0; background: var(--sunken); font-size: .875rem; font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.examples legend { float: left; margin-right: 6px; padding: 0; font-size: .8125rem; color: var(--fg-muted); }
.examples button { min-height: 36px; margin: 0; padding: 0 12px; border: 1px dashed var(--rule-strong); border-radius: 6px; background: transparent; color: var(--fg); font-size: .875rem; font-weight: 600; cursor: pointer; }
.examples button:hover { border-style: solid; border-color: var(--fg); }
.examples:disabled button { opacity: .45; cursor: default; }
.editor > .switch { margin: 12px 0 16px; }
.fold-body .field-label:not(:first-child) { margin-top: 14px; }
.fold-body .tools:first-child { margin-top: 0; }
.fold-body .hint + .tools { margin-top: 16px; }
.inline { display: flex; gap: 8px; }
.inline .field { width: 112px; }
.list { max-height: 236px; margin: 0; overflow: auto; overflow-wrap: anywhere; }
ol.list { padding-left: 1.7em; }
ol.list li { padding: 3px 0; }
ol.list:empty::after { content: "No draws yet."; display: block; margin-left: -1.7em; color: var(--fg-muted); font-size: .875rem; }
.odds-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: .9375rem; }
.odds-row span:last-child { flex: none; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 24px; }
  /* On a phone the board runs edge to edge so the wheel can be as large as the screen allows. */
  .stage { position: static; margin-inline: calc(-1 * var(--gutter)); padding: 8px var(--gutter) 16px; border-inline: 0; border-radius: 0; }
  .wheel-wrap { --size: min(100%, 460px, max(240px, 100svh - 308px)); margin: 24px auto 20px; }
  .to-editor, .to-wheel { display: inline-flex; }
  .to-wheel { align-items: center; min-height: 44px; }
  #fullscreen { width: 44px; padding: 0; font-size: 0; gap: 0; }
  .result { padding-left: 14px; }
  .examples button, .stage-bar .btn { min-height: 44px; }
  .examples legend { width: 100%; margin-bottom: 2px; }
}
}
