/* FairWheel. Reference: a prize wheel standing next to the whiteboard, with an amber flag on top.
   One memorable element: the wheel and its flag. Everything else stays quiet. */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #161b33;
  --muted: #5a6178;
  --line: #e3e6ef;
  --primary: #3d4ed8;
  --primary-dark: #2f3cb5;
  --accent: #e8a33d;
  --soft: #eef0fb;
  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --head: "Fredoka", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--body); }
img, svg, canvas { max-width: 100%; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 48px; }
h2 { font-size: 28px; }
h3 { font-size: 18px; }
p { margin: 0 0 16px; }
code { font-size: 14px; background: var(--soft); padding: 2px 4px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 14px; color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 2px solid var(--primary); border-radius: var(--radius); background: var(--primary); color: #fff;
  font: 600 16px/1 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-line { background: var(--card); color: var(--primary); }
.btn-line:hover { background: var(--soft); color: var(--primary-dark); }
.btn-small { min-height: 44px; padding: 0 12px; font-size: 14px; background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-small:hover { background: var(--soft); color: var(--ink); border-color: var(--line); }
.btn-big { min-height: 56px; padding: 0 32px; font: 700 22px/1 var(--head); letter-spacing: .5px; }

/* header and footer */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 700 22px/1 var(--head); }
.brand:hover { color: var(--ink); }
.top-nav { display: flex; gap: 24px; }
.top-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.top-nav a:hover { color: var(--ink); }
.foot { margin-top: 64px; background: var(--ink); color: #c9cde0; padding: 48px 0 24px; }
.foot-row { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.foot-brand { font: 700 22px/1.2 var(--head); color: #fff; margin-bottom: 8px; }
.foot-say { max-width: 420px; }
.foot-nav { display: flex; flex-direction: column; gap: 8px; }
.foot-nav a { color: #fff; text-decoration: none; }
.foot-nav a:hover { color: var(--accent); }
.foot-copy { margin-top: 32px; font-size: 14px; color: #9aa0b8; }

/* key facts (under the intro heading) */
.facts { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }

/* the tool: it is the first screen. Title sits in the right column on desktop, above the wheel on phones */
.fw-app { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "stage head" "stage panel";
  grid-template-rows: auto 1fr; gap: 16px 32px; align-items: start; padding-top: 24px; }
.fw-head { grid-area: head; }
.fw-head h1 { font-size: 36px; margin-bottom: 8px; }
.fw-sub { color: var(--muted); margin: 0; }
.fw-stage { grid-area: stage; }
.fw-panel { grid-area: panel; }
.fw-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
/* the pointer sits on the right, so the winning name reads left to right */
.fw-wheel-box { position: relative; width: 100%; max-width: min(644px, max(324px, 100vh - 186px)); padding-right: 24px; }
.fw-pointer { position: absolute; top: 50%; right: 0; width: 48px; height: 40px; transform: translateY(-50%); z-index: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.fw-wheel { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.fw-hint { position: absolute; top: 27%; left: calc((100% - 24px) / 2); transform: translate(-50%, -50%); z-index: 2; margin: 0; padding: 8px 16px;
  border-radius: 999px; background: rgba(22, 27, 51, .84); color: #fff; font: 600 16px/1.3 var(--body); white-space: nowrap; pointer-events: none; }
.fw-wheel canvas { display: block; width: 100%; height: 100%; }
.is-spinning .fw-wheel { cursor: progress; }
.fw-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.fw-wheel-title { margin: 0; max-width: 100%; font: 700 28px/1.2 var(--head); text-align: center; word-break: break-word; }
.has-title .fw-wheel-box { max-width: min(600px, max(324px, 100vh - 236px)); }
.fw-tip { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.fw-settings { display: flex; flex-direction: column; gap: 16px; }
.fw-field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.fw-field input[type=text] { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: 400 16px var(--body); color: var(--ink); }
.fw-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--soft); border-radius: var(--radius); padding: 4px; }
.fw-seg label { position: relative; }
.fw-seg input { position: absolute; opacity: 0; inset: 0; }
.fw-seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; text-align: center; }
.fw-seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.fw-seg input:focus-visible + span { outline: 3px solid var(--accent); }
.fw-settings .fw-check { font-size: 14px; font-weight: 600; }
.fw-check input:disabled { opacity: .5; }
/* Hide list: the wheel takes the whole width */
.fw-nolist { grid-template-columns: 1fr; grid-template-areas: "head" "stage"; }
.fw-nolist .fw-panel { display: none; }
.fw-nolist .fw-head { text-align: center; }
.fw-nolist .fw-wheel-box { max-width: min(760px, max(324px, 100vh - 300px)); }
.fw-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.fw-live { min-height: 24px; margin: 0; font-weight: 600; text-align: center; }

.fw-result { position: absolute; inset: 0 24px 0 0; display: flex; align-items: center; justify-content: center; z-index: 3; }
.fw-result[hidden] { display: none; }
.fw-result-card { width: min(92%, 440px); max-height: 92%; overflow: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-2); border: 3px solid var(--accent); padding: 24px; text-align: center; }
.fw-result-kicker { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.fw-result-title { font-size: 36px; word-break: break-word; margin-bottom: 12px; }
.fw-result-body ol { text-align: left; margin: 0 auto 12px; max-width: 280px; padding-left: 24px; }
.fw-result-note { font-size: 14px; color: var(--muted); margin-bottom: 12px; min-height: 0; }
.fw-result-note:empty { display: none; }
.fw-result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fw-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; text-align: left; margin-bottom: 12px; }
.fw-team { background: var(--soft); border-radius: 8px; padding: 12px; }
.fw-team-name { font-weight: 600; margin: 0 0 4px; }
.fw-team ul { margin: 0; padding-left: 18px; font-size: 14px; }

.fw-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 16px; }
.fw-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--soft); border-radius: var(--radius); padding: 4px; margin-bottom: 12px; }
.fw-modes label { position: relative; }
.fw-modes input { position: absolute; opacity: 0; inset: 0; }
.fw-modes span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; text-align: center; }
.fw-modes input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.fw-modes input:focus-visible + span { outline: 3px solid var(--accent); }
.fw-opts { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.fw-opt[hidden] { display: none; }
.fw-opt input[type=number] { width: 72px; min-height: 44px; margin-left: 8px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; font: 600 16px var(--body); }
.fw-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.fw-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.fw-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.fw-tabs button { min-height: 44px; padding: 0 12px; border: 0; border-bottom: 3px solid transparent; background: none; font: 600 14px var(--body); color: var(--muted); cursor: pointer; }
.fw-tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--primary); }
.fw-count { display: inline-block; min-width: 24px; padding: 0 6px; border-radius: 999px; background: var(--soft); color: var(--primary); font-size: 12px; text-align: center; }
.fw-pane[hidden] { display: none; }
.fw-pane textarea { width: 100%; min-height: 240px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font: 400 16px/1.5 var(--body); color: var(--ink); background: #fcfcfe; }
.fw-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fw-sample { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.fw-sample select { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: 400 14px var(--body); background: var(--card); color: var(--ink); }
.fw-history { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.fw-history li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.fw-h-time { font-size: 12px; color: var(--muted); }
.fw-h-res { font-weight: 600; word-break: break-word; }
.fw-empty { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.fw-empty[hidden] { display: none; }
.fw-save { margin-top: 0; }
.fw-save input { flex: 1; min-width: 160px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: 400 16px var(--body); }
.fw-lists { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fw-lists li { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.fw-lists button { min-height: 44px; border: 0; background: var(--card); font: 600 14px var(--body); color: var(--ink); cursor: pointer; padding: 0 12px; }
.fw-lists button:hover { background: var(--soft); }
.fw-list-del { color: var(--muted) !important; border-left: 1px solid var(--line) !important; }
.fw-msg { min-height: 24px; margin: 12px 0 0; font-size: 14px; color: var(--primary-dark); font-weight: 600; }

/* full screen */
.fw-app:fullscreen, .fw-app.fw-max { max-width: none; width: 100%; height: 100%; margin: 0; padding: 24px; background: var(--bg); overflow: auto;
  grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "stage panel"; grid-template-rows: auto; align-items: center; }
.fw-app:fullscreen .fw-head, .fw-app.fw-max .fw-head { display: none; }
.fw-app.fw-nolist:fullscreen, .fw-app.fw-nolist.fw-max { grid-template-columns: 1fr; grid-template-areas: "stage"; }
.fw-app.fw-nolist:fullscreen .fw-wheel-box, .fw-app.fw-nolist.fw-max .fw-wheel-box { max-width: min(86vh + 24px, 100%); }
.fw-app.fw-max { position: fixed; inset: 0; z-index: 50; }
.fw-app:fullscreen .fw-wheel-box, .fw-app.fw-max .fw-wheel-box { max-width: min(86vh + 24px, 100%); }
.fw-locked, .fw-locked body { overflow: hidden; }

/* content sections */
.intro, .how, .modes, .uses, .topic, .why, .fair, .room, .private, .faq, .cta { margin-top: 64px; }
.intro p, .why p, .private p, .fair-text p { max-width: 70ch; font-size: 18px; }
.steps { list-style: none; counter-reset: s; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.steps li { counter-increment: s; position: relative; padding-top: 56px; }
.steps li::before { content: counter(s); position: absolute; top: 0; left: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--ink); font: 700 22px/44px var(--head); text-align: center; }
.steps p { color: var(--muted); }
.mode-grid { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: auto auto; gap: 16px; margin-top: 24px; }
.mode { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.mode-wide { grid-row: span 2; background: var(--primary); border-color: var(--primary); color: #fff; }
.mode-wide h3 { font-size: 28px; }
.mode p { margin: 0; }
.why { border-left: 6px solid var(--accent); padding-left: 24px; }
.fair { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.fair-box { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 24px; }
.fair-box-title { font: 700 22px/1.2 var(--head); color: var(--accent); }
.fair-box p:last-child { margin: 0; }
.ticks { list-style: none; margin: 16px 0 0; padding: 0; max-width: 78ch; }
.ticks li { position: relative; padding: 12px 0 12px 32px; border-bottom: 1px solid var(--line); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 20px; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--soft); }
.qa { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.qa summary { cursor: pointer; padding: 16px 24px; font-weight: 600; font-size: 18px; list-style-position: outside; }
.qa p { padding: 0 24px 16px; margin: 0; color: var(--muted); max-width: 75ch; }
.cta { text-align: center; background: var(--soft); border-radius: var(--radius); padding: 48px 24px; }
.cta p { font: 700 22px/1.3 var(--head); }

/* one section per feature */
.topic > p { max-width: 70ch; font-size: 18px; }
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.topic-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.topic-grid h3 { margin-bottom: 8px; }
.topic-grid p { margin: 0; color: var(--muted); }
.fw-test-scroll { max-width: 560px; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.fw-test-out table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }
.fw-test-out thead th { position: sticky; top: 0; background: var(--card); }
.fw-test-out th, .fw-test-out td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.fw-test-out th { font-weight: 600; }
.fw-test-out td + td, .fw-test-out th + th { text-align: right; }
.fw-test-out p { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* inner pages */
/* wheel pages: question box, answer sets, team split, related wheels */
.fw-head .crumbs { margin-bottom: 8px; }
.fw-question { width: 100%; max-width: 560px; }
.fw-question input { width: 100%; min-height: 52px; padding: 0 16px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); font: 600 20px var(--body); text-align: center; }
.fw-question input:focus { border-color: var(--primary); outline: none; }
.fw-sets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.fw-sets .btn[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.fw-opt select { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: 600 14px var(--body); background: var(--card); color: var(--ink); }
.fw-opt #fw-teams { margin-left: 0; }
.wheel-page { margin-top: 64px; }
.wheel-prose { max-width: 75ch; }
.wheel-prose h2 { font-size: 28px; margin-top: 56px; }
.wheel-prose h2:first-child { margin-top: 0; }
.wheel-prose h3 { font-size: 20px; margin-top: 24px; }
.wheel-prose p, .wheel-prose li { font-size: 18px; }
.wheel-prose table { border-collapse: collapse; margin: 16px 0; font-size: 16px; background: var(--card); }
.wheel-prose th, .wheel-prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.wheel-page .faq, .related { margin-top: 64px; max-width: 75ch; }
.related-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.related-list li { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.related-list a { font: 700 20px/1.2 var(--head); text-decoration: none; }
.related-list span { color: var(--muted); }
.doc { padding-top: 32px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }
.lead { font-size: 18px; color: var(--muted); max-width: 70ch; }
.prose { max-width: 70ch; }
.prose h2 { font-size: 22px; margin-top: 32px; }
.prose ul { padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.doc-back { margin-top: 32px; }

@media (max-width: 900px) {
  .fw-app { grid-template-columns: 1fr; grid-template-areas: "head" "stage" "panel"; grid-template-rows: auto; }
  .fw-app:fullscreen, .fw-app.fw-max { grid-template-columns: 1fr; grid-template-areas: "stage" "panel"; }
  .steps { grid-template-columns: 1fr 1fr; }
  .fair { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  .top-nav { gap: 16px; }
  .top-nav a[href="/about"] { display: none; }
  .fw-app { padding-top: 16px; }
  .fw-head h1 { font-size: 28px; }
  .fw-sub { font-size: 14px; }
  .fw-controls .btn-big { width: 100%; }
  .fw-result-title { font-size: 28px; }
  .fw-result-card { padding: 16px; }
  .fw-hint { font-size: 14px; }
  .steps { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-wide { grid-row: auto; }
  .intro p, .why p, .private p, .fair-text p { font-size: 16px; }
  .wheel-prose p, .wheel-prose li { font-size: 16px; }
  .wheel-prose h2 { font-size: 24px; margin-top: 40px; }
  .wheel-page, .wheel-page .faq, .related { margin-top: 48px; }
  .fw-question input { font-size: 18px; }
  .intro, .how, .modes, .uses, .topic, .why, .fair, .room, .private, .faq, .cta { margin-top: 48px; }
  .topic-grid { grid-template-columns: 1fr; }
  .qa summary { padding: 16px; font-size: 16px; }
  .qa p { padding: 0 16px 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.fw-panel.is-locked { opacity: .6; }
