/* ── Popup Chinese episode components ──
   Page shell/layout comes from the site's MonsterUI Container; these rules
   style only the components inside it. */

.episode-list { display: grid; gap: .6rem; }

.episode-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: .8rem 1rem;
  border: 1px solid #dfe3e8;
  border-radius: .6rem;
  background: white;
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.episode-card h2 {
  overflow: hidden;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-card a { min-width: 0; color: inherit; text-decoration: none; }
.episode-card a:hover h2 { text-decoration: underline; }
.episode-card:has(input:checked) { opacity: .55; }
.episode-card:has(input:checked) h2 { text-decoration: line-through; }

.done-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #4b5563;
  white-space: nowrap;
  cursor: pointer;
}
.done-toggle input { width: 1rem; height: 1rem; margin: 0; accent-color: #2563eb; appearance: auto; }

.pbtn {
  padding: .5rem .9rem;
  border: 0;
  border-radius: .5rem;
  color: white;
  background: #2563eb;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}
.pbtn:hover { background: #1d4ed8; }
.pbtn:disabled { color: #4b5563; background: #dfe3e8; cursor: default; }

.prose, .lesson-section {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #dfe3e8;
  border-radius: .6rem;
  background: white;
}

.prose h2, .lesson-section h2 { margin: 0 0 .75rem; font-size: 1.25rem; font-weight: 700; }
.prose p { margin: 0; }
.prose p + p { margin-top: .75rem; }

.lesson-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .35rem;
}
.lesson-section > header h2 { margin: 0; }

.lesson-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: .75rem 0;
  border-bottom: 1px solid #e5e7eb;
}
.lesson-item:last-child { border-bottom: 0; }
.lesson-item h3 { margin: 0 0 .2rem; font-size: 1.25rem; font-weight: 700; }
.lesson-item p { margin: 0; }
.lesson-item p:first-of-type { color: #4b5563; }
.lesson-item small { color: #6b7280; }

/* ── Matthews entry + dark mode (moved from the notebook) ── */

.matthews-entry p { margin: 10px 0; font-size: 18px; line-height: 1.65; color: rgb(15 23 42); }
.matthews-entry .indentedpara, .matthews-entry .indentedpara0, .matthews-entry .indentedpara1, .matthews-entry .indentedpara2, .matthews-entry .indentedpara11 { margin-left: 0; }
.matthews-entry .bx1 { border: 1px solid rgb(148 163 184); border-radius: 10px; padding: 10px 12px; background: rgb(248 250 252); }
.matthews-entry img { max-width: 100%; height: auto; display: block; margin: 10px auto; }

/* ── Dark mode overrides ── */
html.dark body { background: #0f172a !important; color: #e2e8f0; }

/* Backgrounds */
html.dark .bg-white { background-color: #1e293b !important; }
html.dark .bg-slate-100 { background-color: #1e293b !important; }
html.dark .matthews-entry { background: #1e293b !important; border-color: #334155 !important; }
html.dark .matthews-entry .bx1 { background: #0f172a !important; border-color: #475569 !important; }
html.dark .uk-card { background: #1e293b !important; border-color: #334155 !important; }

/* Text colors */
html.dark .text-slate-900 { color: #f1f5f9 !important; }
html.dark .text-slate-800 { color: #e2e8f0 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600 { color: #94a3b8 !important; }
html.dark .text-slate-500 { color: #94a3b8 !important; }
html.dark .text-slate-400 { color: #64748b !important; }
html.dark .matthews-entry p { color: #cbd5e1 !important; }

/* Borders */
html.dark .border-slate-200 { border-color: #334155 !important; }
html.dark .border-slate-300 { border-color: #475569 !important; }
html.dark .border-slate-900 { border-color: #475569 !important; }

/* Links */
html.dark .text-blue-600 { color: #60a5fa !important; }
html.dark .text-blue-500 { color: #60a5fa !important; }
html.dark .hover\:text-blue-600:hover { color: #93c5fd !important; }
html.dark .hover\:text-blue-500:hover { color: #93c5fd !important; }
html.dark .hover\:text-slate-900:hover { color: #f1f5f9 !important; }
html.dark .hover\:bg-slate-100:hover { background-color: #334155 !important; }

/* Active nav pill in dark mode */
html.dark .bg-slate-900.text-white { background-color: #e2e8f0 !important; color: #0f172a !important; }

/* Inputs */
html.dark .uk-input { background: #0f172a !important; color: #e2e8f0 !important; border-color: #475569 !important; }
html.dark .uk-input::placeholder { color: #64748b !important; }

/* Soundword table */
html.dark th { color: #94a3b8 !important; }
html.dark .border-blue-400 { border-color: #3b82f6 !important; }

/* Book CSS overrides for dark */
html.dark .bx { background-color: #1a2332 !important; }
html.dark .bx1 { background-color: #1a2332 !important; }
html.dark .bcen { border-color: #475569 !important; }
html.dark .bd { border-color: #475569 !important; }
html.dark .brd { border-color: #475569 !important; }
html.dark .t1 { border-color: #475569 !important; }
html.dark .sb { border-color: #475569 !important; }

/* Theme toggle button */
.theme-toggle { font-size: 1.2rem; line-height: 1; cursor: pointer; background: none; border: none; padding: 4px 8px; border-radius: 9999px; transition: background 0.2s; }
.theme-toggle:hover { background: rgba(100,116,139,0.15); }
html.dark .theme-toggle-sun { display: inline; }
html.dark .theme-toggle-moon { display: none; }
html:not(.dark) .theme-toggle-sun { display: none; }
html:not(.dark) .theme-toggle-moon { display: inline; }

/* Dark mode images: slightly brighten for visibility */
html.dark .matthews-entry img { filter: brightness(0.9) contrast(1.1); }

/* ── Dark mode for episode pages ── */
html.dark .episode-card, html.dark .prose, html.dark .lesson-section { background: #1e293b; border-color: #334155; }
html.dark .lesson-item { border-color: #334155; }
html.dark .pbtn:disabled { color: #94a3b8; background: #334155; }

/* ── Reassert popup element styles over franken/tailwind base (episode pages have a bare <main> root) ── */
main h1 { font-size: 1.6rem; font-weight: 700; }
main button { padding: .65rem .9rem; border: 0; border-radius: .5rem; color: white; background: #2563eb; font: inherit; font-weight: 600; cursor: pointer; }
main button:disabled { color: #4b5563; background: #dfe3e8; cursor: default; }
main .done-toggle input { width: 1rem; height: 1rem; margin: 0; accent-color: #2563eb; appearance: auto; }
main h2 { font-size: 1.4rem; font-weight: 700; }
main h3 { font-size: 1.17rem; font-weight: 700; }
