/**
 * ELC Dictation - Mac OS Pastel Design Language
 * Split-screen 60/40, soft glass morphism, pastel palette
 */
:root {
  --d-bg: #f5f5f7;
  --d-surface: #ffffff;
  --d-surface-alt: #fafafa;
  --d-primary: #4B8EDE;
  --d-primary-light: #EBF7FF;
  --d-primary-dark: #4B8EDE;
  --d-green: #22c55e;
  --d-green-light: #dcfce7;
  --d-red: #ef4444;
  --d-red-light: #fee2e2;
  --d-orange: #f59e0b;
  --d-orange-light: #fef3c7;
  --d-text: #1e293b;
  --d-text-secondary: #64748b;
  --d-text-tertiary: #94a3b8;
  --d-border: #e2e8f0;
  --d-shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --d-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --d-shadow-md: 0 4px 6px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04);
  --d-shadow-lg: 0 10px 25px rgba(0,0,0,.06), 0 4px 10px rgba(0,0,0,.04);
  --d-shadow-xl: 0 20px 50px rgba(0,0,0,.08);
  --d-radius: 20px;
  --d-radius-sm: 12px;
  --d-radius-xs: 8px;
  --d-radius-full: 999px;
  --d-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --d-font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --d-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
.dark-mode {
  --d-bg: #0f172a;
  --d-surface: #1e293b;
  --d-surface-alt: #1a2332;
  --d-primary: #4B8EDE;
  --d-primary-light: #1e1b4b;
  --d-primary-dark: #4B8EDE;
  --d-green: #4ade80;
  --d-green-light: #052e16;
  --d-red: #f87171;
  --d-red-light: #450a0a;
  --d-orange: #fbbf24;
  --d-orange-light: #451a03;
  --d-text: #e2e8f0;
  --d-text-secondary: #94a3b8;
  --d-text-tertiary: #64748b;
  --d-border: #334155;
  --d-shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --d-shadow-sm: 0 1px 3px rgba(0,0,0,.25);
  --d-shadow-md: 0 4px 6px rgba(0,0,0,.25);
  --d-shadow-lg: 0 10px 25px rgba(0,0,0,.3);
  --d-shadow-xl: 0 20px 50px rgba(0,0,0,.4);
}

/* ===== Scrollbar ===== */
.d-dictation-app ::-webkit-scrollbar { width: 6px; }
.d-dictation-app ::-webkit-scrollbar-track { background: transparent; }
.d-dictation-app ::-webkit-scrollbar-thumb { background: var(--d-border); border-radius: 3px; }
.d-dictation-app ::-webkit-scrollbar-thumb:hover { background: var(--d-text-tertiary); }

/* ===== Base ===== */
.d-dictation-app,
.d-dictation-app *,
.d-dictation-app *::before,
.d-dictation-app *::after { box-sizing: border-box; }

.d-dictation-app {
  font-family: var(--d-font);
  color: var(--d-text);
  background: var(--d-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--d-transition), color var(--d-transition);
  min-height: 100vh;
}

.d-dictation-app [x-cloak] { display: none !important; }

/* ===== Top Bar ===== */
.d-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1300px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.d-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-topbar-breadcrumb {
  font-size: 13px;
  color: var(--d-text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--d-transition);
}

.d-topbar-breadcrumb:hover { color: var(--d-primary); }

.d-topbar-sep {
  color: var(--d-text-tertiary);
  font-size: 11px;
}

.d-topbar-mode {
  background: var(--d-primary-light);
  color: var(--d-primary-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--d-radius-full);
}

.d-topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Progress Bar ===== */
.d-progress-wrap {
  max-width: 1300px;
  margin: 0 auto 8px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.d-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--d-border);
  border-radius: 3px;
  overflow: hidden;
}

.d-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--d-primary), #4B8EDE);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.d-progress-text {
  font-size: 12px;
  color: var(--d-text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Button System ===== */
.d-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--d-font);
  border: none;
  border-radius: var(--d-radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--d-transition);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.d-btn:active { transform: scale(0.96); }

.d-btn-primary {
  background: var(--d-primary);
  color: #fff;
}
.d-btn-primary:hover { background: var(--d-primary-dark); box-shadow: 0 2px 8px rgba(75, 142, 222,.35); }

.d-btn-outline {
  background: var(--d-surface);
  color: var(--d-primary);
  border: 1.5px solid var(--d-primary);
}
.d-btn-outline:hover { background: var(--d-primary-light); }

.d-btn-ghost {
  background: transparent;
  color: var(--d-text-secondary);
}
.d-btn-ghost:hover { background: var(--d-surface-alt); color: var(--d-text); }

.d-btn-sm { padding: 5px 12px; font-size: 11px; }
.d-btn-lg { padding: 12px 28px; font-size: 15px; }
.d-btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* ===== Split Layout ===== */
.d-split {
  display: flex;
  gap: 20px;
  max-width: 1300px;
  margin: 0 auto 40px;
  padding: 0 24px;
  align-items: flex-start;
}

.d-left {
  flex: 0 0 60%;
  max-width: 60%;
  min-width: 0;
}

.d-right {
  flex: 0 0 40%;
  max-width: 40%;
  min-width: 0;
  position: sticky;
  top: 20px;
}

/* ===== Cards ===== */
.d-card {
  background: var(--d-surface);
  border: 1px solid var(--d-border);
  border-radius: var(--d-radius);
  box-shadow: var(--d-shadow-md);
  transition: background var(--d-transition), border-color var(--d-transition), box-shadow var(--d-transition);
}

.d-left .d-card {
  padding: 32px;
  margin-bottom: 16px;
}

.d-right .d-card {
  padding: 20px;
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Video YouTube (dạng bài Video YouTube) ===== */
.d-video-box { margin-bottom: 20px; }
.d-video-iframe {
  width: 70%; aspect-ratio: 16/9; border: 1px solid var(--d-border);
  border-radius: var(--d-radius-sm); display: block; box-shadow: var(--d-shadow-sm);
  margin: 0 auto;
}

/* ===== Word Display ===== */
.d-word-box {
  text-align: left;
  margin-bottom: 24px;
  position: relative;
}

/* Input vô hình cho bàn phím ảo mobile (x-ref="mobileInput"): phải là input THẬT
   được focus thì điện thoại mới bật keyboard, nhưng không được thấy/che gì cả.
   KHÔNG dùng display:none hay visibility:hidden - trình duyệt sẽ từ chối focus.
   font-size 16px để iOS không tự zoom trang khi focus. */
.d-mobile-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  font-size: 16px;
  pointer-events: none;
}

.d-mobile-input:focus {
  outline: none;
  box-shadow: none;
}

.d-word-target {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 6px;
  font-family: var(--d-font-mono);
  color: var(--d-text);
  margin-bottom: 8px;
  min-height: 56px;
  line-height: 1.3;
  word-break: break-all;
}

.d-word-target .d-char {
  display: inline-block;
  transition: color 0.15s ease, transform 0.15s ease;
}

.d-word-target .d-char.correct { color: var(--d-green); }
.d-word-target .d-char.wrong { color: var(--d-red); }
.d-word-target .d-char.pending { color: var(--d-text-tertiary); }
.d-word-target .d-char.space { margin-right: 6px; }

.d-word-target .d-blank-char {
  display: inline-block;
  width: 28px;
  border-bottom: 2.5px solid var(--d-primary);
  margin: 0 3px;
  text-align: center;
  color: var(--d-primary-dark);
  font-weight: 700;
}

.d-word-target .d-blank-space {
  display: inline-block;
  width: 20px;
}

/* ===== IPA & Definition ===== */
.d-word-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 4px;
}

