:root {
  --bg: #15111d;
  --card: #211a2c;
  --card-2: #2d2340;
  --line: #3a2f4b;
  --text: #f5f0fa;
  --muted: #a497b6;
  --accent: #ff5c8a;
  --accent-2: #9b7bff;
  --ok: #3ecf8e;
  --bad: #ff6b6b;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(255, 92, 138, .16), transparent 70%),
    radial-gradient(50% 40% at 100% 20%, rgba(155, 123, 255, .14), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 { font-size: 30px; line-height: 1.15; margin: 0; }
h2 { font-size: 20px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--bad); text-align: center; padding-top: 30vh; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button { touch-action: manipulation; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.wide { width: 100%; }

.hero { text-align: center; display: flex; flex-direction: column; gap: 14px; padding-top: 10vh; }
.hero.compact { padding-top: 4vh; gap: 4px; }
.hero-emoji { font-size: 64px; }
.hero .btn { margin-top: 12px; }

.topbar { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }

.stages { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.stage {
  padding: 8px 0;
  text-align: center;
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.stage.open { background: var(--card-2); color: var(--text); }
.stage.current { background: var(--accent); color: #fff; }

.progress { height: 4px; background: var(--card); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.play {
  width: 104px;
  height: 104px;
  margin: 8px auto 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 38px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 40px rgba(255, 92, 138, .35);
  cursor: pointer;
  padding-left: 8px;
}
.play:disabled { opacity: .7; }
.play.playing { animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.play-label { text-align: center; color: var(--muted); font-size: 14px; }
.toast { text-align: center; color: var(--accent); min-height: 1.4em; font-size: 14px; }

.volume { display: flex; align-items: center; gap: 10px; }
.volume input { flex: 1; accent-color: var(--accent); height: 22px; }

.search input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* меньше 16px — и iOS зумит страницу */
}
.search input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }

.suggestions {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.suggestions button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.suggestions button:hover, .suggestions button:focus-visible { background: var(--card-2); outline: none; }
.suggestions img { width: 44px; height: 44px; border-radius: 6px; flex: none; background: var(--card-2); }
.suggestions .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.suggestions .free { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.suggestions .free-icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--card-2); font-size: 20px;
}

.t-text { min-width: 0; flex: 1; }
.t-name { font-weight: 600; }
.t-artist { color: var(--muted); font-size: 14px; }

.attempts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attempts li { padding: 10px 12px; border-radius: 12px; background: var(--card); font-size: 14px; }
.attempts .bad { color: var(--bad); }

.reveal-cover {
  display: block;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  margin: 4px auto 0;
  border-radius: 18px;
  object-fit: cover;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.verdict { text-align: center; font-weight: 700; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--bad); }
.song-title { text-align: center; font-size: 24px; }
.song-artist { text-align: center; color: var(--muted); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.note {
  background: var(--card);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
  white-space: pre-wrap;
}
.photo { display: block; width: 100%; border-radius: var(--radius); }
.link { color: var(--muted); text-align: center; font-size: 14px; }

.score {
  font-size: 64px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.summary li { display: flex; gap: 12px; align-items: center; background: var(--card); padding: 10px 12px; border-radius: 12px; }
.squares { flex: none; font-size: 14px; letter-spacing: 1px; }
