:root {
  --bg: #fff7ed;
  --bg-2: #ffedd5;
  --card: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --primary: #ea580c;
  --primary-2: #c2410c;
  --primary-ink: #ffffff;
  --accent: #7c3aed;
  --good: #16a34a;
  --bad: #dc2626;
  --chip: #fef3c7;
  --shadow: 0 6px 24px rgba(120, 53, 15, 0.12);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f;
    --bg-2: #221a15;
    --card: #2a211b;
    --text: #fafaf9;
    --muted: #a8a29e;
    --line: #3f342c;
    --primary: #fb923c;
    --primary-2: #f97316;
    --primary-ink: #1c1917;
    --accent: #a78bfa;
    --good: #4ade80;
    --bad: #f87171;
    --chip: #3b2f22;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% -20%, var(--bg-2), var(--bg) 60%);
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 30px; font-weight: 900; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; }
p { margin: 0 0 10px; line-height: 1.7; }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-ink);
  width: 100%;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--line);
}
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.small { width: auto; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

input[type="text"] {
  font: inherit;
  font-size: 17px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
input[type="text"]:focus { border-color: var(--primary); }

.add-row { display: flex; gap: 8px; }
.add-row .btn { width: auto; white-space: nowrap; }

.players { list-style: none; margin: 12px 0 0; padding: 0; }
.players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line);
}
.players li:last-child { border-bottom: 0; }
.players .name { flex: 1; font-weight: 700; font-size: 17px; }
.players .score {
  font-weight: 800;
  background: var(--chip);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 14px;
}
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.icon-btn:hover { color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.chip.on { background: var(--chip); border-color: var(--primary); }

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.setting:last-child { border-bottom: 0; }
.setting .label { font-weight: 700; }
.setting .hint { font-size: 13px; color: var(--muted); }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 10px;
  border: 2px solid var(--line); background: transparent; color: var(--text);
  font: inherit; font-size: 20px; font-weight: 800; cursor: pointer;
}
.stepper span { min-width: 24px; text-align: center; font-weight: 800; font-size: 18px; }

.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line); cursor: pointer;
  transition: background 0.15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: right 0.15s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { right: 23px; }

.hero { text-align: center; padding: 10px 0 18px; }
.hero .big-emoji { font-size: 56px; line-height: 1; margin-bottom: 6px; }

.reveal-box {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.word {
  font-size: 44px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.2;
  word-break: break-word;
}
.cat-tag {
  display: inline-block;
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 14px;
}
.who {
  font-size: 34px;
  font-weight: 900;
}
.progress { display: flex; gap: 6px; justify-content: center; margin: 6px 0 14px; flex-wrap: wrap; }
.progress i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.progress i.done { background: var(--primary); }

.order { list-style: none; padding: 0; margin: 0; counter-reset: n; }
.order li {
  counter-increment: n;
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; margin-bottom: 6px;
  border: 2px solid transparent; font-weight: 700; font-size: 18px;
  transition: background 0.15s, border-color 0.15s;
}
.order li::before {
  content: counter(n);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--line); display: grid; place-items: center; font-size: 14px; flex-shrink: 0;
}
.order li.current { background: var(--chip); border-color: var(--primary); }
.order li.current::before { background: var(--primary); color: var(--primary-ink); }
.order li.done { opacity: 0.5; }

.vote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote-grid button {
  border: 2px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 18px 8px; font: inherit; font-weight: 800; font-size: 17px;
  cursor: pointer; word-break: break-word;
}
.vote-grid button.sel { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--card)); }

.result-emoji { font-size: 70px; line-height: 1; }
.pair { display: flex; gap: 10px; margin: 12px 0; }
.pair > div {
  flex: 1; border-radius: 14px; padding: 12px; text-align: center; border: 2px solid var(--line);
}
.pair .lbl { font-size: 13px; color: var(--muted); font-weight: 700; }
.pair .w { font-size: 22px; font-weight: 900; }
.pair .odd { border-color: var(--accent); }
.pair .odd .w { color: var(--accent); }

.rules ol { padding-inline-start: 20px; margin: 0; }
.rules li { margin-bottom: 6px; line-height: 1.7; }

.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.link { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 15px; background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }

.badge-good { color: var(--good); font-weight: 800; }
.badge-bad { color: var(--bad); font-weight: 800; }

.fade-in { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Hub page */
.games { display: grid; gap: 12px; }
.game-card {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
}
.game-card .emo { font-size: 44px; }
.game-card .soon { opacity: 0.5; }
