:root {
  color-scheme: light;
  --page: #fbf7ee;
  --ink: #27241f;
  --muted: #655b50;
  --accent: #a53d1b;
  --accent-dark: #832d12;
  --line: #dfd5c3;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--page); color: var(--ink); }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.page { width: 100%; max-width: 680px; min-height: 0; margin: 0 auto; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
.song-heading { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: center; padding: 20px 0; }
.song-cover { display: block; width: 112px; height: 112px; object-fit: cover; border-radius: 14px; box-shadow: 0 5px 18px #5d3b2420; background: #e3cba0; }
.song-info { min-width: 0; }
h1 { margin: 0; font-size: clamp(2rem, 6vw, 2.75rem); font-weight: 800; line-height: 1.35; letter-spacing: -.055em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.creator { margin: 8px 0 0; font-size: 1.375rem; line-height: 1.45; color: var(--muted); font-weight: 600; }
.lyrics-section { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 1px solid var(--line); }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 4px 10px; }
h2 { margin: 0; font-size: 1.25rem; line-height: 1.5; font-weight: 700; color: var(--muted); }
#lyrics-sync-label { font-size: 1.125rem; line-height: 1.5; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.lyrics-viewport { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #c8b49b transparent; padding: 8px 2px 24px; scroll-padding-block: 30%; }
.lyrics-viewport:focus-visible { outline: 3px solid #1f5a85; outline-offset: -3px; border-radius: 8px; }
.lyrics { text-align: center; font-size: 1.5rem; line-height: 1.75; letter-spacing: -.035em; word-break: keep-all; overflow-wrap: anywhere; padding-bottom: min(25vh, 160px); }
.lyric-line { margin: 0; padding: 9px 8px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); font-weight: 500; }
.lyric-line > span { display: inline-block; max-width: 100%; }
.lyric-line.line-gap { margin-top: 22px; }
.lyric-line.is-past { color: #51493f; }
.lyric-line.is-current { color: #8f3010; background: #fff0df; border-color: #ebcdb4; font-weight: 800; }
.player-dock { min-width: 0; padding: 12px max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: #fffdf8; border-top: 1px solid var(--line); box-shadow: 0 -6px 28px #5640180a; }
.dock-inner { max-width: 640px; margin: 0 auto; }
.play-status { margin: 0 0 10px; text-align: center; color: var(--muted); font-size: 1.125rem; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.play-button { border: 0; border-radius: 18px; width: 100%; min-height: 80px; padding: 15px 18px; display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--accent); color: #fff; font-size: 1.75rem; font-weight: 750; line-height: 1.4; cursor: pointer; box-shadow: 0 4px 0 var(--accent-dark); }
#button-label { min-width: 0; overflow-wrap: anywhere; }
.play-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
.play-button:focus-visible, .skip-button:focus-visible { outline: 4px solid #1f5a85; outline-offset: 4px; }
.play-button:disabled { cursor: wait; opacity: .65; }
.button-icon { width: 30px; height: 30px; flex: 0 0 30px; }
.timeline { display: flex; align-items: center; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 1.125rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.timeline time { min-width: 3ch; white-space: nowrap; }
/* The full 44px height is touchable; the colored rail stays visually simple. */
.seek-range { --seek-percent: 0%; display: block; flex: 1 1 auto; width: 100%; min-width: 0; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 12px; appearance: none; -webkit-appearance: none; background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--seek-percent), #d8c9b6 var(--seek-percent), #d8c9b6 100%) center / 100% 7px no-repeat; cursor: pointer; touch-action: none; }
.seek-range::-webkit-slider-runnable-track { height: 7px; border-radius: 7px; background: transparent; }
.seek-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8.5px; border: 3px solid #fffdf8; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.seek-range::-moz-range-track { height: 7px; border: 0; border-radius: 7px; background: transparent; }
.seek-range::-moz-range-thumb { width: 20px; height: 20px; border: 3px solid #fffdf8; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.seek-range:focus-visible { outline: 3px solid #1f5a85; outline-offset: 2px; }
.seek-range:disabled { opacity: .55; cursor: wait; }
.noscript-message { background: var(--page); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; padding: 20px; text-align: center; font-size: 1.25rem; }
.noscript-message audio { max-width: 100%; }
@media (min-width: 720px) and (min-height: 700px) {
  .song-heading { grid-template-columns: 128px minmax(0, 1fr); gap: 24px; padding: 26px 0; }
  .song-cover { width: 128px; height: 128px; }
  .lyrics { font-size: 1.625rem; }
}
@media (max-width: 359px) {
  .page { padding-right: max(16px, env(safe-area-inset-right)); padding-left: max(16px, env(safe-area-inset-left)); }
  .song-heading { grid-template-columns: 100px minmax(0, 1fr); gap: 14px; }
  .song-cover { width: 100px; height: 100px; }
  .player-dock { padding-right: max(16px, env(safe-area-inset-right)); padding-left: max(16px, env(safe-area-inset-left)); }
}
/* Compact mode preserves the playback controls and a usable lyrics viewport. */
body.is-compact .song-heading { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 10px 0; }
body.is-compact .song-cover { width: 76px; height: 76px; border-radius: 10px; }
body.is-compact h1 { font-size: 1.65rem; }
body.is-compact .creator { margin-top: 4px; font-size: 1.125rem; }
body.is-compact .section-label { padding-top: 8px; padding-bottom: 6px; }
body.is-compact .play-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.is-compact .timeline { display: flex; margin-top: 8px; }
body.is-compact .player-dock { padding-top: 10px; }
body.is-compact .play-button { min-height: 72px; padding: 12px; font-size: 1.375rem; gap: 10px; }
@media (max-height: 620px) {
  .song-heading { grid-template-columns: 88px minmax(0, 1fr); padding: 12px 0; gap: 14px; }
  .song-cover { width: 88px; height: 88px; }
  .section-label { padding-top: 8px; padding-bottom: 6px; }
  .play-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .timeline { margin-top: 8px; font-size: 1rem; }
  .play-button { min-height: 72px; padding-top: 12px; padding-bottom: 12px; }
}
@media (max-height: 440px) {
  .song-heading { grid-template-columns: 58px minmax(0, 1fr); padding: 7px 0; gap: 14px; }
  .song-cover { width: 58px; height: 58px; border-radius: 9px; }
  h1 { font-size: 1.5rem; }
  .creator { font-size: 1.125rem; margin-top: 2px; }
  .timeline { display: flex; margin-top: 6px; }
  .player-dock { padding-top: 8px; }
  .play-button { min-height: 64px; font-size: 1.375rem; padding-top: 9px; padding-bottom: 9px; }
  .section-label { padding-top: 5px; padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Previous / play / next remain together in the bottom controls. */
.track-position { margin: 6px 0 0; color: var(--muted); font-size: 1.25rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.transport-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: stretch; }
.transport-row.has-multiple { grid-template-columns: minmax(64px, .75fr) minmax(0, 1.7fr) minmax(64px, .75fr); }
.skip-button { min-width: 0; min-height: 80px; padding: 8px 3px; border: 1px solid #b6aa98; border-radius: 16px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: #f6ede0; color: var(--ink); font-size: 1.125rem; line-height: 1.35; font-weight: 700; cursor: pointer; }
.skip-button svg { width: 26px; height: 26px; flex: 0 0 26px; }
.skip-button span { max-width: 100%; word-break: keep-all; overflow-wrap: anywhere; }
.skip-button:active { background: #ecdeca; }
.skip-button:disabled { opacity: .55; cursor: default; }
.transport-row.has-multiple .play-button { min-width: 0; flex-direction: column; padding: 10px 6px; gap: 5px; font-size: 1.375rem; line-height: 1.3; }
.transport-row.has-multiple .button-icon { width: 26px; height: 26px; flex-basis: 26px; }
.transport-row.has-multiple #button-label { max-width: 100%; word-break: keep-all; overflow-wrap: anywhere; }
body.is-compact .track-position { font-size: 1rem; margin-top: 3px; }
body.is-compact .skip-button { min-height: 72px; font-size: 1rem; padding: 6px 2px; }
body.is-compact .transport-row.has-multiple .play-button { font-size: 1.25rem; min-height: 72px; }
body .play-status.is-important { position: static; width: auto; height: auto; padding: 0; margin: 0 0 8px; overflow: visible; clip-path: none; white-space: normal; font-size: 1rem; }
@media (max-height: 440px) {
  .track-position { margin-top: 2px; font-size: 1rem; }
  .skip-button, .transport-row.has-multiple .play-button { min-height: 64px; }
}

/* Keep enlarged text usable on a narrow phone without sacrificing the lyrics area. */
@media (max-width: 480px) {
  body.is-compact .song-heading { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
  body.is-compact .song-cover { width: 64px; height: 64px; }
  body.is-compact .song-info { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 4px; }
  body.is-compact h1 { flex: 0 0 100%; font-size: 1.25rem; line-height: 1.25; }
  body.is-compact .creator, body.is-compact .track-position { margin: 0; font-size: 1rem; line-height: 1.25; }
  body.is-compact .transport-row.has-multiple { grid-template-columns: minmax(76px, .9fr) minmax(0, 1.4fr) minmax(76px, .9fr); gap: 6px; }
  body.is-compact .skip-button { padding: 6px 2px; gap: 4px; font-size: max(1rem, 18px); line-height: 1.2; }
  body.is-compact .transport-row.has-multiple .play-button { padding: 8px 4px; gap: 4px; font-size: max(1rem, 22px); line-height: 1.2; }
}

/* Seeking is available even in landscape and with enlarged text. */
body.is-compact .timeline { gap: 10px; font-size: max(.75rem, 16px); line-height: 1.25; }
@media (max-width: 480px) {
  body.is-compact .song-heading { grid-template-columns: 56px minmax(0, 1fr); }
  body.is-compact .song-cover { width: 56px; height: 56px; }
  body.is-compact h1 { font-size: 1.125rem; line-height: 1.2; }
  body.is-compact .section-label { padding-top: 6px; padding-bottom: 4px; }
  body.is-compact .section-label h2, body.is-compact #lyrics-sync-label { font-size: max(1rem, 18px); line-height: 1.25; }
}
