@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@600;700&display=swap');

:root {
  --bg: #f9f6ef;
  --card: #ffffff;
  --quote-bg: #f2ece0;
  --text: #241f18;
  --sub: #6c6152;
  --accent: #9a5b13;
  --line: #e4dac8;
}

[data-theme="dark"] {
  --bg: #171411;
  --card: #201c17;
  --quote-bg: #29241d;
  --text: #efe8da;
  --sub: #a69a87;
  --accent: #e09f3e;
  --line: #362f26;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  line-height: 1.75;
  word-break: keep-all;
  -webkit-text-size-adjust: 100%;
}

.page-wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* 1. 상단 바 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}

.site-title {
  font-family: 'Noto Serif KR', serif;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.era-switch {
  display: inline-flex;
  align-items: center;
  background: var(--quote-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.era-tab {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--sub);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.era-tab:hover {
  color: var(--text);
}

.era-tab.active {
  background: var(--accent);
  color: #ffffff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.text-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.text-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.text-btn.logged-in {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.nav-era-link {
  text-decoration: none;
}

/* 2. 날짜 이동 바 */
.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.nav-arrow {
  background: none;
  border: none;
  color: var(--sub);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}

.nav-arrow:hover {
  color: var(--text);
}

.date-center {
  display: flex;
  align-items: baseline;
  gap: 8px;
  position: relative;
}

.date-display {
  background: none;
  border: none;
  font-family: 'Noto Serif KR', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.sub-link {
  background: none;
  border: none;
  color: var(--sub);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: inherit;
}

.dot {
  color: var(--sub);
  font-size: 0.8rem;
}

.sr-only-date {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* 3. 심플 카테고리 슬라이드 탭 */
.cat-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.cat-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cat-bar::-webkit-scrollbar {
  display: none;
}

.cat-scroll-btn {
  flex-shrink: 0;
  background: var(--bg);
  border: none;
  color: var(--sub);
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px 6px 8px;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.cat-scroll-btn:hover {
  color: var(--accent);
}

.cat-scroll-btn.hidden {
  display: none;
}

.cat-link {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 2px 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.cat-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* 3-1. 상단 오늘자 야사 제목 리스트 바로가기 */
.quick-title-box {
  background: var(--quote-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.quick-title-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: none;
  border: none;
  padding: 2px 0;
  font-family: 'Noto Serif KR', serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}

.quick-toggle-icon {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--sub);
  white-space: nowrap;
}

.quick-title-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.quick-title-items.collapsed {
  display: none;
}

.quick-title-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.quick-title-btn:hover {
  background: var(--card);
  color: var(--accent);
}

.quick-text {
  font-weight: 600;
  line-height: 1.42;
  word-break: keep-all;
}

.quick-sub {
  font-size: 0.75rem;
  color: var(--sub);
}

@keyframes cardFlash {
  0% { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
  100% { border-color: var(--line); box-shadow: none; }
}

.story-item.highlight-flash {
  animation: cardFlash 1.4s ease-out;
}

/* 4. 본문 이야기 카드 (책 페이지처럼 차분한 구성) */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.story-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 22px;
}

.story-meta {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.story-title {
  font-family: 'Noto Serif KR', serif;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 14px;
  color: var(--text);
}

.story-body {
  font-family: 'Gowun Batang', serif;
  text-align: justify;
  text-justify: inter-character;
  word-break: break-all;
  line-break: strict;
  overflow-wrap: break-word;
  letter-spacing: -0.01em;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-line;
  margin-bottom: 18px;
}

.sillok-quote {
  background: var(--quote-bg);
  text-align: justify;
  text-justify: inter-character;
  word-break: break-all;
  line-break: strict;
  overflow-wrap: break-word;
  letter-spacing: -0.01em;
  border-left: 3px solid var(--line);
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 0.84rem;
  color: var(--sub);
  line-height: 1.65;
}

.sillok-quote strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
  font-size: 0.78rem;
}

/* 심플 토스트 알림 */
.simple-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 460px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
  z-index: 900;
}

.simple-toast.show {
  display: block;
}

.toast-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast-inner button {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.quick-year {
  font-family: 'Noto Serif KR', serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent);
  min-width: 48px;
  white-space: nowrap;
}

.empty-state-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
}

.empty-state-msg {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state-sub {
  font-size: 0.86rem;
  color: var(--sub);
  margin-bottom: 18px;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-action-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.empty-action-btn.primary {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.empty-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 즐겨찾기 & 메모 액션 */
.story-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.story-meta-row .story-meta {
  margin-bottom: 0;
}

.story-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-pill {
  background: none;
  border: 1px solid var(--line);
  color: var(--sub);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fav-btn.active,
.memo-btn.has-memo {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--quote-bg);
  font-weight: 600;
}

.memo-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--quote-bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.memo-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

.memo-box-btns {
  display: flex;
  gap: 10px;
}

.memo-link-btn {
  background: none;
  border: none;
  color: var(--sub);
  font-size: 0.76rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.memo-link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.memo-link-btn.danger:hover {
  color: #dc2626;
}

.memo-box-text {
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
}

.memo-editor {
  margin-top: 14px;
  padding: 12px;
  background: var(--quote-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.memo-textarea {
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.memo-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.memo-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.memo-save-btn,
.memo-cancel-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.memo-save-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.memo-cancel-btn {
  background: none;
  color: var(--sub);
  border: 1px solid var(--line);
}

.story-illust {
  margin: 12px 0 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--quote-bg);
}

.story-illust img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.story-illust figcaption {
  padding: 6px 10px;
  font-size: 0.76rem;
  color: var(--sub);
  text-align: center;
  border-top: 1px solid var(--line);
}

.sillok-link-wrap {
  margin-top: 8px;
}

.sillok-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.sillok-link:hover {
  border-bottom-color: var(--accent);
}

@media (max-width: 480px) {
  .page-wrap {
    padding: 0 12px 48px;
  }
  .hide-on-mobile {
    display: none;
  }
  .top-bar {
    padding: 10px 0 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
  }
  .brand-group {
    display: contents;
  }
  .site-title {
    order: 1;
    font-size: 0.96rem;
  }
  .top-actions {
    order: 2;
  }
  .era-switch {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 3px;
  }
  .era-tab {
    font-size: 0.68rem;
    padding: 2px 6px;
  }
  .text-btn {
    padding: 4px 8px;
    font-size: 0.76rem;
  }
  .date-bar {
    padding: 8px 0;
  }
  .nav-arrow {
    font-size: 0.82rem;
    padding: 4px 4px;
    white-space: nowrap;
  }
  .date-center {
    gap: 5px;
  }
  .date-display {
    font-size: 1.15rem;
    white-space: nowrap;
  }
  .sub-link {
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .cat-bar-wrap {
    margin-bottom: 12px;
  }
  .cat-link {
    padding: 6px 2px 8px;
    font-size: 0.84rem;
  }
  .story-item {
    padding: 16px 14px;
  }
  .story-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .story-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 5px;
  }
  .action-pill {
    padding: 3px 8px;
    font-size: 0.74rem;
  }
  .story-title {
    font-size: 1.1rem;
  }
  .story-body {
    font-size: 0.95rem;
  }
}

.fallback-notice {
  background: var(--quote-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.84rem;
  color: var(--sub);
  line-height: 1.5;
}
.fallback-notice strong {
  color: var(--accent);
}


/* ===================================================
   오디오북 (Audiobook) 컴포넌트 스타일
   =================================================== */

.audio-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--quote-bg);
  font-weight: 600;
}

.audio-btn.active.playing {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  animation: audioPillPulse 1.8s infinite ease-in-out;
}

@keyframes audioPillPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.92; }
}

.story-item.is-audio-playing {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(158, 42, 43, 0.2), 0 8px 24px rgba(0, 0, 0, 0.08);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .story-item.is-audio-playing {
  box-shadow: 0 0 0 2px rgba(217, 95, 95, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.story-item.is-audio-paused {
  border-color: var(--sub);
  opacity: 0.92;
}

/* 상단 오디오북 재생 배너 */
.audiobook-banner {
  margin: 10px 0 16px;
}

.audiobook-banner-btn {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.audiobook-banner-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.audiobook-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.audiobook-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.audiobook-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.audiobook-banner-desc {
  font-size: 0.78rem;
  color: var(--sub);
  line-height: 1.3;
  margin-top: 2px;
}

.audiobook-banner-badge {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--quote-bg);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.audiobook-banner-btn:hover .audiobook-banner-badge {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* 하단 고정 오디오북 플레이어 바 */
body.has-audio-player .page-wrap {
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
}

.yasa-audiobook-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  display: flex;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.yasa-audiobook-player.hidden {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.yasa-audiobook-bar {
  pointer-events: auto;
  width: 100%;
  max-width: 660px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[data-theme="dark"] .yasa-audiobook-bar {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* 진행률 게이지 트랙 */
.audiobook-progress-track {
  width: 100%;
  height: 3px;
  background: var(--line);
  position: relative;
}

.audiobook-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s linear;
}

/* 바 본체: 2단 레이아웃 (1행: 제목 + 닫기, 2행: 자막 + 재생 컨트롤) */
.audiobook-bar-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.audiobook-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.audiobook-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

/* 좌측 재생 정보 (이퀄라이저 + 제목 + 카운트) */
.audiobook-now-playing {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

/* 이퀄라이저 막대 파동 */
.audiobook-eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.audiobook-eq span {
  display: block;
  width: 2.5px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.audiobook-eq.playing span:nth-child(1) { animation: eqWave 0.7s infinite ease-in-out; }
.audiobook-eq.playing span:nth-child(2) { animation: eqWave 0.5s infinite ease-in-out 0.15s; }
.audiobook-eq.playing span:nth-child(3) { animation: eqWave 0.8s infinite ease-in-out 0.3s; }
.audiobook-eq.playing span:nth-child(4) { animation: eqWave 0.6s infinite ease-in-out 0.1s; }

@keyframes eqWave {
  0%, 100% { height: 3px; }
  50% { height: 14px; }
}

.audiobook-headline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audiobook-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  flex-shrink: 0;
}

.audiobook-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audiobook-count {
  font-size: 0.72rem;
  color: var(--sub);
  flex-shrink: 0;
}

.audiobook-subtitle {
  font-size: 0.76rem;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  min-width: 0;
  flex: 1;
}

/* 컨트롤 버튼들 */
.audiobook-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.audio-btn-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}

.audio-btn-circle:hover {
  background: var(--quote-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.audio-btn-circle.play-pause {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.audio-btn-circle.play-pause:hover {
  transform: scale(1.05);
  background: var(--accent);
  color: #ffffff;
}

.audio-btn-speed {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
  transition: all 0.15s ease;
}

.audio-btn-speed:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.audio-btn-circle.audio-btn-voice {
  font-size: 0.95rem;
  line-height: 1;
}

.audio-btn-circle.audio-btn-voice.active {
  border-color: var(--accent);
  background: var(--quote-bg);
  color: var(--accent);
}

.audio-btn-close {
  background: none;
  border: none;
  color: var(--sub);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.audio-btn-close:hover {
  color: var(--accent);
}

/* 목소리 모달 배경 흐림 오버레이 */
.audiobook-voice-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10040;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.audiobook-voice-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* 낭독 목소리 선택 팝오버 */
.audiobook-voice-popover {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  margin: 0 auto;
  max-width: 380px;
  width: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), 0 2px 10px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10050;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  transform-origin: bottom center;
}

[data-theme="dark"] .audiobook-voice-popover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.4);
}

.audiobook-voice-popover.hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
}

.audiobook-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.audiobook-popover-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.audiobook-popover-close {
  background: none;
  border: none;
  color: var(--sub);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.audiobook-popover-close:hover {
  color: var(--accent);
}

.audiobook-popover-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.audiobook-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.audiobook-field-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sub);
}

.audiobook-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.audiobook-select:focus {
  border-color: var(--accent);
}

.audiobook-pitch-buttons {
  display: flex;
  gap: 6px;
}

.audiobook-chip-btn {
  flex: 1;
  padding: 7px 2px;
  font-size: 0.74rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--sub);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}

.audiobook-chip-btn.active {
  border-color: var(--accent);
  background: var(--quote-bg);
  color: var(--accent);
  font-weight: 700;
}

.audiobook-chip-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.audiobook-popover-footer {
  margin-top: 4px;
  padding-bottom: 2px;
}

.audiobook-test-voice-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--quote-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.audiobook-test-voice-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

.audiobook-test-voice-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .yasa-audiobook-player {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .audiobook-bar-body {
    padding: 8px 12px;
    gap: 6px;
  }
  .audiobook-title {
    font-size: 0.84rem;
  }
  .audiobook-subtitle {
    font-size: 0.72rem;
  }
  .audio-btn-circle {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }
  .audio-btn-circle.play-pause {
    width: 34px;
    height: 34px;
    font-size: 0.88rem;
  }
  .audio-btn-speed {
    min-width: 36px;
    padding: 3px 5px;
    font-size: 0.68rem;
  }
}


