:root {
  --primary-color: #1f2b2d;
  --accent-color: #3B7A57;
  --daisy-green: #3B7A57;
  --daisy-green-hover: #4E9A70;
  --daisy-green-dark: #255239;
  --daisy-green-soft: #F0F7F4;
  --daisy-green-line: #B7E4C7;
  --daisy-line: #e9ecef;
  --bg-color: #f5f6f8;
  --card-bg: #ffffff;
  --text-color: #181818;
  --muted-text: #4a4a4d;
  --sidebar-width: clamp(380px, 33.333vw, 640px);
}

* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* Top Navigation Header */
header {
  position: sticky;
  top: 0;
  width: 100%;
  background: linear-gradient(90deg, #0d5c3b 0%, #126d45 38%, #0b4d39 100%);
  color: #f1fff7;
  padding: 10px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 8px rgba(10, 63, 42, 0.25);
  z-index: 400;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Top-Left Hamburger Icon */
.menu-icon {
  position: absolute;
  left: 20px;
  font-size: 1.6rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.menu-icon:hover {
  color: var(--accent-color);
}

header h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #f1fff7;
}

/* Sliding Left Sidebar Pane - Naver Style */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background-color: #ffffff;
  box-shadow: 4px 0 24px rgba(0,0,0,0.14);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--daisy-line);
  visibility: hidden;
}

.sidebar.open {
  transform: translateX(0);
  visibility: visible;
}

.sidebar-top-card {
  background: linear-gradient(180deg, #f2fff7 0%, #ffffff 100%);
  border-bottom: 1px solid var(--daisy-line);
  padding: 18px 18px 16px;
}

.sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  color: #0b5c39;
  background: #eafaf1;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.home-btn:hover {
  background: var(--daisy-green);
  color: #ffffff;
  border-color: var(--daisy-green);
  box-shadow: 0 4px 10px rgba(59, 122, 87, 0.25);
}

.close-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
}

.close-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.sidebar-cover-wrap {
  width: 110px;
  height: 110px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 14px auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  display: block;
}

.sidebar-cover {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  display: block;
}

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sidebar-meta h3 {
  margin: 4px 0 0 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.sidebar-author {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.sidebar-chapter-section {
  padding: 16px 14px 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-chapter-heading {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 0 4px 2px;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chapter-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.90rem;
  line-height: 1.4;
  background: #fafbfd;
  border: 1px solid var(--daisy-line);
  transition: all 0.15s ease;
  gap: 10px;
}

.chapter-list li a:hover {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #008f3d;
  transform: translateX(3px);
}

.chapter-list li a.active-chapter {
  background-color: #eafaf1;
  border-color: #a3e6be;
  color: #008f3d;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(3, 199, 90, 0.12);
}

.chapter-list li a .ch-title-label {
  flex: 1;
  min-width: 0;
  font-size: 0.90rem;
  font-weight: 700;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-list li a:hover .ch-title-label {
  color: #008f3d;
}

.chapter-list li a.active-chapter .ch-title-label {
  color: #008f3d;
  font-weight: 800;
}

.chapter-list li a .ch-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
  color: #64748b;
  flex-shrink: 0;
  margin-left: 8px;
}

.chapter-list li a.active-chapter .ch-pill {
  background: var(--daisy-green);
  color: #ffffff;
}

/* Dark Overlay behind Sidebar */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 900;
}

.overlay.active {
  display: block;
}

/* Main Reader Container Card */
.reader-card {
  max-width: 1100px;
  width: 92%;
  background: var(--card-bg);
  margin: 16px auto 20px auto;
  padding: 22px 42px 35px;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(24, 32, 36, 0.08);
  border: 1px solid var(--daisy-line);
}

#chapter-title {
  margin-top: 0;
  font-size: 1.65rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--daisy-line);
  padding-bottom: 10px;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.chapter-image-wrap {
  margin: 0 auto 16px auto;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  background: #f6f6f6;
  display: block;
  position: relative;
}

.chapter-image {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  margin: 0 auto;
}

/* Paragraph and Word Styling */
.paragraph {
  line-height: 1.88;
  font-size: 1.2rem;
  margin-bottom: 24px;
  letter-spacing: -0.005em;
}

.sentence-wrap {
  display: inline;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Seamless Continuous Sentence Highlight when Grammar is Active */
.sentence-wrap.popover-highlight-sentence {
  background-color: #e0f2fe; /* Continuous soft blue tint with ZERO gaps */
  color: #0369a1;
  padding: 3px 6px;
  border-radius: 6px;
}

.word-span {
  display: inline-block;
  padding: 0 1px;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.1s ease, color 0.1s ease;
}

/* Active Highlight Style when Audio Plays */
.word-span.active {
  background-color: #dff9e8;
  color: #0d6b3f;
  font-weight: 700;
}

/* Word Highlight when Word or Grammar Popover is Active */
.word-span.popover-highlight-word {
  background-color: #fef08a !important; /* Soft yellow highlight */
  color: #713f12 !important;
  font-weight: 700;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.45);
}

.error-msg {
  color: #c0392b;
  font-weight: bold;
}

/* Bottom Footer for Lexile (Left) & Source Attribution (Right) */
.reader-footer {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid var(--daisy-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.lexile-box {
  display: inline-flex;
  align-items: center;
  background: #eafaf1;
  border: 1px solid #a3e6be;
  color: #0b4d39;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(11, 77, 57, 0.05);
}

.source-credit {
  margin: 0;
  padding: 0;
  border: none;
  color: #94a3b8;
  font-size: 0.73rem;
  text-align: right;
  line-height: 1.4;
  word-break: break-all;
}

.source-credit .source-label {
  font-weight: 500;
  color: #94a3b8;
  margin-right: 4px;
}

.source-credit a.source-link {
  color: #64748b;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.source-credit a.source-link:hover {
  color: var(--accent-color);
}

/* Screen Fixed Left and Right Navigation Arrows */
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--primary-color);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: background-color 0.2s, transform 0.2s;
  z-index: 500;
  text-decoration: none;
}

.nav-arrow:hover {
  background-color: var(--accent-color);
  transform: translateY(-50%) scale(1.1);
}

.arrow-left {
  left: 20px;
}

.arrow-right {
  right: 20px;
}

/* Naver Dictionary & Grammar Hover Popover Window */
/* =========================================================
   Daisy Tutor Chatbot-Style Word & Grammar Popover
   Theme: Daisy Green (#3B7A57 / #255239) & Conversational UI
   ========================================================= */
.dict-popover {
  position: absolute;
  display: none;
  background: #ffffff;
  color: var(--text-color, #1e293b);
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 0;
  width: 380px;
  min-width: 320px;
  min-height: 220px;
  max-width: 96vw;
  max-height: 85vh;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 2500;
  font-size: 0.88rem;
  pointer-events: auto;
  overflow: hidden;
  flex-direction: column;
  resize: both;
  transition: width 0.15s ease, max-width 0.15s ease;
}

.dict-popover.tab-word {
  width: 380px;
  max-width: 96vw;
}

.dict-popover.tab-grammar {
  width: 540px;
  max-width: min(680px, 96vw);
}

/* Invisible hover bridge to bridge cursor gap */
.dict-popover::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 0;
  width: 100%;
  height: 14px;
}

.dict-popover.placement-above::before {
  top: auto;
  bottom: -14px;
}

/* Popover Header */
.dict-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(135deg, #3B7A57 0%, #255239 100%);
  color: #ffffff;
  flex-shrink: 0;
  gap: 8px;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.popover-header-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.popover-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.popover-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.popover-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popover-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.popover-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.popover-badge {
  background: #f59e0b;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 9999px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.popover-subtitle {
  font-size: 10px;
  color: #d1fae5;
  margin: 1px 0 0 0;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.popover-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.popover-tab-btn {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #e2e8f0;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.popover-tab-btn.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #1b4332;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.popover-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.dict-popover .popover-close-btn {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s;
}

.dict-popover .popover-close-btn:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.6);
}

.dict-popover .popover-pin-btn {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.dict-popover .popover-pin-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
  opacity: 1;
}

.dict-popover .popover-pin-btn.pinned {
  background: #f59e0b;
  color: #ffffff;
  opacity: 1;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  transform: rotate(-15deg);
}

.dict-popover.is-pinned {
  border-color: #f59e0b;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25), 0 0 0 1.5px rgba(245, 158, 11, 0.4);
}

.dict-popover .popover-size-btn {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dict-popover .popover-size-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
}

.popover-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 3px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  user-select: none;
  pointer-events: auto;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
}