.d-ipa {
  font-size: 16px;
  color: var(--d-text-secondary);
  font-family: var(--d-font-mono);
  background: var(--d-surface-alt);
  padding: 4px 12px;
  border-radius: var(--d-radius-xs);
}

.d-definition {
  font-size: 14px;
  color: var(--d-text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* ===== Hint Box ===== */
.d-hint-box {
  background: var(--d-orange-light);
  border: 1px solid var(--d-orange);
  border-radius: var(--d-radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-hint-box .d-hint-label { font-weight: 700; flex-shrink: 0; }
.d-hint-box .d-hint-text { font-family: var(--d-font-mono); letter-spacing: 3px; }

/* ===== Input Area ===== */
.d-input-area {
  position: relative;
  margin-bottom: 16px;
}

.d-input-hidden {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.d-input-visual {
  display: flex;
  align-items: center;
  background: var(--d-surface-alt);
  border: 2px solid var(--d-border);
  border-radius: var(--d-radius-sm);
  padding: 14px 18px;
  gap: 6px;
  transition: border-color var(--d-transition), box-shadow var(--d-transition);
  cursor: text;
}

.d-input-visual:focus-within {
  border-color: var(--d-primary);
  box-shadow: 0 0 0 4px rgba(75, 142, 222,.12);
}

.d-input-visual .d-caret {
  display: inline-block;
  width: 2px;
  height: 22px;
  background: var(--d-primary);
  animation: d-blink 1s step-end infinite;
  margin-left: 1px;
}

@keyframes d-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.d-input-visual .d-input-placeholder {
  color: var(--d-text-tertiary);
  font-size: 15px;
  pointer-events: none;
}

.d-input-hint {
  font-size: 11px;
  color: var(--d-text-tertiary);
  margin-top: 6px;
}

/* ===== Action Buttons ===== */
.d-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.d-btn-speech {
  background: var(--d-primary-light);
  color: var(--d-primary-dark);
  border: none;
  font-weight: 700;
}
.d-btn-speech:hover { background: var(--d-primary); color: #fff; }
.d-btn-speech.recording {
  background: var(--d-red);
  color: #fff;
  animation: d-pulse-rec 1.5s infinite;
}

@keyframes d-pulse-rec {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  70% { box-shadow: 0 0 0 14px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.d-btn-show-answer {
  background: var(--d-surface);
  color: var(--d-orange);
  border: 1.5px solid var(--d-orange);
}
.d-btn-show-answer:hover { background: var(--d-orange-light); }

.d-speech-result {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--d-radius-xs);
}

.d-speech-result.ok { background: var(--d-green-light); color: #166534; }
.d-speech-result.near { background: var(--d-orange-light); color: #92400e; }
.d-speech-result.bad { background: var(--d-red-light); color: #991b1b; }

/* ===== Audio Waveform ===== */
.d-waveform-wrap {
  background: var(--d-surface-alt);
  border-radius: var(--d-radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.d-waveform-canvas {
  width: 100%;
  height: 60px;
  display: block;
  border-radius: var(--d-radius-xs);
  cursor: pointer;
}

.d-audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.d-audio-controls .d-btn-icon {
  background: var(--d-surface);
  border: 1px solid var(--d-border);
  font-size: 16px;
}
.d-audio-controls .d-btn-icon:hover { background: var(--d-primary-light); border-color: var(--d-primary); }

.d-audio-controls .d-btn-play {
  background: var(--d-primary);
  color: #fff;
  border-color: var(--d-primary);
  width: 44px;
  height: 44px;
  font-size: 18px;
}
.d-audio-controls .d-btn-play:hover { background: var(--d-primary-dark); }

.d-speed-select {
  font-family: var(--d-font);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border: 1px solid var(--d-border);
  border-radius: var(--d-radius-xs);
  background: var(--d-surface);
  color: var(--d-text);
  cursor: pointer;
}

/* ===== Right Panel Tabs ===== */
.d-tabs {
  display: flex;
  gap: 2px;
  background: var(--d-surface-alt);
  border-radius: var(--d-radius-xs);
  padding: 3px;
  margin-bottom: 14px;
}

.d-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--d-text-secondary);
  transition: all var(--d-transition);
  border: none;
  background: transparent;
  font-family: var(--d-font);
  position: relative;
}

.d-tab:hover { color: var(--d-text); }
.d-tab.active {
  background: var(--d-surface);
  color: var(--d-primary);
  box-shadow: var(--d-shadow-xs);
}

.d-tab .d-tab-count {
  display: inline-block;
  background: var(--d-border);
  color: var(--d-text-secondary);
  font-size: 10px;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 4px;
}

.d-tab.active .d-tab-count {
  background: var(--d-primary-light);
  color: var(--d-primary-dark);
}

/* ===== Tab Content ===== */
.d-tab-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.d-tab-empty {
  text-align: center;
  color: var(--d-text-tertiary);
  padding: 40px 0;
  font-size: 13px;
}

/* ===== Correct / Wrong List Items ===== */
.d-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--d-radius-xs);
  margin-bottom: 4px;
  font-size: 13px;
  transition: background var(--d-transition);
}

.d-item-row:hover { background: var(--d-surface-alt); }

.d-item-row .d-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.d-item-row .d-item-icon.ok {
  background: var(--d-green-light);
  color: var(--d-green);
}

.d-item-row .d-item-icon.wrong {
  background: var(--d-red-light);
  color: var(--d-red);
}

.d-item-row .d-item-text {
  flex: 1;
  font-weight: 600;
  word-break: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d-item-row .d-item-text.ok-text { color: var(--d-green); }
.d-item-row .d-item-text.wrong-text { color: var(--d-red); text-decoration: line-through; }

.d-item-pending {
  padding: 10px 12px;
  border-radius: var(--d-radius-xs);
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--d-text-tertiary);
  opacity: 0.4;
  font-style: italic;
}

/* ===== Notes ===== */
.d-notes {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.d-notes-editor {
  flex: 1;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--d-border);
  border-radius: var(--d-radius-sm);
  font-family: var(--d-font);
  font-size: 13px;
  line-height: 1.6;
  color: var(--d-text);
  background: var(--d-surface-alt);
  resize: none;
  min-height: 150px;
  transition: border-color var(--d-transition);
}

.d-notes-editor:focus {
  outline: none;
  border-color: var(--d-primary);
  box-shadow: 0 0 0 3px rgba(75, 142, 222,.1);
}

.d-notes-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.d-notes-saved {
  font-size: 11px;
  color: var(--d-green);
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Answer Reveal (không khung nền - chỉ chữ) ===== */
.d-answer-reveal {
  text-align: center;
  margin-bottom: 20px;
}

.d-answer-reveal .d-answer-word {
  font-size: 32px;
  font-weight: 800;
  color: var(--d-green);
  font-family: var(--d-font-mono);
  letter-spacing: 3px;
}

.d-answer-reveal .d-answer-msg {
  font-size: 14px;
  color: #166534;
  margin-top: 6px;
}

.d-answer-reveal .d-answer-ipa {
  font-size: 14px;
  color: #166534;
  font-family: var(--d-font-mono);
  margin-top: 4px;
}

/* ===== Feedback Overlay ===== */
.d-feedback-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--d-radius-full);
  font-weight: 700;
  font-size: 14px;
  z-index: 999;
  box-shadow: var(--d-shadow-lg);
  animation: d-slide-down 0.3s ease;
}

@keyframes d-slide-down {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.d-feedback-toast.ok { background: var(--d-green); color: #fff; }
.d-feedback-toast.bad { background: var(--d-red); color: #fff; }

/* ===== Finish Screen ===== */
.d-finish {
  text-align: center;
  padding: 60px 20px;
}

.d-finish-icon { font-size: 64px; margin-bottom: 16px; }

.d-finish-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.d-finish-score {
  font-size: 48px;
  font-weight: 900;
  color: var(--d-primary);
  margin-bottom: 4px;
}

.d-finish-sub {
  font-size: 14px;
  color: var(--d-text-secondary);
  margin-bottom: 8px;
}

.d-finish-streak {
  font-size: 16px;
  color: var(--d-orange);
  font-weight: 700;
  margin-bottom: 24px;
}

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

/* ===== Streak Badge ===== */
.d-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--d-orange-light);
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--d-radius-full);
}

/* ===== Accuracy Badge ===== */
.d-accuracy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--d-primary-light);
  color: var(--d-primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--d-radius-full);
}

/* ===== Font Size Controls ===== */
.d-fontsize-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--d-surface-alt);
  border: 1px solid var(--d-border);
  border-radius: var(--d-radius-full);
  padding: 2px 8px;
}

.d-fontsize-controls .d-btn-icon-sm {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--d-text-secondary);
  transition: color var(--d-transition);
}

.d-fontsize-controls .d-btn-icon-sm:hover {
  color: var(--d-primary);
  background: var(--d-surface);
}

.d-fontsize-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--d-text-tertiary);
  min-width: 28px;
  text-align: center;
}

