/* Spin wheel (วงล้อสุ่ม) — everything scoped under .wh */
.wh > * { max-width: 40rem; margin-inline: auto; }
.wh .page-head > * { max-width: none; }
.wh .page-head { padding-bottom: clamp(1.8rem, 5vw, 3rem); }
.wh .page-head h1 { margin-bottom: .6rem; }
.wh .page-head .lede { margin: 0 0 .9rem; }
.wh .wh-privacy { display: inline-block; font-size: .95rem; background: var(--leaf); border: 2px solid var(--ink); border-radius: 999px; padding: .25rem .9rem; margin: 0; }
.wh .wh-privacy::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--leaf-ink); margin-right: .5rem; vertical-align: .1em; }
.wh .wh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wh [hidden] { display: none !important; }

/* ---------- stage: title, wheel, spin ---------- */
.wh .wh-stage { text-align: center; padding: .4rem 0 1.4rem; }
.wh .wh-wheel-title { font: 600 clamp(1.4rem, 5vw, 2rem)/1.25 var(--display); margin: 0 0 .9rem; overflow-wrap: anywhere; }
.wh .wh-wheel { position: relative; width: min(100%, 30rem); margin: 0 auto; padding-top: 18px; }
.wh .wh-wheel canvas { display: block; width: 100%; aspect-ratio: 1; height: auto; cursor: pointer; border-radius: 50%; box-shadow: 5px 6px 0 var(--ink); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.wh .is-spinning canvas { cursor: progress; }
.wh .wh-pointer { position: absolute; top: 0; left: 50%; width: 40px; height: 48px; margin-left: -20px; z-index: 2; transform-origin: 50% 8px; pointer-events: none; filter: drop-shadow(2px 2px 0 var(--ink)); }
.wh .wh-pointer svg { display: block; width: 100%; height: 100%; }
.wh .wh-spin { margin-top: 1.3rem; font-size: 1.45rem; padding: .85rem 2.6rem; min-height: 3.6rem; min-width: 12rem; border-radius: 18px; }
.wh .wh-hint { font-size: .9rem; color: var(--ink-2); margin: .7rem 0 0; }
.wh .wh-stage-bar { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }
.wh .wh-small { font-size: .95rem; padding: .5rem .95rem; min-height: 2.75rem; box-shadow: 3px 3px 0 var(--ink); }
.wh .wh-small[aria-pressed="true"] { background: var(--leaf); }

/* presentation mode (CSS fallback + real fullscreen) */
.wh-noscroll, .wh-noscroll body { overflow: hidden; }
.wh .wh-stage.is-present { position: fixed; inset: 0; z-index: 1000; max-width: none; margin: 0; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); overflow: auto; }
.wh .wh-stage.is-present .wh-wheel { width: min(92vw, calc(100vh - 13rem), 52rem); width: min(92vw, calc(100dvh - 13rem), 52rem); }
.wh .wh-stage.is-present .wh-wheel-title { font-size: clamp(1.6rem, 4.5vmin, 3rem); margin-bottom: .6rem; }
.wh .wh-stage.is-present .wh-hint { display: none; }
.wh .wh-stage:fullscreen { background: var(--paper); }

