:root {
  --bg: #faf8ff;
  --surface: #ffffff;
  --surface-2: #f3f0fa;
  --text: #2a2638;
  --muted: #625c78;
  --border: #e4dff0;
  --accent: #6552e0;
  --accent-ink: #ffffff;
  --accent-soft: #ece8ff;
  --shadow: 0 1px 2px rgba(42, 38, 56, .06), 0 8px 24px rgba(42, 38, 56, .08);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15131d;
    --surface: #1e1b2a;
    --surface-2: #282437;
    --text: #ece9f5;
    --muted: #aaa4bf;
    --border: #353048;
    --accent: #b0a4ff;
    --accent-ink: #18152a;
    --accent-soft: #2c2745;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15131d;
  --surface: #1e1b2a;
  --surface-2: #282437;
  --text: #ece9f5;
  --muted: #aaa4bf;
  --border: #353048;
  --accent: #b0a4ff;
  --accent-ink: #18152a;
  --accent-soft: #2c2745;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
img, svg, canvas { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; margin-right: auto; white-space: nowrap; }
.brand svg { width: 32px; height: 32px; flex: none; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
@media (max-width: 480px) {
  .header-inner { gap: 6px; }
  .brand { gap: 8px; white-space: normal; line-height: 1.15; font-size: .95rem; }
  .brand span { max-width: 8em; }
  .brand svg { width: 28px; height: 28px; }
  .nav { gap: 0; }
  .nav a { padding: 8px; }
}

/* Tool */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 20px 0 28px; align-items: start; }
@media (max-width: 860px) { .tool { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 12px; } }

.wheel-area { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.wheel-wrap { position: relative; width: min(100%, 600px); aspect-ratio: 1; }
@media (min-width: 861px) { .wheel-wrap { width: min(100%, 600px, max(380px, calc(100vh - 190px))); } }
.wheel-wrap canvas { width: 100%; height: 100%; border-radius: 50%; box-shadow: var(--shadow); cursor: pointer; touch-action: manipulation; }
.pointer { position: absolute; left: 50%; top: -6px; width: 9%; min-width: 30px; transform: translateX(-50%); transform-origin: 50% 20%; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.pointer.tick { animation: tick .12s ease-out; }
@keyframes tick { 40% { transform: translateX(-50%) rotate(-14deg); } }
.hub {
  position: absolute; left: 50%; top: 50%; width: 20%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 4px solid var(--surface); background: var(--accent); color: var(--accent-ink);
  font-weight: 800; letter-spacing: .06em; font-size: clamp(.8rem, 2.6vw, 1.15rem); cursor: pointer;
  box-shadow: 0 4px 14px rgba(42, 38, 56, .28);
}
.hub:hover { filter: brightness(1.06); }
.hub:disabled { cursor: default; }
.wheel-hint { margin: 0; color: var(--muted); font-size: .9rem; text-align: center; }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint-touch { display: inline; }
  .hint-mouse { display: none; }
}
.wheel-tools { display: flex; gap: 8px; }
.wheel-area:fullscreen { background: var(--bg); justify-content: center; padding: 16px; }
.wheel-area:fullscreen .wheel-wrap { width: min(92vw, calc(100vh - 120px)); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px;
  border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.badge { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: .8rem; }
.tabpanel { padding: 14px; }
.tabpanel[hidden] { display: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: .92rem;
  text-decoration: none; color: var(--text);
}
.btn:disabled { opacity: .55; cursor: default; }
.btn:hover { border-color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-lg { min-height: 48px; padding: 10px 24px; font-size: 1rem; }
.entries {
  display: block; width: 100%; height: 300px; margin-top: 10px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); line-height: 1.7;
}
@media (max-width: 860px) { .entries { height: 220px; } }
.field-label { display: block; margin: 14px 0 8px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.style-opt {
  display: flex; flex-direction: column; gap: 6px; padding: 8px; text-align: left;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: .82rem; font-weight: 600;
}
.style-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatches { display: flex; height: 14px; border-radius: 4px; overflow: hidden; }
.swatches i { flex: 1; }
.results { list-style: none; margin: 0 0 12px; padding: 0; max-height: 380px; overflow: auto; }
.results li { display: flex; gap: 10px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.results li:last-child { border-bottom: 0; }
.results .n { color: var(--muted); font-size: .8rem; min-width: 28px; }
.results .name { font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.results time { color: var(--muted); font-size: .8rem; }
.empty { color: var(--muted); margin: 8px 0 14px; }

/* Winner dialog */
.winner { border: 0; border-radius: 18px; padding: 28px 24px 22px; width: min(92vw, 420px); text-align: center; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.winner::backdrop { background: rgba(20, 16, 34, .55); }
.winner p { margin: 0; color: var(--muted); font-weight: 600; }
.winner-name { margin: 8px 0 22px; font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; }
.winner .row { justify-content: center; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2147483647; }

/* Article */
.content { max-width: 860px; padding-bottom: 32px; }
.content h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.2; margin: 12px 0 16px; }
.content h2 { font-size: clamp(1.35rem, 3.4vw, 1.75rem); line-height: 1.25; margin: 48px 0 12px; }
.content h3 { font-size: 1.08rem; margin: 0 0 6px; }
.content p { margin: 0 0 14px; }
.content ul { padding-left: 22px; margin: 0 0 14px; }
.content li { margin-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card p { margin: 0; color: var(--muted); }
.card .eg { margin-top: 10px; font-size: .9rem; }
.step-num { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 10px; border-radius: 50%; background: var(--accent-soft); font-weight: 800; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style-position: outside; margin-left: 4px; }
.faq details p { padding: 0 16px 14px; margin: 0; color: var(--muted); }
.cta { margin: 48px 0 0; padding: 28px 20px; text-align: center; background: var(--accent-soft); border-radius: var(--radius); }
.cta h2 { margin-top: 0; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--muted); }
