/* =========================================================================
   되감기 (Rewind) — mobile-first cassette deck UI
   Design: neubrutalist bold-app treatment — thick outlines, hard offset
   shadows, flat saturated duotone (lime + coral) on near-black, chunky
   geometric display type. A single deliberate dark world by design —
   background & every color are declared explicitly.
   Type: Unbounded (brand/headers) + Plus Jakarta Sans (UI/body) +
   Space Mono (numeric readouts only — a utility face, not the personality).
   ========================================================================= */

/* Self-hosted fonts (SIL Open Font License) — no runtime dependency on any
   third-party font CDN. Files live in ./fonts, see fonts/OFL-*.txt for the
   license text that must ship alongside them. */
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Unbounded-600.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Unbounded-700.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/Unbounded-800.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/PlusJakartaSans-500.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/PlusJakartaSans-600.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/PlusJakartaSans-700.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/PlusJakartaSans-800.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/SpaceMono-400.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/SpaceMono-700.woff2") format("woff2"); }

:root {
  --bg: #0c0c11;
  --surface: #1a1a22;
  --surface-raised: #23232e;
  --border: #34344a;
  --border-strong: #46466a;

  --text: #f6f5fa;
  --text-dim: #a6a3ba;
  --text-faint: #726f8a;

  --lime: #d3ff4d;
  --lime-ink: #10160a;
  --coral: #ff5d73;
  --coral-ink: #2a0510;

  --shell: #f4efe0;      /* cassette body — flat cream, not a gradient */
  --shell-ink: #14110f;
  --shell-dim: #d8cfb4;
  --window: #0a0a0d;
  --reel: #3a3a52;

  --danger: #ff5d73;
  --danger-ink: #fbdcd2;
  --focus: var(--lime);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-hard: 4px 4px 0 #000;
  --shadow-hard-sm: 3px 3px 0 #000;
  --shadow-hard-press: 1px 1px 0 #000;

  /* Unbounded is self-hosted with Latin + Cyrillic glyphs (covers ru), so it
     renders natively for ko/en/es/fr/de/ru headers. Plus Jakarta Sans is
     Latin-only, so ko/ja/zh/ru body text falls through to a native system
     face per script — embedding a CJK font would be several MB, far outside
     what's reasonable to self-host (see LICENSE_AUDIT.md). */
  --font-display: "Unbounded", "Malgun Gothic", "Apple SD Gothic Neo", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "PingFang SC", "Microsoft YaHei", "Segoe UI", "Arial Black", sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  --font-mono: "Space Mono", "SFMono-Regular", Consolas, monospace;

  color-scheme: dark;
}

/* Single deliberate dark world by design — no light-theme branch. */

/* The `hidden` attribute's default `display:none` is a user-agent style, so
   any author rule that sets `display` on the same element (even something as
   broad as `.btn { display: flex }`) silently wins and the element stays
   visible despite `hidden` — a well-known CSS gotcha. `!important` here
   makes `hidden` authoritative everywhere, no matter what other classes an
   element carries. Fixes a pre-existing bug where the empty "내 파일" section
   header stayed visible with zero files (see myFilesBlock in app.js), and
   prevents the same bug in every new premium/subscription element added
   alongside it. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

button, input {
  font-family: inherit;
  -webkit-user-select: none;
  user-select: none;
}
input { -webkit-user-select: text; user-select: text; }

button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.screen {
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding:
    max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.screen[hidden] { display: none; }

/* ---------- Top bar (shared) ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-tape-sm {
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  background: var(--lime);
  border: 2px solid #000;
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-hard-sm);
}
.brand-title-sm {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
}
.tagline-sm {
  margin: -8px 0 0;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.55;
}
.device-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: center;
}
.icon-btn {
  background: var(--surface-raised);
  border: 2px solid #000;
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hard-sm);
  -webkit-touch-callout: none;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Buttons / fields (shared) ---------- */
