/* ==========================================================================
   [1] 기본 변수 및 글로벌 초기화 (Variables & Global Styles)
   - 두 번째 스타일의 포인트 컬러(#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 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)
   - 두 번째 스타일: 이미지를 자르지 않고(object-fit: contain) 원본 비율 유지 및 둥근 모서리 적용
   ========================================================================== */
.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;
}

/* 쉘 컨테이너 안의 헤더 이미지 전용 여백 및 둥근 모서리 (두 번째 스타일 적용) */
/* [수정 후] 헤더 영역 좌우 여백 적용 및 카드 폭에 맞춤 */
.shell > .hero {
  margin: 22px 22px 0 22px !important; /* 상 우 하 좌 여백 (좌우 22px 여백 추가) */
  border-radius: 12px !important;
  overflow: hidden;
}

.shell > .hero > img {
  width: 100% !important;
  height: auto !important;
  display: block;
  border-radius: 12px !important;
}

@media (max-width: 700px) {
  .shell > .hero {
    margin: 16px 16px 0 16px !important; /* 모바일 .main 패딩(16px)과 동일하게 맞춤 */
  }
}
/* ==========================================================================
   [4] 현재 재생 정보 영역 (Now Playing)
   ========================================== */
.main {
  padding: 22px 22px 10px; !important; /* 아래쪽 패딩을 10px로 축소 */
}

.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;
}

/* 앨범 아트워크 이미지 스타일 */
.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;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #465953;
  font-weight: 700;
}

.song h2 {
  margin: 3px 0;
  font-size: clamp(18px, 2.4vw, 25px);
  overflow-wrap: anywhere;
}

.song p {
  margin: 0;
  color: var(--muted);
}

/* 재생 상태 배지 */
.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;
}


/* ==========================================================================
   [5] 컨트롤러 및 타임라인 (Controls & Timeline)
   ========================================== */
/* 타임라인 및 시간 표시 숫자 */
.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열 패널 (트랙리스트 & 가사 창)
   - 두 번째 스타일: 목록 및 가사창 높이를 400px로 깔끔하게 고정 및 통일
   ========================================== */
.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 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;
}

.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel h3 {
  margin: 0;
  font-size: 16px;
}

.panel header span {
  font-size: 12px;
  color: var(--muted);
}

/* 트랙 리스트 전체 영역 */
.list {
  list-style: none;
  padding: 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: 2px;
}

/* 커스텀 체크박스 스타일 (두 번째 스타일의 아이콘 및 색상 우선 적용) */
.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: 3px;
}

/* 선택 항목 제어 액션 버튼들 */
.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 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[aria-current="true"] {
  font-weight: 700;
  color: #324f45; /* 두 번째 스타일 텍스트 컬러 */
}

.num {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.list .track-text {
  font-size: 13px;
  line-height: 1.3;
}

.list .track-artist {
  color: var(--muted);
  font-weight: 400;
}

.list button[aria-current="true"] .track-artist {
  color: #324f45;
}

/* 가사/외부 컨텐츠 프레임 (Lyrics iframe) */
.lyrics {
  flex: 1;
  min-height: 0;
  padding: 0;
  background: white;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.lyrics iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  position: static;
  inset: auto;
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}


/* ==========================================================================
   [7] 팝업 모달 & 안내 요소 (Modals & Notes)
   ========================================== */
.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;
}

#artist {
  color: #3498db;
  font-weight: 700;
}


/* ==========================================================================
   [8] 반응형 미디어 쿼리 (Responsive Styles)
   ========================================== */
@media (max-width: 700px) {
  .shell {
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .main {
    padding: 16px;
  }

  .now {
    padding: 12px;
    gap: 12px;
  }

  .panes {
    grid-template-columns: 1fr;
  }

  /* 모바일 환경에서의 가사창 높이 별도 지정 (두 번째 스타일 반영) */
  #lyrics,
  .lyrics {
    flex: 0 0 460px !important;
    height: 460px !important;
    min-height: 460px !important;
    max-height: 460px !important;
  }

  .lyrics iframe {
    position: static;
    inset: auto;
    width: 100%;
    height: 100% !important;
  }

  .volume {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }

  .art {
    width: 110px;
    height: 110px;
  }
}

/* 부드러운 전환 효과 (모션 감소 설정이 아닐 때만 작동) */
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s, color 0.15s;
  }
}