.popover-resize-handle:hover {
  opacity: 1;
  color: #3B7A57;
}

/* Messages Scrollable Area */
.popover-chat-messages {
  flex: 1 1 auto;
  padding: 10px 12px;
  overflow-y: auto;
  max-height: 310px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #f8fafc;
  scroll-behavior: smooth;
}

/* Conversation Bubble */
.popover-msg {
  display: flex;
  flex-direction: column;
  max-width: 94%;
  animation: popoverFadeIn 0.2s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-msg.bot {
  align-self: flex-start;
}

.popover-msg.user {
  align-self: flex-end;
}

.popover-msg-bubble {
  padding: 8px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
}

.popover-msg.bot .popover-msg-bubble {
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px 12px 12px 4px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.popover-msg.user .popover-msg-bubble {
  background: #3B7A57;
  color: #ffffff;
  border-radius: 12px 12px 4px 12px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(59, 122, 87, 0.22);
}

.popover-msg.bot .popover-msg-bubble p {
  margin: 0 0 6px 0;
  line-height: 1.45;
}

.popover-msg.bot .popover-msg-bubble p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator in Popover */
.popover-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}

.popover-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: popoverBlink 1.4s infinite ease-in-out both;
}

.popover-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.popover-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.popover-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes popoverBlink {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #3B7A57; }
}

/* Panels inside Initial Bot Bubble */
.popover-panel {
  display: block;
}

.popover-panel.hidden {
  display: none !important;
}

/* Word Panel */
.popover-word-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.popover-word-head h4 {
  margin: 0;
  color: var(--primary-color, #0b4d39);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.popover-word-head a.naver-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background-color: #03c75a;
  color: #ffffff;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.popover-word-head a.naver-link:hover {
  background-color: #029b46;
}

#popover-meaning {
  margin: 0;
  color: #334155;
  font-size: 0.88rem;
  line-height: 1.48;
}

/* Grammar Panel */
.grammar-sentence {
  font-size: 0.81rem;
  color: #475569;
  background: #f8fafc;
  border-left: 3px solid #3B7A57;
  padding: 5px 8px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 6px;
  line-height: 1.4;
}

.grammar-translation {
  font-size: 0.84rem;
  color: #0f172a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.42;
}

.grammar-point-item {
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px dashed #e2e8f0;
}
.grammar-point-item:last-child {
  border-bottom: none;
  margin-bottom: 3px;
}

.grammar-point-pattern {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1e293b;
  margin-bottom: 2px;
}

.grammar-point-desc {
  font-size: 0.80rem;
  color: #475569;
  line-height: 1.42;
}

.grammar-vocab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.grammar-vocab-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.74rem;
  color: #334155;
}
.grammar-vocab-tag b {
  color: #0b4d39;
}

/* Quick Prompt Suggestions Container */
.popover-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px 6px 12px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.popover-prompt-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.popover-prompt-pill:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0b4d39;
  transform: translateY(-1px);
}

.popover-prompt-pill:active {
  transform: translateY(0);
}

/* Popover Chat Input Footer */
.popover-chat-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.popover-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #0f172a;
  outline: none;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.popover-chat-input:focus {
  border-color: #3B7A57;
  box-shadow: 0 0 0 2px rgba(59, 122, 87, 0.15);
}

.popover-chat-btn-send {
  background: #3B7A57;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.popover-chat-btn-send:hover {
  background: #255239;
  transform: scale(1.05);
}

.popover-chat-btn-send:active {
  transform: scale(0.96);
}

.popover-chat-btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Audio Bar Chatbot Slot (Zero Overlap with Player) */
.audio-chatbot-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 2px;
}