.btn {
  border: 2px solid #000;
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  box-shadow: var(--shadow-hard);
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-touch-callout: none;
}
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-secondary { background: var(--surface-raised); color: var(--text); }
.btn-ghost { background: transparent; border: 2px dashed var(--border-strong); color: var(--text-dim); box-shadow: none; }
.btn-ghost:active { transform: none; }
.btn-danger { background: var(--coral); color: var(--coral-ink); }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.field input[type="text"], .field input[type="email"] {
  background: var(--window);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  width: 100%;
}
.field input[type="text"]:focus, .field input[type="email"]:focus { border-color: var(--lime); }
.field input[type="text"]::placeholder, .field input[type="email"]::placeholder { color: var(--text-faint); }

.field select {
  background: var(--window);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 22px) center, calc(100% - 16px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field select:focus { border-color: var(--lime); }

/* 라이브러리(홈) 화면 맨 위의 "구글 검색창처럼 단순한" 자연어 검색 입력 —
   탭 한 번으로 addFeedScreen의 전체 AI 검색으로 이어집니다 (app.js의
   runHomeSearch() 참고). podcastSearchEnabled가 꺼져 있으면 아예 숨겨집니다. */
.home-search-row { display: flex; gap: 8px; align-items: center; }
.home-search-row input {
  flex: 1;
  min-width: 0;
  background: var(--window);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
}
.home-search-row input:focus { border-color: var(--lime); }
.home-search-row input::placeholder { color: var(--text-faint); }

.setup-desc { font-size: 12.5px; line-height: 1.6; color: var(--text-faint); margin: 0; }
.error-text { color: var(--coral); font-size: 13px; font-weight: 700; margin: -4px 0 0; }
.status-msg { text-align: center; font-size: 13px; color: var(--text-dim); margin: 0; }

.settings-body { display: flex; flex-direction: column; gap: 22px; }
/* "AI로 팟캐스트 찾기" / 수동 RSS 입력 블록 — 컨트롤끼리는 좀 더 촘촘하게, 큰
   섹션 사이(설명 텍스트, 토글 버튼 등)는 .settings-body의 22px 간격을 그대로 씁니다. */
#aiSearchBlock, #manualAddBlock { display: flex; flex-direction: column; gap: 14px; }
.checkbox-field label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.checkbox-field input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--lime); }

/* ---------- Library screen ---------- */
.section-block { display: flex; flex-direction: column; gap: 11px; }
.section-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0;
}

.channel-list, .episode-list { display: flex; flex-direction: column; gap: 10px; }

.channel-card, .episode-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  width: 100%;
  min-height: 66px;
  box-shadow: var(--shadow-hard-sm);
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-touch-callout: none;
}
.channel-card:active, .episode-card:active { transform: translate(2px, 2px); box-shadow: none; }

.channel-art, .episode-art {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--reel);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}
.channel-art img, .episode-art img { width: 100%; height: 100%; object-fit: cover; }

.card-text { min-width: 0; flex: 1; }
.card-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  margin: 3px 0 0;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-hint {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 22px 8px;
}

/* browse (catalog) screen */
.browse-card { align-items: center; }
.badge {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 13px;
  border-radius: 999px;
  border: 2px solid #000;
  white-space: nowrap;
}
.badge-add { background: var(--lime); color: var(--lime-ink); box-shadow: var(--shadow-hard-sm); }
.badge-added { background: transparent; border-color: var(--border); color: var(--text-dim); font-weight: 500; }

/* ---------- Player screen ---------- */
#playerScreen { justify-content: space-between; }

.cassette {
  background: var(--shell);
  border: 3px solid #000;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 6px 6px 0 var(--coral);
  color: var(--shell-ink);
}

.cassette-window {
  position: relative;
  background: var(--window);
  border: 2px solid #000;
  border-radius: 14px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  overflow: hidden;
}

