/* Dark theme palette - exact hex values from wombat_narrates_gui.py's own
   module-level constants (see briefs/WOMBAT-NARRATES-WEB-FRONTEND-BRIEF.md
   Section 2), reused here so the website and desktop app feel like the
   same product. */
:root {
  --bg-main: #111315;
  --bg-accent: #2b3138;
  --bg-accent-active: #3a4149;
  --fg-main: #f3f4f6;
  --fg-muted: #aeb6bf;
  --fg-status-speaking: #9fc6ff;
  --fg-status-error: #ff9b9b;
  --grade-a: #5fd97a;
  --grade-c: #e0c168;
  /* Frosted glass look, shared by tabs and secondary buttons (30 Nov 2026). */
  --frost-bg: rgba(255, 255, 255, 0.06);
  --frost-bg-hover: rgba(255, 255, 255, 0.14);
  --frost-bg-active: rgba(255, 255, 255, 0.18);
  --frost-border: rgba(255, 255, 255, 0.12);
  --frost-border-strong: rgba(255, 255, 255, 0.24);
  --frost-blur: 8px;
  --danger-bg: rgba(229, 83, 75, 0.10);
  --danger-bg-hover: rgba(229, 83, 75, 0.22);
  --danger-border: rgba(229, 83, 75, 0.30);
  --danger-border-strong: rgba(229, 83, 75, 0.50);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg-main);
  color: var(--fg-main);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  min-height: 100vh;
}

.banner {
  display: block;
  /* Same 20px side margin as the pages, so banner and pages line up at
     every screen size (max 900px = page content width). */
  width: calc(100% - 40px);
  max-width: 900px;
  margin: 16px auto 0;
  height: auto;
  border-radius: 10px;
}

/* Every tab is the banner's width (900px banner + 20px padding each side),
   so all pages line up with the wombat picture; on smaller screens the
   banner and the pages shrink together (Rocky, 30 Nov 2026). */
.view {
  max-width: 940px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* Administration contains real operational tables, so it gets a wide
   workspace without changing the deliberately compact normal app screens. */
.view.admin-active {
  max-width: 1500px;
}

.view[hidden] {
  display: none;
}

h1 {
  font-size: 1.6rem;
  margin: 0.2em 0;
}

.wombat-tagline {
  margin: 0 0 0.35rem;
  color: var(--fg-muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.15rem;
  margin-top: 0;
}

.muted {
  color: var(--fg-muted);
}

.app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.signed-in-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.card {
  background: var(--bg-accent);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
}

.prepared-import {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--fg-status-speaking);
  border-radius: 8px;
}

.prepared-import .btn-secondary { margin-right: 8px; }

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.field input[type="text"],
.field input[type="search"],
.field input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-main);
  color: var(--fg-main);
  border: 1px solid var(--bg-accent-active);
  border-radius: 6px;
  font-size: 1rem;
}

.field select {
  width: 100%; padding: 8px 10px; background: var(--bg-main); color: var(--fg-main);
  border: 1px solid var(--bg-accent-active); border-radius: 6px; font-size: 1rem;
}

.narration-plan { margin: 16px 0; padding: 14px; border: 1px solid var(--bg-accent-active); border-radius: 8px; }
.narration-chapter { display: block; padding: 5px 0; }

button {
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--fg-status-speaking);
  color: var(--bg-main);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: bold;
}

.btn-primary:disabled {
  background: var(--bg-accent-active);
  color: var(--fg-muted);
  opacity: 1;
  cursor: not-allowed;
}

.edit-epub-advice { margin: 4px 0 20px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.edit-epub-advice p { margin: 8px 0; }
.edit-epub-divider { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.edit-epub-action { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.edit-epub-action .btn-primary { margin: 0; }
.ready-to-convert { margin: 0 0 16px; }

.login-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-secondary {
  background: transparent;
  color: var(--fg-main);
  border: 1px solid var(--bg-accent-active);
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: bold;
}

/* Bold+larger rather than underlined - matches the desktop app's Help/
   Contact link styling (see docs/PROJECT-DECISIONS.md, link-style entry). */
.btn-link {
  background: none;
  border: none;
  color: var(--fg-status-speaking);
  font-weight: bold;
  font-size: 1.05rem;
  padding: 0;
}

.status {
  font-weight: bold;
}

.log {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--fg-muted);
  white-space: pre-wrap;
  margin-top: 8px;
}

#listen-along {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-accent-active);
}

#listen-along h3 {
  margin: 0 0 4px;
}

