/* ==========================================================================
   오작교 통합 연주기 v1.0.4 — 모든 장르 공통 스타일시트
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 기본 변수 (Variables) & 초기화 (Reset)
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --ink: #253044;
  --muted: #657187;
  --accent: #526d65;
  --line: #e4e7e9;
  --space: 22px;
  --section-gap: 5px;
  --list-height: 500px;
  --content-height: 500px;
  --header-height: 140px;
  --description-height: 350px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f0eb;
  color: var(--ink);
  font: 14px/1.6 system-ui, -apple-system, "Malgun Gothic", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid #3498db;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. 전체 레이아웃 (Outer Shell & Embedded)
   -------------------------------------------------------------------------- */
.shell {
  max-width: 1060px;
  margin: 24px auto;
  background: #fff;
  border: 1px solid #e8e0d8;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px #30251c12;
}

.embedded body {
  background: transparent;
}

.embedded .shell {
  margin: 0 auto;
  border: 0;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   3. 상단 헤더 배너 (Hero Section)
   -------------------------------------------------------------------------- */
.hero {
  margin: var(--space) var(--space) 0;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(120deg, #344940, #465953);
}

.hero-text {
  min-height: var(--header-height);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}

.hero h1 {
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: clamp(24px, 4.5vw, 34px);
  line-height: 1.35;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.hero-subtitle {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: #e3ebe6;
  overflow-wrap: anywhere;
}

.hero img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hero[data-mode="image"],
.hero[data-mode="track"] {
  position: relative;
  border-radius: 15px;
  box-shadow: 0 3px 9px #24372b26;
}

.hero[data-mode="image"]::after,
.hero[data-mode="track"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    #ffffff12 0%,
    transparent 40%,
    #46595312 72%,
    #46595359 100%
  );
  box-shadow: inset 0 1px 1px #ffffff80, inset 0 -2px 4px #23392e26;
}

.hero[data-mode="image"] img,
.hero[data-mode="track"] img {
  border-radius: inherit;
}

.hero[data-mode="track"] img {
  height: 200px;
  object-fit: contain;
  background: #fff;
}

/* --------------------------------------------------------------------------
   4. 재생 상태 카드 (Now Playing Card)
   -------------------------------------------------------------------------- */
.main {
  padding: var(--section-gap) var(--space) var(--space);
}

.now {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid #dce7df;
  border-left: 5px solid #465953;
  border-radius: 15px;
  background: linear-gradient(110deg, #edf3ef, #f9fbf9);
}

.art-button {
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  flex: none;
}

.art {
  display: block;
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

.song {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: #42574f;
  letter-spacing: 0.06em;
}
/*카드의 제목 / 가수 색상*/
.song h2 {
  margin: 5px 0 7px;
  font-size: clamp(18px, 2.3vw, 25px);
  line-height: 1.45;
  color: #253044;
  overflow-wrap: anywhere;
}

.song p {
  margin: 0;
  color: #3498db;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.playing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8ebea;
  color: #65716b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.playing-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #929b96;
}

.playing-badge.is-playing {
  background: #e0ebe3;
  color: #355048;
}

.playing-badge.is-playing::before {
  background: #2d9a5b;
  box-shadow: 0 0 0 3px #2d9a5b25;
}

.credits {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin: 9px 0 0;
  font-size: 13px;
}

.credits dt {
  font-weight: 700;
  color: #465953;
}

.credits dd {
  margin: 0 12px 0 0;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   5. 타임라인 & 컨트롤 버튼 (Timeline & Controls)
   -------------------------------------------------------------------------- */
.timeline {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 9px;
  align-items: center;
  margin: var(--section-gap) 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.timeline span:last-child {
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  min-width: 0;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.controls button {
  min-width: 40px;
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid #d1dcd5;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

.controls button:hover,
.controls button[aria-pressed="true"] {
  background: #edf2ef;
  border-color: #aabcb4;
  color: #3c574f;
}

.controls .primary {
  min-width: 65px;
  background: var(--accent);
  color: #fff;
  font-size: 21px;
}

.controls .primary:hover {
  background: #3c574f;
  color: #fff;
}

.volume {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  font-size: 12px;
  color: var(--muted);
}

.volume input {
  width: 86px;
}

.status {
  margin: var(--section-gap) 0 0;
  min-height: 21px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   6. 수록곡 목록 & 가사 패널 (Tracklist & Lyrics Panes)
   -------------------------------------------------------------------------- */
.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--section-gap);
  margin-top: var(--section-gap);
}

.shell[data-layout="below"] .panes,
.shell[data-layout="none"] .panes {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
}

.panel-header span {
  color: var(--muted);
  font-size: 11px;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.selection-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #58665f;
  padding: 3px 7px;
  font-size: 12px;
}

.selection-actions button:hover {
  background: #edf2ef;
}

/* 수록곡 트랙 목록 */
.list {
  list-style: none;
  margin: 0;
  padding: 8px;
  height: var(--list-height);
  overflow: auto;
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  scrollbar-width: thin;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
/*체크박스 색상 변경*/
/* 체크박스 */
.track-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0 0 0 5px;
  border: 1px solid #94a59f;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

/* 선택된 체크박스: 흰 바탕 유지 */
.track-check:checked {
  background-color: #fff;
  border-color: #526d65;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8l3 3 7-7' fill='none' stroke='%23526d65' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100% 100%;
}
/*연주기 트랙관련 설정 부분*/
.track-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 31px;
  text-align: left;
  border: 0 !important;
  border-radius: 18px;
  background: transparent !important;
  padding: 5px 9px;
  color: var(--ink);
  font-size: 14px;
  box-shadow: none !important;
}

.track-button:hover {
  background: transparent !important;
  color: #f45e02 !important;
}

.track-button[aria-current="true"] {
  color: #e13b25 !important;
  font-weight: 700;
  background: transparent !important;
}

.track-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  color: inherit;
}

.num {
  font-size: 11px;
  color: #657187;
  font-variant-numeric: tabular-nums;
}

.track-button:disabled {
  text-decoration: line-through;
}

/* 가사 영역 (보완 완료) */
.lyrics {
  height: var(--content-height) !important;
  min-height: 400px;
  overflow: hidden;
  background: #fff;
}

.lyrics iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 400px;
  border: 0 !important;
  background: #fff;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   7. 앨범 소개 & 포스팅 이야기
   -------------------------------------------------------------------------- */
.album-description,
.collection-description {
  display: flow-root;
  margin-top: var(--section-gap);
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
  color: #25304a;
  font-size: 14px;
  line-height: 1.8;
  max-height: var(--description-height);
  overflow: auto;
  overflow-wrap: anywhere;
}

.album-description h3,
.collection-description h3 {
  margin: 0 0 12px;
  font-size: 19px;
  color: green;
}

.album-description p,
.collection-description p {
  margin: 0 0 10px;
}

.album-description p:last-child,
.collection-description p:last-child {
  margin-bottom: 0;
}

.album-description strong {
  display: block;
  font-size: 15px;
  color: #496500;
}

.album-info-image {
  float: right;
  width: 150px;
  max-width: 40%;
  height: auto;
  margin: 0 0 12px 20px;
  border-radius: 10px;
}

.album-description img,
.collection-description img {
  max-width: 100%;
  height: auto;
}

.description-frame {
  height: var(--description-height);
}

.album-description.has-frame {
  padding: 0;
}

.album-description.has-frame iframe {
  min-height: var(--description-height);
}

/* --------------------------------------------------------------------------
   8. 이미지 크게 보기 팝업
   -------------------------------------------------------------------------- */
.image-dialog {
  max-width: 94vw;
  max-height: 94vh;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 12px 50px #0005;
}

.image-dialog::backdrop {
  background: #0009;
}

.image-dialog img {
  display: block;
  max-width: 85vw;
  max-height: 78vh;
  object-fit: contain;
}

.dialog-close {
  display: block;
  margin: 0 0 10px auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 5px 10px;
}

/* --------------------------------------------------------------------------
   9. 탭 버튼 & 기타 요소
   -------------------------------------------------------------------------- */
.album-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--section-gap);
  margin: 0 0 var(--section-gap);
}

.album-tabs button {
  flex: 1;
  min-width: 80px;
  padding: 8px;
  border: 1px solid #b8cbc3;
  border-radius: 9px;
  background: #fff;
  color: #465953;
}

.album-tabs button[aria-pressed="true"] {
  background: #465953;
  color: #fff;
  font-weight: 700;
}

.external-player {
  display: block;
  width: 100%;
  height: 1010px;
  border: 0;
}

.story-image {
  float: left;
  width: 30%;
  max-width: 200px;
  height: auto;
  margin: 0 20px 16px 0;
  border-radius: 12px;
}

.load-error {
  margin: 22px;
  padding: 20px;
  border: 1px solid #dcb2aa;
  border-radius: 12px;
  color: #9d2915;
}

/* --------------------------------------------------------------------------
   10. 모바일 및 반응형 스타일
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  :root {
    --space: 16px;
  }

  .shell {
    margin: 0 auto;
    border: 0;
    box-shadow: none;
  }

  .hero-text {
    min-height: 110px;
    padding: 22px 16px;
  }

  .hero-subtitle {
    font-size: 13px;
  }

  .panes {
    grid-template-columns: minmax(0, 1fr);
  }

  .now {
    padding: 12px;
    gap: 12px;
  }

  .art {
    width: 100px;
    height: 100px;
  }

  .volume {
    margin-left: 8px;
  }

  .volume input {
    width: 110px;
  }

  .panel-header {
    padding: 8px 10px;
  }
/*모바일 트랙 폰트 */
  .track-button {
    padding: 5px 6px;
    font-size: 13px;
  }

  .track-row {
    gap: 5px;
  }

  .album-description,
  .collection-description {
    font-size: 13px;
    padding: 12px;
  }

  .album-info-image {
    width: 130px;
    max-width: 42%;
    margin-left: 12px;
  }
}

@media (max-width: 480px) {
  .volume {
    margin: 4px 0 0;
    flex-basis: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s, color 0.15s;
  }
}