.reel {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--reel);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin 2.6s linear infinite;
  animation-play-state: paused;
}
.reel-hub { width: 20px; height: 20px; border-radius: 50%; background: var(--lime); border: 2px solid #000; }
.reel.playing { animation-play-state: running; }
.reel.rewinding { animation: spin-reverse 0.5s linear infinite; }
.reel.rewinding .reel-hub { background: var(--coral); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-reverse { to { transform: rotate(-360deg); } }

.tape-strip {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 42%;
  height: 5px;
  background: var(--border-strong);
  border-radius: 3px;
}

.cassette-label {
  margin-top: 14px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}
.album-art, .album-art-placeholder {
  width: 52px; height: 52px;
  border-radius: 10px;
  border: 2px solid #000;
  flex-shrink: 0;
  object-fit: cover;
}
.album-art-placeholder {
  background: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.track-info { min-width: 0; flex: 1; }
.track-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--shell-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-artist {
  margin: 3px 0 0;
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: #6b6580;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.progress-row { display: flex; align-items: center; gap: 10px; }
.time-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* ---------- 진행바 (탭·드래그로 위치 이동) ----------
   .progress-bar 는 손가락이 닿는 넓은 영역이고, 눈에 보이는 막대는 그 안의
   .progress-track 입니다. 채움·버퍼·구간 마커·손잡이가 모두 트랙 기준 절대
   위치라, 예전처럼 음수 top 으로 억지로 겹쳐 맞출 필요가 없습니다. */
.progress-bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  padding: 11px 0;          /* 얇은 막대 둘레로 넉넉한 터치 영역 */
  cursor: pointer;
  touch-action: none;       /* 드래그가 페이지 스크롤로 새지 않도록 */
  -webkit-tap-highlight-color: transparent;
}
.progress-bar:focus-visible { outline: none; }
.progress-bar:focus-visible .progress-track {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(211, 255, 77, 0.35);
}

.progress-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-raised);
  border: 2px solid var(--border);
}

/* 내려받아 둔 구간 — 멀리 건너뛴 뒤 왜 잠깐 기다리는지 눈에 보이게 해줍니다. */
.progress-buffered {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 3px;
  background: var(--border);   /* 채움(라임)보다 눈에 덜 띄게 — 정보이되 주인공은 아님 */
  pointer-events: none;
}

.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 3px;
  background: var(--lime);
  pointer-events: none;
  transition: width 0.12s linear;
}

/* 손잡이 — 지금 위치가 어디인지 보여주고, 잡아끌 수 있다는 신호가 됩니다. */
.progress-thumb {
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 6px;
  background: var(--lime);
  border: 2px solid var(--bg);
  box-shadow: var(--shadow-hard-sm);
  transform: translateY(-50%);
  pointer-events: none;
  transition: left 0.12s linear, width 0.12s ease, height 0.12s ease, margin-left 0.12s ease;
}

/* 끄는 동안에는 손가락을 1:1로 따라가야 하므로 애니메이션을 끕니다. */
.progress-bar.scrubbing .progress-fill,
.progress-bar.scrubbing .progress-thumb { transition: none; }
.progress-bar.scrubbing .progress-thumb {
  width: 24px;
  height: 24px;
  margin-left: -12px;
}
/* 끄는 동안 왼쪽 시간 표시를 강조해, 어디로 가는지 숫자로도 보여줍니다. */
.progress-row.scrubbing #posLabel { color: var(--lime); }

@media (prefers-reduced-motion: reduce) {
  .progress-fill, .progress-thumb { transition: none; }
}

