/* Samplify: graphite surfaces, one amber accent, mono figures for time and counts. */
:root {
  color-scheme: dark;
  --bg: #141415;
  --card: #19191b;
  --raised: #232325;
  --line: rgb(237 237 237 / .08);
  --line-hi: rgb(237 237 237 / .16);
  --text: #ededed;
  --text-2: #a1a1a6;
  --muted: #85858b;
  --accent: #f0a83a;
  --accent-hover: #f5b95a;
  --on-accent: #1a1204;
  --good: #4cc38a;
  --bad: #f0686c;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Base */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { padding: 0; border: 0; background: none; cursor: pointer; }
button, a, input, select { touch-action: manipulation; }
button:disabled { opacity: .4; cursor: not-allowed; }
button, a, input, select, summary {
  transition: color .12s var(--ease), background-color .12s var(--ease), border-color .12s var(--ease);
}
a { color: var(--text); text-decoration-color: var(--line-hi); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Fields */
input:where(:not([type=checkbox], [type=radio], [type=range], [type=file])), select {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line-hi);
  border-radius: 8px;
  color: var(--text);
}
input:where(:not([type=checkbox], [type=radio], [type=range], [type=file])):hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input::placeholder { color: var(--muted); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
input[type=file] { max-width: 100%; font-size: 12px; }
input[type=file]::file-selector-button { height: 32px; margin-right: 12px; padding: 0 12px; border: 1px solid var(--line-hi); border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--raised); }

/* Buttons */
.primary { min-height: 40px; padding: 0 20px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 500; }
.primary:hover { background: var(--accent-hover); }
.secondary { min-height: 36px; padding: 0 16px; border: 1px solid var(--line-hi); border-radius: 8px; font-size: 13px; }
.secondary:hover { background: var(--raised); }
.text-button { min-height: 32px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-size: 13px; }
.text-button:hover { background: var(--raised); color: var(--text); }
.count { margin-left: 8px; color: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }

/* Header and navigation */
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 760px; min-height: 64px; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 20px; font-weight: 500; text-decoration: none; }
.brand-mark { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
nav { display: flex; gap: 4px; }
.nav { height: 36px; padding: 0 12px; border-radius: 8px; color: var(--text-2); }
.nav:hover { background: var(--card); color: var(--text); }
.nav.active { background: var(--raised); color: var(--text); }

main { max-width: 760px; min-height: calc(100dvh - 64px); margin: 0 auto; padding: 16px 24px 0; }
.intro { padding: 16px 0 24px; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 16px; }

/* Mode, region and genre selection */
.game-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.game-modes button { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left; }
.game-modes button:hover { border-color: var(--line-hi); }
.game-modes button[aria-pressed=true] { border-color: var(--line-hi); background: var(--raised); }
.mode-title { font-weight: 500; }
.mode-hint { color: var(--text-2); font-size: 12px; }

.regionbar { margin-bottom: 24px; }
.countries { display: flex; flex-wrap: wrap; gap: 4px; }
.countries button { height: 36px; padding: 0 12px; border-radius: 8px; color: var(--text-2); }
.countries button:hover { background: var(--card); color: var(--text); }
.countries .selected { background: var(--raised); color: var(--text); }

.genre-control { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.genre-picker { position: relative; min-width: 224px; max-width: 100%; }
.genre-picker summary { display: flex; align-items: center; height: 36px; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text-2); cursor: pointer; list-style: none; }
.genre-picker summary::-webkit-details-marker { display: none; }
.genre-picker summary::after { content: ""; position: absolute; top: 12px; right: 14px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.genre-picker summary:hover { border-color: var(--line-hi); color: var(--text); }
.genre-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(392px, calc(100vw - 48px)); padding: 16px; border: 1px solid var(--line-hi); border-radius: 12px; background: var(--raised); box-shadow: 0 8px 24px rgb(0 0 0 / .4); }
.genre-help, .genre-note { margin: 0 0 12px; color: var(--text-2); font-size: 12px; }
.genre-note { margin: 12px 0 0; color: var(--muted); }
.genre-exclude { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 0 8px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); cursor: pointer; }
.genre-options { max-height: 280px; overflow: auto; }
.genre-option { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 8px; border-radius: 8px; cursor: pointer; }
.genre-option:hover { background: var(--line); }
.genre-option small { margin-left: auto; color: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }

/* Game card */
.game-card { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.difficulties { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 12px; background: var(--bg); }
.difficulties button { min-width: 0; padding: 8px 4px; border-radius: 8px; color: var(--text-2); font-size: 12px; }
.difficulties button:hover { color: var(--text); }
.difficulties button[aria-pressed=true] { background: var(--raised); color: var(--text); }
.mode-description { margin: 0 0 8px; color: var(--text-2); font-size: 12px; }
.collection-summary { margin-bottom: 16px; color: var(--muted); font: 12px var(--mono); }

.player { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.play-button { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--on-accent); user-select: none; -webkit-tap-highlight-color: transparent; }
.play-button:hover { background: var(--accent-hover); }
.play-button:active { transform: scale(.96); }
.play-button svg { grid-area: 1 / 1; width: 24px; height: 24px; fill: currentColor; pointer-events: none; }
.play-button .play-icon { transform: translateX(1px); }
.play-button .pause-icon, .play-button.is-playing .play-icon { display: none; }
.play-button.is-playing .pause-icon { display: block; }
.sound { flex: 1; min-width: 0; }
.time { display: flex; flex-direction: column; gap: 4px; }
.time span:first-child { font: 500 16px var(--mono); font-variant-numeric: tabular-nums; }
.time span:last-child { color: var(--text-2); font-size: 12px; }

.timeline { position: relative; flex: 0 0 100%; height: 8px; overflow: hidden; border-radius: 4px; background: var(--raised); }
.timeline-available, .timeline-progress { position: absolute; inset: 0 auto 0 0; width: 0; pointer-events: none; }
.timeline-available { background: var(--line-hi); }
.timeline-progress { background: var(--accent); }
.timeline-divisions { position: absolute; inset: 0; pointer-events: none; }
.timeline-divisions span { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bg); transform: translateX(-1px); }
.timeline-labels { position: relative; flex: 0 0 100%; width: 100%; height: 16px; color: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.timeline-labels span { position: absolute; white-space: nowrap; transform: translateX(-50%); }
.timeline-labels span:first-child { transform: none; }
.timeline-labels span:last-child { transform: translateX(-100%); }
.timeline-labels [aria-current=step] { color: var(--text); }

.feedback { min-height: 20px; margin: 16px 0 8px; color: var(--text-2); font-size: 13px; }
.feedback.success { color: var(--good); }
.feedback.error { color: var(--bad); }
.feedback.partial { color: var(--accent); }

.guess-row { display: flex; gap: 8px; margin-top: 16px; }
.guess-field { position: relative; flex: 1; min-width: 0; }
.song-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 8; width: 100%; max-height: min(320px, 40vh); padding: 4px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line-hi); border-radius: 12px; background: var(--raised); box-shadow: 0 8px 24px rgb(0 0 0 / .4); }
.song-menu [role=option] { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; cursor: pointer; }
.song-menu [role=option]:hover, .song-menu [aria-selected=true] { background: var(--line); }
.song-menu strong, .song-menu small { display: block; overflow-wrap: anywhere; }
.song-menu strong { font-weight: 500; }
.song-menu small { color: var(--text-2); font-size: 12px; }
.match-cover { position: relative; display: grid; flex: 0 0 40px; place-items: center; height: 40px; overflow: hidden; border-radius: 4px; background: var(--card); color: var(--muted); }
.match-cover svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.match-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.game-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.volume { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); }
.volume svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.volume input { width: 80px; }

.attempts { display: grid; gap: 4px; margin: 16px 0 0; padding: 0; list-style: none; }
.attempts li { padding: 8px 12px; border-radius: 8px; background: var(--bg); color: var(--text-2); font-size: 13px; }
.attempts li.win { color: var(--good); }
.attempts li.partial { color: var(--accent); }