.audio-chatbot-slot .daisy-chat-launcher {
  position: static !important;
  bottom: auto !important;
  right: auto !important;
  margin: 0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18) !important;
  padding: 3px 10px !important;
  height: 30px !important;
  border-radius: 9999px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

.audio-chatbot-slot .daisy-launcher-icon {
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  padding: 1px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
  overflow: hidden !important;
}

.audio-chatbot-slot .daisy-launcher-icon img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

/* 4-Mode Reader Tab Navigation */
.reader-mode-tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.reader-tab-bar {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  border: 1px solid #e2e8f0;
}
.reader-mode-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.reader-mode-tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}
.reader-mode-tab.active {
  background: #ffffff;
  color: var(--daisy-green-dark, #255239);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
body.dark-mode .reader-tab-bar {
  background: #0f172a;
  border-color: #334155;
}
body.dark-mode .reader-mode-tab {
  color: #94a3b8;
}
body.dark-mode .reader-mode-tab.active {
  background: #1e293b;
  color: var(--daisy-green-hover, #4E9A70);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Write Panel Styling */
.write-panel {
  padding: 6px 0 20px;
}
.write-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--daisy-line);
}
.write-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.write-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.5;
}
.write-topic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--daisy-green-dark);
  background: var(--daisy-green-soft);
  border: 1px solid var(--daisy-green-line);
  padding: 4px 14px;
  border-radius: 999px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ══════════════════════════════════════════════════════════════
   3-Stage Scaffolding Writing Ladder (단계별 글쓰기 사다리)
   ══════════════════════════════════════════════════════════════ */
.write-ladder-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.ladder-step-btn {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  position: relative;
}
.ladder-step-btn:hover {
  border-color: #86efac;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}
.ladder-step-btn.active {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: var(--daisy-green);
  box-shadow: 0 6px 20px rgba(59, 122, 87, 0.16);
  transform: translateY(-2px);
}
body.dark-mode .ladder-step-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-mode .ladder-step-btn.active {
  background: linear-gradient(135deg, #14532d 0%, #064e3b 100%);
  border-color: #34d399;
}
.ladder-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--daisy-green-dark);
  background: #dcfce7;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
body.dark-mode .ladder-badge {
  background: #065f46;
  color: #a7f3d0;
}
.ladder-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 3px;
}
body.dark-mode .ladder-title {
  color: #f8fafc;
}
.ladder-sub {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}
body.dark-mode .ladder-sub {
  color: #94a3b8;
}

/* Stage Container & Stage Banner */
.write-stage-container {
  animation: fadeInStage 0.25s ease-out;
  margin-bottom: 20px;
}
@keyframes fadeInStage {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.stage-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-left: 5px solid var(--daisy-green);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 20px;
}
body.dark-mode .stage-banner {
  background: #0f172a;
  border-color: #334155;
  border-left-color: #34d399;
}
.stage-banner-icon {
  font-size: 1.9rem;
}
.stage-banner-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
}
body.dark-mode .stage-banner-title {
  color: #f1f5f9;
}
.stage-banner-desc {
  font-size: 0.86rem;
  color: #64748b;
  margin: 0;
}
body.dark-mode .stage-banner-desc {
  color: #94a3b8;
}

/* Stage 1: Builder Grid & Cards */
.stage1-builder-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.builder-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s;
}
body.dark-mode .builder-card {
  background: #1e293b;
  border-color: #334155;
}
.builder-card:focus-within {
  border-color: var(--daisy-green);
}
.builder-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.builder-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--daisy-green);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.builder-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}
body.dark-mode .builder-card-title {
  color: #f1f5f9;
}
.builder-card-sub {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}
body.dark-mode .builder-card-sub {
  color: #94a3b8;
}
.builder-sentence-template {
  font-size: 1rem;
  line-height: 1.8;
  color: #334155;
}
body.dark-mode .builder-sentence-template {
  color: #cbd5e1;
}
.builder-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.builder-select, .builder-select-inline {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}
.builder-select:focus, .builder-select-inline:focus {
  border-color: var(--daisy-green);
  box-shadow: 0 0 0 3px rgba(59, 122, 87, 0.15);
  background: #ffffff;
}
body.dark-mode .builder-select, body.dark-mode .builder-select-inline {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}
.builder-input-custom {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.95rem;
  color: #0f172a;
  outline: none;
  transition: all 0.2s;
}
body.dark-mode .builder-input-custom {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}
.builder-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.builder-chip {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.18s ease;
}
.builder-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}
.builder-chip.active {
  background: #dcfce7;
  border-color: var(--daisy-green);
  color: #14532d;
  box-shadow: 0 2px 6px rgba(59, 122, 87, 0.15);
}
body.dark-mode .builder-chip {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}
body.dark-mode .builder-chip.active {
  background: #065f46;
  border-color: #34d399;
  color: #ecfdf5;
}