.chapter-row {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
}

.chapter-row:hover {
  background: var(--bg-accent-active);
}

.chapter-row.playing {
  background: var(--bg-accent-active);
  font-weight: bold;
  color: var(--fg-status-speaking);
}

#chapter-audio {
  margin-top: 10px;
}

#download-area a {
  display: inline-block;
  margin-top: 10px;
  font-weight: bold;
  font-size: 1.05rem;
  color: var(--grade-a);
}

.library-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.library-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.library-table th,
.library-table td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--bg-accent-active);
}

.library-table th {
  color: var(--fg-muted);
}

.library-table td:nth-child(2) {
  font-weight: bold;
}

.library-table th:nth-child(2),
.library-table td:nth-child(2) {
  min-width: 190px;
}

.library-sort-button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  text-align: left;
}

.library-sort-button:hover {
  color: var(--fg-main);
}

.library-quick-actions {
  display: flex;
  gap: 6px;
  min-width: 118px;
}

.library-quick-action {
  min-width: 34px;
  padding: 5px 6px;
  font-size: 1.2rem;
  line-height: 1;
}

.admin-storage-settings {
  margin: 22px 0;
  padding: 14px;
  border: 1px solid var(--bg-accent-active);
  border-radius: 8px;
  max-width: 460px;
}

.admin-storage-settings h3 {
  margin-top: 0;
}

.admin-quota-field {
  margin-bottom: 10px;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-user-actions .btn-secondary {
  padding: 6px 9px;
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  border-bottom: 1px solid var(--bg-accent-active);
}

.tab-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-weight: bold;
  padding: 8px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--fg-main);
  border-bottom-color: var(--fg-status-speaking);
}

/* Real link (navigates away to the WombatEx hub), not a .tab-btn -
   deliberately outside that selector so initTabs()'s click handler (which
   expects a data-tab panel to switch to) never touches it. */
.tab-link {
  flex: 0 0 auto;
  color: var(--fg-muted);
  font-weight: bold;
  padding: 8px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}

.tab-link:hover {
  color: var(--fg-main);
}

.panel[hidden] {
  display: none;
}

.admin-summary {
  margin: 6px 0;
}

.admin-search-field {
  max-width: 560px;
  margin: 0 0 4px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin: 8px 0 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--bg-accent-active);
}

.admin-table th {
  color: var(--fg-muted);
}

.admin-sort-button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  text-align: left;
}

.admin-sort-button:hover {
  color: var(--fg-main);
}

textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-main);
  color: var(--fg-main);
  border: 1px solid var(--bg-accent-active);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

audio {
  width: 100%;
  margin-top: 10px;
}

#btn-preview-play,
#btn-preview-stop {
  margin-right: 8px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--fg-status-speaking);
}

.voice-section {
  margin-top: 14px;
}

.voice-section-heading {
  font-weight: bold;
  margin-bottom: 6px;
}

.voice-columns {
  display: flex;
  gap: 16px;
}

.voice-column {
  flex: 1;
  min-width: 0;
}

