/* ===========================================================================
   VoiceFilm 디자인 시스템 — A-shell 소유 (styles.css)
   다크 톤 오디오 스트리밍 감성 / 모바일 프레임(최대 430px) / 관리자 와이드 지원
   ---------------------------------------------------------------------------
   구성:
   0. CSS 변수 & 리셋            5. 리스트 / 커버 / 배지 / 평점
   1. 프레임 & 셸 레이아웃        6. 폼 (입력/셀렉트/필드/에러)
   2. 타이포그래피               7. 모달 / 바텀시트 / 토스트
   3. 버튼 / 칩 / 탭             8. 캐러셀 / 가로 스크롤 / 진행바 / 슬라이더
   4. 카드 / 섹션 / 빈 상태       9. 플레이어 / 채팅 / 아코디언
                                10. 관리자(와이드 + 테이블)  11. 유틸리티
   ========================================================================= */

/* ------------------------------------------------------------------ 0. 변수 */
:root {
  /* 팔레트 — V2 "딥 인디고 × 플레이 그린" (ui-ux-pro-max DB: Dark audio + play green) */
  --bg: #0f0f23;                 /* 페이지 배경 */
  --bg-frame: #131329;           /* 프레임 배경 */
  --surface: #1a1a33;            /* 카드/리스트 표면 */
  --surface-2: #222247;          /* 표면 위 표면(호버/입력) */
  --surface-3: #2c2c5a;          /* 강조 표면 */
  --border: #2c2a5e;             /* 경계선 */
  --border-strong: #4338ca;

  --text: #f8fafc;               /* 본문 */
  --text-dim: #a5a8c8;           /* 보조 */
  --text-faint: #6e7194;         /* 미약(메타) */

  --accent: #22c55e;             /* 주 포인트(플레이 그린) */
  --accent-strong: #4ade80;
  --accent-deep: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --accent-soft-strong: rgba(34, 197, 94, 0.22);
  --accent-border: rgba(34, 197, 94, 0.5);
  --accent-glow: rgba(34, 197, 94, 0.35);
  --accent-grad: linear-gradient(135deg, #4338ca 0%, #0ea5a4 55%, #22c55e 100%);

  --gold: #f6c453;               /* 별점 */
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #60a5fa;

  /* 흰색 오버레이(경계/호버/칩 배경) — 다크 테마 기준 */
  --ov-weak: rgba(255, 255, 255, 0.06);
  --ov: rgba(255, 255, 255, 0.08);
  --ov-strong: rgba(255, 255, 255, 0.11);

  /* 셸 크롬(탭바/미니플레이어/토스트/페이지 글로우) */
  --chrome-bg: rgba(15, 15, 35, 0.92);        /* 탭바(반투명 블러 배경) */
  --mini-bg: rgba(26, 26, 58, 0.97);          /* 미니 플레이어 컨테이너 */
  --toast-bg: rgba(240, 242, 250, 0.97);      /* 토스트(반전 스타일) */
  --toast-text: #15152a;
  --page-glow: rgba(67, 56, 202, 0.16);       /* 상단 라디얼 글로우(인디고) */
  --table-row-border: rgba(44, 42, 94, 0.55); /* 관리자 테이블 행 구분선 */

  /* 형태 */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.3);

  /* 레이아웃 */
  --frame-w: 430px;
  --tabbar-h: 58px;
  --mini-h: 60px;
  --pad: 16px;

  --font: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font); /* 제목·헤딩 — 본문과 동일한 고딕(세리프 페어링 제거) */

  color-scheme: dark;

  /* 뷰 모듈 호환 별칭(--vf-*) — 뷰들의 스코프 스타일이 참조. 전역 토큰에 연동 */
  --vf-bg: var(--bg);
  --vf-card: var(--surface);
  --vf-text: var(--text);
  --vf-sub: var(--text-dim);
  --vf-accent: var(--accent);
}