/* Scene Options */
.builder-scene-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.builder-scene-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}
.builder-scene-btn:hover {
  border-color: #86efac;
  background: #f0fdf4;
  transform: translateY(-1px);
}
.builder-scene-btn.active {
  background: #f0fdf4;
  border-color: var(--daisy-green);
  color: #14532d;
  box-shadow: 0 2px 8px rgba(59, 122, 87, 0.12);
}
body.dark-mode .builder-scene-btn {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
body.dark-mode .builder-scene-btn.active {
  background: #064e3b;
  border-color: #34d399;
  color: #f0fdf4;
}
.scene-trans {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}
body.dark-mode .scene-trans {
  color: #94a3b8;
}

/* Stage 1 Live Preview */
.stage1-preview-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #fde68a;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.08);
  margin-top: 10px;
}
body.dark-mode .stage1-preview-card {
  background: linear-gradient(135deg, #2d2611 0%, #1f1b0a 100%);
  border-color: #78350f;
}
.stage1-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.preview-badge {
  font-size: 0.92rem;
  font-weight: 800;
  color: #92400e;
}
body.dark-mode .preview-badge {
  color: #fde68a;
}
.preview-stats {
  font-size: 0.82rem;
  font-weight: 700;
  color: #b45309;
}
body.dark-mode .preview-stats {
  color: #fcd34d;
}
.stage1-assembled-box {
  background: #ffffff;
  border: 1px solid #fef08a;
  border-radius: 12px;
  padding: 16px;
  font-size: 1.08rem;
  line-height: 1.75;
  color: #1e293b;
  font-family: inherit;
  min-height: 70px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}
body.dark-mode .stage1-assembled-box {
  background: #0f172a;
  border-color: #451a03;
  color: #f8fafc;
}
.stage1-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-stage-transfer {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-stage-transfer:hover {
  border-color: var(--daisy-green);
  color: var(--daisy-green-dark);
  background: #f0fdf4;
  transform: translateY(-1px);
}
body.dark-mode .btn-stage-transfer {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

/* Stage 2: Starters Grid */
.starters-section {
  margin-bottom: 20px;
}
.starters-section-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 12px;
}
body.dark-mode .starters-section-title {
  color: #cbd5e1;
}
.starters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.starter-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.starter-card:hover {
  border-color: var(--daisy-green);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(59, 122, 87, 0.12);
  background: #f0fdf4;
}
body.dark-mode .starter-card {
  background: #1e293b;
  border-color: #334155;
}
body.dark-mode .starter-card:hover {
  background: #064e3b;
  border-color: #34d399;
}
.starter-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 6px;
  width: fit-content;
}
body.dark-mode .starter-tag {
  background: #065f46;
  color: #a7f3d0;
}
.starter-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}
body.dark-mode .starter-text {
  color: #f1f5f9;
}
.starter-kor {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
}
body.dark-mode .starter-kor {
  color: #94a3b8;
}

/* Connectors Helper */
.connectors-section {
  background: #fffbeb;
  border: 1.5px solid #fef08a;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
body.dark-mode .connectors-section {
  background: #1c1917;
  border-color: #451a03;
}
.connectors-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 8px;
}
body.dark-mode .connectors-title {
  color: #fde68a;
}
.connectors-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.connector-chip {
  background: #ffffff;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #78350f;
  cursor: pointer;
  transition: all 0.15s ease;
}
.connector-chip:hover {
  background: #fef08a;
  transform: translateY(-1px);
}
body.dark-mode .connector-chip {
  background: #292524;
  border-color: #78350f;
  color: #fcd34d;
}

/* Sentence Goal Card */
.sentence-goal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
}
body.dark-mode .sentence-goal-card {
  background: #0f172a;
  border-color: #334155;
}
.goal-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: #334155;
}
body.dark-mode .goal-info {
  color: #cbd5e1;
}
.goal-icon {
  font-size: 1.2rem;
}
.goal-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--daisy-green-dark);
}

/* Stage 3: Checklist */
.checklist-card {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
body.dark-mode .checklist-card {
  background: #064e3b;
  border-color: #047857;
}
.checklist-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #14532d;
  margin-bottom: 12px;
}
body.dark-mode .checklist-title {
  color: #ecfdf5;
}
.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: #166534;
  cursor: pointer;
  user-select: none;
}
body.dark-mode .checklist-item {
  color: #d1fae5;
}
.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--daisy-green);
  cursor: pointer;
}

