:root {
  --bg: #0c0d11;
  --surface: #14161c;
  --surface-2: #1c1f27;
  --unlocked: #262a35;
  --line: #242833;
  --line-2: #323745;
  --text: #eef0f5;
  --muted: #8a90a0;
  --accent: #ff6a55;
  --accent-2: #ffb547;
  --good: #3fd17f;
  --bad: #ff5d73;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(900px 500px at 50% -15%, rgba(255, 106, 85, .10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.game {
  max-width: 720px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- guesses ---------- */
.guesses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.guess {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .012);
  font-weight: 500;
  transition: border-color .2s, background .2s;
}
.guess .ico { flex: none; width: 18px; text-align: center; font-weight: 700; }
.guess .txt { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.guess .txt em { font-style: normal; color: var(--muted); }

.guess.active { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.guess.wrong {
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
  background: color-mix(in srgb, var(--bad) 7%, transparent);
}
.guess.wrong .ico { color: var(--bad); }
.guess.skipped { color: var(--muted); border-style: dashed; }
.guess.correct {
  border-color: color-mix(in srgb, var(--good) 45%, transparent);
  background: color-mix(in srgb, var(--good) 10%, transparent);
}
.guess.correct .ico { color: var(--good); }

/* ---------- timeline ---------- */
.timeline {
  position: relative;
  margin-top: 40px;
  padding-top: 30px;
}

.marker-label {
  position: absolute;
  top: 0;
  left: 0;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: left .35s ease;
}

.marker {
  position: absolute;
  top: 20px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--text);
  transform: translateX(-50%);
  transition: left .35s ease;
}

.bar {
  position: relative;
  height: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.unlocked,
.progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
}
.unlocked { background: var(--unlocked); transition: width .35s ease; }
.progress { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--bg);
}

/* ---------- play ---------- */
.play {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 28px auto;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b0e0a;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  transition: transform .15s ease, filter .15s ease;
}
.play:hover { transform: scale(1.05); filter: brightness(1.05); }
.play:active { transform: scale(.95); }
.play:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.play svg { width: 26px; height: 26px; }
.play .i-stop,
.play.playing .i-play { display: none; }
.play.playing .i-stop { display: block; }
.play.loading svg { opacity: 0; }
.play.loading::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(27, 14, 10, .3);
  border-top-color: #1b0e0a;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.play.error { animation: shake .35s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- search + skip ---------- */
.controls { display: flex; gap: 10px; }

.search { position: relative; flex: 1; min-width: 0; }
.search > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); }

.skip {
  flex: none;
  height: 48px;
  padding: 0 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.skip:hover { background: var(--unlocked); border-color: #3e4455; }

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #171920;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, .55);
}
.suggestions li {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
}
.suggestions li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.suggestions li .a { color: var(--muted); overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.suggestions li.active { background: var(--surface-2); }

/* ---------- result ---------- */
.result {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
}
.result .answer { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.result .answer span { color: var(--muted); margin-left: 8px; }
.result .score {
  flex: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b0e0a;
}
.result.lost .score { background: var(--surface-2); color: var(--muted); }

@media (max-width: 480px) {
  .game { padding: 20px 16px; }
  .guess { height: 44px; }
  .timeline { margin-top: 28px; }
  .play { margin: 22px auto; }
  .skip { padding: 0 18px; }
}