.game-settings { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.game-settings summary { width: fit-content; cursor: pointer; }
.settings-options { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 16px; }
.settings-options label { display: flex; align-items: center; gap: 8px; }
.fine { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Chart and library views */
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0 24px; }
.section-heading p { margin: 8px 0 0; color: var(--text-2); font-size: 13px; }
.section-heading .eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.chart-tools { display: flex; align-items: center; gap: 16px; }
.chart-tools input { max-width: 320px; }
.chart-tools span { color: var(--muted); font: 12px var(--mono); }
.notice { margin: 12px 0 16px; color: var(--muted); font-size: 12px; }
.chart-row { display: flex; align-items: center; gap: 16px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.chart-row:hover { background: var(--card); }
.rank { width: 32px; color: var(--muted); font: 16px var(--mono); font-variant-numeric: tabular-nums; }
.artwork { width: 48px; height: 48px; border-radius: 4px; background: var(--raised); object-fit: cover; }
.song-info { flex: 1; min-width: 0; }
.song-info strong { display: block; font-weight: 500; overflow-wrap: anywhere; }
.song-info small { color: var(--text-2); font-size: 12px; }
.chart-row a { color: var(--text-2); font-size: 12px; }
.chart-row .secondary { min-height: 32px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.empty { padding: 48px 24px; border: 1px dashed var(--line-hi); border-radius: 12px; color: var(--text-2); text-align: center; line-height: 1.6; }

.library-grid { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 32px; }
.side-card { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.side-card h3 { margin-bottom: 16px; }
.side-card > label:not(.check) { display: grid; gap: 8px; margin: 0 0 16px; color: var(--text-2); font-size: 12px; }
.check { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; color: var(--text-2); font-size: 12px; }
#import-submit { width: 100%; }
.library-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.library-item { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.library-item div { flex: 1; }
.library-item strong { font-weight: 500; }
.library-item small { display: block; color: var(--text-2); font-size: 12px; }
.library-item .secondary { width: 36px; padding: 0; }
.library-item .secondary svg { width: 16px; height: 16px; fill: currentColor; }
.help { margin-top: 24px; color: var(--text-2); font-size: 13px; }
.help summary { color: var(--text); cursor: pointer; }
.help p { margin: 8px 0 0; }

footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); }
.footer-brand { color: var(--muted); font-size: 14px; }

/* Dialogs */
dialog { width: calc(100% - 32px); max-width: 560px; padding: 32px; border: 1px solid var(--line-hi); border-radius: 16px; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .6); }
dialog h2 { margin: 0 0 16px; }
dialog p { color: var(--text-2); font-size: 13px; line-height: 1.6; }
dialog .eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-2); font-size: 20px; }
.close:hover { background: var(--raised); color: var(--text); }
.about-links { display: grid; gap: 8px; margin-top: 24px; font-size: 13px; }

#reveal { --result: var(--good); width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 32px 24px; overflow: auto; border: 0; border-radius: 0; background: var(--bg); text-align: center; }
#reveal.lost { --result: var(--bad); }
#reveal.partial { --result: var(--accent); }
#reveal[open] { display: flex; flex-direction: column; align-items: center; animation: reveal-in .2s var(--ease); }
#reveal .close { position: fixed; top: 16px; right: 16px; }
.reveal-art { position: relative; display: grid; flex: none; place-items: center; width: min(288px, 60vw, 37dvh); aspect-ratio: 1; margin: auto 0 0; overflow: hidden; border: 1px solid var(--line-hi); border-radius: 12px; background: var(--card); color: var(--muted); }
.reveal-art svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.reveal-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#reveal .reveal-kicker { margin: 24px 0 4px; color: var(--text-2); font-size: 13px; }
#reveal h2 { max-width: 90vw; margin: 8px 0; font-size: clamp(24px, 5vw, 40px); line-height: 1.2; overflow-wrap: anywhere; }
#reveal-artist { margin: 0; color: var(--text-2); font-size: 16px; }
#answer-link { margin-top: 8px; color: var(--text-2); font-size: 13px; }
#reveal-status { margin: 16px 0 24px; color: var(--result); font-weight: 500; }
#reveal-next { min-height: 44px; margin-bottom: auto; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
  header { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .nav { padding: 0 8px; font-size: 13px; }
  main { padding: 8px 16px 0; }
  h1 { font-size: 28px; }
  .game-card { padding: 16px; }
  .player { gap: 12px; padding: 12px; }
  .difficulties button { font-size: 11px; }
  .library-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .chart-tools { flex-direction: column; align-items: stretch; gap: 12px; }
  .chart-tools input { max-width: none; }
  .chart-row { flex-wrap: wrap; gap: 12px; }
  .artwork { width: 40px; height: 40px; }
  footer { flex-wrap: wrap; }
  dialog { padding: 24px; }
}
@media (max-width: 520px) {
  .game-modes { grid-template-columns: 1fr; }
  .genre-picker { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  #reveal[open] { animation: none; }
}