/* Toolbar Counter Group */
.write-counter-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.write-sentence-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--daisy-green-dark);
  background: var(--daisy-green-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
body.dark-mode .write-sentence-counter {
  background: #065f46;
  color: #a7f3d0;
}

@media (max-width: 640px) {
  .write-ladder-nav {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .ladder-step-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    text-align: left;
  }
  .ladder-badge {
    margin-bottom: 0;
  }
  .stage1-actions {
    flex-direction: column;
  }
  .btn-stage-transfer, .stage1-actions .btn-write-submit {
    width: 100%;
    justify-content: center;
  }
}

.write-editor-wrap {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.write-editor-wrap:focus-within {
  border-color: var(--daisy-green);
  box-shadow: 0 0 0 4px rgba(59, 122, 87, 0.15);
}
body.dark-mode .write-editor-wrap {
  background: #1e293b;
  border-color: #334155;
}
.write-textarea {
  width: 100%;
  min-height: 200px;
  max-height: 500px;
  resize: vertical;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1e293b;
  background: transparent;
  box-sizing: border-box;
  padding: 4px;
}
body.dark-mode .write-textarea {
  color: #f1f5f9;
}
.write-textarea::placeholder {
  color: #94a3b8;
  font-size: 0.98rem;
}
.write-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 10px;
}
body.dark-mode .write-toolbar {
  border-top-color: #334155;
}
.write-counter {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}
.write-counter.warning {
  color: #ef4444;
}
.write-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-write-clear {
  background: #f1f5f9;
  color: #64748b;
  border: none;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-write-clear:hover {
  background: #fee2e2;
  color: #ef4444;
}
body.dark-mode .btn-write-clear {
  background: #334155;
  color: #cbd5e1;
}
.btn-write-submit {
  background: var(--daisy-green);
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(59, 122, 87, 0.3);
  transition: all 0.2s ease;
}
.btn-write-submit:hover:not(:disabled) {
  background: var(--daisy-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 122, 87, 0.4);
}
.btn-write-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.write-feedback-container {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.write-feedback-card {
  background: #fafbfd;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}
body.dark-mode .write-feedback-card {
  background: #1e293b;
  border-color: #334155;
}
.write-feedback-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
body.dark-mode .write-feedback-card-title {
  color: #f1f5f9;
}
.write-overall-text {
  font-size: 14.5px;
  line-height: 1.7;
  color: #334155;
  margin: 0;
}
body.dark-mode .write-overall-text {
  color: #cbd5e1;
}
.write-corrected-box {
  background: var(--daisy-green-soft);
  border: 1.5px solid var(--daisy-green-line);
  border-radius: 14px;
  padding: 18px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--daisy-green-dark);
  white-space: pre-wrap;
}
body.dark-mode .write-corrected-box {
  background: rgba(59, 122, 87, 0.15);
  border-color: rgba(59, 122, 87, 0.35);
  color: #d1fae5;
}
.write-correction-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
body.dark-mode .write-correction-item {
  background: #0f172a;
  border-color: #334155;
}
.write-correction-item:last-child {
  margin-bottom: 0;
}
.write-corr-tag {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 8px;
}
.write-corr-tag.grammar {
  background: #fee2e2;
  color: #dc2626;
}
.write-corr-tag.spelling {
  background: #fef3c7;
  color: #b45309;
}
.write-corr-tag.vocab {
  background: #e0f2fe;
  color: #0369a1;
}
.write-corr-tag.punct {
  background: #f3e8ff;
  color: #7e22ce;
}
.write-diff-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 14.5px;
}
.write-diff-orig {
  color: #dc2626;
  background: #fef2f2;
  padding: 7px 12px;
  border-radius: 8px;
  text-decoration: line-through;
}
body.dark-mode .write-diff-orig {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.write-diff-fixed {
  color: #166534;
  background: #f0fdf4;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 700;
}
body.dark-mode .write-diff-fixed {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.write-corr-reason {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.6;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}
body.dark-mode .write-corr-reason {
  color: #94a3b8;
  border-top-color: #334155;
}
.btn-copy-corrected {
  background: #ffffff;
  border: 1px solid var(--daisy-green-line);
  color: var(--daisy-green-dark);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-copy-corrected:hover {
  background: var(--daisy-green-soft);
}

/* Quiz Panel Styling */
.quiz-panel {
  padding: 6px 0 20px;
}
.quiz-header {
  text-align: center;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--daisy-line);
}
.quiz-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.quiz-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0 0 16px;
}
.quiz-progress-bar-wrap {
  width: 100%;
  max-width: 380px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  margin: 0 auto 10px;
  overflow: hidden;
}
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #03c75a, #10b981);
  transition: width 0.35s ease;
  border-radius: 999px;
}
.quiz-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
}
.quiz-score-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 10px;
  border-radius: 999px;
}
.quiz-card {
  background: #fafbfd;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}
body.dark-mode .quiz-card {
  background: #1e293b;
  border-color: #334155;
}
.quiz-q-number {
  font-size: 0.78rem;
  font-weight: 800;
  color: #008f3d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quiz-q-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 16px;
  line-height: 1.45;
}
.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  font-family: inherit;
  line-height: 1.4;
}
body.dark-mode .quiz-option-btn {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
.quiz-option-btn:hover:not(.correct) {
  border-color: var(--daisy-green);
  background: var(--daisy-green-soft);
  color: var(--daisy-green-dark);
  transform: translateX(2px);
}
body.dark-mode .quiz-option-btn:hover:not(.correct) {
  background: #064e3b;
  color: #fff;
}
.quiz-option-letter {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.2s;
}
body.dark-mode .quiz-option-letter {
  background: #334155;
  color: #cbd5e1;
}
.quiz-option-btn.correct {
  border-color: var(--daisy-green) !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 1px var(--daisy-green);
  cursor: default;
}
body.dark-mode .quiz-option-btn.correct {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
.quiz-option-btn.correct .quiz-option-letter {
  background: var(--daisy-green);
  color: #ffffff;
}
.quiz-option-btn.wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
  animation: quizShake 0.3s ease;
}
body.dark-mode .quiz-option-btn.wrong {
  background: #450a0a !important;
  color: #fca5a5 !important;
}
.quiz-option-btn.wrong .quiz-option-letter {
  background: #ef4444;
  color: #ffffff;
}
@keyframes quizShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.quiz-feedback-box {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeIn 0.25s ease;
}
.quiz-feedback-box.correct {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
body.dark-mode .quiz-feedback-box.correct {
  background: #064e3b;
  border-color: #059669;
  color: #d1fae5;
}
.quiz-feedback-box.wrong {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
body.dark-mode .quiz-feedback-box.wrong {
  background: #450a0a;
  border-color: #dc2626;
  color: #fee2e2;
}
.quiz-summary-card {
  background: #fafbfd;
  border: 2px solid var(--daisy-green);
  border-radius: 20px;
  padding: 30px 24px;
  text-align: center;
  margin-top: 24px;
  box-shadow: 0 10px 25px -5px rgba(59, 122, 87, 0.15);
}
body.dark-mode .quiz-summary-card {
  background: #1e293b;
}
.btn-retake-quiz {
  margin-top: 16px;
  background: var(--daisy-green) !important;
  color: #ffffff !important;
  border: none;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(59, 122, 87, 0.35);
  transition: all 0.2s ease;
}
.btn-retake-quiz:hover {
  background: var(--daisy-green-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(59, 122, 87, 0.45);
}

/* Fixed Bottom Audio Bar */
.audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, #0d5c3b 0%, #126d45 38%, #0b4d39 100%);
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(10, 63, 42, 0.25);
  z-index: 2000;
  border-top: 1px solid rgba(255,255,255,0.08);
  pointer-events: auto;
}

.audio-controls {
  width: 92%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: nowrap;
}

audio {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  pointer-events: auto;
  accent-color: #7ef0a7;
  filter: brightness(1.06) saturate(1.25);
}

.audio-toggles-row {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.hover-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f3f5f6;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  transition: background 0.2s ease;
  border: 1px solid rgba(255,255,255,0.15);
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

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

.hover-toggle input:checked + .toggle-switch {
  background: #7ef0a7;
}

.hover-toggle input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.audio-status {
  color: #f3f5f6;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.5;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  header {
    padding: 12px 16px;
  }
  #book-title {
    font-size: 1.15rem;
    max-width: calc(100vw - 80px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar {
    width: min(400px, 88vw);
  }
  .arrow-left {
    left: 6px;
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    background-color: rgba(11, 77, 57, 0.85);
    backdrop-filter: blur(4px);
  }
  .arrow-right {
    right: 6px;
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    background-color: rgba(11, 77, 57, 0.85);
    backdrop-filter: blur(4px);
  }
  .reader-card {
    width: 95%;
    padding: 22px 16px 110px;
    margin: 16px auto 30px;
    border-radius: 18px;
  }
  #chapter-title {
    font-size: 1.35rem;
    margin-bottom: 16px;
  }
  .reader-card p {
    font-size: 1.1rem;
    line-height: 1.8;
  }
  .word-span {
    -webkit-tap-highlight-color: rgba(3, 199, 90, 0.15);
  }
  .dict-popover {
    width: min(350px, 94vw);
    max-width: calc(100vw - 20px);
    padding: 12px 14px;
    font-size: 0.88rem;
  }
  .audio-bar {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 12px));
    box-shadow: 0 -4px 18px rgba(10, 63, 42, 0.35);
  }
  .audio-controls {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  audio {
    width: 100%;
    height: 48px;
    min-height: 48px;
    border-radius: 26px;
  }
  .audio-toggles-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    flex-wrap: wrap;
  }
  .audio-chatbot-slot {
    margin-left: 0;
    margin-top: 2px;
  }
  .hover-toggle {
    font-size: 0.95rem;
    font-weight: 700;
    gap: 8px;
    color: #f8fafc;
  }
  .toggle-switch {
    width: 38px;
    height: 22px;
  }
  .toggle-switch::after {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
  }
  .hover-toggle input:checked + .toggle-switch::after {
    transform: translateX(16px);
  }
}

@media (max-width: 480px) {
  header {
    padding: 10px 14px;
  }
  #book-title {
    font-size: 1.05rem;
  }
  .reader-card {
    padding: 18px 14px 145px;
  }
  #chapter-title {
    font-size: 1.22rem;
  }
  .reader-card p {
    font-size: 1.05rem;
    line-height: 1.75;
  }
  .audio-bar {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 14px));
  }
  .audio-controls {
    gap: 8px;
  }
  audio {
    width: 100%;
    height: 48px;
    min-height: 48px;
    border-radius: 26px;
  }
  .audio-toggles-row {
    gap: 14px;
  }
  .hover-toggle {
    font-size: 0.92rem;
    font-weight: 700;
    gap: 7px;
    color: #f8fafc;
  }
  .toggle-switch {
    width: 38px;
    height: 22px;
  }
  .toggle-switch::after {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
  }
  .hover-toggle input:checked + .toggle-switch::after {
    transform: translateX(16px);
  }
  .lexile-box {
    padding: 12px 14px;
  }
  .lexile-meta-row {
    gap: 8px;
  }
  .source-credit {
    text-align: left;
    margin-top: 6px;
  }
}

