:root {
  color-scheme: only light;
  --bg: #f8f8f8;
  --card: #ffffff;
  --text-strong: rgb(0 0 0 / .85);
  --text: rgb(0 0 0 / .62);
  --text-soft: rgb(0 0 0 / .46);
  --line: rgb(0 0 0 / .1);
  --red: #e8301f;
  --blue: #2f74f6;
  --blue-edge: #1f5dd1;
  --shadow: rgb(0 0 0 / .18);
  --scrim: rgb(0 0 0 / .3);
  --wave-bar: rgb(0 0 0 / .32);
  font-size: clamp(13px, 1.27vw, 17px);
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.32;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

.page { width: min(44rem, 100% - 2rem); margin: 0 auto; padding: 3rem 0 4rem; }

.small { font-size: .85rem; font-weight: 600; line-height: 1.3; letter-spacing: .02em; color: var(--text-soft); }

/* 앨범 헤더 */
.album { display: grid; grid-template-columns: 13.2rem 1fr; gap: 2rem; align-items: start; }
.cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; background: var(--card); box-shadow: 0 .6rem 1.8rem var(--shadow); }

h1 { font-size: 1.9rem; font-weight: 500; line-height: 1.15; letter-spacing: -.02em; color: var(--text-strong); }
h1 span { display: block; }
.artist { margin-top: .2rem; color: var(--red); font-size: 1.25rem; line-height: 1.2; letter-spacing: -.01em; }

.meta { margin-top: 1rem; }
.meta span + span::before { content: "·"; margin: 0 .5em; }

.intro { margin-top: 1rem; }
.more { font-weight: 600; text-decoration: underline; text-underline-offset: .15em; margin-left: .3em; }
.more:hover { color: var(--text-strong); }

.follow {
  display: block; width: fit-content; min-width: 7.5rem; margin-top: 1rem; padding: .35rem 1.1rem;
  background: var(--blue); border: 1px solid var(--blue-edge); border-radius: .3rem;
  color: #fff; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none;
  box-shadow: 0 .25rem .8rem rgb(47 116 246 / .28);
  transition: filter .15s;
}
.follow:hover { filter: brightness(1.1); }
.follow::after { content: " ↗"; }

/* 트랙 리스트 */
.tracks { list-style: none; padding: 0; margin-top: 2.6rem; border-bottom: 1px solid var(--line); }

.track {
  display: grid; grid-template-columns: 2.15rem 1fr auto auto auto auto; align-items: center;
  min-height: 2.67rem; border-top: 1px solid var(--line); cursor: pointer;
}

.num { position: relative; align-self: stretch; text-align: left; }
.num svg { display: none; width: .8rem; height: .8rem; fill: currentColor; position: absolute; top: 50%; left: 0; translate: 0 -50%; }

/* 번호 → 재생/일시정지 아이콘 */
.track.is-current .n,
.num:focus-visible .n { visibility: hidden; }
.track.is-current:not(.is-playing) .i-play,
.num:focus-visible .i-play { display: block; }
.track.is-playing .i-pause { display: block; }
.track.is-playing .i-play { display: none; }

@media (hover: hover) {
  .track:not(.is-missing):hover .n { visibility: hidden; }
  .track:not(.is-missing):not(.is-playing):hover .i-play { display: block; }
  .track:not(.is-missing):hover .label { color: var(--text-strong); }
}

.name { display: flex; align-items: center; min-width: 0; }
.label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 1rem; }
.track.is-current .label { color: var(--text-strong); }

.elapsed, .total { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.elapsed { display: none; padding-right: .7rem; }
.track.is-current .elapsed { display: inline; }
.total { min-width: 2.6rem; text-align: right; }

/* 파형 재생바 */
.wave { width: 16rem; height: 1.85rem; margin-right: .7rem; cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.wave-in { position: relative; height: 100%; }
.bars { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; color: var(--wave-bar); }
.bars i { display: block; width: 1.5px; height: var(--h, 30%); border-radius: 1px; background: currentColor; transition: height .4s ease; }
.bars.played { color: var(--text-strong); clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0); }
.head { display: none; position: absolute; top: 12%; bottom: 12%; left: calc(var(--p, 0) * 100%); width: 2px; translate: -50% 0; border-radius: 1px; background: var(--red); pointer-events: none; }
.track.is-current .head { display: block; }

/* 한 곡 반복 */
.repeat { align-self: stretch; display: flex; align-items: center; justify-content: flex-end; width: 1.9rem; color: var(--text-soft); transition: color .15s; }
.repeat svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.repeat:hover { color: var(--text-strong); }
.repeat.is-on { color: var(--red); }

.track.is-missing { cursor: not-allowed; }
.track.is-missing .num, .track.is-missing .name, .track.is-missing .wave, .track.is-missing .repeat { opacity: .4; pointer-events: none; }

/* 푸터 */
.foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-top: 1.6rem; }
.foot p { white-space: pre-line; }
.foot-end { display: flex; align-items: center; gap: .7rem; }
#powered span { display: inline-block; }
.links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.links a { display: block; width: 1rem; height: 1rem; background: var(--text-soft); mask: var(--icon) center / contain no-repeat; -webkit-mask: var(--icon) center / contain no-repeat; transition: background .15s; }
.links a:hover { background: var(--text-strong); }

/* 더보기 창 */
.story { width: min(24rem, 100% - 2rem); max-height: 85dvh; margin: auto; padding: 0; border: 0; border-radius: .6rem; background: var(--card); color: var(--text); box-shadow: 0 1rem 3rem var(--shadow); }
.story::backdrop { background: var(--scrim); }
.story-card { padding: 1.6rem; }
.story h2 { font-size: 1.6rem; font-weight: 500; line-height: 1.15; letter-spacing: -.02em; color: var(--text-strong); }
.story .small { margin-top: 1rem; }
#story-body p { margin-top: 1rem; }

/* 모바일 */
@media (max-width: 720px) {
  :root { font-size: 15px; }
  .page { width: calc(100% - 2rem); padding: 1rem 0 3rem; }
  .album { grid-template-columns: 1fr; gap: 1.6rem; }
  .tracks { margin-top: 2.2rem; }
  .track { min-height: 3rem; }
  .wave { width: 7.5rem; margin-right: .5rem; }
  .bars i:nth-child(even) { display: none; }
  .elapsed { padding-right: .5rem; }
  .foot { flex-direction: column; gap: 1rem; }
  .foot-end { width: 100%; justify-content: space-between; }
}
