:root {
  color-scheme: dark;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff4e7;
  background: #210f29;
  --gold: #ffcc65;
  --muted: #debbd9;
  --plum: #3d1b47;
  --cream: #fff4e7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 300px;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 16% 0%, #87274263, transparent 48rem),
    radial-gradient(ellipse at 92% 20%, #6a276950, transparent 40rem),
    #210f29;
}
[hidden] { display: none !important; }
button, input, textarea, select { color: inherit; font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, .file-choice { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .file-choice:focus-within {
  outline: 3px solid #fff5ac;
  outline-offset: 3px;
}
button > svg, .title-icon svg, .wordmark svg { width: 1.25em; height: 1.25em; flex: 0 0 auto; }
a { color: inherit; text-decoration: none; }
p, h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.topbar {
  max-width: 1060px;
  height: 75px;
  padding: 0 24px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 13px;
}
.wordmark { display: inline-flex; gap: 9px; align-items: center; font-size: 1.2rem; font-weight: 900; letter-spacing: .08em; }
.wordmark > span {
  display: grid;
  place-items: center;
  height: 35px;
  width: 35px;
  color: #3a1737;
  border-radius: 11px;
  background: linear-gradient(#ffca73, #f98b52);
  box-shadow: inset 0 2px #fff4b993, 0 3px #853748;
}
.icon-button {
  width: 43px;
  height: 43px;
  display: inline-grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid #ab65a15c;
  background: #552852;
  color: #ffdfb1;
  flex: 0 0 auto;
}
.audio-control { margin-left: auto; }
.home {
  width: min(100% - 48px, 1012px);
  margin: 12px auto 44px;
  display: grid;
  grid-template-columns: 1.16fr 1fr;
  gap: 23px;
  align-items: start;
}
.hero {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid #c360796b;
  border-radius: 27px;
  background: #431735 url('assets/karaoke-party.webp') center 36% / cover no-repeat;
  box-shadow: 0 12px 36px #1007179e, inset 0 0 65px #20051c7a;
}
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(180deg, #25072040, transparent 42%, transparent 74%, #220a28a0);
}
.hero-lettering { position: absolute; top: 22px; width: 100%; padding: 0 14px; text-align: center; }
.hero h1 { margin: 7px 0 6px; }
.hero-logo {
  display: block;
  width: min(85%, 374px);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 5px 8px #290a26a6);
}
.hero-lettering p { color: #ffe5d6; font-weight: 750; text-shadow: 0 2px 6px #320826; }
.panel {
  background: linear-gradient(151deg, #51254f, #351936 76%);
  border: 1px solid #a15e9488;
  box-shadow: 0 10px 24px #16081a69, inset 0 2px #ffe4f315;
  border-radius: 23px;
}
.setup { align-self: center; padding: clamp(19px, 3.4vw, 34px); }
.setup-head, .dialog-head { display: flex; align-items: center; gap: 13px; }
.setup-head h2 { font-size: clamp(26px, 3.4vw, 35px); line-height: 1.25; font-weight: 900; }
.setup-head p, .page-head p, .level-body p, .dialog-head p { color: var(--muted); margin-top: 4px; }
.title-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(#f87ab3, #b74691);
  box-shadow: inset 0 2px #ffb0ca, 0 4px #6e2b68;
  color: #fff4d2;
  font-size: 1.3rem;
}
.count-row { display: flex; align-items: center; justify-content: space-between; font-weight: 760; margin: 22px 0 12px; }
.stepper {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  padding: 4px;
  background: #29152e;
  border: 1px solid #bd75a24d;
}
.stepper button { min-width: 35px; height: 35px; padding: 0; border: 0; border-radius: 8px; background: #653864; font-weight: 850; font-size: 1.3rem; }
.stepper button:disabled { opacity: .35; }
.stepper output { width: 36px; text-align: center; color: var(--gold); font-variant-numeric: tabular-nums; }
.roster { display: grid; gap: 9px; }
.roster-row { display: grid; gap: 13px; grid-template-columns: auto 1fr; align-items: center; }
.avatar-picker { padding: 0; border: 0; background: none; position: relative; }
.avatar-picker > span:last-child { position: absolute; bottom: -3px; right: -4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #784289; color: #fff; border: 1px solid #c498c5; font-size: 12px; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid #ffffff6b;
  border-radius: 15px;
  overflow: hidden;
  background: var(--avatar);
  box-shadow: inset 0 -4px #5e2a5c29;
  font-size: 1.6rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.roster-row input, .field input, .field textarea, .field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #b674aa65;
  background: #2f1835;
}
input::placeholder, textarea::placeholder { color: #c6a3c2; opacity: 1; }
.button {
  min-height: 48px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid #ffec9e9e;
  border-radius: 14px;
  font-weight: 850;
  transition: transform .12s, filter .12s;
}
.button:hover:not(:disabled), .icon-button:hover { filter: brightness(1.14); }
.button:active:not(:disabled) { transform: translateY(2px); }
.button:disabled { opacity: .49; }
.gold { color: #492331; background: linear-gradient(#ffe796, #ffbd4f); box-shadow: inset 0 2px #fff2bb, 0 4px #a65d38; }
.pink { color: #3f193c; background: linear-gradient(#ffadd3, #f47ebc); box-shadow: inset 0 2px #ffdbeb, 0 4px #8a3c78; border-color: #ffd1e4; }
.green { color: #153d31; background: linear-gradient(#a6f7bf, #6cddac); box-shadow: inset 0 2px #d7ffd9, 0 4px #338869; border-color: #c0ffcd; }
.quiet { background: linear-gradient(#613166, #4c2451); color: #ffecf8; border-color: #a56c9f; box-shadow: inset 0 1px #efacf14d, 0 3px #29182f; }
.start { width: 100%; margin: 20px 0 13px; min-height: 53px; font-size: 1.16rem; }
.setup-note { text-align: center; color: var(--muted); font-size: .875rem; }
.page { width: min(100% - 48px, 820px); margin: 18px auto 44px; }
.page-head { margin-bottom: 22px; }
.page-head h1, .play-heading h1 { font-size: clamp(32px, 6vw, 47px); font-weight: 950; line-height: 1.12; color: #fff3d5; }
.level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.level { overflow: hidden; }
.cover { height: 210px; position: relative; background: #592d52 url('assets/retro-cassette.webp') center 44% / cover; }
.cover.future { background-image: linear-gradient(120deg, #3f1b6d95, #26102cc9), url('assets/retro-cassette.webp'); filter: saturate(.70); }
.tag {
  position: absolute;
  top: 13px;
  left: 14px;
  background: #371841ee;
  color: #ffe2a2;
  border: 1px solid #ffcb77a1;
  border-radius: 7px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: .875rem;
}
.locked-mark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 2.8rem; color: #ffebb3; }
.locked-mark svg { width: 1em; height: 1em; filter: drop-shadow(0 4px 7px #100818); }
.level-body { padding: 15px 16px 19px; }
.level-body h2 { font-size: clamp(19px, 3.5vw, 25px); }
.level-body .button { width: 100%; margin-top: 14px; }
.sub-link { background: none; border: 0; color: #ffdba0; text-decoration: underline; text-underline-offset: 4px; padding: 8px 2px; }
.library { max-width: 640px; }
.library-list { overflow: hidden; margin-bottom: 15px; }
.track-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 9px; align-items: center; padding: 9px 13px; }
.track-row + .track-row { border-top: 1px solid #91638047; }
.track-row strong, .track-row small { display: block; }
.track-row small, .track-index { color: var(--muted); }
.track-row .button { min-height: 37px; font-size: .89rem; }
.library-start { width: 100%; margin-bottom: 14px; }
.play-page { max-width: 660px; }
.play-heading { display: flex; justify-content: space-between; align-items: end; gap: 9px; margin-bottom: 13px; }
.play-heading h1 span { color: var(--muted); font-size: 55%; }
.section-label { color: var(--gold); font-size: .875rem; font-weight: 800; margin-bottom: 5px; }
.reveal-setting { display: flex; align-items: center; gap: 5px; min-height: 38px; font-size: .875rem; color: #f4d4e9; }
.reveal-setting input { width: 18px; height: 18px; accent-color: #ffca65; }
.score-panel { padding: 11px 13px 13px; margin-bottom: 11px; }
.score-panel h2 { font-size: .96rem; margin-bottom: 8px; }
.score-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.score-player {
  flex: 1 1 calc(25% - 6px);
  max-width: 160px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  grid-template-areas: "avatar name" "avatar points";
  align-items: center;
  column-gap: 6px;
  text-align: left;
  padding: 5px;
  border-radius: 11px;
  border: 1px solid #95658d88;
  background: #361a3c;
}
.score-player .avatar { grid-area: avatar; width: 32px; height: 32px; border-radius: 9px; font-size: 1.05rem; }
.score-player > span:nth-child(2) { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.score-player strong { grid-area: points; color: var(--gold); font-size: .8rem; }
.score-player.selected { background: #784057; border-color: #ffcf60; box-shadow: 0 0 0 1px #ffcf60; }
.score-player.rejected { opacity: .55; }
.stage { background: radial-gradient(ellipse at top, #57305a, #27152e 75%); padding: 13px; }
.stage-meta { display: flex; align-items: center; gap: 10px; }
.stage-meta h2 { font-size: 1.17rem; }
.stage-meta p { font-size: .88rem; color: var(--muted); }
.record {
  flex: 0 0 43px;
  height: 43px;
  border: 1px solid #e38ec178;
  border-radius: 50%;
  background: radial-gradient(circle, #3b173d 8%, #ffb57d 9% 26%, transparent 28%), repeating-radial-gradient(#16101e 0 3px, #593661 4px 5px);
  box-shadow: 0 3px 7px #130818;
}
.equalizer { margin-left: auto; display: flex; align-items: center; gap: 3px; padding: 0 6px; height: 28px; }
.equalizer i { width: 4px; height: 24px; transform: scaleY(.25); border-radius: 10px; background: #ed89c1; }
.is-playing .equalizer i { animation: beat .7s ease-in-out infinite alternate; transform-origin: center; }
.is-playing i:nth-child(2) { animation-delay: -.36s; }
.is-playing i:nth-child(3) { animation-delay: -.55s; }
.is-playing i:nth-child(4) { animation-delay: -.22s; }
@keyframes beat { from { transform: scaleY(.20); } to { transform: scaleY(1); } }
.lyrics-wrap { position: relative; margin: 12px 0; border: 1px solid #7c557f73; border-radius: 14px; overflow: hidden; background: #201026b0; }
.lyrics {
  height: clamp(147px, 26dvh, 235px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.lyrics p {
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  padding: 3px 0;
  margin: 0;
  color: #c19fbf;
  font-weight: 820;
  font-size: clamp(17px, 4.5vw, 24px);
  line-height: 1.32;
}
.lyrics p.active {
  color: #ffe5ab;
  background: linear-gradient(90deg, #ffd154 var(--filled, 0%), #ffe9cc var(--filled, 0%));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px #ffbf5270);
}
.countdown { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: #25102bf0; }
.countdown small { color: #ffc9e9; font-size: .875rem; font-weight: 850; }
.countdown strong { line-height: 1.05; color: #ffd575; font-weight: 1000; font-size: 5.6rem; text-shadow: 0 6px #903354; }
.resume { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; }
.play-progress { height: 8px; background: #1c0d23; border-radius: 8px; overflow: hidden; }
.play-progress div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #fd7eb9, #ffce62); }
.time-row { display: flex; justify-content: space-between; margin-top: 3px; font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.round-status { margin: 11px 0 8px; color: #edd6ed; min-height: 22px; font-size: .9rem; }
.round-status[data-phase=correct] { color: #a6f7bf; font-weight: 850; }
.round-status[data-phase=timeout], .round-status[data-phase=error] { color: #ffacb9; font-weight: 850; }
.round-actions { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 9px; }
.round-actions .button { padding-inline: 7px; }
dialog {
  border: 1px solid #b3769c;
  border-radius: 20px;
  background: linear-gradient(160deg, #602a55, #301532);
  padding: 18px;
  color: var(--cream);
  width: min(440px, 100% - 30px);
  max-height: 88dvh;
  box-shadow: 0 18px 60px #100918d1;
}
dialog::backdrop { background: #120a1bd1; backdrop-filter: blur(3px); }
.dialog-head { justify-content: space-between; margin-bottom: 10px; align-items: start; }
.dialog-head h2 { font-size: 1.45rem; }
.dialog-buttons, .form-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.avatar-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 10px 0 15px; }
.avatar-options .avatar { width: 100%; height: auto; aspect-ratio: 1; cursor: pointer; }
.avatar-options .avatar[aria-pressed=true] { outline: 2px solid var(--gold); outline-offset: 2px; }
.file-choice { position: relative; }
.file-choice input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; cursor: pointer; }
.field { display: block; min-width: 0; font-size: .89rem; font-weight: 720; margin: 10px 0 5px; }
.field input, .field textarea, .field select { margin: 4px 0 0; }
.field input[type=file] { padding: 7px; }
.field textarea { resize: vertical; }
.track-preview { display: block; width: 100%; height: 43px; margin: 10px 0 0; }
.preview-button { min-height: 42px; font-size: .89rem; margin-top: 5px; }
.form-hint { color: var(--muted); font-size: .875rem; }
.form-error { color: #ffb8c7; font-size: .91rem; margin: 7px 0; }
.form-error:empty { display: none; }
#track-form button[type=submit] { width: 100%; margin-top: 11px; }
.results { text-align: center; }
.trophy { font-size: 4rem; filter: drop-shadow(0 4px 12px #f5ae5969); }
.results h2 { color: #ffe194; font-size: 1.8rem; overflow-wrap: anywhere; }
.results p { color: var(--muted); }
.results-list { margin: 12px 0; display: grid; gap: 5px; }
.results-list > div { display: flex; align-items: center; gap: 8px; text-align: left; padding: 4px 7px; border-radius: 10px; background: #311732; }
.results-list .avatar { height: 34px; width: 34px; border-radius: 9px; font-size: 1.15rem; }
.results-list strong { margin-left: auto; color: var(--gold); flex-shrink: 0; }
.results .button { width: 100%; margin-bottom: 9px; }
@media (max-width: 670px) {
  .topbar { height: 56px; padding: 0 13px; gap: 9px; }
  .topbar .icon-button { width: 39px; height: 39px; }
  .wordmark { font-size: 1rem; }
  .wordmark > span { width: 30px; height: 30px; }
  .home { width: min(100% - 24px, 495px); display: block; margin: 1px auto 22px; }
  .hero { min-height: 0; height: clamp(335px, 105vw, 500px); border-radius: 21px; background-position: center 31%; }
  .hero-lettering { top: 12px; }
  .hero h1 { margin: 5px 0 4px; }
  .hero-logo { width: min(86%, 294px); }
  .hero-lettering p { font-size: .92rem; }
  .setup { position: relative; margin: -13px 5px 0; padding: 15px; }
  .count-row { margin-top: 13px; }
  .start { margin-top: 14px; }
  .page { width: calc(100% - 26px); margin: 12px auto 22px; }
  .cover { height: clamp(118px, 29vw, 176px); }
  .level-grid { gap: 9px; }
  .level { border-radius: 17px; }
  .level-body { padding: 10px 9px 14px; }
  .level-body p { font-size: .875rem; min-height: 41px; }
  .level-body .button { font-size: .875rem; padding-inline: 4px; gap: 4px; }
  .score-player { flex-basis: calc(33.333% - 6px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