.voice-column-heading {
  color: var(--fg-muted);
  font-style: italic;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.voice-row span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grade-badge {
  font-weight: bold;
  font-size: 0.85rem;
  width: 2em;
  text-align: right;
}

.help-section {
  margin-bottom: 18px;
}

.help-heading {
  font-weight: bold;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.help-section p {
  color: var(--fg-muted);
  margin: 0;
}

.wombatex-link {
  display: block;
  margin-top: 20px;
}

.attribution {
  color: var(--fg-muted);
  font-style: italic;
  font-size: 0.8rem;
  margin-top: 4px;
}

.italic {
  font-style: italic;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--bg-accent);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.modal-box .btn-primary,
.modal-box .btn-secondary {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.contact-title {
  margin: 0;
}

.contact-title-main {
  display: block;
  font-size: 1.4rem;
}

.contact-title-sub {
  display: block;
  font-size: 0.95rem;
  font-weight: normal;
  color: var(--fg-muted);
  margin-top: 2px;
}

.contact-image {
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 12px;
}

.contact-link {
  display: block;
  margin: 8px 0;
  text-decoration: none;
}


/* Premium Voices tab (Qwen premium voices brief, Phase 4) */
.tab-premium { color: #f0d27a; }
.premium-locked-note { padding: 12px; border: 1px dashed #f0d27a; border-radius: 8px; }
.premium-active-box { margin: 8px 0 16px; padding: 12px; border: 1px solid #f0d27a; border-radius: 8px; }
.premium-active-box .btn-secondary, .premium-active-box .btn-primary { margin-right: 8px; }
.premium-voice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 16px; }
.premium-voice-card { border: 1px solid var(--bg-accent-active); border-radius: 8px; padding: 10px; cursor: pointer; background: var(--bg-main); }
.premium-voice-card.selected { border-color: #f0d27a; box-shadow: 0 0 0 1px #f0d27a; }
.premium-voice-card strong { display: block; }
.premium-voice-card p { margin: 4px 0 8px; font-size: 0.85rem; color: var(--fg-muted); }
.premium-voice-card button { margin-right: 6px; }
.premium-slider-labels { display: flex; justify-content: space-between; color: var(--fg-muted); font-size: 0.85rem; margin-bottom: 14px; }
#premium-expr { width: 100%; accent-color: #f0d27a; }
.premium-advanced { margin-bottom: 14px; }
.premium-advanced summary { cursor: pointer; color: var(--fg-muted); margin-bottom: 8px; }
.premium-lab { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--bg-accent-active); }
.lab-examples { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.lab-examples button { font-size: 0.8rem; }
.lab-take { border-top: 1px solid var(--bg-accent-active); padding-top: 10px; margin-top: 10px; }
.lab-take .muted { font-size: 0.85rem; }
.lab-take input { margin-right: 6px; }
.engine-banner { margin: 8px 0 12px; padding: 10px 12px; border: 1px solid #f0d27a; border-radius: 8px; }
.engine-banner .btn-secondary { margin-left: 10px; }

/* My Pronunciations (30 Nov 2026) */
.word-modal-box {
  text-align: left;
}

.word-modal-box h2 {
  text-align: center;
}

.words-table td:nth-child(2) {
  font-weight: normal;
}

.words-action {
  margin: 2px 4px 2px 0;
  padding: 4px 10px;
  white-space: nowrap;
}

/* Names in this book (Preview tab, 30 Nov 2026) */
.names-section {
  margin-top: 20px;
}

.names-sentence {
  font-size: 0.8rem;
  margin-top: 2px;
  max-width: 420px;
}

/* My Books (30 Nov 2026) */
.book-card {
  border: 1px solid var(--bg-accent-active);
  border-radius: 10px;
  margin: 10px 0;
  overflow: hidden;
}

.book-card-head {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  cursor: pointer;
}

.book-card-head:hover {
  background: var(--bg-accent);
}

.book-title {
  display: block;
  font-weight: bold;
}

.book-meta {
  display: block;
  font-size: 0.85rem;
  margin-top: 2px;
}

.book-card-body {
  padding: 4px 14px 12px;
}

.book-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 0;
  border-top: 1px solid var(--bg-accent-active);
}

.book-file-label {
  font-weight: 600;
}

.book-file-detail {
  font-size: 0.85rem;
  flex: 1 1 140px;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--bg-accent-active);
}

/* Ordinary links: the same blue as Sign out, never the browser's visited
   purple (Rocky, 30 Nov 2026). The Home tab link keeps its own style. */
a:not(.tab-link),
a:not(.tab-link):visited {
  color: var(--fg-status-speaking);
  font-weight: bold;
}

a:not(.tab-link):hover {
  color: var(--fg-main);
}

/* Converts' reader/editor modal, copied from Wombat Converts static/style.css
   (commit be1f032) so the editor looks and feels the same. */
.handoff-guidance {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--bg-accent-active);
  border-radius: 8px;
  text-align: left;
}

.handoff-guidance p { margin: 6px 0 10px; }
.handoff-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.modal-box.preview-modal-box {
  width: min(1300px, 92vw);
  height: min(92vh, 1400px);
  min-width: 320px;
  min-height: 300px;
  max-width: 95vw;
  max-height: 95vh;
  resize: both;
  overflow: hidden;
  flex: none;
  display: flex;
  flex-direction: column;
}

#btn-close-preview {
  align-self: flex-end;
  margin-bottom: 8px;
}

#preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #f5f0e8;
}

@media (max-width: 640px) {
  #preview-modal.modal-overlay {
    padding: 0;
  }

  .modal-box.preview-modal-box {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    resize: none;
    padding: 0;
  }

  #btn-close-preview {
    display: none;
  }

  #preview-frame {
    border-radius: 0;
  }
}

