:root {
  --bg: #121016;
  --card: #1c1926;
  --card-2: #241f33;
  --accent: #a855f7;
  --accent-2: #ec4899;
  --text: #f4f2f8;
  --text-dim: #9b95ab;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --border: #2f2a3d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(650px circle at 12% 15%, rgba(168, 85, 247, 0.13), transparent 60%),
    radial-gradient(650px circle at 88% 80%, rgba(236, 72, 153, 0.11), transparent 60%),
    radial-gradient(circle at top, #221b2e, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.topbar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.auth-btn.ghost {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.auth-btn.ghost:hover { background: var(--border); }

.auth-btn.upgrade {
  background: linear-gradient(90deg, #f59e0b, var(--accent-2));
}

.legal-page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 20px 60px;
  line-height: 1.65;
}
.legal-page h1 { font-size: 26px; margin-bottom: 4px; }
.legal-page h2 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.legal-page h3 { font-size: 15px; margin-top: 20px; margin-bottom: 4px; }
.legal-page p, .legal-page li { color: #d8d4e0; font-size: 14px; }
.legal-page ul { padding-left: 20px; }
.legal-page a { color: var(--accent); }
.legal-page address { font-style: normal; color: #d8d4e0; font-size: 14px; }
.legal-updated { color: var(--text-dim); font-size: 13px; margin-top: 0; }

/* Marks values that are placeholders until the operator fills in real
   details — deliberately loud so they can't ship unnoticed. */
.legal-todo {
  background: rgba(249, 115, 22, 0.14);
  border: 1px dashed var(--orange);
  border-radius: 6px;
  padding: 1px 6px;
  color: #ffd9bd;
}
.legal-notice {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid var(--orange);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #ffd9bd;
}

.lang-select {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.lang-select:hover { background: var(--border); }
.lang-select:focus { outline: 2px solid var(--accent); }
/* Native dropdowns render options with the OS palette, so force a dark
   background here or the list shows as white-on-white in some browsers. */
.lang-select option { background: var(--card); color: var(--text); }

.site-footer {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.footer-sep { margin: 0 8px; opacity: 0.6; }

.account-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  padding: 0 2px;
}

.premium-badge {
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(90deg, #f59e0b, var(--accent-2));
  padding: 6px 10px;
  border-radius: 999px;
  color: white;
}

.mode-row {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 8px;
}

.mode-toggle {
  display: flex;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.field-hint {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.75;
}

.auth-form input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
}
.auth-form input:focus { outline: 2px solid var(--accent); }

.form-error {
  color: var(--red);
  font-size: 13px;
}

.form-success {
  color: var(--green);
  font-size: 13px;
}

.modal-subtext {
  color: var(--text-dim);
  font-size: 13px;
  margin: 12px 0 0;
  line-height: 1.5;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
}
.link-btn:hover { color: var(--text); text-decoration: underline; }

.share-btn.secondary {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 10px;
}

.logo {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
}

.icon-btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: var(--border); }

.tabs {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  padding: 8px 16px;
}

.tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
}

.tab.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  border-color: transparent;
}

.game-card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin: 12px 16px 40px;
  padding: 24px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.status-text {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

.hidden { display: none !important; }

.attempts-row {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.attempt-pip {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.attempt-pip.current {
  background: var(--card-2);
  border: 1px solid var(--accent);
  box-shadow: 0 0 8px 0 rgba(168, 85, 247, 0.55);
  animation: pip-pulse 1.6s ease-in-out infinite;
}
.attempt-pip.wrong { background: var(--red); }
.attempt-pip.close { background: var(--orange); }
.attempt-pip.skipped { background: var(--card-2); opacity: 0.5; }
.attempt-pip.correct { background: var(--green); }

@keyframes pip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.player {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.play-btn {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.play-btn svg { width: 26px; height: 26px; fill: white; }
.play-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-wrap { flex: 1; }

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.05s linear;
}

.duration-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.guess-area {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
}

.search-wrap { flex: 1; position: relative; }

#searchInput {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
}
#searchInput:focus { outline: 2px solid var(--accent); }

.search-wrap .icon-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
}

.suggestions li {
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.suggestions li:hover, .suggestions li.active { background: var(--border); }
.suggestions li .s-artist { color: var(--text-dim); font-size: 12px; }

.skip-btn {
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.skip-btn:hover { background: var(--border); }
.skip-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.skip-btn:disabled:hover { background: var(--card-2); }

#searchInput:disabled { opacity: 0.5; cursor: not-allowed; }

.guess-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guess-history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 14px;
}

.guess-history li.wrong { border-left: 3px solid var(--red); }
.guess-history li.close { border-left: 3px solid var(--orange); }
.guess-history li.skipped { border-left: 3px solid var(--text-dim); color: var(--text-dim); font-style: italic; }
.guess-history li.correct { border-left: 3px solid var(--green); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: overlay-in 0.15s ease-out;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 22px;
  max-width: 420px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}

.modal h2 { margin-top: 0; }

.howto-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-dim);
  font-size: 14px;
}

.reveal {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-2);
  border-radius: 14px;
  padding: 14px;
  margin: 16px 0;
}

.reveal-art {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--border);
}

.reveal-track { font-weight: 700; font-size: 16px; }
.reveal-artist { color: var(--text-dim); font-size: 14px; margin-top: 2px; }

.dist-title { font-size: 14px; color: var(--text-dim); margin: 20px 0 10px; }

.distribution {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.dist-row .dist-label { width: 14px; color: var(--text-dim); }

.dist-bar-wrap {
  flex: 1;
  background: var(--card-2);
  border-radius: 6px;
  overflow: hidden;
}

.dist-bar {
  height: 20px;
  min-width: 22px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
}
.dist-row.this-run .dist-bar { box-shadow: 0 0 0 2px var(--green) inset; }
.dist-row.this-run .dist-label { color: var(--green); font-weight: 700; }

.stats-row {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  text-align: center;
}

.stats-row .stat-num { font-size: 22px; font-weight: 800; }
.stats-row .stat-label { font-size: 11px; color: var(--text-dim); }

.share-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
}
