:root {
  --nav-height: 0px;
  --font-display: "Arial Black", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
  --sl-ink: #1d2725;
  --sl-paper: #fff8e8;
  --sl-coral: #ef725f;
  --sl-coral-dark: #aa463c;
  --sl-cyan: #65b8aa;
  --sl-cyan-dark: #256f68;
  --sl-yellow: #f2c85b;
  --sl-violet: #758ab5;
  --sl-track: #152c2c;
  --sl-track-soft: #23403d;
  --sl-wood: #9b613d;
  --sl-lane-d: #5cb0a9;
  --sl-lane-f: #d38b49;
  --sl-lane-j: #b7a24a;
  --sl-lane-k: #e06d5f;
}

* { box-sizing: border-box; }
html { color-scheme: light; background: #173a37; }
body { min-width: 320px; margin: 0; font-family: var(--font-body); background: #173a37; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, p, figure, fieldset, dl, dd { margin: 0; }
.skip-link {
  position: fixed;
  z-index: 30;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-160%);
  color: #fff8e8;
  background: #173a37;
}
.skip-link:focus { transform: none; }
.sl-home-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #173a37;
  font-size: .76rem;
  font-weight: 900;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.sl-home-link:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible { outline: 4px solid #fff8e8; outline-offset: 3px; }

.sl-page {
  flex: 1;
  min-height: calc(100vh - var(--nav-height));
  background: var(--sl-yellow);
  color: var(--sl-ink);
  overflow: hidden;
}

.sl-calibration-body label { margin-top: 12px; }
.sl-calibration-body label:first-child { margin-top: 0; }
.sl-calibration-body input[type="range"] { width: 100%; accent-color: var(--sl-coral-dark); }

.sl-menu[hidden],
.sl-game[hidden],
.sl-result[hidden] { display: none; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sl-menu {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - var(--nav-height) - 64px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
  align-items: center;
  gap: clamp(32px, 7vw, 96px);
  padding: clamp(40px, 6vw, 84px) 0;
}

.sl-menu-copy { max-width: 650px; }
.sl-brand {
  width: fit-content;
  margin-bottom: 20px;
  padding: 7px 12px;
  background: var(--sl-ink);
  color: #fff;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 900;
}
.sl-menu h1 {
  max-width: 14ch;
  margin-bottom: 18px;
  font-size: clamp(2.65rem, 5.5vw, 4.55rem);
  line-height: .98;
  letter-spacing: -.035em;
  color: var(--sl-ink);
}
.sl-lead {
  max-width: 54ch;
  margin-bottom: 26px;
  font-size: clamp(.98rem, 1.5vw, 1.12rem);
  line-height: 1.75;
  color: #3f354b;
}
.sl-lead kbd,
.sl-hit-key kbd {
  font-family: var(--font-mono);
  font-weight: 900;
}
.sl-lead kbd {
  display: inline-grid;
  min-width: 1.8em;
  min-height: 1.8em;
  place-items: center;
  border: 2px solid var(--sl-ink);
  border-radius: 5px;
  background: var(--sl-paper);
  box-shadow: 0 3px 0 var(--sl-ink);
}

.sl-song-line {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 590px;
  margin-bottom: 24px;
  padding: 13px 16px;
  background: rgba(255,255,255,.66);
  border: 2px solid var(--sl-ink);
  border-radius: 12px;
  width: 100%;
  color: var(--sl-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(29,39,37,.32);
  transition: transform .15s ease-out, background .15s ease-out;
}
.sl-song-line:hover { transform: translateY(-2px); background: rgba(255,255,255,.82); }
.sl-song-line:focus-visible { outline: 4px solid var(--sl-coral); outline-offset: 3px; }
.sl-song-line > span:nth-child(2) { display: grid; min-width: 0; gap: 1px; }
.sl-song-line strong { font-size: 1rem; }
.sl-song-line small { font-size: .72rem; color: #574b62; }
.sl-song-change { margin-left: auto; color: #8b3f38; font-size: .72rem; white-space: nowrap; }
.sl-vinyl {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: var(--sl-ink);
  box-shadow: inset 0 0 0 6px #3f344c, inset 0 0 0 12px var(--sl-ink);
}
.sl-vinyl i {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--sl-coral);
  border: 2px solid var(--sl-paper);
}

.sl-difficulty {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 590px;
  gap: 8px;
  border: 0;
}
.sl-difficulty legend {
  margin-bottom: 9px;
  font-size: .78rem;
  font-weight: 900;
}
.sl-difficulty-option {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 8px;
  min-height: 68px;
  padding: 10px 11px;
  text-align: left;
  color: var(--sl-ink);
  background: rgba(255,255,255,.5);
  border: 2px solid rgba(23,18,31,.35);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  transition: transform .16s ease-out, background .16s ease-out, border-color .16s ease-out;
}
.sl-difficulty-option:hover { transform: translateY(-2px); border-color: var(--sl-ink); }
.sl-difficulty-option:focus-visible { outline: 3px solid var(--sl-violet); outline-offset: 3px; }
.sl-difficulty-option.is-selected {
  background: var(--sl-paper);
  border-color: var(--sl-ink);
  transform: translateY(-3px);
  box-shadow: 0 4px 0 var(--sl-ink);
}
.sl-difficulty-option b { font-size: .95rem; }
.sl-difficulty-option span { font-size: .7rem; color: #62566e; }
.sl-difficulty-option i {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: var(--sl-ink);
  color: #fff;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}
.sl-difficulty-copy {
  min-height: 1.7em;
  max-width: 590px;
  margin: 12px 0 16px;
  font-size: .78rem;
  color: #51455d;
}
.sl-start,
.sl-panel-primary,
.sl-panel-secondary {
  font: inherit;
  cursor: pointer;
}
.sl-start {
  display: flex;
  width: min(100%, 590px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 12px 17px;
  color: #fff;
  background: var(--sl-coral);
  border: 2px solid var(--sl-ink);
  border-radius: 10px;
  box-shadow: 0 6px 0 var(--sl-ink);
  transition: transform .14s ease-out, box-shadow .14s ease-out, background .14s;
}
.sl-start:not(:disabled):hover { background: #ff4f43; transform: translateY(2px); box-shadow: 0 4px 0 var(--sl-ink); }
.sl-start:not(:disabled):active { transform: translateY(5px); box-shadow: 0 1px 0 var(--sl-ink); }
.sl-start:disabled { cursor: wait; filter: saturate(.45); opacity: .72; }
.sl-start span { font-size: 1rem; font-weight: 900; }
.sl-start small { font-size: .68rem; color: rgba(255,255,255,.86); }
.sl-calibration { max-width: 590px; margin-top: 22px; }
.sl-calibration summary { width: fit-content; cursor: pointer; font-size: .75rem; font-weight: 800; }
.sl-calibration-body {
  margin-top: 10px;
  padding: 13px 15px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(23,18,31,.34);
  border-radius: 9px;
}
.sl-calibration label { display: flex; justify-content: space-between; font-size: .76rem; font-weight: 800; }
.sl-calibration input { width: 100%; accent-color: var(--sl-coral-dark); }
.sl-calibration p { font-size: .68rem; line-height: 1.65; color: #5c5067; }

.sl-menu-art {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 560px;
  place-items: center;
  border: 3px solid var(--sl-ink);
  border-radius: 16px;
  background: var(--sl-cyan);
  box-shadow: 12px 12px 0 var(--sl-ink);
  overflow: hidden;
}
.sl-menu-art::before,
.sl-menu-art::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}
.sl-menu-art::before { width: 370px; height: 370px; background: var(--sl-violet); top: -170px; right: -105px; }
.sl-menu-art::after { width: 260px; height: 260px; background: var(--sl-coral); bottom: -125px; left: -90px; }
.sl-menu-art > p {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: .78rem;
  font-weight: 900;
}
.sl-beat-pal {
  position: relative;
  display: flex;
  width: clamp(170px, 20vw, 235px);
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  gap: 32px;
  border: 5px solid var(--sl-ink);
  border-radius: 50%;
  background: var(--sl-yellow);
  box-shadow: 0 14px 0 rgba(23,18,31,.22);
  animation: sl-pal-breathe 1.846s ease-in-out infinite;
}
.sl-pal-eye {
  width: 18px;
  height: 25px;
  border-radius: 50%;
  background: var(--sl-ink);
  transform-origin: center;
  animation: sl-blink 4.6s linear infinite;
}
.sl-pal-mouth {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 55px;
  height: 25px;
  transform: translateX(-50%);
  border: 5px solid var(--sl-ink);
  border-top: 0;
  border-radius: 0 0 50px 50px;
}
.sl-key-demo {
  position: absolute;
  display: grid;
  width: 86px;
  height: 98px;
  place-items: center;
  align-content: center;
  border: 3px solid var(--sl-ink);
  border-radius: 11px;
  box-shadow: 0 7px 0 var(--sl-ink);
  transform: rotate(var(--tilt));
}
.sl-key-demo b { font: 900 2rem/1 var(--font-mono); }
.sl-key-demo span { font-size: .64rem; font-weight: 800; }
.sl-key-demo-f { --tilt: -11deg; left: 8%; top: 19%; background: var(--sl-coral); }
.sl-key-demo-j { --tilt: 9deg; right: 8%; bottom: 20%; background: var(--sl-paper); }
.sl-orbit { position: absolute; border: 3px solid rgba(23,18,31,.75); border-radius: 50%; }
.sl-orbit-one { width: 390px; height: 150px; transform: rotate(22deg); }
.sl-orbit-two { width: 330px; height: 410px; transform: rotate(-38deg); border-style: dashed; }

@keyframes sl-pal-breathe { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes sl-blink { 0%, 46%, 50%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.08); } }

/* Game */
.sl-game {
  min-height: 100dvh;
  padding: 12px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--sl-ink);
  color: #fff;
}
.sl-game-hud {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) minmax(150px, 2fr) auto auto;
  align-items: center;
  gap: clamp(10px, 2vw, 24px);
  width: min(1100px, 100%);
  min-height: 56px;
  margin: 0 auto 8px;
}
.sl-icon-button {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--sl-track-soft);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}
.sl-track-name { display: grid; line-height: 1.25; }
.sl-track-name strong { font-size: .78rem; }
.sl-track-name span { font-size: .63rem; color: #bcb4c9; }
.sl-progress { height: 7px; background: #3b3148; overflow: hidden; border-radius: 999px; }
.sl-progress i { display: block; width: 0; height: 100%; background: var(--sl-yellow); transition: width .1s linear; }
.sl-hud-stat { display: grid; text-align: right; line-height: 1.2; }
.sl-hud-stat span { font-size: .58rem; color: #bcb4c9; }
.sl-hud-stat strong { min-width: 7.5ch; font: 800 .86rem/1.3 var(--font-mono); font-variant-numeric: tabular-nums; }
.sl-stage {
  position: relative;
  width: min(880px, 100%);
  height: calc(100dvh - 165px);
  min-height: 430px;
  max-height: 760px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: var(--sl-track);
  border: 1px solid rgba(255,255,255,.14);
  transition: transform .08s ease-out;
}
.sl-stage.is-impact { transform: scale(.995); }
#sl-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.sl-countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--sl-yellow);
  font: 900 clamp(4rem, 18vw, 9rem)/1 var(--font-mono);
  text-shadow: 6px 6px 0 var(--sl-coral-dark);
}
.sl-countdown.is-pop { animation: sl-countdown .7s cubic-bezier(.16,1,.3,1); }
@keyframes sl-countdown { from { transform: scale(1.65); opacity: 0; } 28% { transform: scale(1); opacity: 1; } to { opacity: .88; } }
.sl-judge {
  position: absolute;
  z-index: 3;
  top: 61%;
  left: 50%;
  display: grid;
  min-width: 180px;
  transform: translate(-50%, -50%) scale(.72);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.sl-judge strong { font-size: clamp(1.35rem, 4vw, 2.2rem); line-height: 1; text-shadow: 3px 3px 0 rgba(23,18,31,.72); }
.sl-judge span { margin-top: 6px; color: #fff; font: 800 .7rem/1 var(--font-mono); }
.sl-judge.is-show { animation: sl-judge-pop .46s cubic-bezier(.16,1,.3,1); }
.sl-judge.is-perfect strong { color: var(--sl-yellow); }
.sl-judge.is-great strong { color: #78e5df; }
.sl-judge.is-good strong { color: #d5c8ff; }
.sl-judge.is-miss strong { color: #ff877d; }
@keyframes sl-judge-pop { 0% { opacity: 0; transform: translate(-50%, -35%) scale(.55); } 25%, 68% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -72%) scale(.92); } }
.sl-combo {
  position: absolute;
  z-index: 2;
  top: 43%;
  left: 50%;
  display: grid;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.sl-combo.is-visible { opacity: 1; }
.sl-combo strong { font: 900 clamp(2rem, 7vw, 4rem)/.9 var(--font-mono); color: #fff; text-shadow: 3px 3px 0 rgba(23,18,31,.7); }
.sl-combo span { font-size: .55rem; font-weight: 900; letter-spacing: .18em; color: var(--sl-yellow); }
.sl-pause-layer {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23,18,31,.84);
}
.sl-pause-layer[hidden] { display: none; }
.sl-pause-panel { width: min(330px, calc(100% - 32px)); text-align: center; }
.sl-mini-pal {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  place-items: center;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border-radius: 50%;
  font: 900 1.1rem/1 var(--font-mono);
}
.sl-pause-panel h2 { color: #fff; margin-bottom: 6px; }
.sl-pause-panel p { margin-bottom: 20px; color: #d7d0df; font-size: .82rem; }
.sl-panel-primary,
.sl-panel-secondary {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 900;
}
.sl-panel-primary { color: var(--sl-ink); background: var(--sl-yellow); border: 0; box-shadow: 0 4px 0 #a98600; }
.sl-panel-secondary { margin-top: 10px; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.42); }
.sl-hit-controls {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  width: min(520px, calc(100% - 28px));
  gap: 12px;
  transform: translateX(-50%);
  pointer-events: none;
}
.sl-hit-key {
  display: flex;
  min-height: 68px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform .07s ease-out, filter .07s;
}
.sl-hit-key-f { background: var(--sl-coral-dark); }
.sl-hit-key-j { background: var(--sl-cyan-dark); }
.sl-hit-key kbd { font-size: 1.7rem; }
.sl-hit-key span { font-size: .68rem; }
.sl-hit-key.is-down { transform: translateY(4px) scale(.98); filter: brightness(1.35); }

/* Results */
.sl-result {
  width: min(960px, calc(100% - 32px));
  min-height: calc(100vh - var(--nav-height) - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, .78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(30px, 7vw, 84px);
  padding: 50px 0;
}
.sl-result[hidden] { display: none; }
.sl-result-grade { text-align: center; }
.sl-result-pal {
  display: grid;
  width: min(240px, 70vw);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  place-items: center;
  border: 4px solid var(--sl-ink);
  border-radius: 50%;
  background: var(--sl-cyan);
  box-shadow: 9px 9px 0 var(--sl-ink);
  font: 900 2.5rem/1 var(--font-mono);
}
.sl-result-grade p { font-size: .72rem; font-weight: 900; }
.sl-result-grade > strong { display: block; margin-top: -8px; font: 900 clamp(5rem, 15vw, 9rem)/1 var(--font-mono); }
.sl-result-report { padding: clamp(24px, 4vw, 42px); background: var(--sl-paper); border: 3px solid var(--sl-ink); border-radius: 14px; box-shadow: 10px 10px 0 var(--sl-ink); }
.sl-result-song { margin-bottom: 6px; color: #6b5e75; font-size: .72rem; font-weight: 800; }
.sl-result-report h2 { margin-bottom: 22px; color: var(--sl-ink); font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.03em; }
.sl-result-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.sl-result-summary div { padding: 12px 8px; border-top: 2px solid var(--sl-ink); }
.sl-result-summary span { display: block; font-size: .63rem; color: #695d73; }
.sl-result-summary strong { font: 900 .92rem/1.5 var(--font-mono); }
.sl-judgement-list { display: grid; gap: 5px; }
.sl-judgement-list div { display: flex; justify-content: space-between; padding: 7px 11px; border-radius: 6px; font: 800 .72rem/1.4 var(--font-mono); }
.sl-judgement-list .is-perfect { background: #ffe990; }
.sl-judgement-list .is-great { background: #baf2ee; }
.sl-judgement-list .is-good { background: #ded5fa; }
.sl-judgement-list .is-miss { background: #ffd1cd; }
.sl-result-tip { margin: 18px 0; font-size: .78rem; line-height: 1.7; color: #53475e; }
.sl-result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sl-result-actions .sl-panel-secondary { margin: 0; color: var(--sl-ink); border-color: rgba(23,18,31,.52); }

body.sl-immersive { overflow: hidden; background: var(--sl-ink); }
body.sl-immersive .navbar,
body.sl-immersive .footer { display: none; }
body.sl-immersive .sl-page { min-height: 100dvh; }

/* Production song picker */
.sl-song-dialog {
  width: min(900px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: hidden;
  color: var(--sl-ink);
  background: #f7e5b0;
  border: 3px solid var(--sl-ink);
  border-radius: 16px;
  box-shadow: 12px 12px 0 rgba(29,39,37,.72);
}
.sl-song-dialog::backdrop { background: rgba(12,29,28,.76); backdrop-filter: blur(4px); }
.sl-song-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  background: #173a37;
  color: #fff8e8;
  border-bottom: 3px solid var(--sl-ink);
}
.sl-song-dialog-head p { margin: 0 0 3px; color: #f2c85b; font-size: .66rem; font-weight: 900; }
.sl-song-dialog-head h2 { margin: 0; font-size: clamp(1.45rem, 4vw, 2.25rem); }
.sl-song-dialog-head button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: var(--sl-ink);
  background: #f2c85b;
  border: 2px solid #fff8e8;
  border-radius: 50%;
  cursor: pointer;
  font: 900 1.5rem/1 sans-serif;
}
.sl-song-wheel-shell {
  position: relative;
  overflow: hidden;
  background: #23403d;
  border-bottom: 3px solid var(--sl-ink);
}
.sl-song-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  height: min(560px, calc(100dvh - 205px));
  min-height: 330px;
  padding: clamp(98px, 16vh, 150px) clamp(48px, 7vw, 76px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 15%, #000 85%, transparent 100%);
}
.sl-song-list::-webkit-scrollbar { display: none; }
.sl-song-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 11px 18px;
  color: var(--sl-ink);
  background: rgba(255,248,232,.72);
  border: 2px solid rgba(29,39,37,.28);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  opacity: .42;
  scroll-snap-align: center;
  text-align: left;
  transform: scale(.91);
  transition: min-height .22s cubic-bezier(.16,1,.3,1), transform .22s cubic-bezier(.16,1,.3,1), opacity .18s ease-out, background .18s ease-out, border-color .18s ease-out;
}
.sl-song-card:hover { opacity: .78; border-color: var(--sl-yellow); background: #fff8e8; }
.sl-song-card:focus-visible { outline: 4px solid var(--sl-yellow); outline-offset: 3px; }
.sl-song-card.is-wheel-near { opacity: .7; transform: scale(.96); }
.sl-song-card.is-wheel-active {
  z-index: 2;
  min-height: 112px;
  opacity: 1;
  color: #fff8e8;
  background: var(--sl-coral-dark);
  border-color: #fff8e8;
  box-shadow: 0 7px 0 var(--sl-ink);
  transform: scale(1.035);
}
.sl-current-badge {
  position: absolute;
  top: -10px;
  right: 20px;
  display: none;
  padding: 4px 8px;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border: 2px solid var(--sl-ink);
  border-radius: 4px;
  font: 900 .58rem/1 var(--font-mono);
}
.sl-song-card.is-selected .sl-current-badge { display: block; }
.sl-song-number { font: 900 1.2rem/1 var(--font-mono); color: #a84c42; }
.sl-song-card.is-wheel-active .sl-song-number { color: var(--sl-yellow); font-size: 1.65rem; }
.sl-song-card-copy { display: grid; min-width: 0; gap: 2px; }
.sl-song-card-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: clamp(1.05rem, 2.4vw, 1.38rem); line-height: 1.08; }
.sl-song-card.is-wheel-active .sl-song-card-copy strong { font-size: clamp(1.55rem, 4vw, 2.35rem); }
.sl-song-card-copy small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #655a62; font-size: .7rem; }
.sl-song-card.is-wheel-active .sl-song-card-copy small { margin-top: 6px; color: #ffeec5; font-size: .78rem; }
.sl-song-record { min-width: 52px; text-align: right; color: #7b6e55; font: 800 .58rem/1.35 var(--font-mono); }
.sl-song-record b { display: block; color: #a8463e; font-size: .82rem; }
.sl-song-card.is-wheel-active .sl-song-record { color: #ffeec5; }
.sl-song-card.is-wheel-active .sl-song-record b { color: var(--sl-yellow); font-size: 1.08rem; }
.sl-song-step {
  position: absolute;
  z-index: 4;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border: 2px solid #fff8e8;
  border-radius: 5px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 900;
  transform: translateX(-50%);
}
.sl-song-step:hover, .sl-song-step:focus-visible { background: #fff0a5; }
.sl-song-step-prev { top: 11px; }
.sl-song-step-next { bottom: 11px; }
.sl-song-step span { font-size: .8rem; }
.sl-song-counter {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: 17px;
  color: #fff8e8;
  font: 900 .72rem/1 var(--font-mono);
}
.sl-song-list[data-direction="next"] .sl-song-card.is-wheel-active { animation: sl-song-next .25s cubic-bezier(.16,1,.3,1); }
.sl-song-list[data-direction="previous"] .sl-song-card.is-wheel-active { animation: sl-song-previous .25s cubic-bezier(.16,1,.3,1); }
@keyframes sl-song-next { from { opacity: .35; transform: translateY(28px) scale(.94); } }
@keyframes sl-song-previous { from { opacity: .35; transform: translateY(-28px) scale(.94); } }
.sl-song-dialog-foot { margin: 0; padding: 11px 18px 14px; color: #655a62; font-size: .65rem; }

/* Beginner mode retains the whole band but turns the outer members into the
   cheering section; the playable surface itself is an unmistakable 2K game. */
.sl-game.is-2k .sl-performer-d,
.sl-game.is-2k .sl-performer-k { opacity: .58; filter: saturate(.65); }
.sl-game.is-2k .sl-hit-key-d,
.sl-game.is-2k .sl-hit-key-k { display: none; }
.sl-game.is-2k .sl-hit-key-f,
.sl-game.is-2k .sl-hit-key-j { min-height: 70px; }
.sl-game.is-ending .sl-progress { box-shadow: 0 0 0 2px #f2c85b; }

@media (max-width: 820px) {
  .sl-menu { grid-template-columns: 1fr; width: min(650px, calc(100% - 30px)); }
  .sl-menu-art { min-height: 390px; order: -1; }
  .sl-menu-copy { max-width: none; }
  .sl-menu h1 { max-width: 12ch; }
  .sl-result { grid-template-columns: 1fr; }
  .sl-result-pal { width: 180px; }
}

@media (max-width: 640px) {
  .sl-menu { min-height: auto; padding: 28px 0 50px; }
  .sl-menu-art { min-height: 270px; box-shadow: 7px 7px 0 var(--sl-ink); }
  .sl-menu-art > p, .sl-orbit { display: none; }
  .sl-beat-pal { width: 130px; gap: 22px; border-width: 4px; }
  .sl-pal-eye { width: 13px; height: 18px; }
  .sl-pal-mouth { bottom: 31px; width: 38px; height: 18px; border-width: 4px; }
  .sl-key-demo { width: 62px; height: 72px; }
  .sl-key-demo b { font-size: 1.45rem; }
  .sl-menu h1 { font-size: clamp(2.5rem, 11vw, 3.7rem); }
  .sl-difficulty-option { grid-template-columns: 1fr; }
  .sl-difficulty-option i { display: none; }
  .sl-start { align-items: flex-start; flex-direction: column; gap: 1px; }
  .sl-game { padding-top: 6px; }
  .sl-game-hud { grid-template-columns: auto 1fr auto auto; gap: 8px; }
  .sl-progress { grid-column: 1 / -1; grid-row: 2; }
  .sl-track-name { min-width: 0; }
  .sl-track-name strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .sl-stage { height: calc(100dvh - 150px); min-height: 360px; }
  .sl-hit-controls { bottom: max(8px, env(safe-area-inset-bottom)); gap: 7px; }
  .sl-hit-key { min-height: 58px; }
  .sl-result-summary { grid-template-columns: 1fr; }
  .sl-result-summary div { display: flex; justify-content: space-between; }
  .sl-result-actions { grid-template-columns: 1fr; }
  .sl-song-list { min-height: 300px; padding-right: 22px; padding-left: 22px; }
  .sl-song-dialog-head { padding: 16px; }
  .sl-song-dialog-head p { max-width: 34ch; }
  .sl-song-card { grid-template-columns: 38px minmax(0, 1fr); min-height: 64px; gap: 10px; padding: 10px 12px; }
  .sl-song-card.is-wheel-active { min-height: 104px; transform: scale(1.01); }
  .sl-song-record { display: none; }
  .sl-current-badge { right: 10px; }
}

@media (hover: hover) and (min-width: 760px) {
  .sl-hit-controls { opacity: .68; }
  .sl-hit-key { min-height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .sl-beat-pal, .sl-pal-eye, .sl-countdown.is-pop, .sl-judge.is-show { animation: none; }
  .sl-judge.is-show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  .sl-difficulty-option, .sl-start, .sl-stage, .sl-hit-key, .sl-song-card { transition: none; }
  .sl-song-list { scroll-behavior: auto; }
  .sl-song-list[data-direction] .sl-song-card.is-wheel-active { animation: none; }
}

/* 狸尾公寓樂團版 ------------------------------------------------------- */
.sl-page {
  background-color: #f1c75d;
  background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(64,43,29,.08) 1px, transparent 1px);
  background-size: 28px 28px;
}
.sl-brand { background: #173a37; }
.sl-start { background: #c95246; }
.sl-start:not(:disabled):hover { background: #b9443a; }
.sl-lead kbd + kbd { margin-left: 3px; }

.sl-menu-art {
  min-height: 600px;
  padding: 28px 22px 64px;
  place-items: stretch;
  background: linear-gradient(#224c49 0 56%, #c89459 56% 59%, #865238 59%);
  box-shadow: 12px 12px 0 var(--sl-ink);
}
.sl-menu-art::before {
  width: 170px;
  height: 170px;
  top: -55px;
  right: -42px;
  background: #efd98a;
  opacity: .9;
}
.sl-menu-art::after {
  inset: 12% 7% auto;
  width: auto;
  height: 42%;
  border: 2px solid rgba(255,248,232,.22);
  border-radius: 12px;
  background: linear-gradient(90deg, transparent 49.5%, rgba(255,248,232,.18) 50%, transparent 50.5%), linear-gradient(transparent 49.5%, rgba(255,248,232,.18) 50%, transparent 50.5%);
}
.sl-menu-band {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 8px 4px;
}
.sl-menu-band figure { position: relative; display: grid; min-width: 0; place-items: end center; margin: 0; }
.sl-menu-band img { width: min(100%, 235px); max-height: 235px; object-fit: contain; filter: drop-shadow(0 8px 0 rgba(29,39,37,.2)); }
.sl-menu-band figcaption {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 6px;
  padding: 7px 8px;
  color: var(--sl-ink);
  background: rgba(255,248,232,.92);
  border: 2px solid var(--sl-ink);
  border-radius: 7px;
  box-shadow: 0 3px 0 rgba(29,39,37,.6);
}
.sl-menu-band figcaption kbd { grid-row: 1 / 3; font: 900 1.2rem/1 var(--font-mono); }
.sl-menu-band figcaption b { font-size: .74rem; }
.sl-menu-band figcaption span { overflow: hidden; font-size: .58rem; white-space: nowrap; text-overflow: ellipsis; color: #58625f; }
.sl-menu-art > p { z-index: 2; color: #fff8e8; text-shadow: 0 2px 0 rgba(29,39,37,.65); }

.sl-game { background: #112725; }
.sl-game-hud { grid-template-columns: auto minmax(130px, 1fr) minmax(110px, 1.6fr) auto auto auto; }
.sl-section-cue {
  display: grid;
  min-width: 78px;
  padding: 5px 9px;
  line-height: 1.1;
  text-align: center;
  color: var(--sl-ink);
  background: var(--sl-yellow);
  border-radius: 6px;
  transform: rotate(-1deg);
}
.sl-section-cue span { font-size: .52rem; font-weight: 800; }
.sl-section-cue strong { font-size: .72rem; }
.sl-section-cue.is-change { animation: sl-cue-change .48s cubic-bezier(.2,.8,.2,1); }
@keyframes sl-cue-change { 0% { transform: rotate(-1deg) scale(.72); } 55% { transform: rotate(2deg) scale(1.1); } }

.sl-stage {
  display: grid;
  grid-template-rows: clamp(108px, 22vh, 170px) minmax(0, 1fr);
  background: #173a37;
  border-color: rgba(255,248,232,.24);
  box-shadow: 0 0 0 1px rgba(0,0,0,.22), 0 18px 42px rgba(0,0,0,.25);
}
.sl-stage.is-impact { transform: scale(.998); }
.sl-band {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  padding: 8px 7% 0;
  overflow: hidden;
  background: linear-gradient(rgba(15,40,38,.18), rgba(15,40,38,.78)), radial-gradient(circle at 50% -30%, #6f8a74, #214744 68%);
  border-bottom: 5px solid #9d6845;
}
.sl-band::before {
  content: '';
  position: absolute;
  inset: 10px 5% 16px;
  border: 1px solid rgba(255,248,232,.18);
  border-radius: 8px;
  background: linear-gradient(90deg, transparent 24.7%, rgba(255,248,232,.09) 25%, transparent 25.3%, transparent 49.7%, rgba(255,248,232,.09) 50%, transparent 50.3%, transparent 74.7%, rgba(255,248,232,.09) 75%, transparent 75.3%);
}
.sl-performer { position: relative; z-index: 1; display: grid; height: 100%; min-width: 0; place-items: end center; margin: 0; transform-origin: 50% 100%; }
.sl-performer img { width: min(100%, 145px); height: calc(100% - 24px); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 6px 0 rgba(10,28,27,.28)); }
.sl-performer figcaption {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 4px;
  color: #fff8e8;
  border-radius: 4px;
  background: rgba(17,39,37,.82);
  font-size: .56rem;
}
.sl-performer figcaption kbd { font: 900 .72rem/1 var(--font-mono); }
.sl-performer.is-hit { animation: sl-band-hit .24s cubic-bezier(.2,.8,.2,1); }
.sl-performer.is-perfect img { filter: drop-shadow(0 0 12px #f2c85b) drop-shadow(0 6px 0 rgba(10,28,27,.25)); }
.sl-performer.is-miss { animation: sl-band-miss .42s ease-out; }
@keyframes sl-band-hit { 0% { transform: translateY(0) rotate(0); } 45% { transform: translateY(-10px) rotate(-2deg) scale(1.045); } }
@keyframes sl-band-miss { 20% { transform: translateX(-5px) rotate(-2deg); } 45% { transform: translateX(5px) rotate(2deg); } 70% { transform: translateX(-3px); } }
.sl-neighbour-note {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 10px;
  margin: 0;
  padding: 4px 8px;
  color: #4a3425;
  background: #fff4d6;
  border: 1px solid rgba(74,52,37,.6);
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(17,39,37,.45);
  font-size: .55rem;
  font-weight: 800;
  transform: rotate(1.5deg);
}
.sl-lane-viewport { position: relative; min-height: 0; overflow: hidden; }
#sl-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.sl-stage[data-section="chorus"] .sl-band { background: linear-gradient(rgba(43,37,24,.12), rgba(17,39,37,.72)), radial-gradient(circle at 50% -20%, #c4a44b, #28534e 68%); }
.sl-stage[data-section="break"] .sl-band { background: linear-gradient(rgba(10,32,31,.08), rgba(10,32,31,.76)), radial-gradient(circle at 50% -20%, #a05a4a, #234743 68%); }
.sl-stage[data-section="break"] .sl-performer-k { transform: scale(1.08); }
.sl-pause-character { width: 92px; height: 92px; margin: 0 auto 8px; object-fit: contain; }

.sl-hit-controls { width: min(700px, calc(100% - 28px)); gap: 8px; }
.sl-hit-key { min-width: 0; padding: 6px; gap: 8px; border-color: rgba(255,248,232,.72); }
.sl-hit-key-d { background: #367f79; }
.sl-hit-key-f { background: #9b5c2f; }
.sl-hit-key-j { background: #83742e; }
.sl-hit-key-k { background: #a8463e; }

.sl-result-pal {
  grid-template-columns: repeat(2, 1fr);
  place-items: end center;
  padding: 18px;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(#4f8e83 0 62%, #9c6845 62%);
}
.sl-result-pal img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(29,39,37,.18)); }
.sl-result-pal[data-grade="D"] { background: linear-gradient(#8e7770 0 62%, #715344 62%); }

@media (max-width: 820px) {
  .sl-menu-art { min-height: 530px; }
  .sl-menu-band img { max-height: 210px; }
}

@media (max-width: 640px) {
  .sl-menu-art { min-height: 410px; padding: 16px 10px 44px; }
  .sl-menu-band { gap: 2px; }
  .sl-menu-band img { max-height: 160px; }
  .sl-menu-band figcaption { padding: 4px; }
  .sl-menu-band figcaption span { display: none; }
  .sl-game-hud { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .sl-section-cue { grid-column: 2; grid-row: 2; justify-self: start; min-width: 66px; }
  .sl-progress { grid-column: 1 / -1; grid-row: 3; }
  .sl-stage { height: calc(100dvh - 178px); min-height: 420px; grid-template-rows: 96px minmax(0, 1fr); }
  .sl-band { padding: 5px 2% 0; }
  .sl-performer img { width: 100%; height: calc(100% - 18px); }
  .sl-performer figcaption b { display: none; }
  .sl-neighbour-note { display: none; }
  .sl-hit-controls { gap: 4px; }
  .sl-hit-key { min-height: 55px; flex-direction: column; gap: 0; }
  .sl-hit-key kbd { font-size: 1.35rem; }
  .sl-hit-key span { font-size: .54rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sl-performer.is-hit, .sl-performer.is-miss, .sl-section-cue.is-change { animation: none; }
}
