/* Final user-requested fixes. Loaded after all previous styles. */
.nav [data-go="/admin"] {
  display: none !important;
}

.reader-panel::before {
  display: none !important;
  content: none !important;
}

.design-cover {
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

.design-cover img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  object-fit: cover !important;
}

.reader-controls {
  display: grid !important;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) !important;
  gap: 16px !important;
  align-items: center !important;
}

.reader-controls > button {
  width: auto !important;
  min-width: 128px !important;
}

.reader-controls > button:first-child {
  justify-self: start !important;
}

.reader-controls > button:last-child {
  justify-self: end !important;
}

.font-controls {
  justify-self: center !important;
  white-space: nowrap !important;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-head h1 {
  margin: 0;
}

.page:has(.admin-dashboard) {
  width: min(100% - 56px, 1280px) !important;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 18px;
  align-items: start;
}

.admin-dashboard .admin-box {
  min-width: 0;
}

.admin-codes-panel,
.admin-users-panel {
  padding: 24px !important;
}

.admin-tools {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) 110px auto auto;
  gap: 10px !important;
  align-items: center;
}

.code-type-note {
  margin: 12px 0 10px;
  color: #8c735e;
  font-size: 13px;
  line-height: 1.6;
}

.code-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.code-category-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--warm-line, #eadbcd);
  border-radius: 999px;
  background: #fff8ef;
  color: #8c735e;
  font-size: 12px;
  font-weight: 800;
}

.code-category-chips strong {
  color: #9d6f4d;
}

.code-table-wrap {
  max-height: 620px;
  overflow: auto;
}

.user-table-wrap {
  max-height: 620px;
  overflow: auto;
}

.admin-users-panel {
  position: sticky;
  top: 16px;
}

.admin-users-panel .admin-table th,
.admin-users-panel .admin-table td {
  padding: 11px 10px;
  font-size: 13px;
}

.admin-users-panel .ghost {
  min-height: 32px !important;
  padding: 0 12px !important;
}

@media (max-width: 1100px) {
  .admin-dashboard {
    grid-template-columns: 1fr;
  }

  .admin-users-panel {
    position: static;
  }

  .admin-tools {
    grid-template-columns: 1fr;
  }
}

.reader-sidebar section:first-child button:nth-of-type(1),
.reader-sidebar section:first-child button:nth-of-type(2) {
  display: flex !important;
}

@media (max-width: 760px) {
  .reader-controls {
    grid-template-columns: 1fr !important;
  }

  .reader-controls > button,
  .font-controls {
    justify-self: stretch !important;
  }
}

/* Reader page rebuilt to match the supplied clean reading mockup. */
body:has(.reader-layout) {
  background: #fbf7f0 !important;
}

.reader {
  width: 100% !important;
  max-width: none !important;
  padding: 22px 0 0 !important;
}

.reader-topbar,
.chapter-progress-head,
.chapter-title,
.reader-sidebar {
  display: none !important;
}

.reader-layout {
  display: block !important;
  width: min(100% - 8px, 856px) !important;
  margin: 0 auto !important;
}

.chapter-main {
  display: flex !important;
  flex-direction: column !important;
  padding: 0 0 64px !important;
}

.reader-controls {
  order: 1 !important;
}

.reader-panel {
  order: 2 !important;
}

.reader-book-head {
  order: 3 !important;
  display: flex !important;
  justify-content: center !important;
  width: min(100%, 856px) !important;
  margin: 24px auto 0 !important;
}

.reader-book-head > div:first-child {
  display: none !important;
}

.reader-mode-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
}

.reader-mode-actions .ghost {
  min-height: 34px !important;
  padding: 0 13px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 6px !important;
  background: #fffdf9 !important;
  color: #8b6747 !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

.reader-mode-actions .ghost.active {
  border-color: #f2bd8d !important;
  background: #fff3e9 !important;
  color: #7d4c20 !important;
}

.reader-controls {
  display: grid !important;
  grid-template-columns: minmax(116px, 1fr) auto minmax(116px, 1fr) !important;
  align-items: center !important;
  gap: 18px !important;
  margin: 0 0 20px !important;
}

.reader-controls > button {
  width: auto !important;
  min-width: 96px !important;
  min-height: 34px !important;
  padding: 0 17px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 6px !important;
  background: #fffdf9 !important;
  color: #9b6b3e !important;
  box-shadow: none !important;
  font-family: var(--font-ui) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
}

.reader-controls > button:first-child {
  justify-self: start !important;
}

.reader-controls > button:last-child {
  justify-self: end !important;
}

.reader-controls > button:hover {
  border-color: #e7b985 !important;
  background: #fff7ee !important;
  color: #7d4c20 !important;
}

.font-controls {
  justify-self: center !important;
  display: inline-grid !important;
  grid-template-columns: 34px auto 34px !important;
  align-items: center !important;
  min-width: 116px !important;
  min-height: 34px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 6px !important;
  background: #fffdf9 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.font-controls .pill {
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #7c593a !important;
  box-shadow: none !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

.font-controls .pill:hover {
  background: #fff2e5 !important;
}

.font-controls strong {
  min-width: 48px !important;
  padding: 0 8px !important;
  color: #1f242d !important;
  font-family: var(--font-ui) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-align: center !important;
}

.reader-panel {
  position: relative !important;
  min-height: calc(100vh - 100px) !important;
  margin: 0 !important;
  padding: 37px 50px 30px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 12px !important;
  background: #fffefa !important;
  box-shadow: none !important;
  color: #111827 !important;
  font-family: var(--font-reading) !important;
  font-size: var(--reader-size, 20px) !important;
  font-weight: 500 !important;
  line-height: 2.48 !important;
  letter-spacing: 0 !important;
}

.reader-panel::before {
  display: none !important;
  content: none !important;
}

.reader-panel p {
  max-width: none !important;
  margin: 0 0 26px !important;
  padding: 0 !important;
}

.reader-panel p:last-child {
  margin-bottom: 0 !important;
}

.inline-word-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.9em;
  min-height: 2.85em;
  margin: 0 .22em;
  padding: 0 .62em;
  border: 1px solid #f2bd8d;
  border-radius: 7px;
  background: #fff3e9;
  color: #1f2937;
  box-shadow: none;
  font-family: Georgia, "Times New Roman", var(--font-reading);
  font-style: italic;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: middle;
  white-space: nowrap;
}

.blank-pair {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2.65em !important;
  margin: 0 .22em !important;
  padding: 0 .62em !important;
  border: 1px solid #f2bd8d !important;
  border-radius: 7px !important;
  background: #fff3e9 !important;
  box-shadow: none !important;
  vertical-align: middle !important;
}

.inline-blank {
  display: block !important;
  min-width: var(--blank-size, 6em) !important;
  height: .95em !important;
  border: 0 !important;
  background: transparent !important;
}

.chapter-done {
  display: none !important;
}

.word-section {
  order: 4 !important;
  width: min(100%, 856px) !important;
  margin: 32px auto 0 !important;
  padding: 24px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 12px !important;
  background: #fffefa !important;
  box-shadow: none !important;
}

.word-section-head {
  align-items: center !important;
  margin-bottom: 18px !important;
}

.word-section h2 {
  font-family: var(--font-ui) !important;
  font-size: 22px !important;
}

@media (max-width: 760px) {
  .reader {
    padding-top: 12px !important;
  }

  .reader-layout {
    width: min(100% - 20px, 856px) !important;
  }

  .reader-controls {
    grid-template-columns: 1fr auto 1fr !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .reader-controls > button {
    min-width: 76px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
  }

  .font-controls {
    min-width: 104px !important;
  }

  .font-controls strong {
    min-width: 42px !important;
    font-size: 13px !important;
  }

  .reader-panel {
    min-height: calc(100vh - 72px) !important;
    padding: 24px 18px !important;
    border-radius: 10px !important;
    font-size: clamp(17px, var(--reader-size, 20px), 22px) !important;
    line-height: 2.25 !important;
  }

  .reader-panel p {
    margin-bottom: 22px !important;
  }

  .inline-word-card,
  .blank-pair {
    min-height: 2.35em !important;
    padding: 0 .48em !important;
  }

  .word-section {
    width: min(100% - 20px, 856px) !important;
    padding: 18px !important;
  }
}

/* Restore reader actions while keeping the cleaner reading skin. */
.reader {
  width: min(1180px, calc(100vw - 32px)) !important;
  padding: 18px 0 56px !important;
}

.reader-topbar {
  display: grid !important;
  grid-template-columns: 160px minmax(0, 1fr) 46px !important;
  align-items: center !important;
  gap: 14px !important;
  width: min(100%, 1160px) !important;
  margin: 0 auto 18px !important;
  padding: 10px 12px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 10px !important;
  background: rgba(255, 253, 249, .9) !important;
  box-shadow: none !important;
}

.reader-topbar .brand {
  justify-self: center !important;
}

.reader-topbar .text-link,
.reader-topbar .icon-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.reader-topbar .text-link {
  min-height: 36px !important;
  color: #8b6747 !important;
  font-size: 14px !important;
}

.reader-topbar .icon-button {
  width: 58px !important;
  height: 38px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 8px !important;
  background: #fffdf9 !important;
  color: #8b6747 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

.reader-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 856px) 260px !important;
  gap: 22px !important;
  align-items: start !important;
  width: min(100%, 1160px) !important;
  margin: 0 auto !important;
}

.chapter-main {
  display: block !important;
  min-width: 0 !important;
  padding: 0 0 64px !important;
}

.reader-book-head,
.chapter-progress-head,
.chapter-title,
.reader-sidebar {
  display: revert !important;
}

.reader-book-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 18px !important;
  width: 100% !important;
  margin: 0 0 14px !important;
  padding: 18px 20px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 12px !important;
  background: #fffefa !important;
}

.reader-book-head > div:first-child {
  display: block !important;
}

.reader-book-head h1 {
  margin: 8px 0 6px !important;
  color: #1f2937 !important;
  font-size: 26px !important;
  line-height: 1.25 !important;
}

.reader-book-head p {
  margin: 0 !important;
  color: #8f7b68 !important;
  font-size: 14px !important;
}

.reader-mode-actions {
  width: auto !important;
  max-width: 390px !important;
  justify-content: flex-end !important;
  align-items: flex-start !important;
  flex-wrap: wrap !important;
}