/* ------------------------------------------------ 라이트 테마 (V4 시안) */
/* 기본은 다크(V2). 마이페이지 > 화면 테마에서 전환, localStorage 'vf_theme' */
:root[data-theme="light"] {
  --bg: #faf9f7;
  --bg-frame: #f1f0ee;
  --surface: #ffffff;
  --surface-2: #f3f2f7;
  --surface-3: #e9e7f2;
  --border: #e5e3ee;
  --border-strong: #c9c5dd;

  --text: #17151f;
  --text-dim: #5d5a6e;
  --text-faint: #98949f;

  --accent: #4f46e5;
  --accent-strong: #6d64f0;
  --accent-deep: #3b34b8;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --accent-soft-strong: rgba(79, 70, 229, 0.16);
  --accent-border: rgba(79, 70, 229, 0.45);
  --accent-glow: rgba(79, 70, 229, 0.25);
  --accent-grad: linear-gradient(135deg, #4f46e5 0%, #7c6cf0 55%, #b262e8 100%);

  --gold: #d97706;

  --ov-weak: rgba(20, 16, 40, 0.05);
  --ov: rgba(20, 16, 40, 0.07);
  --ov-strong: rgba(20, 16, 40, 0.1);

  --chrome-bg: rgba(250, 249, 247, 0.92);
  --mini-bg: rgba(255, 255, 255, 0.97);
  --mini-card: #dfdbec; /* 미니 플레이어 카드 — 도크 배경과 구분되게 짙은 톤 */
  --toast-bg: rgba(23, 21, 31, 0.95);
  --toast-text: #f5f4fa;
  --page-glow: rgba(79, 70, 229, 0.07);
  --table-row-border: rgba(30, 28, 50, 0.12);

  --shadow: 0 8px 28px rgba(40, 35, 80, 0.12);
  --shadow-soft: 0 4px 14px rgba(40, 35, 80, 0.08);

  color-scheme: light;
}

/* 리셋 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -200px, var(--page-glow), transparent 60%),
    var(--bg);
  min-height: 100dvh;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0 0 8px; }
::selection { background: var(--accent-deep); color: #fff; }

/* 헤딩 타이포그래피 — 페어링: 제목은 세리프(--font-display), 본문은 산스(--font) */
h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
/* 관리자 화면은 도구 성격이므로 산스 유지 */
.adm h1, .adm h2 { font-family: var(--font); }

/* 인라인 SVG 아이콘(icons.js) 정렬 */
svg.vfi { display: inline-block; vertical-align: -0.2em; flex: none; }

/* 스크롤바 (데스크톱에서 다크와 어울리게) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------- 1. 프레임 & 셸 레이아웃 */
.frame {
  position: relative;
  max-width: var(--frame-w);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg-frame);
  transition: max-width 0.25s ease;
}
/* 데스크톱에서 프레임 경계 표시 */
@media (min-width: 480px) {
  .frame {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
  }
}

/* 뷰 컨테이너: 하단 탭바 + 미니플레이어 공간 확보 */
.view {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + 28px);
}
body.no-tabbar .view { padding-bottom: calc(var(--mini-h) + 28px); }

/* 하단 도크 — 미니 플레이어 + 탭바를 담는 단일 고정 컨테이너 (이음새 없는 한 레이어) */
#dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--frame-w));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--chrome-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 60;
  box-sizing: border-box;
}
/* 미니 플레이어가 떠 있으면 도크 상단 라운딩 — 본문 좌우 여백(16px)보다 약간 작게 */
#dock.has-mini { border-radius: 12px 12px 0 0; }
/* 재생 화면: 풀 플레이어가 있으므로 도크 전체 숨김 */
body[data-route="play"] #dock { display: none; }
/* 탭바 없는 라우트(로그인/관리자)에서 미니 플레이어도 없으면 빈 도크 숨김 */
body.no-tabbar #dock:not(.has-mini) { display: none; }

/* 하단 탭바 — 도크 내부 흐름 배치 */
.tabbar {
  display: flex;
  height: var(--tabbar-h);
}
body.no-tabbar .tabbar { display: none; }
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.tab-item svg { transition: transform 0.15s ease; }
.tab-item.active { color: var(--accent-strong); }
.tab-item.active svg { transform: translateY(-1px); }
.tab-item:active svg { transform: scale(0.9); }

/* 미니 플레이어 컨테이너 — 도크 내부 흐름 배치, 내부 DOM은 player.js가 관리 */
#mini-player {
  padding: 10px 10px 8px;
  box-sizing: border-box;
}
#mini-player:empty { display: none; }