.handoff-actions .btn-primary {
  display: inline-block;
  width: auto;
  margin-top: 0;
}

/* Names list: Good tickbox column (30 Nov 2026) */

.names-table {
  table-layout: auto;
}

/* Three columns: Good | name, count and sentence (wraps, takes the spare
   width) | ▶ Fix (never wraps, never cut off). */
.names-table td.names-name {
  width: 100%;
  font-weight: normal;
  white-space: normal;
  overflow-wrap: anywhere;
}

.names-table .names-sentence {
  max-width: none;
}

.names-table .names-count {
  font-size: 0.8rem;
}

.names-table td.names-actions {
  text-align: right;
}

.names-table td:first-child,
.names-table th:first-child {
  width: 1%;
  white-space: nowrap;
}

.names-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.names-good-label {
  cursor: pointer;
  white-space: nowrap;
}

/* Saved words: word + "said as" | buttons (30 Nov 2026) */
.saved-words-table td.saved-word {
  width: 100%;
  font-weight: normal;
  overflow-wrap: anywhere;
}

/* Buttons stay side by side; their column is sized to fit them and the text
   column takes the rest. Only on a very narrow phone may the saved-words
   buttons (three of them) wrap onto a second row. */
.action-group {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.action-group .words-action {
  margin: 0;
  white-space: nowrap;
}

.names-table td.names-actions,
.saved-words-table td.saved-word-actions {
  width: 1%;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .saved-words-table .action-group {
    flex-wrap: wrap;
  }
}

/* The general .library-table rule gives column 2 a 190px minimum; the button
   columns here should size to their buttons instead. */
.saved-words-table td.saved-word-actions,
.names-table td.names-actions {
  min-width: 0;
  font-weight: normal;
}

/* Tabs with an emoji were taller than plain-text tabs (e.g. "Preview"), so
   their text sat at different heights. Same line height, centred. */
.tabs {
  align-items: stretch;
}

.tab-btn,
.tab-link {
  display: inline-flex;
  align-items: center;
  line-height: 1.25;
}

/* display:inline-flex above would otherwise override the hidden attribute
   (it un-hid the admin tab for everyone, 30 Nov 2026). */
.tab-btn[hidden],
.tab-link[hidden] {
  display: none;
}

/* Anything marked hidden stays hidden, whatever display rule a class sets
   (class rules like .modal-box .btn-primary { display: block } otherwise
   override the browser's own [hidden] style). */
[hidden] {
  display: none !important;
}

/* My Books storage meter (30 Nov 2026) */
.storage-meter {
  margin: 12px 0;
}

.storage-text {
  margin: 0 0 6px;
  font-weight: bold;
}

.storage-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--bg-accent-active);
  overflow: hidden;
  max-width: 420px;
}

.storage-bar-fill {
  height: 100%;
  width: 0;
  background: var(--fg-status-speaking);
  transition: width 0.3s ease;
}

.storage-bar-fill.storage-high {
  background: #f0b429;
}

.storage-bar-fill.storage-full {
  background: #e5534b;
}

.storage-note {
  font-size: 0.8rem;
  margin: 6px 0 0;
}

/* Add from Wombat Converts (My Books step 4) */
.library-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-box.converts-files-box {
  max-width: 560px;
  text-align: left;
}

.converts-files-box h2 {
  text-align: center;
}

.converts-files-list {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--bg-accent-active);
  border-radius: 8px;
  padding: 2px 8px;
  margin: 8px 0;
}

.converts-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-accent-active);
  cursor: pointer;
}

.converts-file-row:last-child {
  border-bottom: 0;
}

.converts-file-row input {
  width: 18px;
  height: 18px;
  flex: none;
}

.converts-file-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.converts-file-meta {
  display: block;
  font-size: 0.8rem;
}