.reader-mode-actions .ghost {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.chapter-progress-head {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  gap: 10px 16px !important;
  align-items: center !important;
  margin: 0 0 14px !important;
  color: #7c593a !important;
}

.chapter-progress-head span {
  justify-self: end !important;
  color: #9b8674 !important;
  font-size: 13px !important;
}

.chapter-progress {
  grid-column: 1 / -1 !important;
  height: 6px !important;
  border-radius: 999px !important;
  background: #efe3d7 !important;
}

.chapter-progress span {
  display: block !important;
  height: 100% !important;
  border-radius: inherit !important;
  background: #d99a5e !important;
}

.chapter-title {
  display: block !important;
  margin: 0 0 16px !important;
  padding: 0 !important;
  border: 0 !important;
  color: #1f2937 !important;
  font-family: var(--font-ui) !important;
  font-size: 22px !important;
  line-height: 1.35 !important;
}

.reader-controls,
.reader-panel,
.reader-book-head,
.word-section {
  order: initial !important;
}

.reader-panel {
  min-height: calc(100vh - 240px) !important;
}

.chapter-done {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 16px !important;
  margin: 22px 0 0 !important;
  padding: 18px 20px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 12px !important;
  background: #fffefa !important;
  color: #1f2937 !important;
  box-shadow: none !important;
}

.chapter-done div {
  display: grid !important;
  gap: 4px !important;
}

.chapter-done span {
  color: #8f7b68 !important;
  font-size: 13px !important;
}

.chapter-done .primary {
  min-height: 38px !important;
  border-radius: 8px !important;
  background: #d99a5e !important;
  color: #fff !important;
}

.reader-sidebar {
  position: sticky !important;
  top: 18px !important;
  min-height: 0 !important;
  padding: 18px !important;
  border: 1px solid #ead8c8 !important;
  border-radius: 12px !important;
  background: #fffefa !important;
  box-shadow: none !important;
}

.reader-sidebar section {
  padding-bottom: 18px !important;
  margin-bottom: 18px !important;
  border-bottom: 1px solid #f0e3d8 !important;
}

.reader-sidebar section:last-child {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  border-bottom: 0 !important;
}

.reader-sidebar h3 {
  margin: 0 0 10px !important;
  color: #7d4c20 !important;
  font-size: 15px !important;
}

.reader-sidebar button {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  min-height: 36px !important;
  padding: 0 2px !important;
  border: 0 !important;
  background: transparent !important;
  color: #3b2f26 !important;
  font-size: 14px !important;
}

.reader-sidebar small {
  color: #9b8674 !important;
}

@media (max-width: 980px) {
  .reader {
    width: min(100% - 20px, 856px) !important;
  }

  .reader-topbar {
    grid-template-columns: 1fr auto !important;
  }

  .reader-topbar .brand {
    display: none !important;
  }

  .reader-layout {
    display: block !important;
    width: 100% !important;
  }

  .reader-book-head {
    display: grid !important;
  }

  .reader-mode-actions {
    max-width: none !important;
    justify-content: flex-start !important;
  }

  .reader-sidebar {
    position: static !important;
    margin-top: 22px !important;
  }
}

/* Reader vocabulary display fixes. */
.reader-panel {
  line-height: 2.78 !important;
}

.inline-word-card,
.inline-meaning-card,
.blank-pair {
  min-height: 2.28em !important;
  margin: .16em .36em !important;
  padding: .08em .72em !important;
  border: 1px solid #f1ba89 !important;
  border-radius: 8px !important;
  background: #fff4ec !important;
  box-shadow: none !important;
  vertical-align: middle !important;
}

.inline-word-card {
  min-width: 4.55em !important;
  color: #1f2937 !important;
  font-family: Georgia, "Times New Roman", var(--font-reading) !important;
  font-style: italic !important;
  font-size: 1.02em !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
}

.inline-meaning-card {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #6f4f34 !important;
  font-family: var(--font-reading) !important;
  font-size: .96em !important;
  font-style: normal !important;
  font-weight: 600 !important;
  line-height: 1.22 !important;
}

.inline-learn-card {
  display: inline-flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 0 !important;
  margin: .16em .4em !important;
  border: 1px solid #f1ba89 !important;
  border-radius: 9px !important;
  background: #fff8f2 !important;
  vertical-align: middle !important;
  overflow: hidden !important;
}

.inline-learn-card .inline-word-card,
.inline-learn-card .inline-meaning-card {
  min-height: 2.28em !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.inline-learn-card .inline-word-card {
  border-right: 1px solid #f1ba89 !important;
  background: #fff1e6 !important;
}

.inline-blank {
  min-width: var(--blank-size, 6em) !important;
  height: 1.05em !important;
  border: 0 !important;
  background: transparent !important;
}

.font-controls {
  grid-template-columns: 38px auto 38px !important;
  min-width: 124px !important;
}

.font-controls .pill {
  min-width: 38px !important;
}

.notebook-page {
  display: grid;
  gap: 18px;
}

.notebook-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  border: 1px solid #ead8c8;
  border-radius: 12px;
  background: #fffefa;
}

.notebook-head h1 {
  margin: 10px 0 6px;
  color: #1f2937;
  font-size: 30px;
  line-height: 1.2;
}

.notebook-head p {
  margin: 0;
  color: #8f7b68;
}

.notebook-count {
  display: grid;
  place-items: center;
  min-width: 116px;
  min-height: 82px;
  border: 1px solid #f1ba89;
  border-radius: 10px;
  background: #fff4ec;
  color: #7d4c20;
}

.notebook-count strong {
  font-size: 30px;
  line-height: 1;
}

.notebook-count span {
  font-size: 13px;
  font-weight: 800;
}

.notebook-list {
  display: grid;
  gap: 12px;
}

.notebook-card {
  display: grid;
  grid-template-columns: 170px minmax(220px, 1fr) minmax(190px, .8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid #ead8c8;
  border-radius: 12px;
  background: #fffefa;
}

.notebook-word {
  display: grid;
  gap: 4px;
}

.notebook-word strong {
  color: #1f2937;
  font-family: Georgia, "Times New Roman", var(--font-reading);
  font-size: 24px;
  font-style: italic;
}

.notebook-word span,
.notebook-meta {
  color: #8f7b68;
  font-size: 13px;
}

.notebook-meaning {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #f1ba89;
  border-radius: 8px;
  background: #fff4ec;
  color: #5f452f;
  font-weight: 700;
}

.notebook-meta {
  display: grid;
  gap: 5px;
}

.notebook-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notebook-actions .ghost {
  min-height: 34px !important;
  padding: 0 12px !important;
}

@media (max-width: 980px) {
  .notebook-head,
  .notebook-card {
    grid-template-columns: 1fr;
  }

  .notebook-head {
    display: grid;
  }

  .notebook-count {
    place-items: start;
    min-width: 0;
    min-height: 0;
    padding: 14px;
  }

  .notebook-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .reader-panel {
    line-height: 2.58 !important;
  }

  .inline-word-card,
  .inline-meaning-card,
  .blank-pair {
    min-height: 2.12em !important;
    margin: .14em .24em !important;
    padding: .05em .52em !important;
  }

  .inline-learn-card {
    margin: .14em .28em !important;
  }
}

/* Password visibility toggle. */
.password-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.password-wrap input {
  width: 100% !important;
  padding-right: 48px !important;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.password-toggle span,
.password-toggle span::before {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  transform: translate(-50%, -50%);
}

.password-toggle span {
  width: 20px;
  height: 13px;
  border: 2px solid #9b7354;
  border-radius: 999px / 72%;
}

.password-toggle span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #9b7354;
}

.password-toggle::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #9b7354;
  transform: rotate(-38deg) scaleX(0);
  transform-origin: center;
  transition: transform .15s ease;
}

.password-toggle.is-visible::after {
  transform: rotate(-38deg) scaleX(1);
}

.password-toggle:hover {
  background: #fff4ec;
}

/* Connected vocabulary blocks: cleaner teal skin. */
.inline-learn-card,
.inline-pair-card {
  display: inline-flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 0 !important;
  margin: .18em .42em !important;
  border: 1px solid #9fcfc6 !important;
  border-radius: 10px !important;
  background: #f5fbf9 !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset !important;
  vertical-align: middle !important;
  overflow: hidden !important;
  line-height: 1.18 !important;
}

.inline-learn-card .inline-word-card,
.inline-learn-card .inline-meaning-card,
.inline-pair-card .inline-word-card,
.inline-pair-card .inline-meaning-card,
.inline-pair-card .blank-pair {
  min-height: 2.18em !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.inline-learn-card .inline-word-card,
.inline-pair-card .inline-word-card {
  min-width: 4.45em !important;
  background: #dff3ee !important;
  color: #173f3b !important;
  border-right: 1px solid #9fcfc6 !important;
}

.inline-learn-card .inline-meaning-card,
.inline-pair-card .inline-meaning-card {
  background: #f7fcfb !important;
  color: #315f58 !important;
}

.inline-pair-card .blank-pair {
  min-width: 6.1em !important;
  background: #eef8f5 !important;
  border-left: 1px solid #9fcfc6 !important;
}

.inline-pair-card.guess-english .inline-meaning-card {
  border-right: 0 !important;
}

.inline-pair-card.guess-english .blank-pair {
  border-left: 1px solid #9fcfc6 !important;
}

.inline-pair-card.guess-meaning .blank-pair {
  border-left: 0 !important;
}

.inline-blank {
  min-width: var(--blank-size, 6em) !important;
  background: transparent !important;
}

.inline-pair-card .quiz-answer-slot {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px;
  min-width: max(var(--slot-size, 7em), var(--typed-size, var(--slot-size, 7em))) !important;
  min-height: 2.18em !important;
  margin: 0 !important;
  padding: 0 8px 0 10px !important;
  border-left: 1px solid #9fcfc6 !important;
  background: #eef8f5 !important;
}

.quiz-answer-input {
  width: var(--quiz-input-width, calc(max(var(--slot-size, 7em), var(--typed-size, var(--slot-size, 7em))) - 3.15em));
  min-width: 4.2em;
  height: 2em;
  border: 0;
  outline: 0;
  background: transparent;
  color: #173f3b;
  font-family: inherit;
  font-size: 1em;
  line-height: 1.2 !important;
}

.quiz-answer-input:focus {
  background: rgba(255, 255, 255, .58);
  box-shadow: 0 0 0 2px rgba(57, 142, 130, .18);
  border-radius: 6px;
}

.english-slot .quiz-answer-input {
  min-width: 6.2em;
  font-family: Georgia, "Times New Roman", var(--font-reading);
  font-style: italic;
  font-weight: 700;
}

.meaning-slot .quiz-answer-input {
  font-family: var(--font-reading);
  font-weight: 600;
}

.quiz-eye {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.quiz-eye span,
.quiz-eye span::before {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  transform: translate(-50%, -50%);
}

.quiz-eye span {
  width: 18px;
  height: 12px;
  border: 2px solid #3b7f75;
  border-radius: 999px / 75%;
}

.quiz-eye span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #3b7f75;
}

.quiz-eye::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 13px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #3b7f75;
  transform: rotate(-38deg) scaleX(0);
  transition: transform .15s ease;
}

.quiz-eye.is-visible::after {
  transform: rotate(-38deg) scaleX(1);
}

.quiz-eye:hover {
  background: #dff3ee;
}

.quiz-result {
  display: none;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #dff7e8;
  color: #247248;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.quiz-answer-slot.is-correct {
  background: #edf9f0 !important;
}

.quiz-answer-slot.is-correct .quiz-result,
.quiz-answer-slot.is-similar .quiz-result,
.quiz-answer-slot.is-wrong .quiz-result,
.quiz-answer-slot.has-feedback .quiz-result,
.quiz-answer-slot.is-revealed .quiz-result {
  display: inline-flex;
}

.quiz-answer-slot.is-correct .quiz-result {
  background: #dff7e8;
  color: #247248;
}

.quiz-answer-slot.is-similar .quiz-result {
  background: #fff2d7;
  color: #97630e;
}

.quiz-answer-slot.is-wrong .quiz-result {
  background: #ffe4e1;
  color: #b83a32;
}

.quiz-answer-slot.is-revealed .quiz-result {
  background: #e9f2ff;
  color: #2f5f9f;
}

.inline-pair-card .quiz-answer-slot.is-revealed {
  min-width: 0 !important;
  max-width: 100% !important;
}

.inline-pair-card .quiz-answer-slot.is-revealed .quiz-answer-input {
  width: var(--quiz-input-width, auto) !important;
}

.inline-pair-card .quiz-answer-slot.is-correct {
  min-width: 0 !important;
}

.inline-pair-card .quiz-answer-slot.is-similar,
.inline-pair-card .quiz-answer-slot.is-wrong {
  min-width: 0 !important;
}

.inline-pair-card .quiz-answer-slot.is-correct .quiz-answer-input {
  width: var(--quiz-input-width, auto) !important;
}

.inline-pair-card .quiz-answer-slot.has-feedback .quiz-answer-input {
  width: var(--quiz-input-width, auto) !important;
}

.inline-pair-card:has(.quiz-answer-slot.is-correct) {
  border-color: #79c897 !important;
  background: #f4fcf6 !important;
}

.inline-pair-card:has(.quiz-answer-slot.is-similar) {
  border-color: #ddb56f !important;
  background: #fffaf0 !important;
}

.inline-pair-card:has(.quiz-answer-slot.is-wrong) {
  border-color: #e2a29b !important;
  background: #fff7f5 !important;
}

/* Product polish: modals, directory, status chips, filters. */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 24, 18, .32);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 28px;
  border: 1px solid #ead8c8;
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 28px 80px rgba(70, 48, 31, .18);
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid #ead8c8;
  border-radius: 8px;
  background: #fff8f2;
  color: #8b6747;
  font-size: 20px;
  cursor: pointer;
}