.speed-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.speed-label { font-family: var(--font-display); font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; flex-shrink: 0; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip {
  background: var(--surface-raised);
  border: 2px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  min-height: 38px;
  -webkit-touch-callout: none;
}
.speed-row .chip { padding: 7px 12px; font-size: 12px; min-height: 34px; }
.chip.active { background: var(--lime); border-color: #000; color: var(--lime-ink); }

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.rewind-btn {
  position: relative;
  width: 148px;
  height: 96px;
  border-radius: var(--radius-lg);
  border: 3px solid #000;
  background: var(--surface-raised);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.rewind-btn:active, .rewind-btn.holding {
  transform: translate(4px, 4px);
  box-shadow: none;
  background: var(--coral);
  color: var(--coral-ink);
}
.rewind-icon { font-size: 30px; }
.rewind-step { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; color: var(--text-dim); }
.rewind-btn.holding .rewind-step { color: var(--coral-ink); }

.play-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 3px solid #000;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 23px;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
.play-btn:active { transform: translate(4px, 4px); box-shadow: none; }

@media (max-width: 380px) {
  .rewind-btn { width: 124px; }
}

/* ---------- A-B 구간 반복 (프리미엄) ---------- */
.ab-marker {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 20px;
  background: var(--coral);
  border-radius: 2px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ab-loop-row { margin: -6px 0 2px; }
.btn-ghost.active {
  border-style: solid;
  border-color: var(--coral);
  color: var(--coral);
}

/* 이전/다음 화 이동 + 수면 타이머를 한 줄에 — 좌우의 icon-btn은 고정 크기,
   가운데 수면 타이머 버튼이 남는 폭을 차지합니다. */
.episode-nav-row { display: flex; align-items: center; gap: 8px; }
.episode-nav-row .btn { flex: 1; min-width: 0; }
.episode-nav-row .icon-btn:disabled { opacity: 0.35; cursor: default; }
.episode-nav-row .icon-btn:disabled:active { transform: none; box-shadow: var(--shadow-hard-sm); }

/* 에피소드 목록 화면의 검색창 — .field 래퍼 없이 쓰는 입력창이라 스타일을
   home-search-row와 동일하게 직접 지정합니다. */
#episodeSearchInput {
  background: var(--window);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  width: 100%;
}
#episodeSearchInput:focus { border-color: var(--lime); }
#episodeSearchInput::placeholder { color: var(--text-faint); }

/* AI 단어·표현 설명 블록(플레이어 화면) — 다른 폼 블록과 톤을 맞춰 촘촘한
   세로 간격을 씁니다. */
#explainBlock { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 프리미엄 배지 (라이브러리 헤더) ---------- */
.premium-badge-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 2px solid var(--lime);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- 프리미엄 구독 화면 ---------- */
.premium-intro { display: flex; flex-direction: column; gap: 4px; }
.premium-benefits {
  margin: 4px 0 2px;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.7;
}
.premium-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  color: var(--lime);
  margin: 2px 0 0;
}
.premium-status-badge {
  display: inline-block;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  margin: 0 0 6px;
}
#premiumLoggedOut, #premiumLoggedIn { display: flex; flex-direction: column; gap: 14px; }
#premiumCodeBlock { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
/* [hidden] must win over the ID rules above (same pattern as .screen[hidden]
   elsewhere in this file) — otherwise toggling `.hidden = true` from app.js
   has no visible effect on these flex containers. */
#premiumLoggedOut[hidden], #premiumLoggedIn[hidden], #premiumCodeBlock[hidden] { display: none; }

/* ---------- 재생 중 미니 바 (재생 화면 밖에서만 보임) ----------
   재생 화면을 벗어나도 듣던 에피소드로 한 번에 돌아올 수 있게 화면 아래에
   고정합니다. .screen이 max-width 440px로 가운데 정렬되므로 이 바도 같은 폭에
   맞춰 가운데로 붙입니다. iOS 홈 인디케이터에 가리지 않도록 safe-area만큼
   아래 여백을 둡니다. */
.mini-player {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 40;
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--surface-raised);
  border-top: 2px solid var(--border-strong);
}
.mini-player[hidden] { display: none; }

.mini-open {
  flex: 1;
  min-width: 0;              /* 긴 제목이 바를 밀어내지 않도록 */
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mini-open:active { transform: translate(1px, 1px); }

.mini-art {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.mini-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mini-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* 제목이 길어도 한 줄로 자릅니다 — 바 높이가 들쭉날쭉해지지 않도록 */
.mini-title {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-channel {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 미니 바가 떠 있는 동안 화면 맨 아래 내용이 가려지지 않도록 자리를 비웁니다. */
body.has-mini .screen { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* ---------- 자막(대본) 패널 ----------
   재생 위치에 맞춰 현재 문장을 강조하고, 문장을 누르면 그 지점부터 다시
   들려줍니다. 화면을 다 차지하지 않도록 높이를 제한하고 안에서만 스크롤돼서,
   아래의 되감기·재생 버튼은 항상 손이 닿는 곳에 남습니다. */
.transcript-row { margin: -6px 0 2px; }

/* 켜져 있을 때는 라임 — 아래 자막 패널의 강조색과 같은 신호로 묶어줍니다.
   (구간 반복 버튼의 코랄은 "지금 구간에 갇혀 있다"는 경고 성격이라 여기엔
   어울리지 않습니다.) */
#transcriptToggleBtn.active {
  border-style: solid;
  border-color: var(--lime);
  color: var(--lime);
}

.transcript-panel {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 6px;
  max-height: 34vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;   /* 자막 끝에서 화면 전체가 딸려 스크롤되지 않도록 */
}
.transcript-panel[hidden] { display: none; }

.transcript-status {
  margin: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

.transcript-list { display: flex; flex-direction: column; gap: 2px; }

.transcript-line {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.transcript-line:hover { background: var(--surface-raised); }

/* 지금 재생 중인 문장 */
.transcript-line.active {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
  font-weight: 700;
}

/* 시간 정보가 없는 자막(HTML/평문)은 눌러도 이동할 수 없으니 손가락 모양을 뺍니다. */
.transcript-line.static { cursor: default; }
.transcript-line.static:hover { background: none; }

@media (prefers-reduced-motion: reduce) {
  .transcript-line { transition: none; }
}

/* =========================================================================
   법적 고지 관련 요소 (LEGAL_COMPLIANCE.md)
   제휴 부인 고지, 약관·방침 링크, 사업자 정보, 수집·이용 동의 체크박스.
   본문을 방해하지 않도록 작고 조용하게 두되, 읽을 수 있는 대비는 유지합니다.
   ========================================================================= */

.legal-note {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-faint);
  margin: 14px 0 0;
}

.legal-note a { color: var(--text-dim); text-decoration: underline; }

.legal-link {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: underline;
  padding: 9px 0;
}
.legal-link:hover { color: var(--lime); }

/* 사업자 정보 — 라벨/값 2열. 좁은 화면에서는 한 줄씩 쌓입니다. */
.business-info {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr;
  gap: 5px 12px;
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
}
.business-info dt { color: var(--text-faint); font-weight: 600; }
.business-info dd { color: var(--text-dim); margin: 0; overflow-wrap: anywhere; }

@media (max-width: 360px) {
  .business-info { grid-template-columns: 1fr; gap: 2px; }
  .business-info dd { margin-bottom: 6px; }
}

/* 수집·이용 동의 (개인정보보호법 제15조·제22조) */
.consent-block {
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  padding: 6px 0;
  cursor: pointer;
}
.consent-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 1px;
  accent-color: var(--lime);
}
.consent-row a { color: var(--lime); text-decoration: underline; }
.consent-block .legal-note { margin-top: 10px; }

/* 결제 화면 하단의 청약철회·사업자 정보 블록 */
.premium-legal-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 2px solid var(--border-strong);
}

/* Rewind Pro mobile controls */
.rewind-tools { margin:16px 0; padding:16px; border:1px solid var(--border, #454545); border-radius:16px; background:var(--bg-card, #22252a); }
.tools-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.pro-label { color:var(--coral, #ff947c); font-size:12px; font-weight:700; }
.rewind-tools .chip-row { display:grid; grid-template-columns:repeat(4,1fr); }
.rewind-tools .chip { min-height:44px; }
.repeat-options { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:14px 0; }
.repeat-options label { display:grid; gap:6px; font-size:12px; }
.repeat-options select { min-height:44px; background:#191c20; color:#fff; border:1px solid #555; border-radius:8px; padding:8px; font:inherit; }
.clip-actions { display:flex; gap:8px; }
.clip-actions button { flex:1; min-height:44px; }
#savedClipsPanel { margin-top:16px; }
#savedClipsPanel summary { cursor:pointer; padding:12px 0; font-weight:700; }
.saved-clip { display:flex; align-items:center; border-bottom:1px solid #444; gap:4px; }
.clip-title { min-width:0; flex:1; text-align:left; overflow-wrap:anywhere; font-size:12px; }
.saved-clip button { min-height:44px; }
.consent-line { display:flex; align-items:flex-start; gap:10px; margin:18px 0; font-size:13px; line-height:1.6; }
.consent-line input { flex:none; width:20px; height:20px; margin-top:2px; }
#openSavedClipsBtn { margin:8px 0 20px; }
/* Data notice stays readable on a phone and when opened without JavaScript. */
.data-notice { width: min(100% - 40px, 760px); margin: 36px auto 72px; line-height: 1.85; overflow-wrap: anywhere; }
.data-notice h1 { font-size: 1.75rem; margin: 24px 0; }
.data-notice h2 { font-size: 1.2rem; margin: 30px 0 12px; }
.data-notice dt { font-weight: 700; margin-top: 18px; }
.data-notice dd { margin: 6px 0 18px; }
.data-notice a { color: var(--accent, #c4b5fd); }

/* Share and install: keep both actions visible on narrow phones. */
.pwa-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.pwa-actions .btn { padding: 12px 8px; font-size: 14px; min-width: 0; }
.pwa-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; border: 2px solid var(--border-strong); border-radius: var(--radius-md); padding: 24px; background: var(--surface-raised); color: var(--text); }
.pwa-dialog::backdrop { background: rgba(0,0,0,.7); }
.pwa-dialog h2 { font-size: 20px; margin: 0 0 16px; }
.pwa-dialog p { line-height: 1.7; white-space: pre-line; }
.pwa-dialog .btn { margin-top: 12px; }
.pwa-dialog input { min-width: 0; }
.pwa-actions .btn:disabled { opacity: .65; cursor: default; }

/* Retro cassette library with restrained neon outlines. */
#libraryScreen {
  --home-mint: #d3ff4d;
  --home-violet: #ff8295;
  gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: var(--bg);
}
#libraryScreen .topbar { gap: 8px; margin-bottom: 4px; }
#libraryScreen .brand-row { gap: 9px; margin-right: auto; }
#libraryScreen .brand-title-sm { font-size: 19px; letter-spacing: -.05em; }
#libraryScreen .brand-tape-sm { width: 35px; height: 35px; padding: 6px; border: 2px solid #000; border-radius: 10px; color: #14110f; background: var(--shell); box-shadow: 3px 3px 0 #000; }
#libraryScreen .brand-tape-sm svg { width: 100%; height: 100%; }
.home-beta-badge { font: 600 8px/1 var(--font-mono); letter-spacing: .08em; color: var(--shell); padding: 7px 8px; border: 1px solid #d3ff4d80; border-radius: 6px; white-space: nowrap; }
#librarySettingsBtn { width: 44px; height: 44px; background: var(--surface-raised); border: 2px solid #000; box-shadow: 3px 3px 0 #000; font-size: 16px; }
.home-intro { padding: 14px 16px 16px; border: 3px solid #000; border-radius: 22px; background: var(--shell); box-shadow: 5px 5px 0 var(--coral); margin: 0 4px 5px 0; }
.home-eyebrow { margin: 0; color: #58535e; font: 500 9px/1.4 var(--font-mono); letter-spacing: .14em; }
.home-headline { margin: 0; font-size: clamp(22px, 5.8vw, 27px); line-height: 1.35; font-weight: 800; letter-spacing: -.045em; color: #14110f; text-wrap: balance; }
.home-subtitle { margin: 7px 0 0; font-size: 11px; line-height: 1.5; color: #625c67; letter-spacing: -.02em; }
#libraryScreen .pwa-actions { margin: 0; gap: 10px; }
#libraryScreen .pwa-actions .btn {
  position: relative; min-height: 46px; padding: 10px 8px; gap: 7px; border: 2px solid #000; border-radius: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: -.02em; line-height: 1.4; transition: background .18s, box-shadow .18s, transform .18s;
}
#shareAppBtn { color: var(--shell); background: var(--surface-raised); box-shadow: inset 0 0 0 1px #d3ff4db3, 3px 3px 0 #000; }
#installAppBtn { color: var(--shell); background: var(--surface-raised); box-shadow: inset 0 0 0 1px #ff8295c0, 3px 3px 0 #000; }
#libraryScreen .pwa-actions .btn::before { content: ''; width: 16px; height: 16px; flex: 0 0 16px; background: currentColor; mask: var(--action-icon) center/contain no-repeat; -webkit-mask: var(--action-icon) center/contain no-repeat; }
#shareAppBtn { --action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V3m-4 4 4-4 4 4M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/%3E%3C/svg%3E"); }
#installAppBtn { --action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='3'/%3E%3Cpath d='M9 11h6m-3-3v6m-1 5h2'/%3E%3C/svg%3E"); }
#libraryScreen .pwa-actions .btn:active { transform: scale(.98); }
#libraryScreen .pwa-actions .btn:disabled { opacity: .55; box-shadow: none; }
#libraryScreen .home-search-row { gap: 0; padding: 3px; border: 2px solid #000; border-radius: 12px; background: #19191f; box-shadow: inset 0 0 0 1px #555169, 3px 3px 0 #000; }
#libraryScreen .home-search-row:focus-within { box-shadow: inset 0 0 0 1px var(--home-mint), 3px 3px 0 #000; }
#libraryScreen .home-search-row input { padding: 11px 12px; border: 0; background: transparent; font: 500 12px/1.4 var(--font-body); }
#libraryScreen .home-search-row input::placeholder { color: #a5a3b4; }
#homeSearchBtn { border: 1px solid #000; background: var(--surface-raised); color: var(--shell); box-shadow: none; border-radius: 10px; }
#homeSearchBtn svg { width: 19px; height: 19px; }
#libraryScreen .section-block { gap: 9px; }
.home-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#libraryScreen .section-title { font: 700 14px/1.4 var(--font-body); color: var(--shell); letter-spacing: -.02em; text-transform: none; }
.home-saved-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 0 8px 10px; border: 0; background: transparent; color: #c6c2d5; font-size: 12px; font-weight: 600; cursor: pointer; }
.home-saved-btn::before { content: ''; width: 9px; height: 12px; border: 1.5px solid currentColor; border-radius: 2px 2px 0 0; }
#libraryScreen .channel-list { gap: 8px; }
#libraryScreen .channel-card { min-height: 70px; padding: 11px 12px; gap: 11px; border: 2px solid #000; border-radius: 14px; background: var(--shell); color: #14110f; box-shadow: 3px 3px 0 #000; }
#libraryScreen .channel-card::after { content: '›'; color: #5b526f; font-size: 23px; font-weight: 400; margin-left: 2px; }
#libraryScreen .channel-art { width: 42px; height: 42px; font-size: 22px; border: 2px solid #000; background: #fffefa; border-radius: 10px; }
#libraryScreen .channel-card:nth-child(2n) .channel-art { background: #fffefa; }
#libraryScreen .card-title { font-size: 13px; letter-spacing: -.01em; }
#libraryScreen .card-sub { font: 400 10px/1.5 var(--font-body); color: #686173; margin-top: 4px; font-family: var(--font-mono); }
#libraryScreen #browseCatalogBtn { min-height: 46px; padding: 11px; font-size: 12px; border: 2px solid #000; border-radius: 12px; background: var(--surface-raised); color: var(--shell); box-shadow: inset 0 0 0 1px #d3ff4d80, 3px 3px 0 #000; }
.home-add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#libraryScreen .home-add-actions .btn { min-height: 44px; padding: 9px 5px; font-size: 11px; border: 1px dashed #625c76; border-radius: 11px; background: transparent; color: #c6c2d5; box-shadow: none; }
.home-notice-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: #9896aa; font-size: 10px; margin-top: 1px; }
#libraryScreen .home-notice-row .legal-link { font-size: 10px; padding: 10px 0; text-underline-offset: 3px; }
#libraryScreen .legal-note { margin: 0; font-size: 10px; line-height: 1.65; color: #9896aa; }
#libraryScreen #pwaStatus { color: var(--home-mint); }
#libraryScreen #affiliationDisclaimer { border-top: 1px solid #ffffff0c; padding-top: 11px; }
@media (hover: hover) {
  #libraryScreen .pwa-actions .btn:hover:not(:disabled) { filter: brightness(1.12); }
  #libraryScreen .channel-card:hover { outline: 1px solid #d3ff4d; outline-offset: 1px; background: #fff9ea; }
  .home-saved-btn:hover { color: var(--shell); }
}
@media (max-width: 350px) {
  #libraryScreen { padding-left: 14px; padding-right: 14px; }
  .home-beta-badge { font-size: 7px; padding: 6px; }
}

.home-label-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed #aaa18a; }
.home-mini-tape { width: 58px; height: 25px; flex: 0 0 58px; }
#libraryScreen .pwa-actions .btn:active:not(:disabled), #libraryScreen #browseCatalogBtn:active { transform: translate(2px, 2px); }
#libraryScreen .home-search-row input:focus-visible { outline: 0; }

.resume-card { margin: 14px 0; padding: 16px; background: var(--bg-card, #22252a); border: 1px solid #b5d747; border-radius: 18px; }
.resume-card .card-title { overflow-wrap: anywhere; margin: 10px 0 6px; }
.resume-card .card-sub { margin-bottom: 12px; }
.home-account-links { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; margin:12px 0; }
.home-account-links .btn { min-height:44px; }

.home-account-bar {display:flex;align-items:center;justify-content:flex-end;gap:10px;margin:0 0 12px;}
.account-entry {min-height:44px;padding:8px 16px;border:1px solid #d3ff4d;border-radius:12px;background:#22222f;color:#f6f0e0;box-shadow:3px 3px 0 #050507;font-weight:800;}
.account-state {font-size:12px;color:#d3ff4d;}
.account-profile {margin:12px 0 18px;padding:20px;background:#f6f0e0;color:#17171c;border:2px solid #09090d;border-radius:22px;box-shadow:4px 4px 0 #d3ff4d;}
.profile-top {display:flex;align-items:center;gap:14px;border-bottom:1px dashed #a8a18e;padding-bottom:16px;}
.profile-avatar {display:grid;place-items:center;flex:0 0 56px;height:56px;background:#38364c;color:#d3ff4d;border:2px solid #111;border-radius:18px;font-size:26px;font-weight:900;}
.profile-eyebrow {margin:0 0 5px;font-weight:900;font-size:20px;}
.profile-status {margin:0;font-size:13px;color:#455328;}
.profile-details {margin:16px 0;}
.profile-details dt {font-size:12px;color:#62606a;margin-top:14px;}
.profile-details dd {margin:5px 0 0;font-weight:700;overflow-wrap:anywhere;}
.account-profile .legal-note {color:#62606a;margin-bottom:0;}
.account-entry:focus-visible {outline:2px solid #ff6687;outline-offset:4px;}

.account-entry {position:relative;display:grid;place-items:center;width:46px;height:46px;min-width:46px;padding:10px;}
.account-entry svg {width:24px;height:24px;}
.account-online-dot {position:absolute;top:5px;right:5px;width:8px;height:8px;border-radius:50%;background:#d3ff4d;border:1px solid #17171c;}
.profile-menu {margin:24px 0;}
.profile-menu-item {display:flex;align-items:center;gap:12px;width:100%;padding:15px 12px;margin-bottom:9px;border:1px solid #46415f;border-radius:14px;background:#22222c;color:#f6f0e0;text-align:left;text-decoration:none;font:inherit;cursor:pointer;}
.profile-menu-item>span:nth-child(2) {flex:1;min-width:0;}
.profile-menu-item strong,.profile-menu-item small {display:block;overflow-wrap:anywhere;}
.profile-menu-item strong {font-size:15px;}
.profile-menu-item small {color:#b7b3c8;font-size:12px;margin-top:5px;}
.profile-menu-icon {display:grid;place-items:center;width:34px;height:34px;flex-shrink:0;border:1px solid #d3ff4d;border-radius:10px;color:#d3ff4d;font-size:20px;}
.profile-menu-item:hover,.profile-menu-item:focus-visible {border-color:#d3ff4d;outline:1px solid #d3ff4d;outline-offset:2px;}