/* ===== Daily Goal ===== */
.d-daily-goal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  max-width: 1300px;
  margin: 0 auto 12px;
  font-size: 12px;
  color: var(--d-text-secondary);
}

.d-goal-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(var(--d-primary) var(--goal-pct, 0%), var(--d-border) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.d-goal-ring-inner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--d-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* ===== Dark Mode Toggle ===== */
.d-dark-toggle {
  background: transparent;
  border: 1.5px solid var(--d-border);
  border-radius: var(--d-radius-full);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--d-transition);
}

.d-dark-toggle:hover { background: var(--d-surface-alt); }

/* ===== Loading ===== */
.d-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 12px;
  color: var(--d-text-secondary);
  font-size: 15px;
}

.d-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--d-border);
  border-top-color: var(--d-primary);
  border-radius: 50%;
  animation: d-spin 0.7s linear infinite;
}

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

/* ===== Transcript (old) ===== */
.elc-d-course-layout,
.elc-d-catalog-layout,
.elc-d-player-topbar,
.elc-d-player,
.elc-d-mistakes,
.elc-d-package {
  font-family: var(--d-font);
  color: var(--d-text);
  --d-primary: #4B8EDE;
  --d-primary-dark: #4B8EDE;
  --d-border: #e2e8f0;
  --d-radius: 20px;
  --d-radius-sm: 12px;
}

