/* ==========================================================================
   [1] 글로벌 변수 및 초기화 (Variables & Global Resets)
   - 두 번째 테마의 포인트 컬러(#526d65)를 기본 변수로 승격 적용
   ========================================================================== */
:root {
  color-scheme: light;
  --ink: #253044;
  --muted: #657187;
  --accent: #526d65; /* [두 번째 우선] 기존 버건디(#a93b41) 대신 세이지 그린(#526d65) 적용 */
  --line: #e4e7e9;
  --paper: #fffaf5;
}

/* 전체 요소 박스 크기 계산 표준화 */
* {
  box-sizing: border-box;
}

/* 전체 배경 및 기본 폰트 설정 */
body {
  margin: 0;
  background: #f4f0eb;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif;
  line-height: 1.5;
}

/* 폼 요소 폰트 상속 */
button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

/* [두 번째 우선] 키보드 접근성 포커스 아웃라인 색상을 메인 테마 컬러로 변경 */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* [두 번째 우선] 슬라이더(range) 포인트 컬러 변경 */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}


/* ==========================================================================
   [2] 레이아웃 프레임 (Shell Layout)
   - 플레이어 전체 외곽 틀
   ========================================================================== */
.shell {
  max-width: 1060px;
  margin: 24px auto;
  background: white;
  border: 1px solid #e8e0d8;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px #30251c12;
}

/* 아이프레임(Embedded) 환경 내 테두리 및 그림자 제거 */
.embedded body {
  background: #fff;
}

.embedded .shell {
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}


/* ==========================================================================
   [3] 상단 헤더 / 배너 영역 (Hero Banner)
   - 일반 모드 및 클래식 앨범 모드 공통 폭/여백 강제 맞춤
   ========================================================================== */
.hero {
  position: relative;
  background: #465953;
  min-height: 0 !important;
}

.hero img {
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  display: block;
}

.hero h1 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 30px 25px 16px;
  color: white;
  font-family: Georgia, "Malgun Gothic", serif;
  font-size: clamp(22px, 3vw, 33px);
  background: linear-gradient(transparent, #465953f2);
}

.hero small {
  font: 500 13px system-ui, sans-serif;
  display: block;
  letter-spacing: 0.15em;
}

/* 클래식 앨범용 예외 스타일 (텍스트 숨김 및 배경 흰색) */
.classic-album .hero {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.classic-album .hero h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  background: none;
}

/* [핵심 수정] 클래식 앨범 포함 모든 헤더 영역의 좌우 여백 및 라운딩 강제 적용 */
.shell .hero,
.shell > .hero,
.classic-album .hero,
.shell.classic-album .hero {
  margin: 22px 22px 0 22px !important; /* 아래 .main 박스 패딩(22px)과 완전히 동기화 */
  width: calc(100% - 44px) !important; /* 좌우 여백 제외한 딱 맞는 너비 */
  border-radius: 12px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* 헤더 안의 이미지도 100% 꽉 채우도록 설정 */
.shell .hero img,
.classic-album .hero img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  border-radius: 12px !important;
}

/* ==========================================================================
   [4] 현재 재생 정보 카드 (Now Playing)
   ========================================================================== */
.main {
  padding: 22px;
}

.now {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 18px 22px;
  background: linear-gradient(110deg, #edf3ef, #f9fbf9);
  border: 1px solid #dce7df;
  border-left: 5px solid #465953;
  border-radius: 15px;
}

.classic-album .now {
  min-height: 116px;
}

/* 앨범 커버 아트 */
.art {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
  display: block;
}

.art-button {
  border: 0;
  background: transparent;
  padding: 0;
  flex: none;
  border-radius: 12px;
}

.art-button:hover {
  filter: brightness(0.94);
}

.song {
  min-width: 0;
}

.song h2 {
  margin: 3px 0;
  font-size: clamp(18px, 2.4vw, 25px);
  overflow-wrap: anywhere;
}

/* 클래식 앨범 한 줄 말줄임표 처리 */
.classic-album .song {
  flex: 1;
  min-width: 0;
}

.classic-album .song h2 {
  font-size: clamp(16px, 2.4vw, 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song p {
  margin: 0;
  color: var(--muted);
}

/* 트랙 번호 안내 텍스트 */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #465953;
  font-weight: 900;
}

/* 재생 배지 */
.playing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0ebe3;
  color: #355048;
  font-size: 12px;
  font-weight: 700;
}

.playing-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #688d76;
}