/* ---------- result dialog ---------- */
.wh .wh-dialog { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: transparent; position: fixed; inset: 0; }
.wh .wh-dialog[open] { display: flex; align-items: center; justify-content: center; }
.wh .wh-dialog::backdrop { background: rgba(31, 42, 68, .35); }
.wh .wh-dialog:not(:modal)[open] { background: rgba(31, 42, 68, .35); z-index: 1001; }
.wh .wh-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wh .wh-card { position: relative; width: min(92vw, 28rem); background: #fff; border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: 6px 6px 0 var(--ink); padding: 1.4rem 1.2rem 1.2rem; text-align: center; }
.wh .wh-win-title { margin: 0; font: 500 1rem/1.3 var(--display); color: var(--ink-2); overflow-wrap: anywhere; }
.wh .wh-win-name { margin: .35rem 0 1.2rem; font: 600 clamp(2rem, 9vw, 3.2rem)/1.2 var(--display); overflow-wrap: anywhere; }
.wh .wh-card .btns { flex-direction: column; gap: .6rem; }
.wh .wh-card .btn { width: 100%; text-align: center; white-space: normal; min-height: 3.1rem; }

/* ---------- editor ---------- */
.wh .wh-box { background: #fff; border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); padding: 1.15rem; margin-top: 1.2rem; }
.wh .wh-field + .wh-field { margin-top: .9rem; }
.wh .wh-field label, .wh .wh-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font: 600 1rem/1.35 var(--display); margin-bottom: .35rem; }
.wh .wh-opt, .wh .wh-count { font: 400 .88rem var(--body); color: var(--ink-2); }
.wh .wh-count { font-weight: 600; color: var(--leaf-ink); }
.wh input[type="text"], .wh textarea { width: 100%; font: 400 1.1rem/1.45 var(--body); color: var(--ink); background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; padding: .65rem .85rem; }
.wh textarea { min-height: 11rem; resize: vertical; }
.wh textarea[readonly] { opacity: .7; }
.wh input[type="text"]:focus, .wh textarea:focus { outline: none; border-color: var(--leaf-ink); box-shadow: 0 0 0 3px var(--leaf); background: #fff; }
.wh .wh-warn { color: #9a5b00; font-size: .92rem; margin: .4rem 0 0; }
.wh .wh-warn:empty { display: none; }
.wh .wh-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; margin-top: .8rem; }
.wh .wh-tools .btn { width: 100%; text-align: center; }
.wh .wh-fill { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .9rem; border-top: 1.5px solid var(--rule); }
.wh .wh-fill label { font: 600 1rem var(--display); }
.wh .wh-fill input[type="text"] { width: 5.5rem; text-align: center; padding: .5rem; }
.wh .wh-status { font-size: .95rem; margin: .7rem 0 0; min-height: 1.4em; }
.wh .wh-link { background: none; border: 0; padding: .2rem .1rem; font: inherit; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--coin); text-decoration-thickness: 2px; text-underline-offset: .2em; cursor: pointer; }
.wh .wh-note { font-size: .9rem; color: var(--ink-2); margin: .6rem 0 0; }
.wh .wh-linknote { background: var(--leaf); border: 2px solid var(--ink); border-radius: 14px; padding: .6rem .8rem; font-size: .95rem; margin: 0 0 .9rem; }
.wh .wh-share-out { margin-top: .6rem; font-size: .85rem !important; }
.wh .wh-share-msg { font-size: .95rem; margin: .5rem 0 0; color: var(--leaf-ink); }
.wh .wh-share-msg:empty { display: none; }

/* ---------- history ---------- */
.wh .wh-history-box h2 { font: 600 1.25rem/1.3 var(--display); margin: 0 0 .5rem; }
.wh .wh-history { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow: auto; }
.wh .wh-history li { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-top: 1.5px solid var(--rule); }
.wh .wh-history li:first-child { border-top: 0; }
.wh .wh-history li:first-child b { color: var(--leaf-ink); }
.wh .wh-history b { font-weight: 600; overflow-wrap: anywhere; }
.wh .wh-history span { color: var(--ink-2); font-size: .85rem; white-space: nowrap; }
.wh .wh-history-box .btns { margin-top: .7rem; }

/* ---------- content ---------- */
.wh .section { padding-block: clamp(2.2rem, 6vw, 3.5rem); }
.wh .section > h2 { font-family: var(--display); font-weight: 600; text-transform: none; font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.2; margin-bottom: .9rem; }
.wh .wh-steps { padding-left: 1.4rem; line-height: 1.7; }
.wh .wh-steps li { margin-bottom: .55rem; }
.wh .wh-faq details { border-top: 1.5px solid var(--rule); padding: .85rem 0; }
.wh .wh-faq summary { font-weight: 600; cursor: pointer; }
.wh .wh-faq details p { margin: .5rem 0 0; }
.wh .wh-end { border-top: 2.5px solid var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .wh .btn { transition: none; }
}
