/* ==========================================
   1. 기본 변수 및 글로벌 스타일 (두 번째 테마 컬러 우선 적용)
   ========================================== */
:root {
  color-scheme: light;
  --ink: #253044;
  --muted: #657187;
  --accent: #526d65; /* 두 번째 연주기 톤 반영 */
  --line: #e4e7e9;
  --paper: #fffaf5;
}

html,
body {
  margin: 0 !important;
  padding: 0 !important;
  background: #fff !important; /* 두 번째 스타일의 흰색 바탕 적용 */
}

body {
  color: var(--ink);
  font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ==========================================
   2. 레이아웃 프레임 (Shell)
   ========================================== */
.shell {
  max-width: 1060px;
  margin: 0 auto !important; /* 두 번째 스타일 기준 중앙 정렬 및 여백 수정 반영 */
  background: #fff !important;
  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)
   ========================================== */
.hero {
  position: relative;
  background: #465953;
  min-height: 170px;
}

.hero img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  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 !important;
  width: auto !important;
  min-height: 0 !important;
  height: auto !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.shell > .hero > img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 12px !important;
}

/* ==========================================
   4. 현재 재생 정보 영역 (Now Playing)
   ========================================== */
.main {
  padding: 10px 22px 22px; !important; /* 아래쪽 패딩을 10px로 축소 연주기 카드 부분 - 원안은 22px 22px 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;
}

/* 곡 이미지 카드는 상단 이미지로 통합될 때의 처리 (두 번째 스타일) */
.now > .art-button {
  display: none !important;
}

.now {
  grid-template-columns: minmax(0, 1fr) !important;
}

.now .song {
  min-width: 0;
  width: 100%;
}

.now #title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
  display: block;
}

.song h2 {
  margin: 3px 0;
  font-size: clamp(18px, 2.4vw, 25px);
  overflow-wrap: anywhere;
}

.song p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #465953;
  font-weight: 700;
}

/* 재생 상태 배지 */
.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 {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 9px;
  align-items: center;
 margin: 10px 0 10px; /*카드와 타임라인 간격 원안은 22px 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열 패널 (트랙리스트 & 가사 창)
   ========================================== */
.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;
}

.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);
}

/* 트랙 리스트 영역 */
.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*/
}

/* 커스텀 체크박스 (두 번째 스타일 우선 적용) */
.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;  /*체크박소 여백 조정*/
  accent-color: var(--accent);
}

.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*/
}

.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: 20px 1fr; /*번호와 목록의 갭 원안은 23px*/
  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);
}

/* 두 번째 스타일 반영 목록 덮은 상자 색상 원안은 0.88 숫자가 클수록 원안에 가까움
.list button:hover,
.list button[aria-current="true"] {
  background: rgba(225, 235, 229, 0.5);  
}*/

/* 마우스를 올렸을 때: 박스 없이 곡명 색상만 변경 */
.list button:hover {
  background: transparent;
  color: #f45e02;                 /* 원하는 색상으로 바꾸세요 */
}

.list button[aria-current="true"] {
  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*/
}

.list button[aria-current="true"] .track-artist {
  color: #ff0000; /* 두 번째 스타일 반영 아티스트 색상 */
}

/* 가사/외부 컨텐츠 프레임 (Lyrics) */
.lyrics {
  flex: 1;
  min-height: 0;
  height: 460px;
  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. 앨범 설명 및 커스텀 텍스트 클래스 스타일 (두 번째 추가분)
   ========================================== */
.album-description {
  padding: 16px;
  border-top: 3px solid #dce3df;
  background: #fff;
  color: #253044;
  font-size: 14px;
  line-height: 1.8;
  height: 455px;
  overflow: auto;
}

.album-description::after {
  content: "";
  display: block;
  clear: both;
}

.album-description h3 {
  margin: 0 0 14px;
  color: #526d65;
  font-size: 16px;
}

.album-description h4 {
  margin: 5px 0 -5px 0;
  color: #336600;
  font-size: 16px;
}

.album-description p {
  margin: 0 0 16px;
}

.album-description img {
  float: right;
  width: 30%;
  max-width: 200px;
  height: auto;
  margin: 0 0 12px 16px;
  border-radius: 8px;
}

.album-description2 img {
  float: left;
  width: 30%;
  max-width: 250px;
  height: auto;
  margin: 0 16px 12px 0;
  border-radius: 8px;
}

/* 커스텀 텍스트 클래스들 (.gr, .sl, .or, .al, .bl, .cl, .dl, .steel 등) */
.gr { font-size: 14pt; font-weight: bold; font-family: '맑은 고딕', '돋움', dadum10; color: green; line-height: 25px; margin-left: 10px; }
.sl { font-size: 11pt; font-weight: bold; font-family: '맑은 고딕', '돋움', dadum10; color: #002020; line-height: 19px; margin-left: 0; }
.or { font-size: 11pt; font-weight: bold; font-family: '맑은 고딕', '돋움', dadum10; color: #e56d00; line-height: 21px; margin-left: 10px; }
.al { font-size: 12pt; font-weight: bold; font-family: '맑은 고딕', '돋움', dadum10; color: #002020; line-height: 19px; text-align: left; }
.bl { font-size: 14px; font-weight: normal; font-family: '맑은 고딕', '돋움', dadum10; color: #222222; line-height: 23px; margin-left: 10px; margin-right: 10px; }
.cl { font-size: 14px; font-weight: normal; font-family: '맑은 고딕', '돋움', dadum10; color: #9999ff; line-height: 20px; margin-left: 0; text-align: right; }
.dl { font-size: 14px; font-weight: normal; font-family: '맑은 고딕', '돋움', dadum10; color: #019491; line-height: 25px; margin-left: 0; margin-right: 0; }
.steel { font-size: 14px; font-weight: normal; font-family: '맑은 고딕', '돋움', dadum10; color: steelblue; line-height: 21px; text-align: right; }
.steel1 { font-size: 14px; font-weight: normal; font-family: '맑은 고딕', '돋움', dadum10; color: steelblue; line-height: 21px; margin-left: 10px; }

/* ==========================================
   8. 팝업 모달 & 안내 요소
   ========================================== */
.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;
}

/* ==========================================
   9. 반응형 및 모션 설정
   ========================================== */
.player-no-text .panel:has(#lyrics),
.player-no-text .note {
  display: none !important;
}

.player-no-text .panes {
  display: block !important;
  grid-template-columns: minmax(0, 1fr) !important;
}

.player-no-text .panes > .panel {
  width: 100%;
  box-sizing: border-box;
}

.player-changing-header .hero > img {
  display: block;
  width: 100% !important;
  height: 220px !important;
  object-fit: contain !important;
  background: #fff;
}

@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 {
    min-height: 0;
    height: 460px;
    padding: 0;
  }
  
  .lyrics iframe {
    position: static;
    inset: auto;
    width: 100%;
    height: 100%;
  }

  .volume {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }

  .hero {
    min-height: 150px;
  }

  .hero img {
    height: 150px;
  }

  .hero h1 {
    padding: 25px 16px 13px;
  }

  .art {
    width: 110px;
    height: 110px;
  }

  .album-description img {
    width: 38%;
    margin-left: 12px;
  }
}

@media (max-width: 600px) {
  .player-changing-header .hero > img {
    height: 180px !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s, color 0.15s;
  }
}