.playing-badge.is-playing::before {
  background: #2d9a5b;
  box-shadow: 0 0 0 3px #2d9a5b25;
}

/* 크레딧 정보 */
.credits {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 9px 0 0;
  font-size: 13px;
  color: #43594f;
}

.credits[hidden] {
  display: none;
}

.credits dt {
  font-weight: 700;
}

.credits dd {
  margin: 0;
}


/* ==========================================================================
   [5] 재생 컨트롤러 & 타임라인 (Controls)
   - 두 번째 테마의 은은한 그린 톤 호버 색상 반영
   ========================================================================== */
.timeline {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 9px;
  align-items: center;
  margin: 19px 0 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.timeline span:last-child {
  text-align: right;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.controls button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  min-width: 44px;
  min-height: 44px;
  color: var(--ink);
}

/* [두 번째 우선] 서브 컨트롤 버튼 호버 스타일 */
.controls button:hover,
.controls button[aria-pressed="true"] {
  background: #edf2ef;
  color: #3c574f;
  border-color: #aabcb4;
}

/* [두 번째 우선] 메인 재생/일시정지 버튼 스타일 */
.controls .primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  min-width: 65px;
  font-size: 21px;
}

.controls .primary:hover {
  background: #3c574f;
  color: white;
}

/* 볼륨 조절 슬라이더 */
.volume {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.volume input {
  width: 86px;
}

/* 하단 상태 메시지 */
.status {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  min-height: 22px;
  margin: 8px 0 0;
}


/* ==========================================================================
   [6] 2열 메인 패널 (트랙리스트 & 가사)
   - 커스텀 SVG 체크박스 및 트랙 선택 하이라이트 색상 통합
   ========================================================================== */
.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
   margin-top: 10px;   /*플레이 부분과 아래 목록 간격 원래 22px*/
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* [두 번째 우선] #tracks를 포함하는 패널 배경 흰색 설정 */
.panel:has(> #tracks) {
  background: #fff;
}

.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
   padding: 8px 16px;  /*목록 위 '수록록' 부분 여백 원안은 12 16*/
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel h3 {
  margin: 0;
  font-size: 16px;
}

.panel header span {
  font-size: 12px;
  color: var(--muted);
}

/* 선택 제어 버튼 */
.selection-actions {
  display: flex;
  gap: 5px;
}

.selection-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 3px 7px;
  font-size: 12px;
  color: var(--muted);
}

/* [두 번째 우선] 선택 제어 버튼 호버 */
.selection-actions button:hover {
  background: #edf2ef;
}

/* 트랙 목록 기본 설정 */
.list {
  list-style: none;
  padding: 10px 5px 5px 8px;  /*목록 여백 원안은 그냥 5px*/
  margin: 0;
}

#tracks.list {
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.track-row {
  display: flex;
  align-items: center;
 gap: 10px;  /*체크박스와 리스트 간격 원안은 2px*/
}

/* [두 번째 우선] SVG 커스텀 체크박스 스타일 */
.track-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid #94a59f;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  margin: 0 0 0 9px;  /*체크박소 여백 조정*/
}

.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-check:focus-visible {
  outline: 2px solid #526d65;
  outline-offset: 2px;
}

.list .track-row button {
  flex: 1;
  min-width: 0;
  padding-left: 10px; /*목록 테두리 씌운 것과 목록의 간격 원안은 3px*/
}

.list button {
  display: grid;
  grid-template-columns: 23px 1fr;
  gap: 6px;
  text-align: left;
  align-items: center;
  width: 100%;
  padding: 5px 9px;  /*목록 내부여백 */
  min-height: 31px; /*목록 상자 덮는 것 상하 간격 */
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ink);
}

/* [두 번째 우선] 트랙 항목 호버 및 현재 재생 중 선택 효과 
.list button:hover,
.list button[aria-current="true"] {
  background: rgba(225, 235, 229, 0.88);
}*/

