:root {
  --bg: #1b1537; --bg2: #2a2154; --card: #fffaf0; --ink: #221a3d; --muted: #b7b0d6;
  --ok: #2fbf71; --no: #ef5b5b; --accent: #ffc94a; --line: rgba(255,255,255,.14);
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg));
  color: #fff; font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
#app {
  min-height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(16px + var(--safe-t)) 18px calc(18px + var(--safe-b));
}
h1 { font-size: 44px; line-height: 1; margin: 8px 0 6px; letter-spacing: -1px; }
h1 span { color: var(--accent); }
h2 { font-size: 24px; margin: 4px 0 14px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { min-width: 0; }
button, .btn {
  font: inherit; font-weight: 650; border: 0; border-radius: 16px; padding: 16px 18px;
  background: var(--accent); color: var(--ink); width: 100%; cursor: pointer; display: block;
  text-align: center; text-decoration: none; touch-action: manipulation;
}
button:active { transform: scale(.98); }
button.ghost { background: transparent; color: #fff; border: 1.5px solid var(--line); }
button.small { width: auto; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
button.icon { width: 46px; height: 46px; padding: 0; border-radius: 14px; flex: none; font-size: 22px; }
button:disabled { opacity: .45; }
input[type=text] {
  font: inherit; width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.07); color: #fff; outline: none; user-select: text; -webkit-user-select: text;
}
input[type=text]:focus { border-color: var(--accent); }
.panel { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.label { font-size: 14px; color: var(--muted); margin-bottom: 8px; display: block; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { width: auto; flex: 1 1 0; min-width: 64px; padding: 11px 8px; background: rgba(255,255,255,.08); color: #fff; font-size: 15px; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--ink); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.toggle input { width: 52px; height: 30px; appearance: none; -webkit-appearance: none; background: rgba(255,255,255,.18); border-radius: 30px; position: relative; flex: none; transition: .2s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked { background: var(--ok); }
.toggle input:checked::after { left: 25px; }
.scores { list-style: none; padding: 0; margin: 0; }
.scores li { display: flex; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 19px; }
.scores li:last-child { border: 0; }
.scores li.on { color: var(--accent); font-weight: 700; }
.scores b { font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 100%; transform-origin: left; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.timer { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.2ch; text-align: center; }
.timer.hot { color: var(--no); }
.pill { padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.1); font-weight: 650; font-variant-numeric: tabular-nums; }
.stage { flex: 1; display: grid; place-items: center; padding: 18px 0; touch-action: none; position: relative; }
.stage > * { grid-area: 1 / 1; }
.pausebox {
  z-index: 2; width: calc(100% - 32px); max-width: 360px; padding: 22px 18px; border-radius: 24px; text-align: center;
  background: rgba(27, 21, 55, .94); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.pausebox[hidden] { display: none; }
.pausebox h2 { margin: 0 0 16px; }
.pausebox button + button { margin-top: 12px; }
.pausebox p { font-size: 14px; margin-top: 12px; }
.card {
  width: 100%; min-height: 46vh; border-radius: 28px; background: var(--card); color: var(--ink);
  display: grid; place-items: center; padding: 24px; text-align: center; position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,.35); transition: transform .18s ease, opacity .18s ease;
}
.card .word { font-size: clamp(30px, 10vw, 52px); font-weight: 800; line-height: 1.1; overflow-wrap: break-word; hyphens: manual; }
.card .word.long { font-size: clamp(24px, 7.5vw, 38px); line-height: 1.2; }
.card .hint { position: absolute; left: 0; right: 0; font-size: 13px; color: #8d84ad; }
.card .hint.t { top: 14px; } .card .hint.b { bottom: 14px; }
.card.fly-up { transform: translateY(-120%) rotate(-4deg); opacity: 0; }
.card.fly-down { transform: translateY(120%) rotate(4deg); opacity: 0; }
.card.paused { visibility: hidden; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions button { padding: 22px 10px; font-size: 20px; border-radius: 20px; }
.actions .no { background: var(--no); color: #fff; }
.actions .ok { background: var(--ok); color: #fff; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.list li span { flex: 1; font-size: 18px; }
.list li button { width: 48px; height: 40px; padding: 0; border-radius: 12px; font-size: 20px; flex: none; }
.list li.ok button { background: var(--ok); color: #fff; }
.list li.no button { background: var(--no); color: #fff; }
.list li.no span { text-decoration: line-through; color: var(--muted); }
.big { font-size: 64px; font-weight: 800; line-height: 1; }
.center { text-align: center; }
.rules h3 { margin: 18px 0 6px; font-size: 18px; color: var(--accent); }
.rules ul { padding-left: 20px; margin: 6px 0; }
.rules li { margin: 4px 0; }
.confetti { font-size: 72px; text-align: center; margin: 10px 0; }
.foot { font-size: 13px; text-align: center; color: var(--muted); margin-top: 14px; }
