/* ===== theme ===== */
:root {
  --bg: #0b0b12;
  --panel: #16161f;
  --line: #2a2a3a;
  --text: #f2f0f7;
  --muted: #8e8ca0;
  --accent: #ff2d78;
  --accent2: #8b5cf6;
  --soft: #ffb3cf;
  --ok: #2dd4a7;
  --ng: #ff5470;
  --radius: 18px;
}

/* ===== base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  font-weight: 500;
  overscroll-behavior: none;
  transition: background .3s;
}
button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; }
img { display: block; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

/* ===== home ===== */
#screen-home {
  background:
    radial-gradient(120vw 60vh at 85% -10%, color-mix(in srgb, var(--accent2) 22%, transparent), transparent 60%),
    radial-gradient(100vw 50vh at 0% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg);
}
.home-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 32px);
}
.logo { text-align: center; margin-bottom: 34px; }
.logo-sub {
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .42em;
  color: var(--accent);
  margin-bottom: 6px;
}
.logo-main {
  font-weight: 900;
  font-size: clamp(38px, 11vw, 52px);
  line-height: 1.1;
  background: linear-gradient(100deg, #fff 20%, var(--soft) 55%, var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-bang { -webkit-text-fill-color: var(--accent); font-style: italic; }
.logo-caption { margin-top: 10px; color: var(--muted); font-size: 13px; letter-spacing: .12em; }
.logo-note { margin-top: 12px; font-size: 11px; line-height: 1.7; color: color-mix(in srgb, var(--muted) 80%, transparent); }

.section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--muted);
  margin: 26px 2px 10px;
}

/* difficulty */
.diff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff-btn {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 4px 9px;
  text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
}
.diff-btn:active { transform: scale(.96); }
.diff-sec { display: block; font-family: Montserrat, sans-serif; font-weight: 900; font-size: 19px; }
.diff-name { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.diff-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent2) 18%, transparent));
}
.diff-btn.selected .diff-name { color: var(--soft); }

/* mode cards */
.mode-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 72px;
  transition: transform .1s, border-color .15s;
}
.mode-card:active { transform: scale(.97); }
.mode-card .thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.mode-card .m-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.mode-card .m-count { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mode-card .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }

.mode-card.mix {
  grid-column: 1 / -1;
  min-height: 84px;
  border-color: transparent;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent2) 30%, transparent)),
    var(--panel);
}
.mode-card.mix .m-name { font-size: 18px; font-weight: 900; }
.mode-card.mix .mix-icon {
  width: 48px; height: 48px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px;
  background: linear-gradient(140deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}

.credit { margin-top: 30px; text-align: center; font-size: 11px; color: color-mix(in srgb, var(--muted) 60%, transparent); }
.site-footer {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  text-align: center;
  font-size: 11px;
  line-height: 1.65;
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}
.site-footer a {
  color: var(--soft);
  font-weight: 700;
  text-decoration: none;
}
.site-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.footer-courtesy { font-size: 10px; color: color-mix(in srgb, var(--muted) 55%, transparent); letter-spacing: .03em; }

/* ===== quiz ===== */
#screen-quiz { position: relative; overflow: hidden; }
.quiz-bg {
  position: fixed; inset: 0;
  z-index: 0;
  filter: blur(46px) brightness(.42) saturate(1.15);
  transform: scale(1.35);
}
.quiz-bg img { width: 100%; height: 100%; object-fit: cover; }
.quiz-bg.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); }
.quiz-bg.mosaic img { height: 100%; }

.quiz-inner {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 20px);
}
.quiz-header { display: flex; align-items: center; gap: 10px; }
.btn-icon {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  font-size: 15px;
  display: grid; place-items: center;
}
.quiz-title { flex: 1; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.quiz-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-diff {
  flex: none;
  font-family: Montserrat, sans-serif;
  font-weight: 900;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
}
.quiz-qnum { font-family: Montserrat, sans-serif; font-weight: 900; font-size: 17px; }

.progress { display: flex; gap: 5px; margin-top: 14px; }
.progress span {
  flex: 1; height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .16);
  transition: background .3s;
}
.progress span.done { background: linear-gradient(90deg, var(--accent), var(--accent2)); }

