/* 심야의 코드 — extreme simplicity.
 * 밤(#101014) 위에 앨범아트가 은은하게 방을 밝힌다(#art-glow가 유일한 색 공급원).
 * 고정 액센트 컬러 없음 — 색은 늘 지금 나오는 곡에게서 온다. */

:root {
  --bg: #101014;
  --ink: #f2f0ec;
  --dim: #8b8b94;
  --faint: #55555e;
  --line: rgba(255, 255, 255, 0.10);
  --art: min(58vmin, 340px);
}

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

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  overflow-x: hidden;
}

.room {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

/* ── 시그니처: 앨범아트 앰비언트 글로우 ── */
.glow-wrap {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  z-index: 0;
}
/* 블러를 "연산"이 아니라 "해상도"로 만든다.
 * iOS WebKit 에서 화면 전체를 덮는 fixed 레이어에 filter: blur() 를 걸면 매 합성마다
 * 거대한 오프스크린 버퍼를 다시 만들어 메인 스레드가 수 초씩 멈춘다(실측 6.3초).
 * 대신 썸네일을 8x8 캔버스에 그려 화면 크기까지 늘린다 — 브라우저 기본 보간이
 * 가우시안 블러와 거의 같은 결과를 주고, 합성기 입장에선 작은 텍스처 확대일 뿐이다.
 * filter 없음, transform 없음. */
#art-glow {
  width: 130vmax; height: 130vmax;
  opacity: 0.5;
  transition: opacity 1.2s ease;
}

.deck {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  width: min(92vw, 420px);
  text-align: center;
}

/* ── 썸네일 = 재생 버튼 ── */
.art {
  position: relative;
  width: var(--art); height: var(--art);
  border-radius: 20px;
  overflow: hidden;
  background: #1a1a20;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: width 0.5s ease, height 0.5s ease, border-radius 0.5s ease;
}
/* 썸네일이 없으면 카드 대신 작은 재생 버튼만 */
.art:not(.has-art) {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}
.art:not(.has-art) .ctrl-btn { opacity: 1; background: none; font-size: 26px; }
#yt-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.art.has-art #yt-thumb { display: block; }

.ctrl-btn {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  line-height: 1;
  font-size: 40px;
  color: #fff;
  background: rgba(10, 10, 14, 0.34);
  opacity: 0;
  transition: opacity 0.25s ease;
  user-select: none;
}
.art:hover .ctrl-btn, .ctrl-btn:focus-visible { opacity: 1; }
.ctrl-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (hover: none) { .ctrl-btn { opacity: 1; background: transparent; text-shadow: 0 2px 16px rgba(0,0,0,0.7); } }

/* ── 곡 정보 ── */
.meta { margin: 26px 0 34px; }
.now-playing-badge {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
  margin-bottom: 10px;
}
.song-title {
  font-size: clamp(15px, 3.4vw, 23px);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
  /* 아무리 긴 제목도 2줄까지만 — 레이아웃이 밀리지 않게 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 480px) {
  .song-title { font-size: 15px; }
}
.requester-name { margin-top: 8px; font-size: 13px; color: var(--dim); }
.requester-name:empty { display: none; }

/* ── 신청 ── */
.ask {
  display: flex; gap: 8px;
  width: 100%;
}
.ask input {
  flex: 1;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 13px 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ask input::placeholder { color: var(--faint); }
.ask input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}
.ask button {
  border: 0;
  border-radius: 12px;
  padding: 0 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--ink);
  color: #101014;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.ask button:hover { opacity: 0.85; }
.ask button:disabled { opacity: 0.4; cursor: default; }
.ask button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.ask-result { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.ask-result.err { color: #d99; }

@media (prefers-reduced-motion: reduce) {
  #art-glow { transition: none; }
}