/* Keep old styles for non-dictation-app pages */
.elc-d-btn {
  display: inline-block;
  background: var(--d-primary);
  color: #fff;
  padding: 9px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.elc-d-btn:hover { background: var(--d-primary-dark); color: #fff; }
.elc-d-btn:active { transform: scale(0.97); }
.elc-d-btn-outline { background: #fff; color: var(--d-primary); border: 1px solid var(--d-primary); }
.elc-d-btn-outline:hover { background: #EBF7FF; color: var(--d-primary-dark); }
.elc-d-btn-big { width: 100%; text-align: center; padding: 13px 20px; font-size: 15px; margin-bottom: 8px; }
.elc-d-btn-sm { padding: 5px 14px; font-size: 12px; }
.elc-d-muted { color: #6b7280; font-size: 13px; }
.elc-d-section-title { font-size: 20px; margin: 0 0 14px; }
.elc-d-course-layout { display: flex; gap: 28px; max-width: 1180px; margin: 0 auto; align-items: flex-start; flex-wrap: wrap; font-family: 'Lora', Georgia, serif; }
.elc-d-left-stack { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; }
.elc-d-hero-left { width: 100%; }
.elc-d-hero-card { background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius); box-shadow: 0 6px 20px rgba(0,0,0,.06); overflow: hidden; }
.elc-d-hero-thumb { position: relative; aspect-ratio: 4/3; background: radial-gradient(circle at 30% 20%, #4B8EDE 0%, #4B8EDE 55%, #4B8EDE 100%); display: flex; align-items: center; justify-content: center; }
.elc-d-hero-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.elc-d-hero-thumb-ph { font-size: 44px; width: 88px; height: 88px; border-radius: 50%; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.elc-d-badge-ribbon { position: absolute; top: 12px; left: -6px; background: #f97316; color: #fff; font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 0 6px 6px 0; box-shadow: 0 2px 6px rgba(0,0,0,.15); z-index: 2; }
.elc-d-hero-card-body { padding: 18px; }
.elc-d-hero-progress { margin-bottom: 12px; }
.elc-d-progress-bar { background: #eef0f4; border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 6px; }
.elc-d-progress-bar span { display: block; height: 100%; background: var(--d-primary); border-radius: 999px; }
.elc-d-hero-price { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.elc-d-price-free { color: #16a34a; }
.elc-d-hero-meta { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid #f3f4f6; font-size: 13px; color: #4b5563; }
.elc-d-hero-meta li { padding: 3px 0; }
.elc-d-right-col { flex: 1; min-width: 320px; }
.elc-d-hero-right { background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius); box-shadow: 0 4px 16px rgba(0,0,0,.08); padding: 28px 32px; margin-bottom: 24px; width: 100%; min-width: 0; box-sizing: border-box; }
.elc-d-back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; color: var(--d-text-secondary, #64748b); text-decoration: none; margin-bottom: 14px; transition: color .15s ease; }
.elc-d-back-link:hover { color: var(--d-primary); }
.elc-d-hero-tags { margin-bottom: 8px; }
.elc-d-hero-tag { display: inline-block; background: #EBF7FF; color: var(--d-primary-dark); font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 12px; margin-right: 6px; }
.elc-d-hero-title { margin: 0 0 12px; font-size: 30px; }
.elc-d-hero-desc { line-height: 1.7; }
.elc-d-mode-tag { position: absolute; top: 12px; right: 12px; background: rgba(17,24,39,.72); backdrop-filter: blur(4px); color: #fff; font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 999px; z-index: 2; letter-spacing: .02em; }
.elc-d-player-modelabel { background: #EBF7FF; color: var(--d-primary-dark); font-size: 12px; font-weight: 700; padding: 7px 16px; border-radius: 999px; }

/* ===== Mô tả — nằm chung 1 khung với tiêu đề (.elc-d-hero-right), không lồng khung riêng nữa ===== */
.elc-d-desc-card {
  margin-bottom: 8px;
}

/* ===== Danh sách Test (minitest) — tiêu đề + list cùng 1 khung bo góc Mac OS, giống .elc-sach-toc bên Sách ===== */
.elc-d-testlist {
  background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius); box-shadow: 0 4px 16px rgba(0,0,0,.08);
  padding: 20px 24px; margin-bottom: 28px;
}
.elc-d-test-listcard { overflow: hidden; }
.elc-d-test-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--d-border); transition: background .15s ease; }
.elc-d-test-row:last-child { border-bottom: none; }
.elc-d-test-row:hover { background: rgba(75, 142, 222,.05); }
.elc-d-test-ring { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.elc-d-test-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.elc-d-test-ring-bg { fill: none; stroke: #eef0f4; stroke-width: 4; }
.elc-d-test-ring-fg { fill: none; stroke: var(--d-primary); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.elc-d-test-ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--d-primary-dark); }
.elc-d-test-info { flex: 1; min-width: 0; }
.elc-d-test-title { font-weight: 700; font-size: 16px; color: var(--d-text, #1e293b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elc-d-test-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.elc-d-test-trial-tag { color: #16a34a; font-weight: 700; }
.elc-d-test-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--d-primary-light, #EBF7FF); color: var(--d-primary-dark);
  font-size: 13px; font-weight: 700; padding: 8px 16px; border-radius: 999px;
  text-decoration: none; transition: background .15s ease, color .15s ease, transform .1s ease;
}
.elc-d-test-btn:hover { background: var(--d-primary); color: #fff; }
.elc-d-test-btn:active { transform: scale(0.96); }
.elc-d-test-btn-locked { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

/* ===== Top Thành Viên Chăm Chỉ Nhất — đồng bộ giao diện ELC Vocab ===== */
.elc-d-topstudents {
  width: 100%; min-width: 0; box-sizing: border-box;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.08);
  padding: 20px; margin-top: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.elc-d-topstudents h3 {
  margin: 0 0 14px; color: #4B8EDE; font-size: 16px; line-height: 1.4; font-weight: 800;
}
.elc-d-topstudents ol {
  display: flex; flex-direction: column; gap: 10px;
  list-style: none; margin: 0; padding: 0;
}
.elc-d-topstudents li {
  display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px;
}
.elc-d-top-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  background: #EBF7FF; color: #4B8EDE; font-size: 12px; font-weight: 700;
}
.elc-d-top-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.elc-d-topstudents li:nth-child(-n+3) .elc-d-top-name {
  color: #ec4899; font-weight: 800;
}
.elc-d-top-count {
  flex-shrink: 0; color: #6b7280; font-size: 12px; font-weight: 600;
}
.elc-d-medal-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.elc-d-medal-fallback {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--d-primary-light, #EBF7FF); color: var(--d-primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.dark-mode .elc-d-test-listcard { background: rgba(30,41,59,.6); }
.dark-mode .elc-d-test-row { border-color: var(--d-border); }
.dark-mode .elc-d-test-ring-bg { stroke: #334155; }
.dark-mode .elc-d-test-btn-locked { background: #1e293b; color: #64748b; }

/* .elc-d-table vẫn được dùng ở trang Sổ lỗi cá nhân (render_mistakes()) */
.elc-d-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius-sm); overflow: hidden; font-size: 13px; }
.elc-d-table th { text-align: left; background: #f9fafb; color: #6b7280; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--d-border); }
.elc-d-table td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.elc-d-table tbody tr:hover { background: #f9fafb; }
.elc-d-table tbody tr:last-child td { border-bottom: none; }
.elc-d-table audio { height: 30px; max-width: 180px; }

/* ===== Trang Combo [elc_dictation_combo] — bo góc Mac OS đồng bộ ===== */
.elc-d-combo-page { max-width: 900px; margin: 0 auto; padding: 32px 24px; font-family: var(--d-font); color: var(--d-text, #1e293b); }
.elc-d-combo-desc { font-size: 15px; line-height: 1.7; color: #4b5563; margin: 10px 0 22px; }
.elc-d-combo-owned {
  background: var(--d-green-light, #dcfce7); color: #166534;
  border-radius: var(--d-radius-sm, 12px); padding: 14px 18px; font-size: 14px; font-weight: 600;
  margin-bottom: 22px;
}
.elc-d-combo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.elc-d-combo-card {
  background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--d-border, #e2e8f0); border-radius: var(--d-radius, 20px);
  box-shadow: var(--d-shadow-sm, 0 1px 3px rgba(0,0,0,.06));
  padding: 22px; text-align: center;
  transition: transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s cubic-bezier(.4,0,.2,1);
}
.elc-d-combo-card:hover { transform: translateY(-3px); box-shadow: var(--d-shadow-md, 0 4px 6px rgba(0,0,0,.06)); }
.elc-d-combo-card-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.elc-d-combo-card-duration { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
.elc-d-combo-card-price { font-size: 22px; font-weight: 800; color: var(--d-primary, #4B8EDE); margin-bottom: 16px; }
.elc-d-combo-card .elc-d-btn-big { margin-bottom: 8px; }
.dark-mode .elc-d-combo-card { background: rgba(30,41,59,.6); }
.dark-mode .elc-d-combo-owned { background: #052e16; color: #4ade80; }

/* Ngôn ngữ - nút chuyển trang catalog theo ngoại ngữ (?lang=slug) */
.elc-d-catalog-langswitch { display: flex; justify-content: center; gap: 10px; max-width: 1600px; margin: 0 auto 20px; flex-wrap: wrap; }
.elc-d-catalog-langbtn {
  padding: 8px 20px; border-radius: 999px; border: 1px solid var(--d-border, #e2e8f0);
  background: #fff; color: var(--d-text, #1e293b); font-size: 14px; font-weight: 600;
  text-decoration: none; transition: all .15s ease;
}
.elc-d-catalog-langbtn:hover { border-color: var(--d-primary, #4B8EDE); color: var(--d-primary, #4B8EDE); }
.elc-d-catalog-langbtn.active { background: var(--d-primary, #4B8EDE); border-color: var(--d-primary, #4B8EDE); color: #fff; }
.dark-mode .elc-d-catalog-langbtn { background: #1e293b; }

/* Catalog styles */
.elc-d-catalog-layout { display: flex; gap: 24px; max-width: 1600px; margin: 0 auto; align-items: flex-start; }
.elc-d-catalog-popular { max-width: 1600px; margin: 0 auto 28px; }
.elc-d-catalog-popular .elc-d-catalog-heading { margin-top: 0; }
.elc-d-catalog-thumb-package { background: radial-gradient(circle at 30% 20%, #fbbf24 0%, #f59e0b 55%, #b45309 100%); }
.elc-d-catalog-card-package .elc-d-catalog-card-title { margin-bottom: 10px; }
.elc-d-package-options { list-style: none; margin: 0 0 10px; padding: 0; }
.elc-d-package-option { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--d-border); font-size: 13px; }
.elc-d-package-option:last-child { border-bottom: none; }
.elc-d-package-option-label { font-weight: 600; white-space: nowrap; }
.elc-d-package-option-price { margin-left: auto; font-size: 12px; color: var(--d-primary-dark); font-weight: 700; text-align: right; }
.elc-d-package-option-price del { color: #9ca3af; font-weight: 400; }
.elc-d-catalog-card-package .elc-d-btn-outline { display: block; text-align: center; }
/* Cột trái xếp dọc: bộ lọc thẻ + khung gamification trong CÙNG 1 cột 220px -
   flex-basis/sticky nằm ở wrapper này, .elc-d-catalog-filter bên trong chỉ
   còn là 1 khối con (tự giãn full width theo mặc định của flex-column). */
.elc-d-catalog-left-stack { flex: 0 0 220px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }
.elc-d-catalog-filter { background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius-sm); padding: 16px; }
.elc-d-catalog-filter-title { margin: 0 0 10px; font-size: 15px; }
.elc-d-catalog-filter-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; cursor: pointer; }
.elc-d-catalog-filter-count { color: #9ca3af; margin-left: auto; }

.elc-d-gamification-box { background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius-sm); box-shadow: 0 4px 16px rgba(0,0,0,.08); padding: 18px 20px; width: 100%; min-width: 0; box-sizing: border-box; }
.elc-d-gamification-box h3 { margin: 0 0 14px; font-size: 16px; }
.elc-d-gamification-box ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.elc-d-gamification-box li { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.elc-d-medal-img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.elc-d-medal-fallback { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: #EBF7FF; color: #4B8EDE; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.elc-d-top-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-top-count { color: #6b7280; font-size: 12px; font-weight: 600; }
.elc-d-streak-line { font-size: 13px; color: #4b5563; line-height: 1.6; }
.elc-d-streak-divider { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
.elc-d-catalog { flex: 1; min-width: 0; }
.elc-d-catalog-yearpass {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--d-border, #e2e8f0); box-shadow: var(--d-shadow-sm, 0 1px 3px rgba(0,0,0,.06));
  color: var(--d-text, #1e293b); border-radius: var(--d-radius); padding: 18px 24px; margin-bottom: 20px;
}
.elc-d-catalog-yearpass .elc-d-price { color: var(--d-primary-dark, #4B8EDE); font-weight: 700; margin-left: 10px; }
.dark-mode .elc-d-catalog-yearpass { background: rgba(30,41,59,.6); color: #f1f5f9; }
.elc-d-catalog-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.elc-d-catalog-row--5 { grid-template-columns: repeat(7, 1fr); }
.elc-d-catalog-heading { margin: 24px 0 12px; font-size: 18px; }
.elc-d-catalog-group:first-child .elc-d-catalog-heading { margin-top: 0; }
.elc-d-catalog-viewmore-wrap { text-align: center; margin: 14px 0 8px; }
.elc-d-catalog-back-btn { margin-bottom: 6px; }
.elc-d-catalog-card { display: block; background: #fff; border: 1px solid var(--d-border); border-radius: var(--d-radius-sm); overflow: hidden; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: box-shadow 0.15s ease, transform 0.15s ease; }
.elc-d-catalog-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.1); transform: translateY(-2px); }
.elc-d-catalog-thumb { display: block; position: relative; aspect-ratio: 4/3; background: radial-gradient(circle at 30% 20%, #4B8EDE 0%, #4B8EDE 55%, #4B8EDE 100%); }
.elc-d-catalog-thumb img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-catalog-thumb-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; color: rgba(255,255,255,.9); }
.elc-d-catalog-card-body { padding: 14px; }
.elc-d-catalog-card-title { display: block; font-weight: 700; color: #1f2937; text-decoration: none; margin-bottom: 8px; line-height: 1.4; }
.elc-d-catalog-attempts { display: block; color: #9ca3af; font-size: 12px; margin: -4px 0 8px; }
.elc-d-price { display: block; font-weight: 700; color: var(--d-primary-dark); margin-bottom: 8px; }
.elc-d-price-free { color: #16a34a; }
/* Nút trong card catalog: card hẹp (5 cột) nên thu nhỏ nút, chia đều bề ngang, không cho chữ xuống dòng. */
.elc-d-catalog-card-body .elc-d-btn { padding: 7px 12px; font-size: 12.5px; white-space: nowrap; text-align: center; }
.elc-d-catalog-empty { color: #6b7280; padding: 40px 0; text-align: center; }
.elc-d-catalog-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.elc-d-catalog-page-btn { background: #fff; border: 1px solid var(--d-border); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-family: inherit; }
.elc-d-catalog-page-btn.active { background: var(--d-primary); color: #fff; border-color: var(--d-primary); }
#elc-dictation-catalog-results.is-loading { opacity: .5; }

/* Old player styles - kept for backward compat */
.elc-d-player-topbar { max-width: 1280px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: var(--d-font); }
.elc-d-player { max-width: 1280px; margin: 0 auto; }
.elc-d-loading { text-align: center; padding: 60px 0; color: #6b7280; }
.elc-d-split { display: flex; gap: 20px; align-items: flex-start; }
.elc-d-left { flex: 0 0 60%; max-width: 60%; background: #fff; border: 1px solid var(--d-border); border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.06); padding: 28px; }
.elc-d-right { flex: 0 0 40%; max-width: 40%; background: #fafafa; border: 1px solid var(--d-border); border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.06); padding: 22px; max-height: 640px; overflow-y: auto; position: sticky; top: 20px; }
.elc-d-right-title { margin: 0 0 14px; font-size: 15px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.elc-d-transline { padding: 8px 12px; border-radius: 10px; margin: 0 0 6px; line-height: 1.6; transition: background 0.2s ease, filter 0.2s ease; }
.elc-d-transline.elc-d-active { background: #EBF7FF; font-weight: 600; }
.elc-d-transline.elc-d-blurred { filter: blur(5px); user-select: none; color: #9ca3af; }
.elc-d-progresstext { font-size: 13px; color: #6b7280; font-weight: 600; margin-bottom: 14px; }
.elc-d-audiobar { display: flex; align-items: center; gap: 10px; background: #f9fafb; border-radius: 999px; padding: 10px 16px; margin-bottom: 22px; flex-wrap: wrap; }
.elc-d-iconbtn { background: #fff; border: 1px solid var(--d-border); border-radius: 999px; width: 36px; height: 36px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.elc-d-iconbtn:hover { background: #EBF7FF; }
.elc-d-playbtn { background: var(--d-primary); color: #fff; border-color: var(--d-primary); width: 42px; height: 42px; font-size: 16px; }
.elc-d-playbtn:hover { background: var(--d-primary-dark); }
.elc-d-seekbar { flex: 1; min-width: 100px; accent-color: var(--d-primary); }
.elc-d-select { border: 1px solid var(--d-border); border-radius: 999px; padding: 6px 10px; font-size: 12px; background: #fff; font-family: inherit; }
.elc-d-blanktext { font-size: 19px; line-height: 1.9; background: #f9fafb; border-radius: 14px; padding: 16px 20px; margin-bottom: 18px; }
.elc-d-blank { display: inline-block; border-bottom: 2px solid var(--d-primary); color: var(--d-primary-dark); font-weight: 700; padding: 0 4px; }

/* Mistakes page */
/* max-width tăng 30% (900px -> 1170px) + bo góc Mac OS đồng bộ với .elc-d-combo-page/.d-card. */
.elc-d-mistakes {
  max-width: 1170px; margin: 0 auto; transform: none !important;
  padding: 32px 24px; background: #fff;
  border: 1px solid var(--d-border, #e2e8f0); border-radius: var(--d-radius, 20px);
  box-shadow: var(--d-shadow-sm, 0 1px 3px rgba(0,0,0,.06));
}
.elc-d-mistake-wrong { color: #dc2626; }
.elc-d-mistake-correct { color: #16a34a; font-weight: 600; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .d-split { flex-direction: column; }
  .d-left, .d-right { flex: 1 1 auto; max-width: 100%; }
  .d-right { position: static; }
  .d-right .d-card { height: auto; max-height: 500px; }
  .d-word-target { font-size: 32px; letter-spacing: 4px; }
}

@media (max-width: 1180px) {
  .elc-d-catalog-row--5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .elc-d-course-layout, .elc-d-catalog-layout { flex-direction: column; }
  .elc-d-hero-left, .elc-d-catalog-filter, .elc-d-catalog-left-stack { width: 100%; }
  .elc-d-catalog-row { grid-template-columns: repeat(2, 1fr); }
  .elc-d-split { flex-direction: column; }
  .elc-d-left, .elc-d-right { max-width: 100%; flex-basis: auto; width: 100%; }
  .elc-d-right { position: static; max-height: 320px; }
}

@media (max-width: 640px) {
  .d-topbar { padding: 12px 16px; }
  .d-split { padding: 0 12px; }
  .d-left .d-card { padding: 20px; }
  .d-right .d-card { padding: 16px; }
  .d-word-target { font-size: 26px; letter-spacing: 3px; }
  .d-actions { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .elc-d-catalog-row { grid-template-columns: 1fr; }
}

/* ===== Print ===== */
@media print {
  .d-dictation-app { background: #fff; color: #000; }
  .d-topbar, .d-progress-wrap, .d-audio-controls, .d-btn, .d-dark-toggle { display: none !important; }
  .d-split { flex-direction: column; }
  .d-left, .d-right { max-width: 100%; flex: 1; }
}


/* ===== Thu vien bai Dictation + langswitch + gamification row ===== */
.elc-d-langswitch { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px auto 18px; }
.elc-d-langbtn { padding: 8px 22px; border: 1px solid #dce3eb; border-radius: 999px; background: #fff; color: #3d485a; font: 600 14px/1 Inter,sans-serif; text-decoration: none; }
.elc-d-langbtn:hover { border-color: #4b8ede; color: #4b8ede; }
.elc-d-langbtn.active { border-color: #4b8ede; background: #4b8ede; color: #fff; }
.elc-d-gamification-row { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: start; margin-top: 30px; }
.elc-d-gamification-reserved { min-height: 1px; }
@media (max-width: 900px) { .elc-d-gamification-row { grid-template-columns: 1fr; } }
.elc-d-continue-reading {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 12px;
	margin-bottom: 32px;
}

@media (max-width: 900px) {
	.elc-d-continue-reading {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 560px) {
	.elc-d-continue-reading {
		grid-template-columns: repeat(2, 1fr);
	}
}

.elc-d-continue-card {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	padding: 10px;
	border-radius: 10px;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.elc-d-continue-card:hover {
	background: #EBF7FF;
	transform: translateY(-2px);
}

.elc-d-continue-cover {
	width: 48px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.elc-d-continue-cover-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #EBF7FF;
	font-size: 20px;
}

.elc-d-continue-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.elc-d-continue-title {
	font-size: 14px;
	font-weight: 600;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.elc-d-popular {
	margin-bottom: 32px;
}

.elc-d-popular-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.elc-d-popular-heading {
	font-size: 20px;
	font-weight: 700;
	color: #1f2937;
	margin: 0;
}

.elc-d-popular-shuffle {
	background: none;
	border: none;
	color: #4B8EDE;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	padding: 6px 10px;
	border-radius: 8px;
	transition: background-color 0.15s ease;
}

.elc-d-popular-shuffle:hover {
	background: #EBF7FF;
}

.elc-d-popular-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 160px));
	gap: 16px;
	justify-content: start;
}

@media (max-width: 900px) {
	.elc-d-popular-grid {
		grid-template-columns: repeat(3, minmax(0, 140px));
	}
}

@media (max-width: 560px) {
	.elc-d-popular-grid {
		grid-template-columns: repeat(2, minmax(0, 140px));
	}
}

.elc-d-popular-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	text-decoration: none;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.elc-d-popular-card:hover {
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.elc-d-popular-cover {
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	display: block;
	background: #EBF7FF;
}

.elc-d-popular-cover-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
}

.elc-d-popular-title {
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	padding: 8px 10px 2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.elc-d-popular-sub {
	font-size: 11px;
	color: #6b7280;
	padding: 0 10px 10px;
}

.elc-d-continue-progress {
	font-size: 12px;
	color: #6b7280;
}

/* ===== Thanh tìm kiếm sách kiểu WeRead/macOS (shortcode [elc_sach_search]) =====
   Selector viết dư bậc (.elc-d-search-box form... + [type="text"]) CỐ Ý để
   thắng CSS input mặc định của theme Blocksy - trước đây rule 1 class bị theme
   đè mất border-radius/padding nên icon kính lúp đè lên chữ placeholder. */
.elc-d-search-box {
	max-width: 480px;
	margin: 0 auto 32px;
}

.elc-d-search-box form.elc-d-search-box-form {
	position: relative;
	display: flex;
	align-items: center;
	margin: 0;
}

.elc-d-search-box form.elc-d-search-box-form svg {
	position: absolute;
	left: 18px;
	top: 50%;
	width: 18px;
	height: 18px;
	transform: translateY(-50%);
	color: #9ca3af;
	pointer-events: none;
	z-index: 1;
}

.elc-d-search-box form.elc-d-search-box-form input[type="text"] {
	width: 100%;
	box-sizing: border-box;
	font-size: 15px;
	line-height: 1.4;
	color: #1f2937;
	background: #f0f1f3;
	border: none;
	border-radius: 999px;
	padding: 13px 20px 13px 50px;
	outline: none;
	box-shadow: none;
	transition: background 0.15s ease, box-shadow 0.15s ease;
}

.elc-d-search-box form.elc-d-search-box-form input[type="text"]::placeholder {
	color: #9ca3af;
}

.elc-d-search-box form.elc-d-search-box-form input[type="text"]:focus {
	background: #fff;
	border: none;
	box-shadow: 0 0 0 3px rgba(75, 142, 222, 0.15), 0 1px 6px rgba(0, 0, 0, 0.08);
}

.elc-d-catalog-card.elc-d-search-hidden {
	display: none !important;
}

/* Stoody Reading library — WeRead-inspired catalogue, reader logic untouched. */
body:has(.elc-d-library) { background: #f5f7fa; }
body:has(.elc-d-library) .entry-header,
body:has(.elc-d-library) .page-title,
body:has(.elc-d-library) [class*="mobile-cart"],
body:has(.elc-d-library) [class*="book-cart"] { display: none !important; }
.elc-d-library, .elc-d-library * { box-sizing: border-box; }
.elc-d-library {
	--elc-d-blue: #4b8ede; --elc-d-pale: #ebf7ff; --elc-d-ink: #17233b; --elc-d-muted: #6d7a90;
    width: 78%; max-width: 1500px; margin: 22px auto 72px;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--elc-d-ink);
}
.elc-d-library-hero {
	padding: 34px 20px 36px; text-align: center; border: 0; border-radius: 0; background: transparent;
}
.elc-d-library-brand { display: flex; min-height: 52px; align-items: center; justify-content: center; }
.elc-d-library-brand-text { color: #111827; font: 800 32px/1.15 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing: -.025em; }
.elc-d-library-logo { display: block; width: auto; max-width: min(300px,75vw); height: auto; max-height: 68px; object-fit: contain; }
.elc-d-library .elc-d-search-box { width: min(740px, 100%); max-width: none; margin: 26px auto 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.elc-d-library .elc-d-search-box form.elc-d-search-box-form {
	height: 54px; padding: 0; border: 0; border-radius: 999px; background: #fff; box-shadow: none;
}
.elc-d-library .elc-d-search-box form.elc-d-search-box-form input[type="text"] {
	height: 54px; margin: 0; padding: 0 24px 0 52px; border: 0 !important; border-radius: 999px !important;
	background: transparent !important; box-shadow: none !important; font: 500 15px/1.2 Inter,sans-serif;
}
.elc-d-library .elc-d-search-box form.elc-d-search-box-form input[type="text"]:focus { background: transparent !important; box-shadow: none !important; }
.elc-d-library .elc-d-catalog-yearpass { margin: 22px 0 0; }
.elc-d-library-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.elc-d-library-section-head h2 { margin: 0; font-size: clamp(20px, 2vw, 26px); line-height: 1.35; letter-spacing: -.02em; }
.elc-d-library-section-head > a { flex: none; font-size: 14px; font-weight: 700; color: var(--elc-d-blue); }
.elc-d-library-continue, .elc-d-ranking, .elc-d-categories, .elc-d-library-subpage { margin-top: 30px; }
.elc-d-library .elc-d-continue-reading { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.elc-d-library .elc-d-continue-card { min-height: 112px; padding: 16px; border: 1px solid #e4eaf1; border-radius: 16px; background: #fff; box-shadow: none; }
.elc-d-library .elc-d-continue-card:hover { transform: translateY(-2px); border-color: #bfd8f5; box-shadow: 0 12px 30px rgba(40,71,107,.09); }
.elc-d-ranking-stack { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 20px 24px; margin-top: 30px; }
.elc-d-ranking { margin: 0; padding: 24px; border: 1px solid #e3e9f0; border-radius: 20px; background: #fff; box-shadow: 0 10px 30px rgba(30,55,85,.055); }
.elc-d-ranking-title-content { min-width: 0; }
.elc-d-ranking-title-content > :first-child { margin-top: 0; }
.elc-d-ranking-title-content > :last-child { margin-bottom: 0; }
.elc-d-ranking .elc-d-ranking-title-content h2 { margin: 0; font-size: 17px; line-height: 1.5; }
.elc-d-ranking-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 22px; }
.elc-d-ranking-card {
	display: grid; grid-template-columns: 28px 54px minmax(0,1fr); align-items: center; gap: 10px; min-width: 0;
	padding: 13px 0; border-top: 1px solid #edf0f4; color: inherit; text-decoration: none;
}
.elc-d-ranking-card:nth-child(-n+2) { border-top: 0; }
.elc-d-ranking-number { font-size: 17px; font-weight: 800; color: var(--elc-d-blue); }
.elc-d-ranking-cover { display: flex; width: 54px; height: 72px; align-items: center; justify-content: center; overflow: hidden; border-radius: 5px; background: var(--elc-d-pale); box-shadow: 0 5px 14px rgba(31,52,77,.12); }
.elc-d-ranking-cover img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-ranking-placeholder { font: 800 22px/1 Georgia,serif; color: var(--elc-d-blue); }
.elc-d-ranking-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.elc-d-ranking-copy strong, .elc-d-ranking-copy span, .elc-d-ranking-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-ranking-copy strong { font-size: 14px; transition: color .18s ease; }
.elc-d-ranking-copy span, .elc-d-ranking-copy small { font-size: 12px; color: var(--elc-d-muted); }
.elc-d-ranking-card:hover .elc-d-ranking-copy strong { color: var(--elc-d-blue); }
.elc-d-categories { padding: 28px; border-radius: 20px; background: #eef2f6; }
.elc-d-category-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.elc-d-category-card { display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 16px; border: 1px solid #e0e7ef; border-radius: 14px; background: #fff; color: inherit; text-decoration: none; transition: transform .18s ease,border-color .18s ease,box-shadow .18s ease; }
.elc-d-category-card:hover { transform: translateY(-2px); border-color: #bcd7f5; box-shadow: 0 12px 28px rgba(40,71,107,.08); }
.elc-d-category-mark { display: grid; width: 52px; height: 64px; flex: none; place-items: center; border-radius: 8px 12px 12px 8px; background: linear-gradient(145deg,#4b8ede,#78afe9); font: 800 22px/1 Georgia,serif; color: #fff; }
.elc-d-category-card > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.elc-d-category-card strong { font-size: 15px; }
.elc-d-category-card small { font-size: 12px; color: var(--elc-d-muted); }
.elc-d-library-subpage { padding: 26px; border: 1px solid #e3e9f0; border-radius: 20px; background: #fff; }
.elc-d-library-back { display: inline-flex; margin-bottom: 22px; font-size: 14px; font-weight: 700; color: var(--elc-d-blue); }
.elc-d-library .elc-d-catalog-row { grid-template-columns: repeat(5,minmax(0,1fr)); }
.elc-d-library .elc-d-search-hidden { display: none !important; }
.elc-d-library *, .elc-d-library *::before, .elc-d-library *::after { animation: none !important; }
@media (max-width: 1024px) {
	.elc-d-ranking-stack { grid-template-columns: 1fr; }
	.elc-d-ranking-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
	.elc-d-library .elc-d-continue-reading, .elc-d-category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
	.elc-d-library .elc-d-catalog-row { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 640px) {
	.elc-d-library { width: min(100% - 24px,1240px); margin-top: 12px; }
	.elc-d-library-hero { padding: 24px 10px 28px; }
	.elc-d-library-brand-text { font-size: 27px; }
	.elc-d-ranking { padding: 18px; }
	.elc-d-ranking-grid, .elc-d-library .elc-d-continue-reading, .elc-d-category-grid { grid-template-columns: 1fr; }
	.elc-d-ranking-card:nth-child(2) { border-top: 1px solid #edf0f4; }
	.elc-d-categories { padding: 20px; }
	.elc-d-library .elc-d-catalog-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Lớp tìm kiếm thư viện độc lập, không tải lại/lọc trang Sách phía sau. */
body.elc-d-library-search-open { overflow: hidden !important; }

/* Gợi ý ngẫu nhiên kiểu WeRead: bìa lớn, tác giả rõ, đổi nhóm không tải trang. */
.elc-d-random { margin: 34px 0 42px; }
.elc-d-random .elc-d-library-section-head { margin-bottom: 18px; }
.elc-d-random-refresh {
	padding: 0; border: 0; background: transparent; box-shadow: none; color: #4b8ede;
	font: 600 14px/1.4 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; cursor: pointer;
}
.elc-d-random-refresh:hover { color: #2f78ca; background: transparent; transform: none; }
.elc-d-random-refresh:disabled { opacity: .55; cursor: wait; }
.elc-d-random-toolbar { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.elc-d-random-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 16px; transition: opacity .16s ease; }
.elc-d-random-grid.is-loading { opacity: .46; }
.elc-d-random-card {
	display: flex; min-width: 0; min-height: 350px; align-items: center; flex-direction: column; justify-content: center;
	padding: 30px 18px 26px; border-radius: 12px; background: #fff; color: #17233b; text-align: center; text-decoration: none;
}
.elc-d-random-cover {
	display: grid; width: 112px; height: 164px; place-items: center; overflow: hidden; margin-bottom: 24px; border-radius: 3px;
	background: #ebf7ff; color: #4b8ede; font: 800 30px/1 Georgia,serif; box-shadow: 0 7px 22px rgba(35,55,80,.1);
}
.elc-d-random-cover img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-random-card strong { max-width: 100%; overflow: hidden; font: 600 16px/1.45 Inter,sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-random-author { max-width: 100%; overflow: hidden; margin-top: 9px; color: #7a8799; font: 400 14px/1.4 Inter,sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-random-card:hover { color: #4b8ede; transform: translateY(-2px); }
@media (max-width: 900px) { .elc-d-random-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) {
	.elc-d-random-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
	.elc-d-random-card { min-height: 270px; padding: 22px 10px 20px; }
	.elc-d-random-cover { width: 88px; height: 130px; margin-bottom: 18px; }
}

.elc-d-library-search-overlay[hidden] { display: none !important; }
.elc-d-library-search-overlay {
	position: fixed; inset: 0; z-index: 2147483000; overflow-y: auto; padding: clamp(90px,16vh,180px) 20px 60px;
	background: #f0f1f3; opacity: 0; transition: opacity .16s ease;
	font-family: Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; color: #17233b;
}
.elc-d-library-search-overlay.is-open { opacity: 1; }
.elc-d-library-search-shell { width: min(740px,100%); margin: 0 auto; }
.elc-d-library-search-topbar { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 16px; align-items: center; margin-bottom: 22px; }
.elc-d-library-search-back {
	display: grid; width: 52px; height: 52px; padding: 0; place-items: center; border: 0; border-radius: 50%;
	background: #fff; color: #8793a4; box-shadow: none; font: 300 36px/1 Inter,sans-serif; cursor: pointer;
}
.elc-d-library-search-back:hover { background: #fff; color: #4b8ede; transform: none; }
.elc-d-library-search-form {
	display: grid; height: 54px; grid-template-columns: 42px minmax(0,1fr) 44px; align-items: center;
	margin: 0; padding: 0 9px 0 14px; border-radius: 999px; background: #fff;
}
.elc-d-library-search-form > svg, .elc-d-library-search-form button svg {
	width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.elc-d-library-search-form > svg { justify-self: center; color: #8a96a7; }
.elc-d-library-search-form input[type="search"] {
	width: 100%; height: 52px; margin: 0; padding: 0; border: 0 !important; border-radius: 0 !important;
	background: transparent !important; box-shadow: none !important; outline: 0; color: #17233b; font: 500 16px/1 Inter,sans-serif;
}
.elc-d-library-search-form input[type="search"]::-webkit-search-cancel-button { display: none; }
.elc-d-library-search-form button {
	display: grid; width: 36px; height: 36px; padding: 0; place-items: center; justify-self: end; border: 0; border-radius: 50%;
	background: #f5f6f8; color: #8a96a7; box-shadow: none; cursor: pointer;
}
.elc-d-library-search-form button:hover { background: #ebf7ff; color: #4b8ede; transform: none; }
.elc-d-library-search-card { overflow: hidden; border: 0; border-radius: 14px; background: #fff; box-shadow: none; }
.elc-d-library-search-label { padding: 22px 20px 10px; font-size: 14px; color: #607087; }
.elc-d-library-search-status { padding: 8px 20px 16px; font-size: 13px; color: #8a96a7; }
.elc-d-library-search-results { transition: opacity .12s ease; }
.elc-d-library-search-results.is-loading { opacity: .45; }
.elc-d-search-result {
	display: grid; min-height: 132px; grid-template-columns: 74px minmax(0,1fr) 24px; gap: 16px; align-items: center;
	margin: 0 20px; padding: 14px 0; border-top: 1px solid #e7e9ed; color: inherit; text-decoration: none;
}
.elc-d-search-result:first-child { border-top: 0; }
.elc-d-search-result-cover {
	display: grid; width: 72px; height: 104px; place-items: center; overflow: hidden; border-radius: 4px;
	background: #ebf7ff; color: #4b8ede; font: 800 25px/1 Georgia,serif; box-shadow: 0 4px 12px rgba(31,52,77,.1);
}
.elc-d-search-result-cover img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-search-result-copy { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.elc-d-search-result-copy strong { overflow: hidden; color: #367fcf; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-search-result-copy span { overflow: hidden; color: #7a8799; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-search-result-arrow { color: #b3bbc6; font-size: 24px; }
.elc-d-search-result:hover .elc-d-search-result-copy strong { color: #246ebf; }
.elc-d-search-empty { display: flex; min-height: 220px; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 36px; text-align: center; }
.elc-d-search-empty strong { font-size: 17px; }
.elc-d-search-empty span { color: #8793a4; font-size: 14px; }
@media (max-width: 640px) {
	.elc-d-library-search-overlay { padding: 24px 12px 40px; }
	.elc-d-library-search-topbar { grid-template-columns: 44px minmax(0,1fr); gap: 10px; }
	.elc-d-library-search-back { width: 44px; height: 44px; font-size: 31px; }
	.elc-d-library-search-form { height: 48px; grid-template-columns: 34px minmax(0,1fr) 38px; }
	.elc-d-library-search-form input[type="search"] { height: 46px; font-size: 15px; }
	.elc-d-search-result { min-height: 112px; grid-template-columns: 58px minmax(0,1fr) 16px; gap: 12px; margin: 0 14px; }
	.elc-d-search-result-cover { width: 56px; height: 82px; }
	.elc-d-search-result-copy strong { font-size: 14px; }
	.elc-d-search-result-copy span { font-size: 12px; }
}

/* One destination for rankings and categories: category rail + book results. */
.elc-d-library-browser {
	display: grid; width: min(1320px,calc(100% - 40px)); grid-template-columns: 310px minmax(0,1fr);
	overflow: hidden; margin: 28px auto 48px; border-radius: 18px; background: #fff;
	color: #17233b; font-family: Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.elc-d-library-sidebar {
	padding: 26px 18px 34px; border-right: 1px solid #e5e9ef; background: #fbfcfd;
}
.elc-d-library-sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.elc-d-library-sidebar h3 {
	margin: 22px 12px 8px; color: #8793a4; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.elc-d-library-sidebar-link {
	display: flex; min-height: 44px; align-items: center; justify-content: flex-start; gap: 12px;
	padding: 12px 14px; border-radius: 9px; color: #3d485a; font-size: 14px; font-weight: 700; line-height: 1.45; text-decoration: none;
}
.elc-d-library-sidebar-link:hover { background: #ebf7ff; color: #367fcf; }
.elc-d-library-sidebar-link.is-active { background: #4b8ede; color: #fff; }
.elc-d-library-category-link { min-height: 44px; }
.elc-d-library-category-link .elc-d-category-mark { width: 46px; height: 64px; flex: 0 0 46px; overflow: hidden; border-radius: 4px; }
.elc-d-library-category-link .elc-d-category-mark img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-library-category-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.elc-d-library-category-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-library-category-copy small { font-size: 12px; font-weight: 500; opacity: .72; }
.elc-d-library-browser-content { min-width: 0; padding: 28px 42px 48px; }
.elc-d-library-back {
	display: inline-flex; margin-bottom: 18px; color: #4b8ede; font-size: 14px; font-weight: 700; text-decoration: none;
}
.elc-d-library-browser-results > h2 { margin: 0 0 8px; color: #17233b; font-size: 28px; line-height: 1.3; }
.elc-d-library-browser-results.is-loading { opacity: .48; pointer-events: none; }
.elc-d-library-book-list { display: flex; flex-direction: column; }
.elc-d-library-book-row {
	display: grid; min-width: 0; grid-template-columns: 34px 100px minmax(0,1fr); gap: 24px; align-items: center;
	padding: 24px 18px; border-top: 1px solid #e5e9ef; border-radius: 10px; color: #17233b; text-decoration: none;
}
.elc-d-library-book-row:first-child { border-top: 0; }
.elc-d-library-book-rank { color: #65748a; font-size: 18px; text-align: center; }
.elc-d-library-book-cover {
	display: grid; width: 100px; height: 142px; place-items: center; overflow: hidden; border-radius: 4px;
	background: #ebf7ff; color: #4b8ede; font: 800 28px/1 Georgia,serif; box-shadow: 0 7px 20px rgba(31,52,77,.1);
}
.elc-d-library-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.elc-d-library-book-copy { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.elc-d-library-book-copy strong { overflow: hidden; font-size: 18px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.elc-d-library-book-copy span { color: #607087; font-size: 14px; }
.elc-d-library-book-copy small {
	display: -webkit-box; overflow: hidden; color: #8793a4; font-size: 14px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.elc-d-library-book-row:hover { background: #f3f5f7; }
.elc-d-library-book-row:hover .elc-d-library-book-copy strong { color: #367fcf; }
.elc-d-library-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 28px; }
.elc-d-library-page-btn { min-width: 38px; height: 38px; padding: 0 11px; border: 1px solid #dce3eb; border-radius: 8px; background: #fff; color: #3d485a; cursor: pointer; font: 700 14px/1 Inter,sans-serif; }
.elc-d-library-page-btn:hover { border-color: #4b8ede; color: #4b8ede; }
.elc-d-library-page-btn.is-active { border-color: #4b8ede; background: #4b8ede; color: #fff; }
.elc-d-library-book-empty { padding: 70px 20px; color: #8793a4; text-align: center; }
@media (max-width: 760px) {
	.elc-d-library-browser { width: calc(100% - 20px); grid-template-columns: 1fr; margin-top: 16px; }
	.elc-d-library-sidebar { padding: 16px; border-right: 0; border-bottom: 1px solid #e5e9ef; }
	.elc-d-library-sidebar nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
	.elc-d-library-sidebar h3 { grid-column: 1 / -1; }
	.elc-d-library-browser-content { padding: 24px 18px 36px; }
	.elc-d-library-book-row { grid-template-columns: 24px 76px minmax(0,1fr); gap: 13px; padding: 18px 0; }
	.elc-d-library-book-cover { width: 76px; height: 108px; }
	.elc-d-library-book-copy strong { font-size: 15px; }
	.elc-d-library-book-copy span, .elc-d-library-book-copy small { font-size: 12px; }
}