.player { position: relative; text-align: center; margin: auto 0; padding: 26px 0; }
.pass-btn {
  position: absolute;
  right: 0;
  top: -14px;
  padding: 8px 13px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, .22);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  letter-spacing: .06em;
  transition: transform .1s;
}
.pass-btn:active { transform: scale(.94); }
.pass-note {
  display: block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  color: rgba(255, 255, 255, .65);
  margin-top: 3px;
}
.play-btn {
  width: 108px; height: 108px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 40px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 2px 8px rgba(255, 255, 255, .35);
  display: inline-grid; place-items: center;
  transition: transform .12s;
}
.play-btn:active { transform: scale(.93); }
.play-icon { font-size: 36px; padding-left: 6px; }
.play-btn.playing .play-icon { animation: pulse .8s infinite; padding-left: 0; }
@keyframes pulse { 50% { transform: scale(1.18); } }

.snippet-bar {
  width: min(240px, 70%);
  height: 4px;
  margin: 20px auto 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}
.snippet-fill { width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.player-hint { margin-top: 12px; font-size: 12.5px; color: rgba(255, 255, 255, .75); letter-spacing: .08em; }

.choices { display: grid; gap: 10px; }
.choice {
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, .12);
  border-radius: 15px;
  padding: 14px 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  transition: transform .1s, border-color .15s, background .15s;
}
.choice:active { transform: scale(.98); }
.choice .c-artist { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.choice.reveal-ok { border-color: var(--ok); background: rgba(45, 212, 167, .16); }
.choice.reveal-ng { border-color: var(--ng); background: rgba(255, 84, 112, .16); }
.choices.locked .choice { pointer-events: none; }

/* ===== overlays ===== */
.overlay {
  position: fixed; inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 14, .78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 24px;
  overflow-y: auto;
}
.overlay.show { display: flex; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; } }
.overlay-inner { text-align: center; width: 100%; max-width: 400px; margin: auto; }

.result-badge {
  font-weight: 900;
  font-size: 34px;
  margin-bottom: 18px;
  animation: pop .4s cubic-bezier(.2, 1.6, .4, 1);
}
.result-badge.ok { color: var(--ok); text-shadow: 0 0 30px rgba(45, 212, 167, .6); }
.result-badge.ng { color: var(--ng); text-shadow: 0 0 30px rgba(255, 84, 112, .5); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

.art-frame {
  width: min(58vw, 260px);
  margin: 0 auto 18px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .14);
  animation: artIn .5s cubic-bezier(.2, 1.4, .4, 1);
}
.art-frame.small { width: min(42vw, 180px); }
.art-frame img { width: 100%; aspect-ratio: 1; object-fit: cover; }
@keyframes artIn { from { transform: scale(.6) rotate(-4deg); opacity: 0; } }

.song-title { font-weight: 900; font-size: 19px; line-height: 1.35; }
.song-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.wrong-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; letter-spacing: .2em; }
.streak-note { margin-top: 14px; font-size: 13px; color: var(--soft); }

/* streaming links */
.stream-row { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.stream-btn {
  flex: 1;
  max-width: 118px;
  padding: 10px 4px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  color: #fff;
  line-height: 1.2;
  transition: transform .1s;
}
.stream-btn:active { transform: scale(.95); }
.stream-btn.apple { background: linear-gradient(135deg, #fa5c74, #fb2a4e); }
.stream-btn.spotify { background: #1db954; color: #06230f; }
.stream-btn.amazon { background: #25d1da; color: #052b30; }

/* X share */
.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 13px 30px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  background: #000;
  border: 1.5px solid rgba(255, 255, 255, .28);
  color: #fff;
  transition: transform .1s;
}
.btn-share:active { transform: scale(.95); }
.x-mark { font-size: 16px; font-weight: 900; }

.btn-primary {
  margin-top: 22px;
  padding: 15px 38px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .06em;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .1s;
}
.btn-primary:active { transform: scale(.95); }
.btn-secondary {
  margin-top: 22px;
  padding: 15px 30px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, .12);
  transition: transform .1s;
}
.btn-secondary:active { transform: scale(.95); }
.btn-row { display: flex; gap: 12px; justify-content: center; }

/* ===== clear ===== */
#screen-clear {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(100vw 70vh at 50% -20%, color-mix(in srgb, var(--accent2) 35%, transparent), transparent 65%),
    var(--bg);
}
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.clear-inner {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.clear-sub { font-size: 14px; letter-spacing: .3em; color: var(--soft); font-weight: 700; }
.clear-main {
  font-family: Montserrat, sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(64px, 22vw, 110px);
  line-height: 1.05;
  margin: 8px 0 14px;
  background: linear-gradient(100deg, #ffd166, var(--accent) 55%, var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
.clear-detail { color: var(--muted); font-size: 14px; }

@media (min-width: 480px) {
  .diff-grid { grid-template-columns: repeat(5, 1fr); }
  .mode-list { grid-template-columns: repeat(3, 1fr); }
  .mode-card.mix { grid-column: 1 / -1; }
}