/* 마우스를 올렸을 때: 박스 없이 곡명 색상만 변경 */
.list button:hover {
  background: transparent;
  color: #f45e02;                 /* 원하는 색상으로 바꾸세요 */
}

.list button[aria-current="true"],
.list button[aria-current="true"] 
.track-artist {
  font-weight: 700;
 color: #ff0000; /* 두 번째 스타일 반영 현재 연주괴는 곡명 색상 원안은 #324f45*/
}

.num {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.list .track-text {
  font-size: 14px;
  line-height: 1.3;
}

.list .track-artist {
  color: var(--muted);
  font-weight: 700;  /*원안은 400*/
}

/* 가사/외부 컨텐츠 프레임 */
.lyrics {
  flex: 1;
  min-height: 0;
  padding: 0px 0px 0px 0px;  /*가사 여백 지정하는 곳 원안 18 14 18 28 */
  background: white;
  position: relative;
}

.lyrics iframe {
  display: block;
  width: calc(100% - 42px);
  height: calc(100% - 36px);
  border: 0;
  overflow: hidden;
  position: absolute;
  inset: 10px 10px 10px 8px;  /*가사 여백 지정하는 곳 원안 18 14 18 28 */
}

/* 하단 배치 모드 옵션 (.content-below) */
.content-below .panes {
  grid-template-columns: 1fr;
}

.content-below .lyrics {
  min-height: 652px;
  padding: 10px 10px;   /*가사 여백 지정하는 곳 원안 18 24  */
}

.content-below .lyrics iframe {
  inset: 10px 10px;   /*가사 여백 지정하는 곳 원안 18 24  */
  width: calc(100% - 20px);  /*원안 48*/
  height: calc(100% - 20px); /*원안 36*/
}

.content-below .art {
  object-fit: contain;
  background: #f1f3f1;
}


/* ==========================================================================
   [7] 팝업 모달 & 텍스트 요소
   ========================================================================== */
.image-dialog {
  border: 0;
  border-radius: 15px;
  padding: 12px;
  background: white;
  max-width: calc(100vw - 30px);
  max-height: calc(100vh - 30px);
  box-shadow: 0 20px 60px #0006;
}

.image-dialog::backdrop {
  background: #161616bc;
}

.image-dialog img {
  display: block;
  max-width: min(900px, calc(100vw - 54px));
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

.dialog-close {
  display: block;
  margin: 0 0 8px auto;
  border: 0;
  background: #f1ebe6;
  border-radius: 7px;
  padding: 6px 12px;
}

.empty {
  padding: 20px;
  color: var(--muted);
}

.note {
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0 0;
}

#count {
  font-weight: 800;
}

#artist {
  color: #3498db;
  font-weight: 800;
}


/* ==========================================================================
   [8] 반응형 미디어 쿼리 (Responsive Mobile Styles)
   ========================================================================== */
@media (max-width: 700px) {
  .shell {
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  /* 모바일 화면에서 헤더 배너 모서리 및 여백 조정 */
  .shell > .hero {
    margin: 16px 16px 0 16px !important;
  }

  .main {
    padding: 16px;
  }

  .now {
    padding: 12px;
    gap: 12px;
  }

  .panes {
    grid-template-columns: 1fr;
  }

  .lyrics {
    min-height: 480px;
    padding: 14px 8px 14px 18px;
  }

  .lyrics iframe {
    inset: 14px 8px 14px 18px;
    width: calc(100% - 26px);
    height: calc(100% - 28px);
  }

  .content-below .lyrics {
    min-height: 652px;
    padding: 14px;
  }

  .content-below .lyrics iframe {
    inset: 14px;
    width: calc(100% - 28px);
    height: calc(100% - 28px);
  }

  .volume {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }

  .hero {
    min-height: 150px;
  }

  .classic-album .hero {
    min-height: 0;
    height: auto;
  }

  .classic-album .hero img {
    height: auto;
  }

  .hero h1 {
    padding: 25px 16px 13px;
  }

  .art {
    width: 110px;
    height: 110px;
  }
}

/* 애니메이션 동작 옵션 감지 */
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s, color 0.15s;
  }
}