.directory-modal h2,
.locked-modal h2 {
  margin: 12px 0 6px;
  color: #1f2937;
  font-size: 28px;
}

.directory-modal p,
.locked-modal p {
  margin: 0 0 18px;
  color: #8f7b68;
}

.directory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.directory-list button {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #ead8c8;
  border-radius: 9px;
  background: #fffdf9;
  color: #2f251d;
  text-align: left;
  cursor: pointer;
}

.directory-list button.active {
  border-color: #f1ba89;
  background: #fff4ec;
}

.directory-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-list em {
  color: #9b8674;
  font-size: 12px;
  font-style: normal;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-state {
  width: max-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #ead8c8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.book-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
  color: #8f7b68;
  font-size: 12px;
  font-weight: 800;
}

.design-card .locked-button {
  width: 100%;
  margin-top: 8px;
}

.is-playing {
  opacity: .82;
  pointer-events: none;
}

.audio-button.is-playing,
.notebook-actions .is-playing {
  border-color: #f1ba89 !important;
  background: #fff4ec !important;
  color: #7d4c20 !important;
}

.notebook-tools,
.admin-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid #ead8c8;
  border-radius: 12px;
  background: #fffefa;
}

.notebook-tools select,
.notebook-tools input,
.admin-filter-row select,
.admin-filter-row input {
  min-height: 38px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid #ead8c8;
  border-radius: 8px;
  background: #fffdf9;
  color: #2f251d;
  font-weight: 700;
}

.notebook-status-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px !important;
  border: 1px solid #ead8c8;
  border-radius: 8px;
  background: #fffdf9;
}

.notebook-status-tabs .tab {
  justify-content: center;
  min-height: 30px;
  border: 0;
  background: transparent;
}

.notebook-status-tabs .tab.active {
  background: #fff4ec;
  color: #7d4c20;
}

.notebook-card.is-learned {
  opacity: .78;
}

.notebook-card.is-learned .notebook-meaning {
  background: #f5f8f2;
  border-color: #d7e6d0;
  color: #466339;
}

.admin-filter-row {
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 180px) auto;
  margin: 12px 0;
}