.converts-file-added {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Covers (My Books step 7) */
.book-card-head-cover {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-head-text {
  flex: 1;
  min-width: 0;
}

.book-thumb {
  flex: none;
  width: 44px;
  height: 64px;
  border-radius: 4px;
  background: var(--bg-accent-active);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}

.book-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-box.cover-modal-box {
  max-width: 520px;
}

.cover-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.cover-preview {
  max-width: 220px;
  max-height: 320px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.cover-placeholder {
  width: 160px;
  height: 230px;
  border-radius: 6px;
  border: 2px dashed var(--bg-accent-active);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
}

.cover-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-box .cover-actions .btn-primary,
.modal-box .cover-actions .btn-secondary {
  margin-top: 0;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 10px;
}

.cover-tile {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: var(--bg-accent-active);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  cursor: pointer;
}

.cover-tile:hover {
  border-color: var(--fg-status-speaking);
}

.cover-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Buttons mixing emoji and plain symbols had text at different heights
   (30 Nov 2026): same height, contents centred. */
.words-action,
.library-quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.2;
  min-height: 32px;
  vertical-align: middle;
}

.book-actions {
  align-items: center;
}

/* Keep all six book buttons on one line on normal screens (30 Nov 2026). */
.book-actions {
  gap: 4px;
  flex-wrap: nowrap;
}

.book-actions .words-action {
  padding: 5px 9px;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .book-actions {
    flex-wrap: wrap;
  }
}

/* ---- Frosted style: ONE definition for the whole site (30 Nov 2026) ----
   Applies to every secondary button, the tabs, and anything given the
   .frosted class. Shape differs (tabs rounded on top); the frost doesn't.
   Add .btn-danger to any of these for the red-tinted destructive version. */
.btn-secondary,
.tab-btn,
.tab-link,
.frosted {
  background: var(--frost-bg);
  -webkit-backdrop-filter: blur(var(--frost-blur));
  backdrop-filter: blur(var(--frost-blur));
  border: 1px solid var(--frost-border);
  color: var(--fg-main);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover:not(:disabled),
.tab-btn:hover,
.tab-link:hover,
.frosted:hover {
  background: var(--frost-bg-hover);
  border-color: var(--frost-border-strong);
  color: var(--fg-main);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary,
.frosted {
  border-radius: 10px;
}

/* Tabs: rounded on top, sitting on the line below, active one brighter. */
.tabs {
  gap: 4px;
  padding: 0 2px;
}

.tab-btn,
.tab-link {
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
}

.tab-btn.active {
  background: var(--frost-bg-active);
  border-color: var(--frost-border-strong);
  border-bottom-color: var(--fg-status-speaking);
  color: var(--fg-main);
}

/* Destructive actions (Delete). */
.btn-secondary.btn-danger,
.frosted.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn-secondary.btn-danger:hover:not(:disabled),
.frosted.btn-danger:hover {
  background: var(--danger-bg-hover);
  border-color: var(--danger-border-strong);
}


/* Cover full-size view (30 Nov 2026) */
.cover-preview {
  cursor: zoom-in;
}

.cover-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}

.cover-lightbox img {
  max-width: 95vw;
  max-height: calc(100vh - 60px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
}

.cover-lightbox-hint {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* Help page steps (30 Nov 2026) */
.help-steps {
  margin: 6px 0 4px;
  padding-left: 22px;
  line-height: 1.5;
}

.help-steps li {
  margin: 3px 0;
}

/* All tabs on one line on a desktop, spread evenly across the banner's
   width (Rocky, 30 Nov 2026). Smaller screens still wrap. */
@media (min-width: 900px) {
  .tabs {
    flex-wrap: nowrap;
  }

  .tab-btn,
  .tab-link {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.95rem;
  }
}

/* Storage breakdown by app (WombatEx Storage Checker, 30 Nov 2026) */
.storage-meter {
  cursor: pointer;
}

.storage-breakdown {
  margin-top: 8px;
  max-width: 420px;
  border: 1px solid var(--frost-border);
  border-radius: 10px;
  background: var(--frost-bg);
  padding: 4px 12px;
}

.storage-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--frost-border);
  color: var(--fg-main);
  text-decoration: none;
  font-weight: normal;
}

a.storage-breakdown-row:not(.tab-link) {
  font-weight: normal;
  color: var(--fg-main);
}

.storage-breakdown-row:last-child {
  border-bottom: 0;
}

/* Admin users table: per-app shares under the WombatEx total (30 Nov 2026) */
.admin-app-shares {
  font-size: 0.8rem;
  white-space: nowrap;
}