/* Configurable Site Footer */
.site-footer {
  width: 92%;
  max-width: 1100px;
  margin: 0 0 120px 0;
  padding: 24px 0 10px;
  border-top: 1px solid var(--daisy-line);
  text-align: center;
}

.footer-content {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Audible Floating Controller & Audio-First Listening Mode Styles
   ========================================================================== */
.audible-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #0f1111;
  color: #ffffff;
  padding: 8px 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  border-top: 2px solid #f8991c;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.audible-bar-content {
  max-width: 1100px;
  width: 92%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.audible-bar-left-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.audible-bar-center-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 320px;
}

.audible-bar-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-audible-restart {
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9999px;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-audible-restart:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.btn-audible-restart:active {
  transform: translateY(0);
}

.audible-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 440px;
}

.audible-time-text {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: center;
  user-select: none;
}

.audible-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: height 0.15s ease;
}

.audible-progress-bar:hover {
  height: 8px;
  background: rgba(255, 255, 255, 0.26);
}

.audible-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f8991c, #ffa733);
  border-radius: 9999px;
  transition: width 0.2s linear;
}

.audible-bar-right-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

#audibleChatbotSlot {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

#audibleChatbotSlot .daisy-chat-launcher {
  height: 36px !important;
  padding: 4px 14px !important;
  font-size: 0.82rem !important;
  gap: 7px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35) !important;
  background: linear-gradient(135deg, #3B7A57 0%, #255239 100%) !important;
}

#audibleChatbotSlot .daisy-launcher-icon {
  width: 22px !important;
  height: 22px !important;
}

.audible-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #232f3e;
  border: 1px solid rgba(248, 153, 28, 0.4);
  padding: 3px 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.audible-icon {
  font-size: 0.9rem;
}

.audible-text-brand {
  font-size: 0.8rem;
  font-weight: 800;
  color: #f8991c;
  letter-spacing: -0.02em;
}