.users-filter {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.filter-count {
  color: #8f7b68;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-table .compact {
  min-height: 30px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
}

@media (max-width: 980px) {
  .reader-layout {
    display: block !important;
  }

  .reader-sidebar {
    margin-top: 18px !important;
  }

  .directory-list,
  .notebook-tools,
  .admin-filter-row,
  .users-filter {
    grid-template-columns: 1fr;
  }

  .filter-count {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .modal-layer {
    padding: 10px;
  }

  .modal-panel {
    padding: 22px 16px;
  }

  .directory-list button {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .directory-list em {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .inline-pair-card {
    max-width: 100% !important;
  }

  .inline-pair-card .quiz-answer-slot {
    min-width: min(max(var(--slot-size, 7em), var(--typed-size, var(--slot-size, 7em))), 11.5em) !important;
    padding-right: 6px !important;
  }

  .quiz-answer-input {
    width: var(--quiz-input-width, min(calc(max(var(--slot-size, 7em), var(--typed-size, var(--slot-size, 7em))) - 3em), 8.2em)) !important;
    min-width: 3.6em !important;
  }

  .english-slot .quiz-answer-input {
    min-width: 5.8em !important;
  }

  .quiz-eye {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
  }

  .quiz-result {
    min-height: 22px;
    padding: 0 6px;
    font-size: 11px;
  }

  .inline-pair-card .quiz-answer-slot.is-revealed {
    min-width: 0 !important;
  }

  .inline-pair-card .quiz-answer-slot.is-revealed .quiz-answer-input {
    width: var(--quiz-input-width, auto) !important;
  }

  .inline-pair-card .quiz-answer-slot.is-correct {
    min-width: 0 !important;
  }

  .inline-pair-card .quiz-answer-slot.is-correct .quiz-answer-input {
    width: var(--quiz-input-width, auto) !important;
  }
}

/* Reader inline quiz: editorial annotation style, lighter than form controls. */
.chapter-text .inline-learn-card,
.chapter-text .inline-pair-card {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  margin: 0 .16em !important;
  min-height: 1.95em !important;
  max-width: 100% !important;
  overflow: hidden !important;
  vertical-align: -0.24em !important;
  border: 1px solid #dec9ad !important;
  border-radius: 7px !important;
  background: #fffaf3 !important;
  box-shadow: 0 1px 0 rgba(120, 82, 45, .05), inset 0 -1px 0 rgba(222, 201, 173, .4) !important;
  color: #243031 !important;
  line-height: 1.18 !important;
}

.chapter-text .inline-learn-card .inline-word-card,
.chapter-text .inline-pair-card .inline-word-card,
.chapter-text .inline-learn-card .inline-meaning-card,
.chapter-text .inline-pair-card .inline-meaning-card {
  min-height: 1.95em !important;
  padding: .35em .72em .33em !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  line-height: 1.16 !important;
}

.chapter-text .inline-learn-card .inline-word-card,
.chapter-text .inline-pair-card .inline-word-card {
  border-right: 1px solid #e8d8c3 !important;
  color: #173f3b !important;
  font-family: Georgia, "Times New Roman", var(--font-reading) !important;
  font-style: italic !important;
  font-weight: 700 !important;
}

.chapter-text .inline-learn-card .inline-meaning-card,
.chapter-text .inline-pair-card .inline-meaning-card {
  color: #6d4f35 !important;
  font-weight: 600 !important;
}

.chapter-text .inline-pair-card .quiz-answer-slot {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  min-width: 0 !important;
  min-height: 1.95em !important;
  padding: .16em .42em .16em .58em !important;
  border: 0 !important;
  border-left: 1px solid #e8d8c3 !important;
  border-radius: 0 !important;
  background: #fffdf8 !important;
  box-shadow: none !important;
}

.chapter-text .quiz-answer-input {
  width: var(--quiz-input-width, 92px) !important;
  min-width: 0 !important;
  height: 1.62em !important;
  padding: 0 .08em .05em !important;
  border: 0 !important;
  border-bottom: 1px solid #c9aa88 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #173f3b !important;
  box-shadow: none !important;
  line-height: 1.25 !important;
}

.chapter-text .quiz-answer-input:focus {
  border-bottom-color: #8c633d !important;
  background: transparent !important;
  box-shadow: 0 2px 0 rgba(140, 99, 61, .12) !important;
}

.chapter-text .english-slot .quiz-answer-input {
  min-width: 92px !important;
  font-family: Georgia, "Times New Roman", var(--font-reading) !important;
  font-style: italic !important;
  font-weight: 700 !important;
}

.chapter-text .meaning-slot .quiz-answer-input {
  min-width: 0 !important;
  font-family: var(--font-reading) !important;
  font-weight: 600 !important;
}

.chapter-text .quiz-answer-slot.is-revealed .quiz-answer-input,
.chapter-text .quiz-answer-slot.has-feedback .quiz-answer-input,
.chapter-text .quiz-answer-slot.is-correct .quiz-answer-input {
  border-bottom-color: transparent !important;
}

.chapter-text .quiz-eye {
  flex: 0 0 22px !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  background: transparent !important;
  opacity: .72 !important;
}

.chapter-text .quiz-eye span {
  width: 14px !important;
  height: 9px !important;
  border-width: 1.5px !important;
  border-color: #7d654f !important;
}

.chapter-text .quiz-eye span::before {
  width: 4px !important;
  height: 4px !important;
  background: #7d654f !important;
}

.chapter-text .quiz-eye::after {
  left: 5px !important;
  top: 10px !important;
  width: 13px !important;
  height: 1.5px !important;
  background: #7d654f !important;
}

.chapter-text .quiz-eye:hover {
  background: #f4eadb !important;
  opacity: 1 !important;
}

.chapter-text .quiz-result {
  min-height: auto !important;
  padding: .22em .5em !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  color: #3f8a57 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.chapter-text .quiz-answer-slot.is-correct .quiz-result {
  border-color: #b6e0c0 !important;
  background: #e7f8ec !important;
  color: #2d7a45 !important;
}

.chapter-text .quiz-answer-slot.is-similar .quiz-result {
  border-color: #efd18d !important;
  background: #fff6dd !important;
  color: #9a6412 !important;
}

.chapter-text .quiz-answer-slot.is-wrong .quiz-result {
  border-color: #f0b8b2 !important;
  background: #fff0ee !important;
  color: #b73a32 !important;
}

.chapter-text .quiz-answer-slot.is-revealed .quiz-result {
  border-color: #e7d0ab !important;
  background: #fff8ea !important;
  color: #9a6a35 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-correct) {
  border-color: #b7d5ba !important;
  background: #fbfff9 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-correct) .quiz-answer-slot {
  background: #fbfff9 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-similar) {
  border-color: #e3c178 !important;
  background: #fffaf0 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-similar) .quiz-answer-slot {
  background: #fffaf0 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-wrong) {
  border-color: #e5aaa4 !important;
  background: #fff7f5 !important;
}

.chapter-text .inline-pair-card:has(.quiz-answer-slot.is-wrong) .quiz-answer-slot {
  background: #fff7f5 !important;
}

@media (max-width: 760px) {
  .chapter-text .inline-learn-card,
  .chapter-text .inline-pair-card {
    border-radius: 6px !important;
  }

  .chapter-text .inline-pair-card .quiz-answer-slot {
    min-width: 0 !important;
    padding-right: .34em !important;
  }

  .chapter-text .quiz-answer-input {
    width: var(--quiz-input-width, 82px) !important;
    min-width: 0 !important;
  }

  .chapter-text .english-slot .quiz-answer-input {
    min-width: 90px !important;
  }

  .chapter-text .quiz-eye {
    flex-basis: 21px !important;
    width: 21px !important;
    height: 21px !important;
  }
}

/* Sharper eye icon for answer reveal. */
.chapter-text .quiz-eye {
  flex: 0 0 28px !important;
  width: 28px !important;
  height: 28px !important;
  display: inline-grid !important;
  place-items: center !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  color: #75563b !important;
  opacity: .9 !important;
}

.chapter-text .quiz-eye span,
.chapter-text .quiz-eye span::before {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  display: block !important;
  transform: translate(-50%, -50%) !important;
}

.chapter-text .quiz-eye span {
  width: 18px !important;
  height: 12px !important;
  border: 1.8px solid currentColor !important;
  border-radius: 999px / 72% !important;
  background: #fffaf3 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55) !important;
}

.chapter-text .quiz-eye span::before {
  content: "" !important;
  width: 5.5px !important;
  height: 5.5px !important;
  border-radius: 999px !important;
  background: currentColor !important;
  box-shadow: 0 0 0 1.5px #fffaf3 !important;
}

.chapter-text .quiz-eye::after {
  content: "" !important;
  position: absolute !important;
  left: 7px !important;
  top: 13px !important;
  width: 16px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: currentColor !important;
  transform: rotate(-42deg) scaleX(0) !important;
  transform-origin: center !important;
  transition: transform .16s ease !important;
}

.chapter-text .quiz-eye.is-visible {
  color: #9a6a35 !important;
  background: #f8eddf !important;
  border-color: #ead8c2 !important;
}

.chapter-text .quiz-eye.is-visible::after {
  transform: rotate(-42deg) scaleX(1) !important;
}

.chapter-text .quiz-eye:hover {
  color: #5d3f29 !important;
  background: #f7ead8 !important;
  border-color: #e7d3ba !important;
  opacity: 1 !important;
}

@media (max-width: 760px) {
  .chapter-text .quiz-eye {
    flex-basis: 27px !important;
    width: 27px !important;
    height: 27px !important;
  }
}

/* The live reader body is .reader-panel. Keep this block last. */
.reader-panel .quiz-eye {
  flex: 0 0 36px !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  display: inline-grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #45564f !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.reader-panel .quiz-eye::before,
.reader-panel .quiz-eye::after {
  display: none !important;
  content: none !important;
}

.reader-panel .quiz-eye-icon {
  width: 27px !important;
  height: 27px !important;
  display: block !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.25 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.reader-panel .quiz-eye-icon circle {
  fill: currentColor !important;
  stroke: none !important;
}

.reader-panel .quiz-eye .eye-closed {
  display: none !important;
}

.reader-panel .quiz-eye.is-visible .eye-open {
  display: none !important;
}

.reader-panel .quiz-eye.is-visible .eye-closed {
  display: block !important;
}

.reader-panel .quiz-eye:hover,
.reader-panel .quiz-eye:focus-visible,
.reader-panel .quiz-eye.is-visible {
  background: #e3efea !important;
  color: #213b31 !important;
  outline: none !important;
}

@media (max-width: 760px) {
  .reader-panel .quiz-eye {
    flex-basis: 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  .reader-panel .quiz-eye-icon {
    width: 28px !important;
    height: 28px !important;
  }
}

/* Clear, conventional eye control for inline quiz answers. */
.chapter-text .quiz-eye {
  flex: 0 0 34px !important;
  width: 34px !important;
  height: 34px !important;
  display: inline-grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #52615a !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.chapter-text .quiz-eye-icon {
  width: 25px !important;
  height: 25px !important;
  display: block !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.chapter-text .quiz-eye-icon circle {
  fill: currentColor !important;
  stroke: none !important;
}

.chapter-text .quiz-eye:hover,
.chapter-text .quiz-eye:focus-visible,
.chapter-text .quiz-eye.is-visible {
  border: 0 !important;
  background: #e6f0ec !important;
  color: #263f36 !important;
  outline: none !important;
}

@media (max-width: 760px) {
  .chapter-text .quiz-eye {
    flex-basis: 36px !important;
    width: 36px !important;
    height: 36px !important;
  }

  .chapter-text .quiz-eye-icon {
    width: 26px !important;
    height: 26px !important;
  }
}

/* Absolute final dark-mode visibility overrides. */
html[data-theme="dark"] body,
html[data-theme="dark"] body:has(.reader-layout),
html[data-theme="dark"][data-app-mode="tablet"] body {
  background:
    radial-gradient(circle at 12% -8%, rgba(208, 138, 88, .2), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(73, 128, 118, .18), transparent 30%),
    linear-gradient(180deg, #15110f 0%, #090b0f 42%, #07090d 100%) !important;
  color: #f7efe5 !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .reader-topbar {
  border: 1px solid rgba(235, 201, 169, .16) !important;
  border-radius: 12px !important;
  background: rgba(22, 19, 17, .94) !important;
  color: #fff4e8 !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .32) !important;
}

html[data-theme="dark"] .topbar .brand,
html[data-theme="dark"] .reader-topbar .brand {
  color: #fff4e8 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .home-stats div,
html[data-theme="dark"] .hero-stats div,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .profile-stats div {
  border-color: rgba(235, 201, 169, .2) !important;
  background: linear-gradient(180deg, #1b1f28, #12161e) !important;
  color: #fff5eb !important;
}

html[data-theme="dark"] .home-stats strong,
html[data-theme="dark"] .hero-stats strong,
html[data-theme="dark"] .metric strong,
html[data-theme="dark"] .profile-stats strong {
  color: #fffaf3 !important;
}

html[data-theme="dark"] .home-stats span,
html[data-theme="dark"] .hero-stats span,
html[data-theme="dark"] .metric span,
html[data-theme="dark"] .profile-stats span {
  color: #d8c2ad !important;
}

html[data-theme="dark"] .featured-book,
html[data-theme="dark"] .main-book,
html[data-theme="dark"] .story-card,
html[data-theme="dark"] .story-card.design-card,
html[data-theme="dark"] .reader-book-head,
html[data-theme="dark"] .chapter-header,
html[data-theme="dark"] .tool-row,
html[data-theme="dark"] .word-section,
html[data-theme="dark"] .word-card,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .redeem-card,
html[data-theme="dark"] .notebook-card,
html[data-theme="dark"] .notebook-head,
html[data-theme="dark"] .notebook-count,
html[data-theme="dark"] .profile-hero,
html[data-theme="dark"] .profile-book,
html[data-theme="dark"] .admin-box,
html[data-theme="dark"] .modal-panel {
  border-color: rgba(235, 201, 169, .18) !important;
  background: linear-gradient(180deg, #171b24, #10141b) !important;
  color: #fff4e8 !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .36) !important;
}

html[data-theme="dark"] .featured-info h3,
html[data-theme="dark"] .design-card-info h3,
html[data-theme="dark"] .story-card h3,
html[data-theme="dark"] .word-main strong,
html[data-theme="dark"] .notebook-word strong,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 {
  color: #fff8f0 !important;
}

html[data-theme="dark"] .home-intro p,
html[data-theme="dark"] .featured-info p,
html[data-theme="dark"] .design-card-info p,
html[data-theme="dark"] .reading-metrics,
html[data-theme="dark"] .story-card p,
html[data-theme="dark"] .book-card-stats,
html[data-theme="dark"] .locked-hint,
html[data-theme="dark"] .chapter-progress-head span {
  color: #d9c5b2 !important;
}

html[data-theme="dark"] .reading-metrics strong,
html[data-theme="dark"] .book-card-stats strong {
  color: #ffe1bf !important;
}

html[data-theme="dark"] .reader-panel {
  border-color: rgba(117, 165, 153, .24) !important;
  background: linear-gradient(180deg, #10151d, #080b10) !important;
  color: #f8f0e6 !important;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .42) !important;
}

html[data-theme="dark"] .reader-panel p,
html[data-theme="dark"] .chapter-text {
  color: #f8f0e6 !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost,
html[data-theme="dark"] .reader-controls > button,
html[data-theme="dark"] .font-controls,
html[data-theme="dark"] .font-controls button,
html[data-theme="dark"] .reader-topbar .text-link,
html[data-theme="dark"] .reader-topbar .icon-button,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .nav .ghost {
  border-color: rgba(235, 201, 169, .22) !important;
  background: #322b25 !important;
  color: #fff0df !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost.active,
html[data-theme="dark"] .font-controls .active,
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .home-tabs .tab.active,
html[data-theme="dark"] .primary {
  border-color: #d08a58 !important;
  background: #d08a58 !important;
  color: #130d09 !important;
}

html[data-theme="dark"] .inline-learn-card,
html[data-theme="dark"] .inline-pair-card,
html[data-theme="dark"] .chapter-text .inline-learn-card,
html[data-theme="dark"] .chapter-text .inline-pair-card {
  border-color: rgba(151, 224, 211, .48) !important;
  background: #dff8f2 !important;
  color: #09231f !important;
}

html[data-theme="dark"] .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-word-card {
  border-color: rgba(28, 92, 81, .36) !important;
  background: #dff8f2 !important;
  color: #127263 !important;
  text-shadow: none !important;
}

html[data-theme="dark"] .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-meaning-card {
  background: #f9efe1 !important;
  color: #3a2617 !important;
}

html[data-theme="dark"] .inline-pair-card .quiz-answer-slot,
html[data-theme="dark"] .chapter-text .inline-pair-card .quiz-answer-slot {
  border-left-color: rgba(28, 92, 81, .32) !important;
  background: #dff8f2 !important;
}

html[data-theme="dark"] .quiz-answer-input,
html[data-theme="dark"] .chapter-text .quiz-answer-input {
  border: 0 !important;
  border-bottom: 2px solid rgba(18, 114, 99, .42) !important;
  background: transparent !important;
  color: #09231f !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .quiz-answer-input:focus,
html[data-theme="dark"] .chapter-text .quiz-answer-input:focus {
  border-bottom-color: #127263 !important;
  background: rgba(255, 255, 255, .32) !important;
  box-shadow: 0 2px 0 rgba(18, 114, 99, .16) !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye,
html[data-theme="dark"] .reader-panel .quiz-eye {
  color: #124a41 !important;
  background: transparent !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye:hover,
html[data-theme="dark"] .chapter-text .quiz-eye:focus-visible,
html[data-theme="dark"] .chapter-text .quiz-eye.is-visible,
html[data-theme="dark"] .reader-panel .quiz-eye:hover,
html[data-theme="dark"] .reader-panel .quiz-eye:focus-visible,
html[data-theme="dark"] .reader-panel .quiz-eye.is-visible {
  background: rgba(18, 114, 99, .13) !important;
  color: #082d27 !important;
}

html[data-theme="dark"] .word-status,
html[data-theme="dark"] .phonetic {
  color: #e6bb80 !important;
}

html[data-theme="dark"] .word-meaning,
html[data-theme="dark"] .notebook-meaning {
  background: #fff1de !important;
  color: #352414 !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
}

html[data-theme="dark"] .word-actions .audio-button,
html[data-theme="dark"] .notebook-actions .audio-button {
  background: #eaf3ff !important;
  color: #1658a8 !important;
}

html[data-theme="dark"] .word-actions .audio-button.uk,
html[data-theme="dark"] .notebook-actions .audio-button.uk {
  background: #ffeaf8 !important;
  color: #934077 !important;
}

html[data-theme="dark"] .book-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .lock-chip {
  border-color: rgba(224, 173, 108, .42) !important;
  background: rgba(224, 173, 108, .18) !important;
  color: #ffd18f !important;
}

html[data-theme="dark"] .unlock-chip {
  border-color: rgba(106, 217, 160, .38) !important;
  background: rgba(106, 217, 160, .16) !important;
  color: #9df0be !important;
}

html[data-theme="dark"] input:not(.quiz-answer-input),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .admin-tools input,
html[data-theme="dark"] .admin-tools select,
html[data-theme="dark"] .notebook-tools input,
html[data-theme="dark"] .notebook-tools select,
html[data-theme="dark"] .admin-filter-row input,
html[data-theme="dark"] .admin-filter-row select {
  border-color: rgba(235, 201, 169, .24) !important;
  background: #0d1118 !important;
  color: #fff2e6 !important;
}

/* Final dark-mode readability pass. Keep this at the very end. */
html[data-theme="dark"] body,
html[data-theme="dark"] body:has(.reader-layout),
html[data-theme="dark"][data-app-mode="tablet"] body {
  background:
    radial-gradient(circle at 12% -8%, rgba(208, 138, 88, .2), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(73, 128, 118, .18), transparent 30%),
    linear-gradient(180deg, #15110f 0%, #090b0f 42%, #07090d 100%) !important;
  color: #f7efe5 !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .reader-topbar {
  border: 1px solid rgba(235, 201, 169, .16) !important;
  border-radius: 12px !important;
  background: rgba(22, 19, 17, .94) !important;
  color: #fff4e8 !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .32) !important;
}

html[data-theme="dark"] .topbar .brand,
html[data-theme="dark"] .reader-topbar .brand {
  color: #fff4e8 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .reader-top-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
}

html[data-theme="dark"] .home-intro h1,
html[data-theme="dark"] .reading-section h2,
html[data-theme="dark"] .library-head h2,
html[data-theme="dark"] .section-row h2,
html[data-theme="dark"] .shelf-title,
html[data-theme="dark"] .chapter-title,
html[data-theme="dark"] .reader-title {
  color: #fff6ed !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18) !important;
}

html[data-theme="dark"] .home-intro p,
html[data-theme="dark"] .hero-subtitle,
html[data-theme="dark"] .featured-info p,
html[data-theme="dark"] .design-card-info p,
html[data-theme="dark"] .reading-metrics,
html[data-theme="dark"] .story-card p,
html[data-theme="dark"] .book-card-stats,
html[data-theme="dark"] .locked-hint,
html[data-theme="dark"] .chapter-progress-head span {
  color: #d9c5b2 !important;
}

html[data-theme="dark"] .home-stats div,
html[data-theme="dark"] .hero-stats div,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .profile-stats div {
  border-color: rgba(235, 201, 169, .2) !important;
  background: linear-gradient(180deg, #1b1f28, #12161e) !important;
  color: #fff5eb !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

html[data-theme="dark"] .home-stats strong,
html[data-theme="dark"] .hero-stats strong,
html[data-theme="dark"] .metric strong,
html[data-theme="dark"] .profile-stats strong {
  color: #fffaf3 !important;
}

html[data-theme="dark"] .home-stats span,
html[data-theme="dark"] .hero-stats span,
html[data-theme="dark"] .metric span,
html[data-theme="dark"] .profile-stats span {
  color: #d8c2ad !important;
}

html[data-theme="dark"] .featured-book,
html[data-theme="dark"] .main-book,
html[data-theme="dark"] .story-card,
html[data-theme="dark"] .story-card.design-card,
html[data-theme="dark"] .reader-book-head,
html[data-theme="dark"] .chapter-header,
html[data-theme="dark"] .tool-row,
html[data-theme="dark"] .word-section,
html[data-theme="dark"] .word-card,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .redeem-card,
html[data-theme="dark"] .notebook-card,
html[data-theme="dark"] .notebook-head,
html[data-theme="dark"] .notebook-count,
html[data-theme="dark"] .profile-hero,
html[data-theme="dark"] .profile-book,
html[data-theme="dark"] .admin-box,
html[data-theme="dark"] .modal-panel {
  border-color: rgba(235, 201, 169, .18) !important;
  background: linear-gradient(180deg, #171b24, #10141b) !important;
  color: #fff4e8 !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .36) !important;
}

html[data-theme="dark"] .featured-book .featured-info h3,
html[data-theme="dark"] .main-book h2,
html[data-theme="dark"] .story-card h3,
html[data-theme="dark"] .design-card-info h3,
html[data-theme="dark"] .word-main strong,
html[data-theme="dark"] .notebook-word strong,
html[data-theme="dark"] .profile-book h3 {
  color: #fff8f0 !important;
}

html[data-theme="dark"] .featured-book .reading-metrics strong,
html[data-theme="dark"] .book-card-stats strong {
  color: #ffe1bf !important;
}

html[data-theme="dark"] .reader-panel {
  border-color: rgba(117, 165, 153, .24) !important;
  background: linear-gradient(180deg, #10151d, #080b10) !important;
  color: #f8f0e6 !important;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .42) !important;
}

html[data-theme="dark"] .reader-panel p,
html[data-theme="dark"] .chapter-text {
  color: #f8f0e6 !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost,
html[data-theme="dark"] .reader-controls > button,
html[data-theme="dark"] .font-controls,
html[data-theme="dark"] .font-controls button,
html[data-theme="dark"] .reader-topbar .text-link,
html[data-theme="dark"] .reader-topbar .icon-button,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .nav .ghost {
  border-color: rgba(235, 201, 169, .22) !important;
  background: #322b25 !important;
  color: #fff0df !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost.active,
html[data-theme="dark"] .font-controls .active,
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .home-tabs .tab.active,
html[data-theme="dark"] .primary {
  border-color: #d08a58 !important;
  background: #d08a58 !important;
  color: #130d09 !important;
}

html[data-theme="dark"] .tabs,
html[data-theme="dark"] .home-tabs {
  border-color: rgba(235, 201, 169, .14) !important;
  background: rgba(14, 13, 13, .74) !important;
}

html[data-theme="dark"] .tab {
  color: #ddc7b3 !important;
  background: transparent !important;
}

html[data-theme="dark"] .progress-line,
html[data-theme="dark"] .chapter-progress,
html[data-theme="dark"] .reader-progress,
html[data-theme="dark"] .mini-progress {
  background: #332922 !important;
}

html[data-theme="dark"] .progress-line span,
html[data-theme="dark"] .chapter-progress span,
html[data-theme="dark"] .reader-progress span,
html[data-theme="dark"] .mini-progress span {
  background: linear-gradient(90deg, #d08a58, #efbf7d) !important;
}

html[data-theme="dark"] .inline-learn-card,
html[data-theme="dark"] .inline-pair-card,
html[data-theme="dark"] .chapter-text .inline-learn-card,
html[data-theme="dark"] .chapter-text .inline-pair-card {
  border-color: rgba(151, 224, 211, .48) !important;
  background: #dff8f2 !important;
  color: #09231f !important;
}

html[data-theme="dark"] .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-word-card {
  border-color: rgba(28, 92, 81, .36) !important;
  background: #dff8f2 !important;
  color: #127263 !important;
  text-shadow: none !important;
}

html[data-theme="dark"] .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-meaning-card {
  background: #f9efe1 !important;
  color: #3a2617 !important;
}

html[data-theme="dark"] .inline-pair-card .quiz-answer-slot,
html[data-theme="dark"] .chapter-text .inline-pair-card .quiz-answer-slot {
  border-left-color: rgba(28, 92, 81, .32) !important;
  background: #dff8f2 !important;
}

html[data-theme="dark"] .quiz-answer-input,
html[data-theme="dark"] .chapter-text .quiz-answer-input {
  border: 0 !important;
  border-bottom: 2px solid rgba(18, 114, 99, .42) !important;
  background: transparent !important;
  color: #09231f !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .quiz-answer-input:focus,
html[data-theme="dark"] .chapter-text .quiz-answer-input:focus {
  border-bottom-color: #127263 !important;
  background: rgba(255, 255, 255, .32) !important;
  box-shadow: 0 2px 0 rgba(18, 114, 99, .16) !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye,
html[data-theme="dark"] .reader-panel .quiz-eye {
  color: #124a41 !important;
  background: transparent !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye:hover,
html[data-theme="dark"] .chapter-text .quiz-eye:focus-visible,
html[data-theme="dark"] .chapter-text .quiz-eye.is-visible,
html[data-theme="dark"] .reader-panel .quiz-eye:hover,
html[data-theme="dark"] .reader-panel .quiz-eye:focus-visible,
html[data-theme="dark"] .reader-panel .quiz-eye.is-visible {
  background: rgba(18, 114, 99, .13) !important;
  color: #082d27 !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-correct),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-correct) {
  border-color: #66bf83 !important;
  background: #e8f9ec !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-similar),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-similar) {
  border-color: #d7a64f !important;
  background: #fff5dc !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-wrong),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-wrong) {
  border-color: #d56e67 !important;
  background: #fff0ee !important;
}

html[data-theme="dark"] .word-status,
html[data-theme="dark"] .phonetic {
  color: #e6bb80 !important;
}

html[data-theme="dark"] .word-meaning,
html[data-theme="dark"] .notebook-meaning {
  background: #fff1de !important;
  color: #352414 !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
}

html[data-theme="dark"] .word-actions .audio-button,
html[data-theme="dark"] .notebook-actions .audio-button {
  background: #eaf3ff !important;
  color: #1658a8 !important;
}

html[data-theme="dark"] .word-actions .audio-button.uk,
html[data-theme="dark"] .notebook-actions .audio-button.uk {
  background: #ffeaf8 !important;
  color: #934077 !important;
}

html[data-theme="dark"] .word-actions .ghost,
html[data-theme="dark"] .notebook-actions .ghost,
html[data-theme="dark"] .story-actions .ghost,
html[data-theme="dark"] .featured-actions .ghost {
  border-color: rgba(235, 201, 169, .28) !important;
  background: #18120f !important;
  color: #ffe7ca !important;
}

html[data-theme="dark"] .book-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .lock-chip {
  border-color: rgba(224, 173, 108, .42) !important;
  background: rgba(224, 173, 108, .18) !important;
  color: #ffd18f !important;
}

html[data-theme="dark"] .unlock-chip {
  border-color: rgba(106, 217, 160, .38) !important;
  background: rgba(106, 217, 160, .16) !important;
  color: #9df0be !important;
}

html[data-theme="dark"] input:not(.quiz-answer-input),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .admin-tools input,
html[data-theme="dark"] .admin-tools select,
html[data-theme="dark"] .notebook-tools input,
html[data-theme="dark"] .notebook-tools select,
html[data-theme="dark"] .admin-filter-row input,
html[data-theme="dark"] .admin-filter-row select {
  border-color: rgba(235, 201, 169, .24) !important;
  background: #0d1118 !important;
  color: #fff2e6 !important;
}

/* Light / black theme switch. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b0f;
  --paper: #11151d;
  --ink: #f5f0e8;
  --muted: #a99d90;
  --line: #2b241f;
  --soft: #171c25;
  --black: #f2e8db;
  --blue: #d08a58;
  --green: #64d49b;
  --amber: #e0ad6c;
  --shadow: 0 24px 70px rgba(0, 0, 0, .42);
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, .34);
}

.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(201, 134, 85, .26);
  border-radius: 999px;
  background: rgba(255, 254, 250, .72);
  color: #735740;
  font-family: var(--font-ui);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(122, 86, 54, .07);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 134, 85, .46);
  background: #fffaf2;
  box-shadow: 0 14px 30px rgba(122, 86, 54, .12);
}

.theme-toggle-icon {
  position: relative;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 50%;
  background: #161b24;
  box-shadow: inset -5px -4px 0 #f6dfbf;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon {
  background: #f2d095;
  box-shadow:
    0 0 0 4px rgba(242, 208, 149, .16),
    0 0 16px rgba(242, 208, 149, .34);
}

.reader-top-actions {
  justify-self: end !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.reader-top-actions .theme-toggle {
  min-height: 42px;
  padding-inline: 12px;
}

@media (max-width: 760px) {
  .theme-toggle {
    min-height: 36px;
    padding: 0 10px;
  }

  .theme-toggle-text {
    display: none;
  }

  .reader-top-actions {
    gap: 6px !important;
  }
}

html[data-theme="dark"] body,
html[data-theme="dark"] body:has(.reader-layout),
html[data-theme="dark"][data-app-mode="tablet"] body {
  background:
    radial-gradient(circle at 16% -6%, rgba(208, 138, 88, .18), transparent 34%),
    radial-gradient(circle at 92% 4%, rgba(70, 130, 118, .16), transparent 30%),
    linear-gradient(180deg, #0b0d12 0%, #090b0f 48%, #07080b 100%) !important;
  color: #f5f0e8 !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .reader-topbar {
  color: #f5f0e8 !important;
}

html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .reader-topbar .brand-mark {
  background: linear-gradient(145deg, #d59666, #9c5d3a) !important;
  color: #fffaf2 !important;
  box-shadow: 0 12px 26px rgba(208, 138, 88, .24) !important;
}

html[data-theme="dark"] .ghost,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .text-link,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .tab {
  border-color: rgba(222, 185, 149, .24) !important;
  background: rgba(22, 18, 16, .76) !important;
  color: #e9d4bf !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .ghost:hover,
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .text-link:hover,
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .tab:hover {
  border-color: rgba(222, 185, 149, .42) !important;
  background: rgba(42, 33, 27, .9) !important;
  color: #fff4e8 !important;
}

html[data-theme="dark"] .primary,
html[data-theme="dark"] .dark,
html[data-theme="dark"] .pill.active,
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .home-tabs .tab.active,
html[data-theme="dark"] .reader-mode-actions .ghost.active,
html[data-theme="dark"] .reader .tab.active {
  border-color: #d08a58 !important;
  background: #d08a58 !important;
  color: #17100c !important;
  box-shadow: 0 14px 32px rgba(208, 138, 88, .22) !important;
}

html[data-theme="dark"] .theme-toggle-icon {
  background: #f2d095 !important;
  box-shadow:
    0 0 0 4px rgba(242, 208, 149, .14),
    0 0 18px rgba(242, 208, 149, .32) !important;
}

html[data-theme="dark"] .theme-toggle[aria-pressed="true"] .theme-toggle-icon {
  background: #f0e6d6 !important;
  box-shadow: inset -6px -4px 0 #171b24 !important;
}

html[data-theme="dark"] .hero-subtitle,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .metric span,
html[data-theme="dark"] .book-info p,
html[data-theme="dark"] .story-card p,
html[data-theme="dark"] .reader-book-head p,
html[data-theme="dark"] .chapter-progress-head,
html[data-theme="dark"] .word-status,
html[data-theme="dark"] .word-meaning,
html[data-theme="dark"] .profile-hero p,
html[data-theme="dark"] .profile-stats span,
html[data-theme="dark"] .profile-book p,
html[data-theme="dark"] .notebook-head p,
html[data-theme="dark"] .notebook-meta,
html[data-theme="dark"] .auth-subtitle,
html[data-theme="dark"] .auth-switch,
html[data-theme="dark"] .locked-hint,
html[data-theme="dark"] .footer {
  color: #b9aa9a !important;
}

html[data-theme="dark"] .main-book,
html[data-theme="dark"] .story-card,
html[data-theme="dark"] .story-card.design-card,
html[data-theme="dark"] .reader-panel,
html[data-theme="dark"] .reader-book-head,
html[data-theme="dark"] .word-section,
html[data-theme="dark"] .word-card,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .redeem-card,
html[data-theme="dark"] .admin-box,
html[data-theme="dark"] .admin-shell,
html[data-theme="dark"] .notebook-shell,
html[data-theme="dark"] .notebook-card,
html[data-theme="dark"] .notebook-head,
html[data-theme="dark"] .notebook-count,
html[data-theme="dark"] .profile-hero,
html[data-theme="dark"] .profile-book,
html[data-theme="dark"] .profile-stats div,
html[data-theme="dark"] .modal-panel {
  border-color: rgba(222, 185, 149, .18) !important;
  background:
    linear-gradient(180deg, rgba(24, 27, 35, .94), rgba(15, 18, 25, .96)) !important;
  color: #f5f0e8 !important;
  box-shadow: 0 24px 72px rgba(0, 0, 0, .35) !important;
}

html[data-theme="dark"] .reader-panel {
  background:
    linear-gradient(180deg, rgba(17, 20, 27, .98), rgba(12, 14, 19, .98)) !important;
}

html[data-theme="dark"] .reader-panel p,
html[data-theme="dark"] .chapter-text,
html[data-theme="dark"] .chapter-title,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] strong {
  color: #f5f0e8 !important;
}

html[data-theme="dark"] .reader-progress,
html[data-theme="dark"] .mini-progress,
html[data-theme="dark"] .progress-track {
  background: #2b2421 !important;
}

html[data-theme="dark"] .reader-progress span,
html[data-theme="dark"] .mini-progress span,
html[data-theme="dark"] .progress-track span {
  background: linear-gradient(90deg, #d08a58, #e8c07f) !important;
}

html[data-theme="dark"] .inline-learn-card,
html[data-theme="dark"] .inline-pair-card,
html[data-theme="dark"] .chapter-text .inline-learn-card,
html[data-theme="dark"] .chapter-text .inline-pair-card {
  border-color: rgba(121, 188, 176, .38) !important;
  background: #13231f !important;
  color: #e7f7f1 !important;
}

html[data-theme="dark"] .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-word-card {
  border-color: rgba(121, 188, 176, .38) !important;
  color: #bff2e5 !important;
}

html[data-theme="dark"] .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-meaning-card {
  color: #e6c6a6 !important;
}

html[data-theme="dark"] .inline-pair-card .quiz-answer-slot,
html[data-theme="dark"] .chapter-text .inline-pair-card .quiz-answer-slot {
  border-left-color: rgba(121, 188, 176, .32) !important;
  background: #10201d !important;
}

html[data-theme="dark"] .quiz-answer-input,
html[data-theme="dark"] .chapter-text .quiz-answer-input {
  color: #eafff8 !important;
  border-bottom-color: rgba(222, 185, 149, .42) !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye,
html[data-theme="dark"] .reader-panel .quiz-eye {
  color: #b7d8cf !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye:hover,
html[data-theme="dark"] .chapter-text .quiz-eye:focus-visible,
html[data-theme="dark"] .chapter-text .quiz-eye.is-visible,
html[data-theme="dark"] .reader-panel .quiz-eye:hover,
html[data-theme="dark"] .reader-panel .quiz-eye:focus-visible,
html[data-theme="dark"] .reader-panel .quiz-eye.is-visible {
  background: rgba(121, 188, 176, .16) !important;
  color: #eafff8 !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-correct),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-correct) {
  border-color: #65bf85 !important;
  background: #102b1d !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-similar),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-similar) {
  border-color: #d4a552 !important;
  background: #2a2111 !important;
}

html[data-theme="dark"] .chapter-text .inline-pair-card:has(.quiz-answer-slot.is-wrong),
html[data-theme="dark"] .inline-pair-card:has(.quiz-answer-slot.is-wrong) {
  border-color: #cc736f !important;
  background: #2d1515 !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .admin-tools input,
html[data-theme="dark"] .admin-tools select,
html[data-theme="dark"] .notebook-tools input,
html[data-theme="dark"] .notebook-tools select,
html[data-theme="dark"] .admin-filter-row input,
html[data-theme="dark"] .admin-filter-row select {
  border-color: rgba(222, 185, 149, .26) !important;
  background: rgba(8, 10, 14, .82) !important;
  color: #f5f0e8 !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #887a6d !important;
}

html[data-theme="dark"] .book-pill,
html[data-theme="dark"] .lock-chip {
  border-color: rgba(224, 173, 108, .32) !important;
  background: rgba(224, 173, 108, .14) !important;
  color: #efc483 !important;
}

html[data-theme="dark"] .unlock-chip {
  border-color: rgba(100, 212, 155, .28) !important;
  background: rgba(100, 212, 155, .12) !important;
  color: #94e6ba !important;
}

html[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, .68) !important;
}

html[data-theme="dark"] .directory-list button,
html[data-theme="dark"] .admin-table th,
html[data-theme="dark"] .admin-table td {
  border-color: rgba(222, 185, 149, .14) !important;
  color: #e9d4bf !important;
}

html[data-theme="dark"] .directory-list button.active {
  background: rgba(208, 138, 88, .2) !important;
  color: #ffd9b8 !important;
}

html[data-theme="dark"] .notice,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .toast {
  border-color: rgba(222, 185, 149, .22) !important;
  background: rgba(19, 23, 31, .96) !important;
  color: #f5f0e8 !important;
}

/* Polished auth badge icon. */
.auth-icon {
  position: relative !important;
  width: 76px !important;
  height: 76px !important;
  display: grid !important;
  place-items: center !important;
  margin: 0 auto 18px !important;
  border: 1px solid rgba(255, 255, 255, .72) !important;
  border-radius: 24px !important;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .82), transparent 34%),
    linear-gradient(145deg, #f4dbc3 0%, #d09262 58%, #a9633d 100%) !important;
  box-shadow:
    0 18px 34px rgba(159, 99, 56, .22),
    inset 0 1px 0 rgba(255, 255, 255, .58),
    inset 0 -10px 22px rgba(122, 74, 42, .16) !important;
  color: #fff8ef !important;
  overflow: hidden !important;
}

.auth-icon::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 19px;
  pointer-events: none;
}

.auth-icon svg {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  overflow: visible;
}

.auth-icon-book.back {
  fill: rgba(95, 73, 56, .24);
  transform: translate(3px, 3px);
}

.auth-icon-book.front {
  fill: #fff8ef;
  filter: drop-shadow(0 5px 8px rgba(96, 61, 37, .24));
}

.auth-icon-line {
  fill: none;
  stroke: #9a6242;
  stroke-width: 3.1;
  stroke-linecap: round;
}

.auth-icon-ribbon {
  fill: #d08a58;
}

.auth-icon-spark {
  fill: #fff8ef;
  opacity: .94;
  filter: drop-shadow(0 2px 5px rgba(115, 72, 42, .18));
}

.auth-icon .spark-b {
  opacity: .72;
}

/* User profile page. */
.nav {
  align-items: center !important;
  gap: 12px !important;
}

.nav .ghost {
  min-width: auto !important;
  white-space: nowrap !important;
}

.profile-page {
  width: min(100%, 980px);
  margin: 58px auto 80px;
}

.profile-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 28px;
  border: 1px solid #ead8c8;
  border-radius: 14px;
  background: rgba(255, 253, 249, .82);
  box-shadow: 0 20px 44px rgba(102, 74, 46, .08);
}

.profile-hero h1 {
  margin: 14px 0 8px;
  color: #20242c;
  font-family: var(--warm-serif);
  font-size: 34px;
  line-height: 1.15;
}

.profile-hero p {
  margin: 0;
  color: #8a7664;
  font-weight: 700;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 34px;
}

.profile-stats div {
  min-height: 106px;
  display: grid;
  align-content: center;
  padding: 20px;
  border: 1px solid #ead8c8;
  border-radius: 12px;
  background: rgba(255, 253, 249, .72);
}

.profile-stats strong {
  color: #20242c;
  font-family: var(--warm-serif);
  font-size: 34px;
  line-height: 1;
}

.profile-stats span,
.profile-book p {
  color: #8a7664;
  font-weight: 800;
}

.profile-books h2 {
  margin: 0 0 16px;
  color: #20242c;
  font-family: var(--warm-serif);
  font-size: 28px;
}

.profile-book-list {
  display: grid;
  gap: 14px;
}

.profile-book {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid #ead8c8;
  border-radius: 14px;
  background: rgba(255, 253, 249, .82);
}

.profile-book h3 {
  margin: 8px 0 6px;
  color: #20242c;
  font-family: var(--warm-serif);
  font-size: 22px;
}

.profile-book .mini-progress {
  width: min(100%, 360px);
}

@media (max-width: 760px) {
  .profile-page {
    margin-top: 34px;
  }

  .profile-hero,
  .profile-book {
    display: grid;
  }

  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-book {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .profile-book > button {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}

/* Tablet install mode. */
html[data-app-mode="tablet"] .featured-actions .ghost[data-go="/redeem"],
html[data-app-mode="tablet"] [data-go="/redeem"],
html[data-app-mode="tablet"] [data-go="/login"],
html[data-app-mode="tablet"] [data-go="/register"],
html[data-app-mode="tablet"] [data-go="/admin"] {
  display: none !important;
}

html[data-app-mode="tablet"] body {
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

html[data-app-mode="tablet"] .page {
  padding-bottom: max(42px, env(safe-area-inset-bottom)) !important;
}

@media (orientation: landscape) and (min-width: 900px) {
  html[data-app-mode="tablet"] .story-grid.design-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  html[data-app-mode="tablet"] .reader {
    width: min(1240px, calc(100vw - 44px)) !important;
  }

  html[data-app-mode="tablet"] .reader-layout {
    width: min(100%, 1020px) !important;
    max-width: 1020px !important;
  }
}

@media (orientation: portrait) and (max-width: 920px) {
  html[data-app-mode="tablet"] .page {
    width: min(100% - 28px, 760px) !important;
  }

  html[data-app-mode="tablet"] .story-grid.design-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-app-mode="tablet"] .featured-book {
    grid-template-columns: 96px minmax(0, 1fr) !important;
  }

  html[data-app-mode="tablet"] .featured-actions {
    grid-column: 1 / -1;
    display: flex !important;
    justify-content: flex-end !important;
  }

  html[data-app-mode="tablet"] .reader {
    width: min(100% - 24px, 760px) !important;
  }

  html[data-app-mode="tablet"] .reader-book-head {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-app-mode="tablet"] .reader-mode-actions {
    justify-content: flex-start !important;
  }
}

@media (max-width: 640px) {
  html[data-app-mode="tablet"] .story-grid.design-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Reader topbar: keep the brand locked to the true center. */
.reader-topbar {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
}

.reader-topbar .text-link {
  justify-self: start !important;
}

.reader-topbar .center-brand,
.reader-topbar .brand {
  justify-self: center !important;
  display: inline-flex !important;
}

.reader-topbar .icon-button {
  justify-self: end !important;
}

@media (max-width: 980px) {
  .reader-topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  }

  .reader-topbar .center-brand,
  .reader-topbar .brand {
    display: inline-flex !important;
  }
}

/* Reader page: remove the right utility/history rail. */
.reader-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  width: min(100%, 940px) !important;
  max-width: 940px !important;
}

.reader-sidebar {
  display: none !important;
}

.chapter-main {
  width: 100% !important;
}

/* Smoother page navigation and open/back feedback. */
#app > .page,
#app > .reader {
  will-change: transform, opacity, filter;
}

#app.route-exit > .page,
#app.route-exit > .reader {
  opacity: 0;
  filter: blur(5px);
  transform: translate3d(0, 10px, 0) scale(.992);
  transition: opacity .13s ease, transform .13s ease, filter .13s ease;
}

#app.route-enter > .page,
#app.route-enter > .reader {
  opacity: 0;
  filter: blur(5px);
  transform: translate3d(0, 14px, 0) scale(.992);
}

#app.route-enter.route-enter-active > .page,
#app.route-enter.route-enter-active > .reader {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity .32s cubic-bezier(.22, .8, .28, 1), transform .32s cubic-bezier(.22, .8, .28, 1), filter .32s ease;
}

.reader-layout,
.featured-book,
.auth-card,
.redeem-card,
.notebook-shell,
.admin-shell {
  animation: soft-panel-in .42s cubic-bezier(.18, .84, .24, 1) both;
}

.story-card.design-card {
  transition: transform .22s cubic-bezier(.2, .82, .22, 1), border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
  will-change: transform;
}

.story-card.design-card:hover {
  transform: translateY(-4px);
  border-color: rgba(198, 133, 84, .46);
  box-shadow: 0 18px 34px rgba(104, 75, 48, .12);
}

.story-card.design-card:active {
  transform: translateY(-1px) scale(.992);
  transition-duration: .08s;
}

.reader-topbar .text-link,
.reader-controls > button,
.reader-sidebar button,
.reader-mode-actions .ghost,
.nav .ghost,
button[data-go] {
  transition: transform .18s cubic-bezier(.2, .82, .22, 1), border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.reader-topbar .text-link {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
}

.reader-topbar .text-link:hover {
  background: #fff4ec;
  color: #6f4d35;
  transform: translateX(-3px);
  box-shadow: 0 10px 22px rgba(111, 77, 53, .1);
}

.reader-topbar .text-link:active,
button[data-go]:active {
  transform: translateY(1px) scale(.985);
  transition-duration: .08s;
}

.reader-panel {
  animation: reader-page-open .46s cubic-bezier(.18, .84, .24, 1) both;
  transform-origin: 50% 18px;
}

.chapter-title,
.chapter-progress-head,
.reader-controls,
.word-section {
  animation: soft-panel-in .38s cubic-bezier(.18, .84, .24, 1) both;
}

.chapter-progress-head { animation-delay: .03s; }
.chapter-title { animation-delay: .05s; }
.reader-controls { animation-delay: .07s; }
.word-section { animation-delay: .1s; }

@keyframes soft-panel-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes reader-page-open {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(.986);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #app.route-exit > .page,
  #app.route-exit > .reader,
  #app.route-enter > .page,
  #app.route-enter > .reader,
  #app.route-enter.route-enter-active > .page,
  #app.route-enter.route-enter-active > .reader,
  .reader-layout,
  .featured-book,
  .auth-card,
  .redeem-card,
  .notebook-shell,
  .admin-shell,
  .reader-panel,
  .chapter-title,
  .chapter-progress-head,
  .reader-controls,
  .word-section {
    animation: none !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* Book library lock badge: place the lock on the card corner, not on the cover. */
.story-card.design-card {
  position: relative;
}

.story-card.is-locked .design-cover::before,
.story-card.is-locked .design-cover::after {
  content: none !important;
}

.story-card.design-card.is-locked::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 12px;
  background: linear-gradient(145deg, #8d6f57, #5f4b3e);
  box-shadow: 0 10px 20px rgba(86, 62, 43, .22), inset 0 1px 0 rgba(255, 255, 255, .26);
  pointer-events: none;
}

.story-card.design-card.is-locked::before {
  content: "\9501";
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff9f1;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(39, 29, 21, .38);
  pointer-events: none;
}

@media (max-width: 760px) {
  .story-card.design-card.is-locked::before,
  .story-card.design-card.is-locked::after {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 11px;
  }
}

/* Minimal eye icon, matching the user's reference. */
.chapter-text .quiz-eye {
  flex: 0 0 24px !important;
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #7f8984 !important;
  opacity: 1 !important;
}

.chapter-text .quiz-eye:hover,
.chapter-text .quiz-eye.is-visible {
  border: 0 !important;
  background: transparent !important;
  color: #65706b !important;
}

.chapter-text .quiz-eye span {
  width: 17px !important;
  height: 10px !important;
  border: 2px solid currentColor !important;
  border-radius: 999px / 70% !important;
  background: transparent !important;
  box-shadow: none !important;
}

.chapter-text .quiz-eye span::before {
  width: 4px !important;
  height: 4px !important;
  background: currentColor !important;
  box-shadow: none !important;
}

.chapter-text .quiz-eye::after {
  left: 5px !important;
  top: 11px !important;
  width: 15px !important;
  height: 2px !important;
  background: currentColor !important;
  transform: rotate(-42deg) scaleX(0) !important;
}

.chapter-text .quiz-eye.is-visible::after {
  transform: rotate(-42deg) scaleX(1) !important;
}

@media (max-width: 760px) {
  .chapter-text .quiz-eye {
    flex-basis: 24px !important;
    width: 24px !important;
    height: 24px !important;
  }
}

/* Real SVG eye icon, no more box-shaped CSS drawing. */
.chapter-text .quiz-eye {
  flex: 0 0 30px !important;
  width: 30px !important;
  height: 30px !important;
  display: inline-grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 1px solid #d9c6b0 !important;
  border-radius: 999px !important;
  background: #fff8ef !important;
  color: #4f5c55 !important;
}

.chapter-text .quiz-eye span,
.chapter-text .quiz-eye span::before,
.chapter-text .quiz-eye::after {
  display: none !important;
  content: none !important;
}

.chapter-text .quiz-eye-icon {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.35 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.chapter-text .quiz-eye-icon circle {
  fill: currentColor !important;
  stroke: none !important;
}

.chapter-text .quiz-eye .eye-closed {
  display: none !important;
}

.chapter-text .quiz-eye.is-visible .eye-open {
  display: none !important;
}

.chapter-text .quiz-eye.is-visible .eye-closed {
  display: block !important;
}

.chapter-text .quiz-eye:hover,
.chapter-text .quiz-eye.is-visible {
  border-color: #c7ad92 !important;
  background: #f6eadc !important;
  color: #2f3f38 !important;
}

@media (max-width: 760px) {
  .chapter-text .quiz-eye {
    flex-basis: 30px !important;
    width: 30px !important;
    height: 30px !important;
  }

  .chapter-text .quiz-eye-icon {
    width: 22px !important;
    height: 22px !important;
  }
}

/* Final eye visibility override. */
.chapter-text .quiz-eye {
  flex: 0 0 34px !important;
  width: 34px !important;
  height: 34px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #52615a !important;
  opacity: 1 !important;
}

.chapter-text .quiz-eye-icon {
  width: 25px !important;
  height: 25px !important;
  stroke-width: 2.2 !important;
}

.chapter-text .quiz-eye:hover,
.chapter-text .quiz-eye:focus-visible,
.chapter-text .quiz-eye.is-visible {
  border: 0 !important;
  background: #e6f0ec !important;
  color: #263f36 !important;
}

@media (max-width: 760px) {
  .chapter-text .quiz-eye {
    flex-basis: 36px !important;
    width: 36px !important;
    height: 36px !important;
  }

  .chapter-text .quiz-eye-icon {
    width: 26px !important;
    height: 26px !important;
  }
}

/* Absolute final dark-mode visibility overrides. */
html[data-theme="dark"] body,
html[data-theme="dark"] body:has(.reader-layout),
html[data-theme="dark"][data-app-mode="tablet"] body {
  background:
    radial-gradient(circle at 12% -8%, rgba(208, 138, 88, .2), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(73, 128, 118, .18), transparent 30%),
    linear-gradient(180deg, #15110f 0%, #090b0f 42%, #07090d 100%) !important;
  color: #f7efe5 !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .reader-topbar {
  border: 1px solid rgba(235, 201, 169, .16) !important;
  border-radius: 12px !important;
  background: rgba(22, 19, 17, .94) !important;
  color: #fff4e8 !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .32) !important;
}

html[data-theme="dark"] .topbar .brand,
html[data-theme="dark"] .reader-topbar .brand {
  color: #fff4e8 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .home-stats div,
html[data-theme="dark"] .hero-stats div,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .profile-stats div {
  border-color: rgba(235, 201, 169, .2) !important;
  background: linear-gradient(180deg, #1b1f28, #12161e) !important;
  color: #fff5eb !important;
}

html[data-theme="dark"] .home-stats strong,
html[data-theme="dark"] .hero-stats strong,
html[data-theme="dark"] .metric strong,
html[data-theme="dark"] .profile-stats strong {
  color: #fffaf3 !important;
}

html[data-theme="dark"] .home-stats span,
html[data-theme="dark"] .hero-stats span,
html[data-theme="dark"] .metric span,
html[data-theme="dark"] .profile-stats span {
  color: #d8c2ad !important;
}

html[data-theme="dark"] .featured-book,
html[data-theme="dark"] .main-book,
html[data-theme="dark"] .story-card,
html[data-theme="dark"] .story-card.design-card,
html[data-theme="dark"] .reader-book-head,
html[data-theme="dark"] .chapter-header,
html[data-theme="dark"] .tool-row,
html[data-theme="dark"] .word-section,
html[data-theme="dark"] .word-card,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .redeem-card,
html[data-theme="dark"] .notebook-card,
html[data-theme="dark"] .notebook-head,
html[data-theme="dark"] .notebook-count,
html[data-theme="dark"] .profile-hero,
html[data-theme="dark"] .profile-book,
html[data-theme="dark"] .admin-box,
html[data-theme="dark"] .modal-panel {
  border-color: rgba(235, 201, 169, .18) !important;
  background: linear-gradient(180deg, #171b24, #10141b) !important;
  color: #fff4e8 !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .36) !important;
}

html[data-theme="dark"] .featured-info h3,
html[data-theme="dark"] .design-card-info h3,
html[data-theme="dark"] .story-card h3,
html[data-theme="dark"] .word-main strong,
html[data-theme="dark"] .notebook-word strong,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 {
  color: #fff8f0 !important;
}

html[data-theme="dark"] .home-intro p,
html[data-theme="dark"] .featured-info p,
html[data-theme="dark"] .design-card-info p,
html[data-theme="dark"] .reading-metrics,
html[data-theme="dark"] .story-card p,
html[data-theme="dark"] .book-card-stats,
html[data-theme="dark"] .locked-hint,
html[data-theme="dark"] .chapter-progress-head span {
  color: #d9c5b2 !important;
}

html[data-theme="dark"] .reading-metrics strong,
html[data-theme="dark"] .book-card-stats strong {
  color: #ffe1bf !important;
}

html[data-theme="dark"] .reader-panel {
  border-color: rgba(117, 165, 153, .24) !important;
  background: linear-gradient(180deg, #10151d, #080b10) !important;
  color: #f8f0e6 !important;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .42) !important;
}

html[data-theme="dark"] .reader-panel p,
html[data-theme="dark"] .chapter-text {
  color: #f8f0e6 !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost,
html[data-theme="dark"] .reader-controls > button,
html[data-theme="dark"] .font-controls,
html[data-theme="dark"] .font-controls button,
html[data-theme="dark"] .reader-topbar .text-link,
html[data-theme="dark"] .reader-topbar .icon-button,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .nav .ghost {
  border-color: rgba(235, 201, 169, .22) !important;
  background: #322b25 !important;
  color: #fff0df !important;
}

html[data-theme="dark"] .reader-mode-actions .ghost.active,
html[data-theme="dark"] .font-controls .active,
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .home-tabs .tab.active,
html[data-theme="dark"] .primary {
  border-color: #d08a58 !important;
  background: #d08a58 !important;
  color: #130d09 !important;
}

html[data-theme="dark"] .inline-learn-card,
html[data-theme="dark"] .inline-pair-card,
html[data-theme="dark"] .chapter-text .inline-learn-card,
html[data-theme="dark"] .chapter-text .inline-pair-card {
  border-color: rgba(151, 224, 211, .48) !important;
  background: #dff8f2 !important;
  color: #09231f !important;
}

html[data-theme="dark"] .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-word-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-word-card {
  border-color: rgba(28, 92, 81, .36) !important;
  background: #dff8f2 !important;
  color: #127263 !important;
  text-shadow: none !important;
}

html[data-theme="dark"] .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-pair-card .inline-meaning-card,
html[data-theme="dark"] .chapter-text .inline-learn-card .inline-meaning-card {
  background: #f9efe1 !important;
  color: #3a2617 !important;
}

html[data-theme="dark"] .inline-pair-card .quiz-answer-slot,
html[data-theme="dark"] .chapter-text .inline-pair-card .quiz-answer-slot {
  border-left-color: rgba(28, 92, 81, .32) !important;
  background: #dff8f2 !important;
}

html[data-theme="dark"] .quiz-answer-input,
html[data-theme="dark"] .chapter-text .quiz-answer-input {
  border: 0 !important;
  border-bottom: 2px solid rgba(18, 114, 99, .42) !important;
  background: transparent !important;
  color: #09231f !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .quiz-answer-input:focus,
html[data-theme="dark"] .chapter-text .quiz-answer-input:focus {
  border-bottom-color: #127263 !important;
  background: rgba(255, 255, 255, .32) !important;
  box-shadow: 0 2px 0 rgba(18, 114, 99, .16) !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye,
html[data-theme="dark"] .reader-panel .quiz-eye {
  color: #124a41 !important;
  background: transparent !important;
}

html[data-theme="dark"] .chapter-text .quiz-eye:hover,
html[data-theme="dark"] .chapter-text .quiz-eye:focus-visible,
html[data-theme="dark"] .chapter-text .quiz-eye.is-visible,
html[data-theme="dark"] .reader-panel .quiz-eye:hover,
html[data-theme="dark"] .reader-panel .quiz-eye:focus-visible,
html[data-theme="dark"] .reader-panel .quiz-eye.is-visible {
  background: rgba(18, 114, 99, .13) !important;
  color: #082d27 !important;
}

html[data-theme="dark"] .word-status,
html[data-theme="dark"] .phonetic {
  color: #e6bb80 !important;
}

html[data-theme="dark"] .word-meaning,
html[data-theme="dark"] .notebook-meaning {
  background: #fff1de !important;
  color: #352414 !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
}

html[data-theme="dark"] .word-actions .audio-button,
html[data-theme="dark"] .notebook-actions .audio-button {
  background: #eaf3ff !important;
  color: #1658a8 !important;
}

html[data-theme="dark"] .word-actions .audio-button.uk,
html[data-theme="dark"] .notebook-actions .audio-button.uk {
  background: #ffeaf8 !important;
  color: #934077 !important;
}

html[data-theme="dark"] .book-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .lock-chip {
  border-color: rgba(224, 173, 108, .42) !important;
  background: rgba(224, 173, 108, .18) !important;
  color: #ffd18f !important;
}

html[data-theme="dark"] .unlock-chip {
  border-color: rgba(106, 217, 160, .38) !important;
  background: rgba(106, 217, 160, .16) !important;
  color: #9df0be !important;
}

html[data-theme="dark"] input:not(.quiz-answer-input),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .admin-tools input,
html[data-theme="dark"] .admin-tools select,
html[data-theme="dark"] .notebook-tools input,
html[data-theme="dark"] .notebook-tools select,
html[data-theme="dark"] .admin-filter-row input,
html[data-theme="dark"] .admin-filter-row select {
  border-color: rgba(235, 201, 169, .24) !important;
  background: #0d1118 !important;
  color: #fff2e6 !important;
}
