:root {
  --bg: #16120e;
  --surface: #211a14;
  --ink: #f1eadb;
  --inv: #16120e;
  --muted: #a3978a;
  --line: #3b3027;
  --paper: #efe6d3;
  --obi: #e04a2f;
  --sticker: #f4c62e;
  --hand: "Sue Ellen Francisco", cursive;
  --serif: "Noto Serif KR", serif;
  --sans: "IBM Plex Sans KR", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sticker); outline-offset: 2px; }

/* 맨 위 */
.bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  padding: 18px 40px 0;
  max-width: 1640px; margin: 0 auto;
}
.mark { margin: 0; font-family: var(--hand); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: .02em; color: var(--paper); }
.stats { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); }

.page { padding: 0 40px 80px; max-width: 1640px; margin: 0 auto; }

/* 판 (LP는 검은 판, CD는 은색) */
.disc, .cv::before {
  border-radius: 50%;
  background:
    conic-gradient(from 25deg, transparent 0 9%, rgba(255, 255, 255, .13) 13%, transparent 18% 58%, rgba(255, 255, 255, .1) 63%, transparent 68%),
    repeating-radial-gradient(circle, rgba(255, 255, 255, .045) 0 1px, transparent 1px 4px),
    radial-gradient(circle, var(--bg) 0 2.2%, var(--obi) 2.6% 17%, #0a0908 17.5%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1);
}

/* 오늘의 판 */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 48px;
  padding: 56px 0 64px;
}
.eyebrow { margin: 0 0 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--sticker); }
.hero h2 {
  margin: 0 0 14px;
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(34px, 5.2vw, 78px); line-height: 1.08; letter-spacing: -.02em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-artist { margin: 0 0 6px; font-size: 20px; font-weight: 500; }
.hero-meta { margin: 0 0 30px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.player { position: relative; width: min(34vw, 420px); aspect-ratio: 1; margin-right: min(14vw, 180px); cursor: pointer; }
.jacket {
  position: relative; display: block; width: 100%; height: 100%; object-fit: cover;
  box-shadow: 0 30px 60px -20px #000, 0 0 0 1px rgba(255, 255, 255, .06);
}
.player .disc {
  position: absolute; top: 3%; left: 46%; width: 94%; height: 94%;
  animation: spin 9s linear infinite;
}
.disc .label {
  position: absolute; inset: 33%; border-radius: 50%;
  background: var(--obi) center / cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4);
}
.disc .label::after { content: ""; position: absolute; inset: 44%; border-radius: 50%; background: var(--bg); }
.player.cd .disc {
  background: conic-gradient(from 40deg, #d9d6cf, #f7f4ec 12%, #b9c7d6 22%, #e9e2cf 34%, #d6c3d0 48%, #f3efe6 60%, #bcd0c8 74%, #e6dfd0 88%, #d9d6cf);
}
.player.cd .label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 버튼 */
.sticker {
  background: var(--sticker); color: #1b1713;
  border: 0; border-radius: 3px; padding: 9px 16px;
  font-weight: 600; cursor: pointer;
  transform: rotate(-1.5deg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.sticker:hover { transform: rotate(0); }
.sticker.alt { background: var(--obi); color: #fff; transform: rotate(1deg); }
.sticker.alt:hover { transform: rotate(0); }
.sticker:disabled { opacity: .4; cursor: default; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 3px; padding: 8px 16px; cursor: pointer; }
.ghost:hover { border-color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }
.link:hover { color: var(--ink); }

/* 찾기 */
.controls {
  position: sticky; top: 0; z-index: 4;
  background: var(--bg);
  padding: 14px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.row { display: flex; gap: 8px; margin-bottom: 10px; }
#q { flex: 1 1 auto; min-width: 0; }
#q, select {
  height: 40px; padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 3px;
}
#q::placeholder { color: var(--muted); }
select { max-width: 38%; }
select option { background: var(--surface); color: var(--ink); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 3px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 4px 10px;
  background: transparent; border: 1px solid var(--line); border-radius: 3px;
  cursor: pointer; white-space: nowrap; font-size: 13px;
}
.chip small { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 5px; }
button.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--inv); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .65; }

.status { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
#count { font-size: 13px; font-variant-numeric: tabular-nums; }
#pick { margin-left: auto; }
#mixInfo { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* 밝은 종이 면: 뽑은 판, 상세 창 */
.picked, dialog {
  --ink: #1b1713; --inv: #efe6d3; --muted: #6d6156; --line: #cdc1aa; --bg: #efe6d3; --surface: #e2d8c2;
  background: var(--paper); color: var(--ink);
}
.picked { border-left: 6px solid var(--obi); padding: 20px 22px 24px; margin-bottom: 40px; }
.picked-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.picked h2 { font-family: var(--serif); font-weight: 900; font-size: 24px; margin: 0; }

/* 커버 격자 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 34px 26px; }
.picked .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 22px 18px; }
.rec { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.cv { position: relative; aspect-ratio: 1; }
.cv::before {
  content: ""; position: absolute; inset: 4%;
  transition: transform .28s cubic-bezier(0, 0, 0, 1);
}
.rec.cd .cv::before {
  background: conic-gradient(from 40deg, #d9d6cf, #f7f4ec 12%, #b9c7d6 22%, #e9e2cf 34%, #d6c3d0 48%, #f3efe6 60%, #bcd0c8 74%, #e6dfd0 88%, #d9d6cf);
  -webkit-mask: radial-gradient(circle, transparent 0 7%, #000 7.5%);
  mask: radial-gradient(circle, transparent 0 7%, #000 7.5%);
  box-shadow: none;
}
.rec:hover .cv::before, .rec:focus-visible .cv::before { transform: translateX(19%); }
.cv img, .cv .none {
  position: relative; display: block; width: 100%; height: 100%; object-fit: cover;
  background: var(--surface);
  box-shadow: 0 10px 22px -12px #000, 0 0 0 1px rgba(255, 255, 255, .05);
}
.picked .cv img { box-shadow: 0 8px 16px -10px rgba(0, 0, 0, .6); }
.cv .none { display: grid; place-items: center; padding: 10px; font-family: var(--serif); font-weight: 700; text-align: center; font-size: 13px; }
.rec .k {
  position: absolute; left: 0; bottom: 0;
  background: rgba(10, 9, 8, .82); color: #f1eadb;
  font-family: var(--mono); font-size: 10px; padding: 1px 5px;
}
.rec .a { margin: 10px 0 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec .t { margin: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec .y { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.rec .y b { color: var(--sticker); font-weight: 500; }
.picked .rec .y b { color: var(--ink); }

.empty { padding: 60px 0; color: var(--muted); }
#more { height: 1px; }
.foot { margin-top: 72px; font-size: 12px; color: var(--muted); }

/* 수록곡·플레이리스트 */
.tracks, .mix { list-style: none; margin: 0; padding: 0; }
.tracks { margin-bottom: 22px; border-top: 1px solid var(--line); font-size: 13px; }
.tracks li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.tracks i { font-style: normal; color: var(--muted); }
.pos, .dur { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.mix li { border-top: 1px solid var(--line); }
.rec.row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 3.2em; align-items: center; gap: 12px; width: 100%; padding: 7px 0; }
.rec.row img, .rec.row .noimg { width: 48px; height: 48px; object-fit: cover; background: var(--line); display: block; }
.rec.row:hover b { text-decoration: underline; }
.mt { min-width: 0; display: grid; }
.mt b, .mt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt b { font-weight: 600; }
.mt span { font-size: 13px; color: var(--muted); }
.rec.row .dur { text-align: right; }

/* 상세 */
dialog {
  border: 0; padding: 0;
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-shadow: 0 30px 80px -20px #000;
}
dialog[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
dialog::backdrop { background: rgba(8, 6, 4, .78); }
.close {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--paper); border: 0; font-size: 28px; line-height: 1; cursor: pointer; z-index: 2;
}
.sleeve { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-self: start; background: var(--line); }
.sleeve img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.d-obi {
  background: var(--obi); color: #fff;
  writing-mode: vertical-rl;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 14px 0; gap: 14px;
  font-family: var(--serif); font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden;
}
.d-obi em { font-family: var(--mono); font-style: normal; font-weight: 400; font-size: .75em; letter-spacing: .1em; }
.d-body { padding: 34px 28px 26px; overflow-y: auto; }
.d-artist { margin: 0 0 4px; font-weight: 600; }
.d-body h2 { font-family: var(--serif); font-weight: 900; font-size: 28px; line-height: 1.2; margin: 0 0 20px; }
dl { display: grid; grid-template-columns: 5.5em 1fr; gap: 6px 10px; margin: 0 0 18px; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; }
dd.mono { font-family: var(--mono); font-size: 13px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.d-body a { color: var(--ink); font-weight: 600; }

@media (max-width: 720px) {
  .bar { padding: 14px 16px 0; }
  .mark { font-size: 34px; }
  .stats span { display: none; }
  .page { padding: 0 16px 60px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 28px 0 40px; }
  .player { order: -1; width: 62vw; margin: 0; }
  .hero h2 { font-size: 34px; }
  .hero-artist { font-size: 17px; }
  .hero-meta { margin-bottom: 22px; }
  .controls { position: static; }
  .row { flex-wrap: wrap; }
  #q { flex-basis: 100%; }
  select { max-width: none; flex: 1 1 0; min-width: 0; }
  .status { flex-wrap: wrap; gap: 10px; }
  .sticker { padding: 7px 11px; font-size: 13px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 12px; }
  .picked { padding: 16px 14px 18px; }
  .picked .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 10px; }
  .rec:hover .cv::before { transform: none; }
  .rec.row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .rec.row img, .rec.row .noimg { width: 40px; height: 40px; }
  .rec.row .dur { display: none; }
  dialog[open] { grid-template-columns: 1fr; overflow-y: auto; }
  .d-body { padding: 20px 18px 24px; overflow: visible; }
  .d-body h2 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .player .disc { animation: none; }
  .cv::before { transition: none; }
}
