* {
  box-sizing: border-box;
}

:root {
  --bg-0: #080c1d;
  --bg-1: #111939;
  --bg-2: #1b2d66;
  --surface-border: rgba(170, 196, 255, 0.24);
  --text-main: #f5f8ff;
  --text-subtle: #d7e3ff;
  --accent-gold: rgba(255, 224, 124, 0.98);
  --accent-gold-border: rgba(255, 224, 124, 0.55);
  --karaoke-highlight: rgba(255, 223, 117, 0.34);
  --glass-bg: linear-gradient(
    180deg,
    rgba(30, 42, 92, 0.78),
    rgba(20, 30, 70, 0.76)
  );
  --glass-shadow:
    0 14px 30px rgba(3, 7, 22, 0.5),
    0 1px 0 rgba(200, 220, 255, 0.08) inset;
  --font-ko: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic Medium",
    "Noto Sans JP", var(--font-ko);
  --song-sidebar-width: 300px;
  --song-thumb-size: 76px;
  --app-background:
    radial-gradient(1100px 520px at 15% -10%, #324d9f 0%, transparent 70%),
    radial-gradient(850px 460px at 90% 5%, #213a86 0%, transparent 72%),
    linear-gradient(165deg, var(--bg-2) 0%, var(--bg-1) 38%, var(--bg-0) 100%);
}

html {
  min-height: 100%;
  background-color: var(--bg-0);
}

/* 고정 배경: background-attachment: fixed는 모바일 사파리 미지원·스크롤 리페인트
   비용이 커서, 고정 의사 요소로 같은 효과를 낸다. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--app-background);
  background-repeat: no-repeat;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ko);
  color: var(--text-main);
  background: transparent;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 일본어 원문(lang="ja")은 일본어 자형 우선 — 한중일 통합 한자 자형 문제 방지 */
:lang(ja) {
  font-family: var(--font-jp);
  letter-spacing: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.app-header {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 20px 8px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 20px 28px;
}

.app-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.brand {
  display: inline-block;
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fbff;
  text-decoration: none;
  text-shadow: 0 4px 18px rgba(43, 94, 255, 0.35);
}

/* 현재 곡 제목(h1) — 검색 노출용 헤딩이자 시각적 곡 정보 */
.song-heading {
  margin: 0;
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  font-weight: 700;
  line-height: 1.4;
  word-break: keep-all;
}

.song-heading-artist {
  margin-left: 10px;
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-subtle);
}

.not-found-message {
  margin: 12px 6px;
  font-size: 1rem;
  color: var(--text-subtle);
}

.not-found-message a {
  color: #ffd88f;
}

.app-main {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.song-sidebar {
  min-width: 0;
  flex: 0 0 auto;
  width: 100%;
}

.song-sidebar-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  padding: 12px 12px 10px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-shadow);
}

.song-sidebar-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8f0ff;
}

.song-list-status {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #ffd6de;
  line-height: 1.45;
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.song-list::-webkit-scrollbar {
  width: 8px;
}

.song-list::-webkit-scrollbar-thumb {
  background: rgba(146, 173, 241, 0.45);
  border-radius: 999px;
}

.song-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: var(--song-thumb-size) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: calc(var(--song-thumb-size) + 16px);
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(117, 145, 230, 0.12);
  color: inherit;
  text-decoration: none;
  text-align: left;
  padding: 8px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.song-list-item:hover {
  background: rgba(130, 162, 255, 0.22);
}

.song-list-item.active {
  background: rgba(122, 162, 255, 0.28);
  border-color: var(--accent-gold-border);
}

.song-card-thumb {
  width: var(--song-thumb-size);
  height: var(--song-thumb-size);
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(8, 12, 28, 0.45);
  border: 1px solid rgba(173, 199, 255, 0.22);
}

.song-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.song-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.song-list-title {
  display: block;
  font-size: 0.86rem;
  line-height: 1.4;
  word-break: keep-all;
  text-wrap: pretty;
}

.controls,
.player-panel,
.current-lyric-panel,
.full-lyrics-panel {
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-shadow);
}

.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 14px 13px;
  font-size: 0.93rem;
}

