:root {
  --bg: #0a0a0b;
  --panel: #141416;
  --panel-2: #1c1c1f;
  --line: #2a2a2e;
  --text: #ece9e4;
  --muted: #8f8b85;
  --accent: #c8102e;
  --accent-2: #e23a3a;
  --gold: #d4af37;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at top, rgba(200, 16, 46, 0.18), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

main { width: min(1040px, 100% - 32px); margin: 0 auto; flex: 1; }

h1, h2, h3 { font-family: "Cinzel", serif; letter-spacing: 0.04em; margin: 0 0 14px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.site-header { text-align: center; padding: 40px 16px 24px; }
.site-header h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 800; text-transform: uppercase; }
.site-header h1 span { display: block; color: var(--accent-2); font-size: 0.55em; letter-spacing: 0.3em; margin-top: 4px; }
.tagline { color: var(--muted); margin: 8px 0 0; }

.muted { color: var(--muted); }
.center { text-align: center; }

.screen { display: none; animation: fade 0.3s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }

/* buttons */
.btn {
  font: 600 0.95rem "Inter", sans-serif;
  border-radius: 999px;
  padding: 12px 22px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover:not(:disabled) { border-color: var(--muted); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }
.link:hover { color: var(--text); }
.link-row { display: flex; gap: 12px; }

kbd {
  font: 600 0.75rem "Inter", sans-serif;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--panel-2);
  color: var(--muted);
}

/* covers */
.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.cover img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 0.3s;
}
.cover.has-art img { opacity: 1; }
.cover.has-art .cover-fallback { opacity: 0; }
.cover-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 10%;
  font-family: "Cinzel", serif;
  transition: opacity 0.3s;
}
.cover-fallback b { font-size: 1.05em; line-height: 1.2; }
.cover-fallback small { color: rgba(255, 255, 255, 0.6); margin-top: 6px; }
.cover.small { width: 56px; font-size: 6px; }
.cover.big { width: 120px; font-size: 11px; }

/* setup */
.album-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.album-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
}
.album-toggle:has(input:not(:checked)) { opacity: 0.45; }
.album-toggle:has(input:checked) { border-color: var(--accent); }
.album-toggle input { accent-color: var(--accent); }
.album-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.album-meta small { color: var(--muted); }

.size-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.pill { cursor: pointer; }
.pill input { display: none; }
.pill span {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2);
}
.pill input:checked + span { border-color: var(--accent); background: rgba(200, 16, 46, 0.15); }

.start-row { display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.start-row #song-count { margin-right: auto; }
.center-row { justify-content: center; margin-top: 24px; }

/* battle */
.progress { margin-bottom: 20px; }
.progress-bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width 0.4s ease; }
#progress-text { font-size: 0.85rem; margin: 8px 0 0; }

.battle-title { text-align: center; font-size: 1.5rem; margin-bottom: 22px; }
.battle-cards { display: grid; gap: 18px; justify-content: center; }
.battle-cards.n2 { grid-template-columns: repeat(2, minmax(0, 300px)); }
.battle-cards.n3 { grid-template-columns: repeat(3, minmax(0, 300px)); }

.song-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  animation: pop 0.3s ease backwards;
}
.song-card:nth-child(2) { animation-delay: 0.05s; }
.song-card:nth-child(3) { animation-delay: 0.1s; }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.song-card:hover, .song-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(200, 16, 46, 0.25);
  outline: none;
}
.song-card .cover { width: 100%; font-size: 15px; }
.song-card .text { display: flex; flex-direction: column; gap: 4px; }
.song-name { font-family: "Cinzel", serif; font-weight: 800; font-size: 1.15rem; margin-top: 4px; }
.song-album { color: var(--muted); font-size: 0.85rem; }
.song-card kbd { position: absolute; top: 22px; right: 22px; background: rgba(0, 0, 0, 0.6); }

.battle-actions { display: flex; justify-content: center; gap: 12px; margin: 26px 0 8px; }
.hint { text-align: center; font-size: 0.85rem; margin-bottom: 28px; }

.top-panel { max-width: 520px; margin: 0 auto 24px; }
.top-so-far { list-style: none; margin: 0; padding: 0; }
.top-so-far li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.top-so-far li:last-child { border-bottom: 0; }
.top-so-far span { color: var(--gold); font-weight: 600; margin-right: 6px; }

/* results */
.results-title { text-align: center; font-size: 1.6rem; }
.results-list { list-style: none; margin: 20px auto 0; padding: 0; max-width: 560px; }
.result {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 10px;
  animation: pop 0.35s ease backwards;
}
.result:nth-child(odd) { background: var(--panel-2); }
.result .rank { width: 32px; text-align: center; font-family: "Cinzel", serif; font-weight: 800; font-size: 1.3rem; color: var(--muted); }
.result.first { background: linear-gradient(90deg, rgba(212, 175, 55, 0.18), transparent); border: 1px solid rgba(212, 175, 55, 0.4); padding: 16px 12px; margin-bottom: 8px; }
.result.first .rank { color: var(--gold); font-size: 2rem; }
.result.first b { font-size: 1.35rem; font-family: "Cinzel", serif; }
.result:nth-child(2) .rank { color: #c0c0c0; }
.result:nth-child(3) .rank { color: #cd7f32; }

/* about / FAQ */
.about { line-height: 1.6; }
.about p { margin: 0 0 14px; }
.about h3 { margin-top: 24px; }
.steps { padding-left: 20px; margin: 0 0 14px; }
.steps li { margin-bottom: 6px; }
.album-index { columns: 2; column-gap: 32px; padding-left: 18px; margin: 0; color: var(--muted); }
.album-index li { break-inside: avoid; margin-bottom: 4px; }
.about details { border-top: 1px solid var(--line); padding: 12px 0; }
.about details:last-child { border-bottom: 1px solid var(--line); }
.about summary { cursor: pointer; font-weight: 600; }
.about details p { color: var(--muted); margin: 10px 0 0; }
@media (max-width: 720px) { .album-index { columns: 1; } }

footer { text-align: center; font-size: 0.8rem; padding: 24px 16px; }

@media (max-width: 720px) {
  .battle-cards.n3, .battle-cards.n2 { grid-template-columns: 1fr; }
  .song-card { flex-direction: row; align-items: center; gap: 14px; }
  .song-card .cover { width: 84px; font-size: 7px; }
  .song-card kbd { display: none; }
  .song-name { margin-top: 0; }
  .song-card .text { display: flex; flex-direction: column; }
}
