:root {
  --bg: #fff8f1;
  --card: #ffffff;
  --ink: #1f1b2e;
  --muted: #6b6578;
  --line: #ece4da;
  --accent: #ff5a36;
  --accent-ink: #ffffff;
  --accent-soft: #ffe6dd;
  --violet: #6c4cf5;
  --ok: #1f9d55;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(31, 27, 46, 0.06), 0 8px 24px rgba(31, 27, 46, 0.07);
  font-family: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; line-height: 1.45; }
a { color: var(--violet); }
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; margin-left: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 750; font-size: 16px; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 #d9431f; transition: transform 0.06s; min-height: 48px; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9431f; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--ink); box-shadow: 0 3px 0 #000; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { padding: 9px 15px; font-size: 14px; min-height: 38px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--violet); font-weight: 650; cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.err { color: #c92a2a; font-weight: 600; min-height: 1.2em; font-size: 15px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: #b8341a; font-weight: 700; font-size: 13px; }

/* Forms */
label.field { display: block; font-weight: 700; font-size: 15px; }
label.field span.hint { font-weight: 500; color: var(--muted); }
input[type='text'] { width: 100%; padding: 13px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 17px; margin-top: 6px; outline: none; }
input[type='text']:focus { border-color: var(--violet); }
.seg { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; padding: 10px 8px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed='true'] { border-color: var(--violet); background: #f0ecff; color: #4a2fd6; }
.stepper { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 22px; font-weight: 800; cursor: pointer; }
.stepper output { font-size: 22px; font-weight: 800; min-width: 2ch; text-align: center; }

/* Home */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 34px; align-items: center; padding: 26px 0 40px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 56px); font-weight: 850; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 19px; color: #3c3650; margin: 16px 0 22px; max-width: 34em; }
.hero .art { max-width: 460px; width: 100%; justify-self: center; }
.trust { margin-top: 14px; font-size: 14px; color: var(--muted); }
section.block { padding: 34px 0; }
section.block h2 { font-size: 28px; margin-bottom: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps .card b { display: block; font-size: 18px; margin: 6px 0 4px; }
.steps .num { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.faq details { background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.faq summary { font-weight: 750; cursor: pointer; }
.faq p { margin: 8px 0 0; color: #3c3650; }
footer.foot { padding: 30px 0 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 30px; }
footer.foot a { color: var(--muted); margin-right: 14px; }

/* Theme picker */
.picker h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 8px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.theme { text-align: left; border: 2px solid transparent; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; display: flex; gap: 12px; align-items: center; }
.theme:hover { border-color: #d9d0ff; }
.theme[aria-pressed='true'] { border-color: var(--violet); background: #f6f3ff; }
.theme .e { font-size: 28px; line-height: 1; }
.theme b { display: block; font-size: 16px; }
.theme small { color: var(--muted); font-size: 13px; display: block; }
.featured { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #1f6f4a, #155238); color: #fff; border-radius: 18px; padding: 16px; cursor: pointer; border: 0; width: 100%; text-align: left; }
.featured .e { font-size: 40px; }
.featured b { font-size: 19px; display: block; }
.featured small { opacity: 0.85; }

/* Sheet (modal) */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 16, 35, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: var(--bg); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px 28px; }
@media (min-width: 760px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.x { border: 0; background: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; box-shadow: var(--shadow); }

/* Chart */
.board { position: relative; width: 100%; aspect-ratio: 1; background: #fff; border-radius: 20px; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
.board svg.bg { border-radius: 20px; }
#boardwrap { padding-bottom: 16px; }
.board svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.board .lbl { position: absolute; font-weight: 800; font-size: 12.5px; color: #4b4560; background: rgba(255, 255, 255, 0.92); padding: 3px 8px; border-radius: 999px; white-space: nowrap; pointer-events: none; box-shadow: 0 0 0 1px var(--line); z-index: 1; }
.board .lbl.t { top: 8px; left: 50%; transform: translateX(-50%); }
.board .lbl.b { bottom: 8px; left: 50%; transform: translateX(-50%); }
.board .lbl.l { left: 6px; top: 50%; transform: translateY(-50%); }
.board .lbl.r { right: 6px; top: 50%; transform: translateY(-50%); }
.board .cell { position: absolute; width: 33.33%; height: 33.33%; display: flex; align-items: flex-start; justify-content: center; padding: 7px 5px 0; font-weight: 800; font-size: 11.5px; color: #8a83a0; text-align: center; pointer-events: none; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.15; }
.dot { position: absolute; width: 0; height: 0; z-index: 3; }
.dot .b { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); cursor: grab; }
.dot .n { position: absolute; top: 21px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; background: var(--ink); color: #fff; padding: 1px 7px; border-radius: 999px; white-space: nowrap; pointer-events: none; }
.dot.sel .b { outline: 3px solid var(--violet); outline-offset: 2px; }
.dot.dragging { z-index: 6; }
.dot.dragging .b { transform: scale(1.15); cursor: grabbing; }
.board.reveal .dot { transition: left 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.15), top 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.15); }
.ring { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2.5px dashed; opacity: 0; transition: opacity 0.6s; z-index: 2; pointer-events: none; }
.board svg.links { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
.board.rings .ring, .board.rings svg.links { opacity: 0.85; }
.hint-tap { position: absolute; inset: auto 0 38px 0; text-align: center; font-weight: 700; color: var(--muted); font-size: 14px; pointer-events: none; z-index: 1; }

/* Play page */
.chart-head { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; }
.chart-head .e { font-size: 34px; }
.chart-head h1 { font-size: 23px; }
.chart-head .line { color: var(--muted); font-size: 14px; font-weight: 600; }
.ask { font-size: 20px; font-weight: 800; margin: 14px 0 10px; display: flex; align-items: center; gap: 8px; min-height: 32px; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px; border-radius: 999px; background: #fff; border: 2px solid var(--line); font-weight: 700; cursor: pointer; font-size: 15px; }
.chip .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.chip.cur { border-color: var(--violet); background: #f3f0ff; }
.chip.placed { opacity: 0.75; }
.chip.placed::after { content: '✓'; color: var(--ok); font-weight: 900; }
.people { display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.person .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; }
.person .st { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 650; }
.person .st.ok { color: var(--ok); }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width 0.4s; }
.invite { background: var(--ink); color: #fff; }
.invite .muted { color: #c9c4d8; }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { margin: 0; font-size: 14px; background: #2d2840; border-color: #3d3756; color: #fff; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 700; z-index: 60; box-shadow: var(--shadow); }
.menu { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }

/* Results */
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.award { background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.award .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; flex: none; }
.award small { display: block; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.06em; }
.award b { font-size: 17px; }
.award p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.mine { background: linear-gradient(135deg, #6c4cf5, #9b5cf6); color: #fff; }
.mine .big { font-size: 22px; font-weight: 850; line-height: 1.2; }
.mine .muted { color: #e5dcff; }
.verdicts .v { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.verdicts .v:last-child { border-bottom: 0; }
.verdicts .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; flex: none; }
.verdicts .v div { font-size: 14.5px; }
.verdicts b { font-size: 15.5px; }
.next { background: #fff3d6; }

.play-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) {
  .play-grid { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); align-items: start; }
  .play-grid .side { position: sticky; top: 16px; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 8px; gap: 18px; }
  .hero .art { max-width: 340px; order: -1; }
  .steps { grid-template-columns: 1fr; }
  .top nav a.hide-sm { display: none; }
}
@media (max-width: 380px) {
  .board .lbl { font-size: 11px; padding: 2px 6px; }
  .board .cell { font-size: 10px; }
}
.hidden { display: none !important; }