.primary-btn,
.ghost-btn {
  border: 1px solid rgba(186, 209, 255, 0.35);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.91rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-btn {
  background: linear-gradient(180deg, #7ea8ff, #5b86f4);
  color: #ffffff;
  border-color: rgba(212, 225, 255, 0.5);
  box-shadow: 0 8px 18px rgba(65, 106, 232, 0.35);
}

.ghost-btn {
  background: rgba(133, 160, 234, 0.18);
  color: var(--text-subtle);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:hover {
  box-shadow: 0 10px 22px rgba(83, 125, 255, 0.42);
}

.ghost-btn:hover {
  background: rgba(147, 173, 245, 0.26);
}

.toggle-main {
  min-width: 130px;
  justify-content: center;
}

.toggle-main[aria-pressed="false"] {
  background: rgba(117, 145, 230, 0.18);
  border-color: rgba(173, 199, 255, 0.36);
  color: #e8f0ff;
  box-shadow: none;
}

.toggle-main[aria-pressed="true"] {
  background: linear-gradient(
    180deg,
    rgba(124, 166, 255, 0.74),
    rgba(84, 124, 242, 0.74)
  );
  border-color: rgba(213, 226, 255, 0.9);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(208, 225, 255, 0.42) inset,
    0 8px 16px rgba(74, 112, 232, 0.3);
}

.toggle-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  border: 1px solid rgba(173, 199, 255, 0.34);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e8f0ff;
  background: rgba(117, 145, 230, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
}

.toggle-chip input:checked + span {
  background: linear-gradient(
    180deg,
    rgba(124, 166, 255, 0.68),
    rgba(84, 124, 242, 0.68)
  );
  border-color: rgba(213, 226, 255, 0.88);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(208, 225, 255, 0.42) inset,
    0 8px 16px rgba(74, 112, 232, 0.26);
}

.skip-instrumental-btn {
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.skip-instrumental-btn:not(:disabled) {
  color: #fff4d6;
  border-color: rgba(255, 224, 124, 0.55);
  background: rgba(255, 210, 96, 0.16);
}

.skip-instrumental-btn:not(:disabled):hover {
  background: rgba(255, 210, 96, 0.28);
}

.skip-instrumental-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

#player {
  width: 100%;
  aspect-ratio: 16 / 7.8;
  border-radius: 14px;
  overflow: hidden;
}

.player-error {
  margin: 0;
  padding: 12px 16px;
  background: rgba(255, 94, 121, 0.2);
  color: #ffe2ea;
  border-top: 1px solid rgba(255, 156, 176, 0.4);
  border-bottom: 1px solid rgba(255, 156, 176, 0.4);
  font-size: 0.92rem;
}

.current-lyric-panel {
  padding: 10px 12px;
}

.current-lyric-line {
  width: 100%;
  background: linear-gradient(
    180deg,
    rgba(95, 136, 255, 0.24),
    rgba(82, 118, 229, 0.18)
  );
  border: 1px solid rgba(173, 198, 255, 0.52);
  color: #f6f8ff;
  border-radius: 12px;
  text-align: center;
  font-size: 1.32rem;
  line-height: 1.75;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow:
    0 8px 24px rgba(35, 54, 120, 0.36),
    0 1px 0 rgba(213, 225, 255, 0.16) inset;
}

.current-lyric-line.active {
  background: linear-gradient(
    180deg,
    rgba(122, 161, 255, 0.3),
    rgba(90, 127, 240, 0.24)
  );
  box-shadow:
    0 0 0 1px rgba(204, 221, 255, 0.45) inset,
    0 10px 26px rgba(45, 74, 166, 0.34);
}

.current-main {
  font-size: clamp(1.16rem, 2.1vw, 1.56rem);
  line-height: 1.78;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  text-align: center;
  word-break: keep-all;
  text-wrap: pretty;
}

.current-pron {
  margin-top: 8px;
  font-size: clamp(1.02rem, 1.45vw, 1.2rem);
  color: #dff2ff;
  font-weight: 600;
  word-break: keep-all;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.current-meaning {
  margin-top: 6px;
  font-size: clamp(0.98rem, 1.32vw, 1.12rem);
  color: #d0f5d8;
  line-height: 1.52;
  font-weight: 500;
  word-break: keep-all;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(177, 200, 255, 0.2);
}

.panel-title-wrap h2 {
  margin: 0;
  font-size: 1rem;
}

.lyrics-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 10px;
  max-height: 38vh;
  overflow-y: auto;
}

.lyrics-list::-webkit-scrollbar {
  width: 10px;
}

.lyrics-list::-webkit-scrollbar-thumb {
  background: rgba(146, 173, 241, 0.45);
  border-radius: 999px;
}

.lyrics-list::-webkit-scrollbar-track {
  background: rgba(46, 60, 108, 0.22);
}

.lyrics-line {
  width: 100%;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  border-left: 2px solid transparent;
}

.lyrics-line:hover {
  background: rgba(130, 162, 255, 0.18);
}

.lyrics-line.active {
  background: rgba(122, 162, 255, 0.23);
  border-left-color: var(--accent-gold);
}

.line-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: start;
}

.timestamp {
  display: inline-block;
  font-size: 0.78rem;
  color: #d6e5ff;
  background: rgba(117, 151, 255, 0.24);
  border: 1px solid rgba(172, 198, 255, 0.45);
  border-radius: 999px;
  padding: 3px 8px 4px;
}

.jp-line {
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  text-wrap: pretty;
}

.jp-line .word-karaoke-target,
.current-main .word-karaoke-target {
  display: inline;
  border-radius: 4px;
  padding: 0 1px;
  transition: background 0.12s ease;
  cursor: pointer;
}

.word-karaoke-target.active-word {
  background: var(--karaoke-highlight);
  box-shadow: 0 0 0 1px rgba(255, 223, 117, 0.44) inset;
}

.ko-pron {
  margin-top: 6px;
  color: #d8eeff;
  font-size: 0.91rem;
  line-height: 1.45;
  word-break: keep-all;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ko-meaning {
  margin-top: 4px;
  color: #c9f0d2;
  font-size: 0.86rem;
  line-height: 1.46;
  word-break: keep-all;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ko-pron .word-karaoke-target,
.ko-meaning .word-karaoke-target,
.current-pron .word-karaoke-target,
.current-meaning .word-karaoke-target {
  border-radius: 6px;
  padding: 1px 4px;
  cursor: pointer;
}

.line-words ruby {
  ruby-position: over;
}

ruby rt {
  font-size: 0.6em;
  color: #ffd88f;
  letter-spacing: 0.02em;
}

.show-word-block .line-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
}

.show-word-block .current-main.word-block-line {
  justify-content: center;
}

.show-word-block .line-words .word {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: rgba(160, 183, 242, 0.16);
  border: 1px solid rgba(189, 211, 255, 0.28);
  border-radius: 7px;
  padding: 5px 8px;
  cursor: pointer;
}

.show-word-block .line-words .word-main {
  display: block;
}

.show-word-block .line-words .word-pron {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: #c9e7ff;
  line-height: 1.2;
}

.show-word-block .line-words .word-meaning {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  color: #a8dcb7;
  line-height: 1.2;
}

.show-word-block .current-main .word-pron {
  font-size: 0.92rem;
  line-height: 1.3;
}

.show-word-block .current-main .word-meaning {
  font-size: 0.86rem;
  line-height: 1.3;
}

.show-word-block .line-words .word.active-word {
  background: rgba(255, 223, 117, 0.28);
  border-color: rgba(255, 223, 117, 0.56);
}

.hide-yomigana rt,
.hide-yomigana .word rt {
  display: none;
}

.show-word-block .ko-pron,
.show-word-block .current-pron {
  display: none;
}

.show-word-block .ko-meaning,
.show-word-block .current-meaning {
  display: none;
}

.hide-pronunciation .ko-pron,
.hide-pronunciation .current-pron,
.hide-pronunciation .line-words .word-pron {
  display: none;
}

/* 좁은 화면: 노래 목록을 상단 가로 스크롤 (가사 아래로 밀리지 않음) */
@media (max-width: 899px) {
  .song-sidebar {
    order: -1;
  }

  .app-main {
    order: 0;
  }

  .song-sidebar-inner {
    max-height: none;
  }

  .song-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    max-height: none;
  }

  .song-list li {
    flex: 0 0 auto;
    width: min(168px, 44vw);
  }

  .song-list-item {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: 0;
    padding: 8px;
  }

  .song-card-thumb {
    width: 100%;
    height: 88px;
  }

  .song-card-body {
    padding: 0 2px 4px;
  }
}

/* 넓은 화면: main(왼쪽) → sidebar(오른쪽) DOM 순서 */
@media (min-width: 900px) {
  .app-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 18px;
  }

  .app-main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .song-sidebar {
    flex: 0 0 var(--song-sidebar-width);
    width: var(--song-sidebar-width);
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
  }

  .song-sidebar-inner {
    max-height: inherit;
  }

  .song-list {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .song-list li + li {
    margin-top: 8px;
  }
}

@media (max-width: 980px) {
  .app-header {
    padding: 18px 14px 6px;
  }

  .app-shell {
    padding: 0 12px 18px;
  }

  .app-main {
    padding: 8px 0 0;
    gap: 10px;
  }

  #player {
    aspect-ratio: 16 / 9;
  }

  .controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .skip-instrumental-btn {
    margin-left: auto;
  }

  .current-lyric-line {
    font-size: 1.12rem;
  }

  .line-row {
    grid-template-columns: 58px 1fr;
    gap: 10px;
  }
}

@media (max-aspect-ratio: 3 / 4) {
  .app-header {
    padding: 14px 12px 6px;
  }

  .app-main {
    padding: 6px 10px 16px;
    gap: 9px;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .primary-btn {
    grid-column: 1 / -1;
  }

  .skip-instrumental-btn {
    grid-column: 1 / -1;
    justify-self: end;
    margin-left: 0;
  }

  #player {
    aspect-ratio: 16 / 10;
  }

  .current-lyric-line {
    padding: 12px 12px;
  }

  .lyrics-list {
    max-height: 46vh;
  }
}

@media (min-aspect-ratio: 2 / 1) and (min-width: 1200px) {
  .app-main {
    gap: 16px;
  }

  #player {
    aspect-ratio: 21 / 8;
  }

  .current-lyric-line {
    padding: 16px 20px;
  }

  .lyrics-list {
    max-height: 42vh;
  }
}

