:root {
  --bg: #0b0b0d;
  --panel: #141418;
  --panel-2: #1c1c22;
  --line: #2a2a32;
  --text: #ececf1;
  --muted: #8b8b97;
  --accent: #e8c547;
  --good: #3ecf72;
  --bad: #f05454;
  --skip: #5a5a66;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(11, 11, 13, .9); backdrop-filter: blur(8px); z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .18em; font-size: 18px; }
.brand span { color: var(--accent); }
.modes { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.mode { background: none; border: 0; padding: 7px 18px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.mode.active { background: var(--text); color: var(--bg); }
.top-spacer { width: 32px; }
.credit { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 32px; line-height: 1.6; }
.credit a { color: var(--text); }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--panel); }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }

/* Level + type pickers */
.controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.levels, .play-type { display: flex; gap: 6px; flex-wrap: wrap; }
.level, .pt {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.level:hover, .pt:hover { color: var(--text); }
.level.active { color: var(--bg); border-color: transparent; }
.level.active[data-level="easy"] { background: #3ecf72; }
.level.active[data-level="medium"] { background: #e8c547; }
.level.active[data-level="hard"] { background: #f08a3c; }
.level.active[data-level="impossible"] { background: #f05454; }
.pt.active { color: var(--text); border-color: var(--muted); }

/* Quote card */
.quote-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 44px 32px 32px; text-align: center; position: relative;
}
.quote-card::before {
  content: "\201C"; position: absolute; top: -6px; left: 18px;
  font: italic 500 96px/1 "Playfair Display", serif; color: var(--accent); opacity: .5;
}
.quote-text { font: italic 500 clamp(22px, 4vw, 30px)/1.35 "Playfair Display", Georgia, serif; margin: 0; }
.hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; min-height: 34px; }
.hint {
  font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); animation: pop .25s ease;
}
.hint b { color: var(--accent); font-weight: 600; margin-right: 4px; }
.hint.locked { color: var(--muted); border-style: dashed; background: none; }

/* Stills frame */
.frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s ease, opacity .3s ease;
}
.frame img.loading { opacity: 0; }
.frame .frame-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }
.frame .badge {
  position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.65); padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
}
.thumbs { display: flex; gap: 6px; margin-top: 10px; justify-content: center; }
.thumb {
  width: 40px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.thumb:disabled { opacity: .35; cursor: default; }
.thumb.on { border-color: var(--text); color: var(--text); }

.setup { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.setup h3 { margin: 0 0 8px; }
.setup p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.setup .row { display: flex; gap: 8px; max-width: 460px; margin: 0 auto; }
.setup input { flex: 1; }

/* Attempt bar (like songless segments) */
.attempts { display: flex; gap: 4px; margin: 18px 0 10px; }
.attempts .seg { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); }
.seg.wrong { background: var(--bad); }
.seg.skip { background: var(--skip); }
.seg.right { background: var(--good); }
.seg.current { background: var(--text); opacity: .5; }

/* Guess list */
.guesses { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.guesses li {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); font-size: 14px; animation: pop .2s ease;
}
.guesses li .ico { width: 18px; text-align: center; font-weight: 700; }
.guesses li.wrong .ico { color: var(--bad); }
.guesses li.skip { color: var(--muted); }
.guesses li.right { border-color: var(--good); }
.guesses li.right .ico { color: var(--good); }
.guesses li .yr { color: var(--muted); margin-left: auto; font-size: 13px; }

/* Guess bar */
.guess-bar { display: flex; gap: 8px; align-items: stretch; }
.search { position: relative; flex: 1; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type="text"] {
  width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 15px; outline: none;
}
.search input { padding-left: 38px; }
input[type="text"]:focus { border-color: var(--muted); }
.suggestions {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); margin: 0; padding: 4px; list-style: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.6); z-index: 5;
}
.suggestions:empty { display: none; }
.suggestions li { padding: 9px 12px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.suggestions li .yr { color: var(--muted); font-size: 13px; }
.suggestions li mark { background: none; color: var(--accent); font-weight: 600; }
.suggestions li.hl, .suggestions li:hover { background: var(--line); }

.actions { display: flex; gap: 8px; }
.btn { border-radius: 10px; padding: 0 18px; font-weight: 600; font-size: 14px; border: 1px solid var(--line); min-height: 44px; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: var(--panel); }
.btn.ghost:hover { border-color: var(--muted); }

/* Result */
.result { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; animation: pop .3s ease; }
.result .verdict { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.result .verdict.win { color: var(--good); }
.result .verdict.lose { color: var(--bad); }
.result h2 { margin: 8px 0 4px; font-size: 24px; }
.result .sub { color: var(--muted); margin: 0 0 16px; }
.result .poster { width: 120px; border-radius: 8px; margin: 4px auto 14px; display: block; }
.stats { display: flex; justify-content: center; gap: 28px; margin: 16px 0; }
.stats div { display: grid; }
.stats b { font-size: 22px; }
.stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.result .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.countdown { color: var(--muted); font-size: 13px; margin-top: 12px; }

.muted { color: var(--muted); line-height: 1.5; }
.small { font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: all .25s ease; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .top { padding: 12px 14px; }
  .brand { font-size: 15px; }
  .mode { padding: 6px 12px; }
  .quote-card { padding: 40px 18px 24px; }
  .guess-bar { flex-direction: column; }
  .actions .btn { flex: 1; }
  .suggestions { bottom: auto; top: calc(100% + 6px); }
}
