* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg0: #0b1220;
  --bg1: #121a2b;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --danger: #f87171;
  --ok: #34d399;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 40% -10%, rgba(129, 140, 248, 0.18), transparent),
    linear-gradient(160deg, var(--bg0), var(--bg1) 50%, #0f172a);
  line-height: 1.5;
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.nav { margin-bottom: 1.25rem; font-size: 0.9rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.header { margin-bottom: 1.5rem; }
.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.5rem;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, #e2e8f0, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lede { color: var(--muted); max-width: 36rem; }

.panel, .results {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  margin-bottom: 1rem;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  text-align: center;
}
.scorebar strong {
  display: block;
  font-size: 1.4rem;
  margin-top: 0.15rem;
}

.difficulty-panel {
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.diff-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.diff-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}
@media (max-width: 480px) {
  .diff-selector { grid-template-columns: repeat(2, 1fr); }
}
.diff-btn {
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.55rem 0.4rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.diff-btn:hover {
  border-color: rgba(129, 140, 248, 0.4);
  color: var(--text);
}
.diff-btn.active {
  color: #0b1220;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.diff-btn[data-difficulty="easy"].active {
  background: linear-gradient(90deg, #34d399, #2dd4bf);
}
.diff-btn[data-difficulty="hard"].active {
  background: linear-gradient(90deg, #f87171, #fb7185);
}
.diff-btn[data-difficulty="any"].active {
  background: linear-gradient(90deg, #818cf8, #a78bfa);
}
.diff-hint {
  margin-top: 0.55rem;
  font-size: 0.82rem;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.easy { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }
.badge.medium { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.badge.hard { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }

.clue {
  font-size: 1.1rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  min-height: 5.5rem;
}
.extra-clue {
  font-size: 0.98rem;
  line-height: 1.5;
  margin-bottom: 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.28);
  color: #ddd6fe;
}
.extra-clue strong {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4b5fd;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  outline: none;
}
input[type="text"]:focus {
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}
input:disabled { opacity: 0.6; }

.row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
#new-clue,
#extra-clue-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}
#extra-clue-btn:not(:disabled):hover {
  border-color: rgba(129, 140, 248, 0.45);
  background: rgba(129, 140, 248, 0.12);
}
#submit {
  color: #0b1220;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.muted { color: var(--muted); font-size: 0.85rem; }
.status {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--accent);
}
.status.error { color: var(--danger); }

.result-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.result-title.correct { color: var(--ok); }
.result-title.incorrect { color: var(--danger); }
.reveal {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}
.fun {
  margin-top: 0.65rem;
  color: #c4b5fd;
  font-size: 0.95rem;
}

.query-timer {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #94a3b8;
}
.query-timer.running { color: var(--accent); }
.query-timer.result-timer {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}