/* ===========================================================================
   홈(랜딩) 페이지 — 헤더 + 검색 + 히어로 캐러셀 + 칩 필터 + 곡 카드 그리드
   =========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.home-header {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-nav {
  display: flex;
  gap: 18px;
}

.home-nav a {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 2px;
}

.home-nav a:hover {
  color: #ffffff;
}

.home-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 검색 — 인프런처럼 헤더 아래 중앙의 큰 필 형태 */
.home-search {
  position: relative;
  z-index: 50; /* 자동완성 드롭다운이 히어로 캐러셀 위에 오도록 */
  width: min(640px, 100%);
  margin: 4px auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 6px 6px 6px 20px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
}

.home-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 0.96rem;
  outline: none;
}

.home-search input::placeholder {
  color: rgba(215, 227, 255, 0.55);
}

.home-search-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(180deg, #7ea8ff, #5b86f4);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.home-search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(65, 106, 232, 0.4);
}

/* 히어로 캐러셀 */
.hero-carousel {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  box-shadow: var(--glass-shadow);
}

.hero-track {
  display: flex;
  transition: transform 0.45s ease;
}

/* 슬라이드 전체가 곡으로 가는 링크다. 썸네일을 어둡게 깔고 문구를 얹는다. */
.hero-slide {
  min-width: 100%;
  padding: clamp(34px, 6vw, 64px) clamp(24px, 7vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
  min-height: 250px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 썸네일이 없을 때의 폴백 그라디언트 */
.hero-theme-0 {
  background-color: #14224f;
}

.hero-theme-1 {
  background-color: #1c1840;
}

.hero-theme-2 {
  background-color: #112743;
}

.hero-theme-3 {
  background-color: #102036;
}

.hero-theme-4 {
  background-color: #181a3e;
}

.hero-title {
  display: block;
  margin: 0;
  font-size: clamp(1.4rem, 3.2vw, 2.2rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  word-break: keep-all;
  text-wrap: balance;
  text-shadow: 0 4px 22px rgba(4, 10, 32, 0.85);
}

.hero-song {
  display: block;
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  color: rgba(220, 232, 255, 0.88);
  text-shadow: 0 2px 10px rgba(4, 10, 32, 0.8);
}

.hero-hint {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0d1838;
  background: linear-gradient(180deg, #ffe9a8, #ffd86a);
  box-shadow: 0 8px 20px rgba(255, 216, 106, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.hero-slide:hover .hero-hint {
  transform: translateX(3px);
  box-shadow: 0 12px 26px rgba(255, 216, 106, 0.4);
}

.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(186, 209, 255, 0.4);
  background: rgba(10, 16, 40, 0.55);
  color: #e8f0ff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.16s ease;
}

.hero-arrow:hover {
  background: rgba(60, 86, 170, 0.6);
}

.hero-prev {
  left: 14px;
}

.hero-next {
  right: 14px;
}

.hero-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(215, 227, 255, 0.35);
  cursor: pointer;
  transition: background 0.16s ease, width 0.16s ease;
}

.hero-dot.active {
  width: 22px;
  border-radius: 999px;
  background: var(--accent-gold);
}

/* 섹션 공통 */
.home-section-title {
  margin: 8px 0 0;
  font-size: clamp(1.12rem, 1.8vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.home-main,
.home-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-list-status {
  margin: 0;
  font-size: 0.88rem;
  color: #ffd6de;
}

/* 칩 필터 */
.home-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-chip {
  border: 1px solid rgba(173, 199, 255, 0.34);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #e8f0ff;
  background: rgba(117, 145, 230, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
}

.home-chip:hover {
  background: rgba(147, 173, 245, 0.28);
}

.home-chip.active {
  background: linear-gradient(180deg, rgba(124, 166, 255, 0.68), rgba(84, 124, 242, 0.68));
  border-color: rgba(213, 226, 255, 0.88);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(208, 225, 255, 0.42) inset,
    0 8px 16px rgba(74, 112, 232, 0.26);
}

/* 곡 카드 그리드 */
.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 16px;
}

.home-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  box-shadow: var(--glass-shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.home-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold-border);
  box-shadow:
    0 18px 36px rgba(3, 7, 22, 0.55),
    0 1px 0 rgba(200, 220, 255, 0.1) inset;
}

.home-card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: rgba(8, 12, 28, 0.45);
}

.home-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-new {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0d1838;
  background: linear-gradient(180deg, #ffe9a8, #ffd86a);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.home-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 13px 13px;
}

.home-card-title {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-card-artist {
  font-size: 0.83rem;
  color: var(--text-subtle);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-card-artist-empty {
  color: rgba(215, 227, 255, 0.4);
}

.home-card-meta {
  margin-top: 2px;
  font-size: 0.76rem;
  color: rgba(215, 227, 255, 0.62);
}

/* 학습 기능 소개 */
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.home-feature-card {
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  box-shadow: var(--glass-shadow);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-feature-icon {
  font-size: 1.6rem;
}

.home-feature-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.home-feature-card p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--text-subtle);
}

.home-footer {
  margin-top: 14px;
  padding: 18px 0 6px;
  border-top: 1px solid rgba(177, 200, 255, 0.16);
  text-align: center;
  font-size: 0.82rem;
  color: rgba(215, 227, 255, 0.55);
}

@media (max-width: 640px) {
  .home-nav {
    gap: 12px;
  }

  .hero-slide {
    min-height: 210px;
  }

  .home-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

/* 인증 — 헤더 우측 영역(모든 SSR 페이지 공유) */
.home-header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-link {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 2px;
}

.auth-link:hover {
  color: #ffffff;
}

.auth-link-signup {
  color: #ffd88f;
}

.auth-username {
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 600;
}

.logout-form {
  display: inline;
  margin: 0;
}

.auth-link-btn {
  background: transparent;
  border: none;
  padding: 6px 2px;
  color: var(--text-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-link-btn:hover {
  color: #ffffff;
}

/* 인증 — 로그인/회원가입 페이지 */
.auth-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 48px 20px 64px;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 30px 26px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
}

.auth-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-desc {
  margin: 0 0 6px;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 99, 120, 0.16);
  border: 1px solid rgba(255, 120, 140, 0.45);
  color: #ffd2da;
  font-size: 0.86rem;
}

.auth-label {
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.auth-card input {
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--text-main);
  background: rgba(16, 24, 52, 0.6);
}

.auth-card input:focus {
  outline: none;
  border-color: #7ea8ff;
}

.auth-hint {
  margin: -4px 0 0;
  font-size: 0.78rem;
  color: rgba(215, 227, 255, 0.6);
}

.auth-submit {
  margin-top: 8px;
}

.auth-alt {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--text-subtle);
  text-align: center;
}

.auth-alt a {
  color: #ffd88f;
}

/* ── 플레이리스트 ─────────────────────────────────────────── */
.playlist-shell {
  max-width: 860px;
}
.playlist-main {
  padding: 8px 0 24px;
}
.playlist-message,
.playlist-add-banner {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(133, 160, 234, 0.16);
  border: 1px solid var(--surface-border);
  color: var(--text-subtle);
  font-size: 0.92rem;
}
.playlist-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.playlist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
}
.playlist-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  min-width: 0;
}
.playlist-row-main strong {
  font-size: 1.02rem;
}
.playlist-row-meta {
  font-size: 0.8rem;
  color: var(--text-subtle);
  opacity: 0.8;
}
.playlist-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.playlist-inline-form {
  margin: 0;
  display: inline;
}
.playlist-empty {
  color: var(--text-subtle);
  opacity: 0.85;
  padding: 14px 4px;
  list-style: none;
}
.playlist-create {
  padding: 18px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
}
.playlist-create-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
.playlist-create-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.playlist-input,
.playlist-select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: rgba(8, 12, 29, 0.55);
  color: var(--text-main);
  font-size: 0.95rem;
}
.playlist-input {
  flex: 1 1 220px;
}
.playlist-song-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.playlist-song {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
}
.playlist-song-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
  color: var(--text-main);
}
.playlist-song-thumb {
  width: 72px;
  height: 41px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(8, 12, 29, 0.5);
}
.playlist-song-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.playlist-song-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.playlist-song-artist {
  font-size: 0.82rem;
  color: var(--text-subtle);
  opacity: 0.85;
}
.playlist-back {
  margin: 0 0 6px;
}
.playlist-back a {
  color: var(--text-subtle);
  text-decoration: none;
}
.playlist-detail-meta {
  margin: 0 0 12px;
  color: var(--text-subtle);
  opacity: 0.85;
  font-size: 0.9rem;
}
.add-to-playlist-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ── 검색 자동완성 드롭다운 (반투명, 슬라이드다운) ─────────────── */
.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  list-style: none;
  margin: 0;
  padding: 6px;
  border-radius: 18px;
  background: rgba(17, 25, 57, 0.72);
  border: 1px solid var(--surface-border);
  box-shadow: 0 18px 40px rgba(6, 10, 26, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  /* 닫힘 상태: 위에서 살짝 접힌 채 투명 */
  transform-origin: top center;
  transform: translateY(-6px);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.search-suggest.open {
  /* 열림: 주르륵 내려옴 */
  transform: translateY(0);
  opacity: 1;
}
.search-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-main);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.search-suggest-item:hover,
.search-suggest-item.active {
  background: rgba(133, 160, 234, 0.22);
}
.search-suggest-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-suggest-tag {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle);
  opacity: 0.7;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 1px 8px;
}
@media (prefers-reduced-motion: reduce) {
  .search-suggest {
    transition: none;
    transform: none;
  }
}

/* ── 곡 페이지: 조회수 배지 + 다음 곡 ─────────────────────── */
.song-heading-views {
  margin-left: 10px;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--text-subtle);
  opacity: 0.85;
  white-space: nowrap;
}
.next-songs {
  background: var(--glass-bg);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-shadow);
  padding: 14px;
}
.next-songs-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
}
.next-songs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.next-song-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(117, 145, 230, 0.12);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.next-song-card:hover {
  background: rgba(130, 162, 255, 0.22);
  border-color: var(--accent-gold-border);
}
.next-song-thumb {
  width: 72px;
  height: 41px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(8, 12, 29, 0.5);
}
.next-song-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.next-song-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.next-song-body strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.next-song-artist {
  font-size: 0.8rem;
  color: var(--text-subtle);
  opacity: 0.85;
}

.playlist-edit {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.playlist-edit .playlist-input {
  flex: 1 1 200px;
}