.audible-title-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.audible-book-heading {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.audible-title-separator {
  color: #64748b;
  font-size: 0.8rem;
  user-select: none;
}

.audible-chapter-sub {
  font-size: 0.84rem;
  color: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.btn-audible-companion,
.btn-audible-cloud {
  background: linear-gradient(135deg, #f8991c 0%, #ea8500 100%);
  color: #0f1111;
  font-size: 0.88rem;
  font-weight: 800;
  border: none;
  border-radius: 9999px;
  padding: 9px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(248, 153, 28, 0.4);
}

.btn-audible-unified {
  background: linear-gradient(135deg, #f8991c 0%, #ea8500 100%);
  color: #0f172a;
  font-size: 0.98rem;
  font-weight: 800;
  border: none;
  border-radius: 9999px;
  padding: 12px 34px;
  min-width: 320px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 3px 12px rgba(248, 153, 28, 0.45);
  font-family: inherit;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn-audible-unified:hover {
  background: linear-gradient(135deg, #ffa733 0%, #f8991c 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 5px 18px rgba(248, 153, 28, 0.65);
}

.btn-audible-unified:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(248, 153, 28, 0.4);
}

.btn-audible-unified .audible-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.btn-audible-unified .audible-btn-label {
  font-weight: 800;
  color: #0f172a;
}

.btn-audible-companion:hover,
.btn-audible-cloud:hover {
  background: linear-gradient(135deg, #ffa733 0%, #f8991c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(248, 153, 28, 0.6);
}

.btn-audible-app {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-audible-app:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Audio-First Listening Canvas */
.audible-listening-container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.audible-player-hero-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px;
  padding: 24px;
  color: #ffffff;
  border: 1.5px solid rgba(248, 153, 28, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.audible-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(248, 153, 28, 0.15);
  border: 1px solid #f8991c;
  color: #f8991c;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audible-hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px 0;
}

.audible-hero-narrator {
  font-size: 0.88rem;
  color: #cbd5e1;
  margin: 0 0 16px 0;
}

.audible-hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.audible-hero-btn-play {
  background: linear-gradient(135deg, #f8991c 0%, #ea8500 100%);
  color: #0f1111;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(248, 153, 28, 0.5);
  transition: all 0.2s ease;
}

.audible-hero-btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(248, 153, 28, 0.7);
}

.audible-hero-btn-app {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 9999px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.audible-hero-btn-app:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Listening Guide Card */
.listening-guide-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
}

.listening-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #1e293b;
  font-size: 1.05rem;
  font-weight: 800;
}

.listening-guide-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #334155;
  margin: 0 0 14px 0;
}

.listening-guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.listening-step-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.84rem;
  color: #475569;
}

.listening-step-num {
  font-weight: 800;
  color: var(--daisy-green-dark);
  margin-bottom: 4px;
  display: block;
}

/* Pre-listening Target Vocabulary */
.prelistening-vocab-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.prelistening-vocab-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 16px;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 10px;
}

.prelistening-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.prelistening-word-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.prelistening-word-item:hover {
  background: var(--daisy-green-soft);
  border-color: var(--daisy-green-line);
}

.prelistening-word-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.prelistening-word-term {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.prelistening-word-pos {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
}

.prelistening-word-korean {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--daisy-green-dark);
  margin-bottom: 4px;
}

.prelistening-word-sample {
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .audible-bar {
    padding: 8px 12px 10px 12px;
  }
  .audible-bar-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .audible-bar-left-wrap {
    justify-content: center;
    width: 100%;
    gap: 8px;
  }
  .audible-chapter-sub {
    max-width: 240px;
  }
  .audible-bar-actions {
    justify-content: center;
    width: 100%;
  }
  .btn-audible-companion, .btn-audible-cloud {
    flex: 1;
    justify-content: center;
  }
  .btn-audible-unified {
    width: 100%;
    min-width: 0;
    padding: 10px 18px;
    font-size: 0.92rem;
  }
  .audible-bar-right-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  #audible-bar .audio-chatbot-slot {
    position: static;
    transform: none;
    margin-top: 4px;
  }
}

/* Solution 2: Audible Companion Player Note */
.audible-hero-note {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 12px 0 0 0;
  line-height: 1.45;
  text-align: center;
}

/* ==========================================================================
   Centered Reader Workspace & Audible Player (Listen Tab)
   ========================================================================== */
.reader-workspace {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reader-main-pane {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Centered In-Page Audible Player (Listen Tab) */
.audible-tab-listening-wrapper {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.audible-simple-card {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 auto 14px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.audible-cover-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 340px;
  margin: 0 auto 10px auto;
}

.audible-book-cover-img {
  display: block;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f6f6f6;
  transition: transform 0.2s ease;
}

body.dark-mode .audible-book-cover-img {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  background: #1e293b;
}

.chapter-list li a .ch-time-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  flex-shrink: 0;
}

.chapter-list li a.active-chapter .ch-time-pill {
  background: #f59e0b;
  color: #ffffff;
  border-color: #d97706;
}

.audible-time-guide-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.12);
  margin-bottom: 2px;
}

body.dark-mode .audible-time-guide-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.audible-action-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 6px 0;
}

.btn-audible-open-app {
  background: linear-gradient(135deg, #f8991c 0%, #ea8500 100%);
  color: #0f172a;
  border: none;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 13px 28px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(248, 153, 28, 0.35);
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.btn-audible-open-app:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(248, 153, 28, 0.5);
}

.btn-audible-open-app:active {
  transform: translateY(0);
}

.btn-audible-open-player {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

body.dark-mode .btn-audible-open-player {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

.btn-audible-open-player:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-2px);
}

body.dark-mode .btn-audible-open-player:hover {
  background: #334155;
  border-color: #475569;
}

.btn-audible-open-player:active {
  transform: translateY(0);
}

.audible-btn-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.audible-dock-status {
  width: 100%;
  max-width: 640px;
  padding: 14px 20px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  box-sizing: border-box;
}

body.dark-mode .audible-dock-status {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.audible-synopsis-box {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 22px;
  box-sizing: border-box;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

body.dark-mode .audible-synopsis-box {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.audible-synopsis-heading {
  margin: 0 0 8px 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .audible-synopsis-heading {
  color: #f1f5f9;
}

.audible-synopsis-text {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.65;
  color: #334155;
}

body.dark-mode .audible-synopsis-text {
  color: #cbd5e1;
}

@media (max-width: 768px) {
  .btn-audible-open-app,
  .btn-audible-open-player {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 14px 20px;
  }
  .audible-synopsis-box {
    padding: 20px 20px;
  }
}

/* Audible Read Tab & CTA Card Styles */
.audible-read-cta-card {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 14px;
  padding: 14px 20px;
  margin-top: 10px;
  box-sizing: border-box;
  gap: 16px;
  transition: all 0.2s ease;
}

body.dark-mode .audible-read-cta-card {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.audible-read-cta-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.audible-read-cta-text strong {
  color: #166534;
  font-size: 0.95rem;
  font-weight: 700;
}

body.dark-mode .audible-read-cta-text strong {
  color: #4ade80;
}

.audible-read-cta-text span {
  color: #15803d;
  font-size: 0.85rem;
}

body.dark-mode .audible-read-cta-text span {
  color: #86efac;
}

.btn-audible-goto-read {
  background: #166534;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-audible-goto-read:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.35);
}

.btn-audible-goto-read:active {
  transform: translateY(0);
}

.audible-reading-story-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 0 30px 0;
}

.reading-story-paragraph {
  font-size: 1.15rem;
  line-height: 1.85;
  color: #1e293b;
  margin-bottom: 22px;
  letter-spacing: -0.01em;
  text-align: justify;
}

body.dark-mode .reading-story-paragraph {
  color: #e2e8f0;
}

.audible-no-text-notice {
  text-align: center;
  padding: 40px 24px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
  max-width: 560px;
  margin: 20px auto;
}

body.dark-mode .audible-no-text-notice {
  background: #1e293b;
  border-color: #475569;
}

.audible-no-text-notice .no-text-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.audible-no-text-notice h3 {
  font-size: 1.25rem;
  margin: 0 0 8px 0;
  color: #0f172a;
}

body.dark-mode .audible-no-text-notice h3 {
  color: #f8fafc;
}

.audible-no-text-notice p {
  font-size: 0.95rem;
  color: #64748b;
  margin: 6px 0;
  line-height: 1.6;
}

body.dark-mode .audible-no-text-notice p {
  color: #94a3b8;
}

.btn-goto-listen {
  margin-top: 16px;
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 640px) {
  .audible-read-cta-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .btn-audible-goto-read {
    justify-content: center;
  }
  .reading-story-paragraph {
    font-size: 1.05rem;
    line-height: 1.75;
    text-align: left;
  }
}

/* Option A: Audible Chapter Study Companion & Vocabulary Styles */
.audible-study-guide-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 0 40px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.audible-study-hero-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(22, 101, 52, 0.08);
}

body.dark-mode .audible-study-hero-card {
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.25) 0%, rgba(20, 83, 45, 0.35) 100%);
  border-color: rgba(74, 222, 128, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.audible-study-badge {
  display: inline-block;
  background: #166534;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

body.dark-mode .audible-study-badge {
  background: #22c55e;
  color: #0f172a;
}

.audible-study-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #14532d;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

body.dark-mode .audible-study-title {
  color: #86efac;
}

.audible-study-overview-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #1e293b;
  margin: 0;
}

body.dark-mode .audible-study-overview-text {
  color: #e2e8f0;
}

.audible-study-tip-card {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 14px;
  padding: 16px 20px;
}

body.dark-mode .audible-study-tip-card {
  background: rgba(30, 58, 138, 0.25);
  border-color: rgba(96, 165, 250, 0.3);
}

.audible-study-tip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: #1e40af;
  margin-bottom: 6px;
}

body.dark-mode .audible-study-tip-header {
  color: #93c5fd;
}

.audible-study-tip-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
  margin: 0;
}

body.dark-mode .audible-study-tip-text {
  color: #cbd5e1;
}

.audible-study-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audible-study-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .audible-study-section-title {
  color: #f8fafc;
}

.audible-scenes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audible-scene-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.dark-mode .audible-scene-card {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #60a5fa;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.audible-scene-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px 0;
}

body.dark-mode .audible-scene-title {
  color: #f1f5f9;
}

.audible-scene-desc {
  font-size: 1rem;
  line-height: 1.75;
  color: #475569;
  margin: 0;
}

body.dark-mode .audible-scene-desc {
  color: #cbd5e1;
}

.audible-themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.audible-theme-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #eab308;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.dark-mode .audible-theme-card {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #facc15;
}

.audible-theme-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px 0;
}

body.dark-mode .audible-theme-title {
  color: #f1f5f9;
}

.audible-theme-desc {
  font-size: 0.98rem;
  line-height: 1.7;
  color: #475569;
  margin: 0;
}

body.dark-mode .audible-theme-desc {
  color: #cbd5e1;
}

.audible-vocab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.audible-vocab-hint {
  font-size: 0.85rem;
  color: #64748b;
  font-style: italic;
}

body.dark-mode .audible-vocab-hint {
  color: #94a3b8;
}

.audible-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.audible-vocab-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.audible-vocab-card:hover {
  transform: translateY(-2px);
  border-color: #166534;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.12);
}

body.dark-mode .audible-vocab-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .audible-vocab-card:hover {
  border-color: #4ade80;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.audible-vocab-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audible-vocab-word {
  font-size: 1.2rem;
  font-weight: 800;
  color: #166534;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #86efac;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

body.dark-mode .audible-vocab-word {
  color: #4ade80;
  text-decoration-color: #166534;
}

.audible-vocab-pos {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: lowercase;
  font-style: italic;
}

body.dark-mode .audible-vocab-pos {
  color: #94a3b8;
  background: #334155;
}

.audible-vocab-def {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #334155;
  margin: 0;
}

body.dark-mode .audible-vocab-def {
  color: #cbd5e1;
}

.audible-vocab-sent-wrap {
  margin-top: 4px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #cbd5e1;
}

body.dark-mode .audible-vocab-sent-wrap {
  background: #0f172a;
  border-left-color: #475569;
}

.audible-vocab-sent-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
}

body.dark-mode .audible-vocab-sent-label {
  color: #94a3b8;
}

.audible-vocab-sentence {
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.55;
  color: #475569;
  margin: 2px 0 0 0;
}

body.dark-mode .audible-vocab-sentence {
  color: #cbd5e1;
}

.audible-study-nav-card {
  margin-top: 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

body.dark-mode .audible-study-nav-card {
  background: #1e293b;
  border-color: #334155;
}

.audible-study-nav-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audible-study-nav-text strong {
  font-size: 1.05rem;
  color: #0f172a;
}

body.dark-mode .audible-study-nav-text strong {
  color: #f8fafc;
}

.audible-study-nav-text span {
  font-size: 0.9rem;
  color: #64748b;
}

body.dark-mode .audible-study-nav-text span {
  color: #94a3b8;
}

.audible-study-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-study-action {
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-study-listen {
  background: #f1f5f9;
  color: #334155;
}

.btn-study-listen:hover {
  background: #e2e8f0;
}

body.dark-mode .btn-study-listen {
  background: #334155;
  color: #f1f5f9;
}

body.dark-mode .btn-study-listen:hover {
  background: #475569;
}

.btn-study-quiz {
  background: #166534;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.25);
}

.btn-study-quiz:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-study-write {
  background: #0f172a;
  color: #ffffff;
}

.btn-study-write:hover {
  background: #334155;
  transform: translateY(-1px);
}

body.dark-mode .btn-study-write {
  background: #f8fafc;
  color: #0f172a;
}

@media (max-width: 640px) {
  .audible-study-hero-card {
    padding: 18px 20px;
  }
  .audible-vocab-grid, .audible-themes-grid {
    grid-template-columns: 1fr;
  }
  .audible-study-nav-card {
    flex-direction: column;
    align-items: stretch;
  }
  .audible-study-nav-actions {
    justify-content: stretch;
  }
  .audible-study-nav-actions .btn-study-action {
    flex: 1;
    text-align: center;
  }
}