/* 미니 플레이어 권장 내부 구조(.mini-player) 스타일 */
.mini-player {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px 8px;
  padding: 8px 10px;
  background: var(--mini-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: rise-in 0.25s ease;
}
.mini-player .mini-cover {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  overflow: hidden;
}
.mini-player .mini-meta { flex: 1; min-width: 0; }
.mini-player .mini-title {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-player .mini-sub {
  font-size: 11.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-player .mini-progress {
  position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; border-radius: 2px; overflow: hidden;
}

/* 상단 앱바(뷰 내부 공통 헤더) */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px var(--pad);
  background: var(--chrome-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}
.appbar.bordered { border-bottom-color: var(--border); }
.appbar .appbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------- 2. 타이포그래피 */
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 800; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.xsmall { font-size: 11px; }
.bold { font-weight: 700; }
.accent-text { color: var(--accent-strong); }
.danger-text { color: var(--danger); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------ 3. 버튼 / 칩 / 탭 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 108, 240, 0.35);
}
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #17070a; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 20px; font-size: 15.5px; border-radius: var(--radius); }
.btn-block { display: flex; width: 100%; }
.btn-pill { border-radius: var(--radius-full); }

/* 아이콘 전용 버튼(뒤로가기/공유/하트 등) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.liked { color: #ff6b81; }

/* 장르 칩 */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px var(--pad) 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(0.95); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(139, 124, 248, 0.4);
}

/* 세그먼트 탭 (상세: 회차/소개/리뷰, 구매내역/고객지원 탭) */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--pad);
  gap: 4px;
}
.tabs .tab {
  padding: 11px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* 세그먼트 컨트롤(알약형) */
.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.segmented .seg {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.segmented .seg.active { background: var(--surface-3); color: var(--text); }

/* --------------------------------------------- 4. 카드 / 섹션 / 빈 상태 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-elev { box-shadow: var(--shadow-soft); }
.card-accent {
  background: linear-gradient(140deg, rgba(124, 108, 240, 0.16), rgba(213, 95, 180, 0.08)),
    var(--surface);
  border-color: rgba(139, 124, 248, 0.35);
}

.section { padding: 18px var(--pad) 6px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.section-more { font-size: 12.5px; color: var(--text-faint); background: none; border: none; cursor: pointer; }

/* 빈 상태 */
.empty {
  padding: 56px 28px;
  text-align: center;
  color: var(--text-dim);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.85; }
.empty-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-desc { font-size: 13px; color: var(--text-faint); margin-bottom: 16px; }

/* 구분선 */
.divider { height: 1px; background: var(--border); margin: 14px 0; border: none; }
.divider-thick { height: 8px; background: var(--bg); border: none; margin: 8px 0; }

/* ------------------------------------- 5. 리스트 / 커버 / 배지 / 평점 */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--pad);
  cursor: pointer;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.list-item:hover { background: rgba(255, 255, 255, 0.025); }
.list-item:active { background: rgba(255, 255, 255, 0.05); }
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-title {
  font-size: 14.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .item-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.list-item .item-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.list-item + .list-item { border-top: 1px solid rgba(38, 38, 54, 0.5); }

/* 화살표 있는 메뉴 행(마이페이지) */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px var(--pad);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(38, 38, 54, 0.5);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu-item:active { background: rgba(255, 255, 255, 0.04); }
.menu-item .menu-icon { font-size: 18px; width: 24px; text-align: center; }
.menu-item::after {
  content: "›";
  margin-left: auto;
  color: var(--text-faint);
  font-size: 18px;
  font-weight: 400;
}

/* 커버 아트 — db의 cover 키(g1~g12 그라디언트) 또는 이모지 표시
   사용: <div class="cover g3">🌙</div> / 크기 변형 .cover-sm .cover-lg .cover-xl */
.cover {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.cover-sm { width: 42px; height: 42px; font-size: 20px; border-radius: var(--radius-xs); }
.cover-lg { width: 96px; height: 96px; font-size: 44px; border-radius: var(--radius); }
.cover-xl { width: 132px; height: 132px; font-size: 60px; border-radius: var(--radius-lg); }
.cover-hero {
  width: min(64vw, 260px); height: min(64vw, 260px);
  font-size: 100px; border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* 커버 그라디언트 키 (B-data cover 키와 매핑) */
.g1  { background: linear-gradient(135deg, #667eea, #764ba2); }
.g2  { background: linear-gradient(135deg, #f77062, #fe5196); }
.g3  { background: linear-gradient(135deg, #243949, #517fa4); }
.g4  { background: linear-gradient(135deg, #fc6076, #ff9a44); }
.g5  { background: linear-gradient(135deg, #0ba360, #3cba92); }
.g6  { background: linear-gradient(135deg, #b224ef, #7579ff); }
.g7  { background: linear-gradient(135deg, #ff512f, #dd2476); }
.g8  { background: linear-gradient(135deg, #1a2980, #26d0ce); }
.g9  { background: linear-gradient(135deg, #4b134f, #c94b4b); }
.g10 { background: linear-gradient(135deg, #134e5e, #71b280); }
.g11 { background: linear-gradient(135deg, #2b5876, #4e4376); }
.g12 { background: linear-gradient(135deg, #d66d75, #e29587); }

/* 배지 (무료 / 가격P / 소장중 / 잠금) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-free { background: rgba(74, 222, 128, 0.14); color: var(--success); }
.badge-price { background: var(--accent-soft); color: var(--accent-strong); }
.badge-owned { background: rgba(96, 165, 250, 0.14); color: var(--info); }
.badge-lock { background: var(--surface-3); color: var(--text-faint); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-genre { background: var(--surface-3); color: var(--text-dim); }

/* 순위 숫자(TOP20) */
.rank-num {
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  min-width: 26px;
}

/* 평점 별 */
.rating { color: var(--gold); font-weight: 700; font-size: 13px; }
.rating .count { color: var(--text-faint); font-weight: 500; font-size: 12px; }
/* 별점 선택(리뷰 작성) */
.star-input { display: inline-flex; gap: 4px; font-size: 26px; cursor: pointer; }
.star-input .star { color: var(--surface-3); transition: color 0.1s ease, transform 0.1s ease; }
.star-input .star.on { color: var(--gold); }
.star-input .star:active { transform: scale(1.2); }

/* 포인트 표기 */
.point-value { font-weight: 800; color: var(--accent-strong); }
.point-plus { color: var(--success); font-weight: 700; }
.point-minus { color: var(--danger); font-weight: 700; }

/* ------------------------------------------------------------- 6. 폼 */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--text-dim); }
.label .req { color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
textarea { resize: vertical; min-height: 88px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a7a5b8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.error-text { font-size: 12px; color: var(--danger); }
.help-text { font-size: 12px; color: var(--text-faint); }

/* 검색 입력(둥근 + 아이콘 여백) */
.search-bar { position: relative; padding: 8px var(--pad); }
.search-bar input {
  border-radius: var(--radius-full);
  padding-left: 42px;
  background: var(--surface);
}
.search-bar .search-icon {
  position: absolute;
  left: calc(var(--pad) + 14px);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-bar .clear-btn {
  position: absolute;
  right: calc(var(--pad) + 8px);
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}

/* 소셜 로그인 버튼 */
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-social.google { background: #fff; color: #1f1f1f; border-color: #fff; }
.btn-social.apple { background: #000; color: #fff; border-color: #333; }

/* ------------------------------------------- 7. 모달 / 바텀시트 / 토스트 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 5, 10, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease;
}
.modal {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
  animation: pop-in 0.2s ease;
}
.modal .modal-title { font-size: 16.5px; font-weight: 800; margin-bottom: 8px; }
.modal .modal-body { font-size: 13.5px; color: var(--text-dim); margin-bottom: 18px; }
.modal .modal-actions { display: flex; gap: 8px; }
.modal .modal-actions .btn { flex: 1; }

/* 바텀시트(회차 리스트/구매/공유) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(5, 5, 10, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease;
}
.sheet {
  width: min(100%, var(--frame-w));
  max-height: 78dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 0 calc(18px + env(safe-area-inset-bottom, 0px));
  animation: rise-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet .sheet-handle {
  width: 40px; height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
  margin: 4px auto 10px;
}
.sheet .sheet-title {
  font-size: 15.5px; font-weight: 800;
  padding: 4px var(--pad) 10px;
  border-bottom: 1px solid var(--border);
}
.sheet .sheet-body { padding: 8px var(--pad); }

/* 공유 시트 그리드 */
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px var(--pad);
}
.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 4px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.share-option .share-icon { font-size: 24px; }
.share-option:active { background: var(--surface-3); }

/* 토스트 */
#toast-root {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--mini-h) + 26px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 48px), calc(var(--frame-w) - 48px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast {
  max-width: 100%;
  padding: 11px 18px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ----------------------------- 8. 캐러셀 / 가로 스크롤 / 진행바 / 슬라이더 */
/* 배너 캐러셀 */
.carousel { position: relative; overflow: hidden; }
.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.3, 1);
}
.carousel-slide { flex: 0 0 100%; padding: 12px var(--pad) 4px; }
.banner-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  min-height: 128px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.banner-card .banner-headline { font-size: 17px; font-weight: 900; line-height: 1.3; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.banner-card .banner-sub { font-size: 12.5px; color: rgba(255, 255, 255, 0.82); margin-top: 4px; }
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px 0 2px;
}
.carousel-dots .dot {
  width: 6px; height: 6px;
  border: none; padding: 0;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  transition: all 0.25s ease;
  cursor: pointer;
}
.carousel-dots .dot.active { width: 18px; background: var(--accent); }

/* 가로 스크롤 리스트(TOP20 등) */
.hlist {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px var(--pad) 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.hlist::-webkit-scrollbar { display: none; }
.hcard {
  flex-shrink: 0;
  width: 108px;
  scroll-snap-align: start;
  cursor: pointer;
}
.hcard .cover { width: 108px; height: 108px; font-size: 48px; border-radius: var(--radius); margin-bottom: 7px; }
.hcard .hcard-title { font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.hcard .hcard-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

/* 진행바(읽기 전용) */
.progress {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress .progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-grad);
  transition: width 0.2s linear;
}

/* Seek 슬라이더 (input[type=range]) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  --seek: 0%; /* JS가 채움 비율 갱신: el.style.setProperty('--seek', pct+'%') */
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(to right, var(--accent) var(--seek), var(--surface-3) var(--seek));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type="range"]::-moz-range-track {
  height: 5px; border-radius: 5px; background: var(--surface-3);
}
input[type="range"]::-moz-range-progress {
  height: 5px; border-radius: 5px; background: var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: none; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------- 9. 플레이어 / 채팅 / 아코디언 */
/* 재생 화면 레이아웃 도움 클래스 */
.player-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--mini-h));
  padding: 0 22px calc(30px + env(safe-area-inset-bottom, 0px));
}
.player-cover-wrap { display: flex; justify-content: center; padding: 26px 0 22px; }
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 0;
}
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.ctrl-btn:hover { background: var(--surface-2); }
.ctrl-btn:active { transform: scale(0.9); }
.ctrl-btn:disabled { opacity: 0.3; cursor: default; }
.ctrl-btn.play-main {
  width: 68px; height: 68px;
  font-size: 28px;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 108, 240, 0.45);
}
.ctrl-btn.play-main:hover { filter: brightness(1.08); background: var(--accent-grad); }

/* 미리듣기 배너 */
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(139, 124, 248, 0.3);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 700;
}

/* 채팅(1:1 문의 시뮬레이션) */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px var(--pad);
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 16px;
  word-break: break-word;
}
.bubble.me {
  align-self: flex-end;
  background: var(--accent-deep);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 5px;
}
.bubble-time { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.chat-input-row {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 8px);
  display: flex;
  gap: 8px;
  padding: 10px var(--pad);
  background: var(--bg-frame);
}
.chat-input-row input { flex: 1; border-radius: var(--radius-full); }

/* 아코디언(공지/FAQ) — details/summary 기반 */
details.accordion {
  border-bottom: 1px solid rgba(38, 38, 54, 0.6);
}
details.accordion summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--pad);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
details.accordion summary::-webkit-details-marker { display: none; }
details.accordion summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--text-faint);
  transition: transform 0.2s ease;
}
details.accordion[open] summary::after { transform: rotate(180deg); }
details.accordion .accordion-body {
  padding: 0 var(--pad) 16px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.65;
  white-space: pre-line;
}

/* ------------------------------------------- 10. 관리자 (와이드 + 테이블) */
body.route-admin { background: var(--bg); }
body.route-admin .frame { max-width: 1080px; }
body.route-admin .view { padding-bottom: 60px; }

.admin-layout { display: flex; min-height: 100dvh; }
.admin-nav {
  width: 200px;
  flex-shrink: 0;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 100dvh;
}
.admin-nav .admin-brand {
  font-size: 16px; font-weight: 900;
  padding: 6px 12px 18px;
  letter-spacing: -0.01em;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.admin-nav-item:hover { background: var(--surface); color: var(--text); }
.admin-nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.admin-main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.admin-title { font-size: 20px; font-weight: 800; margin-bottom: 18px; }

/* 모바일 폭에서 관리자: 세로 스택 */
@media (max-width: 760px) {
  .admin-layout { flex-direction: column; }
  .admin-nav {
    width: 100%;
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: static;
  }
  .admin-main { padding: 18px var(--pad) 60px; }
}

/* 통계 카드 그리드 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.stat-card .stat-value { font-size: 24px; font-weight: 900; margin-top: 4px; letter-spacing: -0.02em; }

/* 관리자 테이블 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--table-row-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr.selected { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* 관리자 폼 패널 */
.admin-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-grid .field-wide { grid-column: 1 / -1; }

/* -------------------------------------------------------- 11. 유틸리티 */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.flex1 { flex: 1; min-width: 0; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }

.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.mx-16 { margin-left: var(--pad); margin-right: var(--pad); }
.p-16 { padding: 16px; }
.px-16 { padding-left: var(--pad); padding-right: var(--pad); }
.py-8 { padding-top: 8px; padding-bottom: 8px; }

.hidden { display: none !important; }

/* 애니메이션 키프레임 */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 로딩 스피너 */
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 32px auto;
}

/* 뷰 진입 트랜지션 */
.view > * { animation: fade-in 0.2s ease; }

/* 모션 최소화 존중 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
