@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Noto+Sans+SC:wght@400;500;600;700;800;900&family=Noto+Serif+SC:wght@500;600;700;900&display=swap");

:root {
  --font-ui: Inter, "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-reading: "Noto Serif SC", "Noto Sans SC", Inter, ui-serif, Georgia, "Times New Roman", serif;
}

.cover-wrap {
  position: relative;
  width: 100%;
  align-self: start;
}

.cover-wrap.small {
  max-width: 122px;
}

.lock-badge {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(28, 37, 55, .12);
  border-radius: 999px;
  background: #172033;
  box-shadow: 0 12px 24px rgba(23, 32, 51, .22);
  font-size: 0;
}

.lock-badge::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 7px;
  width: 12px;
  height: 10px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.lock-badge::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 15px;
  width: 16px;
  height: 12px;
  border-radius: 3px;
  background: #fff;
}

.story-card.is-locked,
.main-book.is-locked {
  cursor: pointer;
  background: rgba(255, 255, 255, .78);
}

.story-card.is-locked .small-cover,
.main-book.is-locked .cover {
  filter: saturate(.78) brightness(.94);
}

.locked-hint {
  margin: -2px 0 12px;
  color: #7a8494;
  font-size: 14px;
  line-height: 1.6;
}

.lock-chip {
  border-color: #ead7bd;
  background: #fff4e5;
  color: #9a5d16;
}

.unlock-chip {
  border-color: #cfdfd9;
  background: #edf7f3;
  color: #27634d;
}

.locked-button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #f5f7fa;
  color: #536176;
  font-weight: 800;
  cursor: pointer;
}

.locked-button:hover {
  border-color: #c9d5e4;
  background: #edf2f7;
}

/* UI refresh */
:root {
  --bg: #f4f7fb;
  --paper: #ffffff;
  --ink: #171a22;
  --muted: #647084;
  --line: #dce4ef;
  --soft: #eef3f9;
  --blue: #245fce;
  --green: #158765;
  --black: #141820;
  --rose: #c85a8a;
  --amber: #c78a32;
  --shadow: 0 20px 50px rgba(22, 34, 52, .08);
  --shadow-soft: 0 12px 28px rgba(22, 34, 52, .06);
}

body {
  background:
    linear-gradient(90deg, rgba(222, 230, 241, .88), rgba(250, 252, 255, .28) 17%, rgba(250, 252, 255, .28) 83%, rgba(222, 230, 241, .88)),
    linear-gradient(180deg, #fbfdff 0, #f5f8fc 42%, #eef3f9 100%);
}

.page {
  width: min(1180px, calc(100vw - 44px));
  padding: 42px 0 64px;
}

.reader {
  width: min(1080px, calc(100vw - 44px));
  padding: 32px 0 72px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 34px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 228, 239, .82);
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 14px 36px rgba(20, 29, 43, .07);
  backdrop-filter: blur(16px);
}

.brand {
  gap: 12px;
  font-size: 15px;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #141820, #2d3442);
  box-shadow: 0 10px 20px rgba(20, 24, 32, .16);
}

.pill,
.ghost,
.primary,
.dark,
.tab,
.audio-button {
  letter-spacing: 0;
}

.pill,
.ghost,
.primary,
.dark {
  min-height: 40px;
  border-radius: 8px;
  background: #fff;
  border-color: #dce5f0;
  color: #263244;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}

.primary {
  background: linear-gradient(135deg, #245fce, #174ea8);
  border-color: #174ea8;
  color: #fff;
}

.dark,
.pill.active {
  background: #141820;
  border-color: #141820;
  color: #fff;
}

.ghost:hover,
.pill:hover,
.primary:hover,
.dark:hover,
.audio-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(22, 34, 52, .1);
}

.home-hero {
  min-height: 214px;
  margin-bottom: 22px;
  padding: 34px;
  border: 1px solid #dbe6f2;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(242, 247, 253, .9)),
    linear-gradient(90deg, rgba(36, 95, 206, .08), rgba(200, 90, 138, .08));
  box-shadow: var(--shadow);
}

.hero-title {
  max-width: 680px;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-subtitle {
  margin: 12px 0 0;
  font-size: 18px;
  color: #58667a;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
}

.hero-stats div,
.metric {
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-soft);
}

.hero-stats div {
  min-width: 98px;
  padding: 16px 18px;
}

.hero-stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.main-book,
.metric,
.story-card,
.chapter-header,
.tool-row,
.admin-box,
.word-card,
.word-section {
  border-color: #dce5f0;
  background: rgba(255, 255, 255, .92);
}

.main-book {
  min-height: 236px;
  padding: 28px;
  border-radius: 8px;
  grid-template-columns: 150px minmax(0, 1fr);
  box-shadow: var(--shadow);
}

.cover,
.small-cover {
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 18px 34px rgba(20, 29, 43, .16);
}

.chip {
  background: #eef3f9;
  color: #516074;
  border: 1px solid #dfe7f1;
}

.book-title {
  font-size: 31px;
  letter-spacing: 0;
}

.progress-line {
  height: 8px;
  background: #e6edf5;
}

.progress-line span,
.chapter-progress span {
  background: linear-gradient(90deg, #245fce, #19a177);
}

.metric {
  padding: 20px;
  box-shadow: none;
}

.metric strong {
  color: #182033;
}

.section-row {
  margin-top: 42px;
  border-color: #dce5f0;
}

.section-row h2,
.shelf-title {
  font-size: 32px;
  letter-spacing: 0;
}

.tabs {
  border-radius: 8px;
  background: rgba(238, 243, 249, .72);
  border-color: #dce5f0;
}

.tab {
  min-height: 38px;
  border-radius: 7px;
  color: #536174;
}

.tab.active {
  color: #141820;
  background: #fff;
  box-shadow: 0 10px 22px rgba(22, 34, 52, .08);
}

.story-grid {
  gap: 16px;
}

.story-card {
  padding: 22px;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: start;
  box-shadow: var(--shadow-soft);
}

.story-card h3 {
  font-size: 21px;
  margin-bottom: 10px;
}

.story-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.reader-top {
  margin-bottom: 14px;
  padding: 0 0 18px;
  border-color: #dce5f0;
  align-items: end;
}

.reader-title {
  font-size: 38px;
  letter-spacing: 0;
}

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

.mode-switch {
  min-width: 382px;
  padding: 5px;
  border-radius: 8px;
  background: #eef3f9;
  border-color: #dce5f0;
}

.chapter-header {
  margin: 16px 0 10px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  box-shadow: var(--shadow-soft);
}

.chapter-header h2 {
  margin-top: 6px;
  font-size: 28px;
}

.chapter-progress {
  height: 9px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.chapter-progress span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
}

.tool-row {
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: none;
}

.reader-panel {
  margin-top: 12px;
  padding: 46px 52px;
  border-radius: 8px;
  border-color: #dce5f0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .96)),
    repeating-linear-gradient(0deg, transparent 0, transparent 41px, rgba(36, 95, 206, .025) 42px);
  color: #20242d;
  line-height: 2.18;
  box-shadow: 0 28px 70px rgba(22, 34, 52, .08);
}

.reader-panel p {
  margin-bottom: 28px;
}

.blank-pair {
  min-height: 1.42em;
  padding: 0 .32em;
  border-radius: 8px;
  box-shadow: none;
}

.inline-blank {
  height: .82em;
}

.chapter-done {
  margin: 24px 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #141820, #263244);
}

.word-section {
  margin-top: 26px;
  padding: 28px;
  scroll-margin-top: 104px;
  box-shadow: var(--shadow);
}

.word-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.word-section h2 {
  font-size: 32px;
  margin-top: 6px;
}

.word-summary {
  min-width: 82px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #141820;
  color: #fff;
  text-align: center;
}

.word-summary strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.word-summary span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 800;
}

.word-tabs {
  width: 100%;
  max-width: 760px;
  margin-left: 0;
}

.word-list {
  gap: 10px;
}

.word-card {
  min-height: 86px;
  padding: 14px 16px 14px 20px;
  grid-template-columns: minmax(170px, 220px) minmax(220px, 1fr) minmax(250px, auto);
  gap: 16px;
  background: #fbfdff;
  box-shadow: none;
}

.word-card::before {
  inset: 14px auto 14px 0;
  background: #d3a760;
}

.word-main strong {
  font-size: 25px;
}

.word-status {
  min-height: 24px;
  margin-top: 7px;
  background: #f4efe6;
}

.word-meaning {
  padding: 12px 14px;
  background: #f4f7fb;
  border-color: #e0e8f1;
  font-size: 17px;
}

.word-actions {
  gap: 7px;
}

.audio-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

.audio-button.us {
  border-color: #cfe0f8;
  background: #f4f8ff;
}

.audio-button.uk {
  border-color: #efd0de;
  background: #fff6fa;
}

.float-left,
.float-right {
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(20, 29, 43, .14);
}

.float-left {
  left: 20px;
}

.float-right {
  right: 20px;
}

.catalog {
  width: min(390px, 88vw);
  padding: 28px;
  box-shadow: 24px 0 70px rgba(20, 29, 43, .16);
}

.chapter-link {
  min-height: 44px;
  padding: 9px 12px;
  line-height: 1.45;
}

.admin-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.admin-box {
  border-color: #dce5f0;
  box-shadow: var(--shadow-soft);
}

.field input,
.field textarea {
  border-color: #dce5f0;
  background: #fbfdff;
}

.field input:focus,
.field textarea:focus {
  border-color: #9fb7d2;
  box-shadow: 0 0 0 4px rgba(36, 95, 206, .08);
}

@media (max-width: 980px) {
  .page,
  .reader {
    width: min(100vw - 24px, 760px);
    padding-top: 22px;
  }

  .topbar,
  .home-hero,
  .reader-top,
  .chapter-header,
  .tool-row,
  .chapter-done,
  .word-section-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar .nav {
    margin-left: auto;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar .nav {
    margin-left: auto;
  }

  .home-hero {
    padding: 24px;
  }

  .hero-title,
  .reader-title {
    font-size: 31px;
  }

  .hero-stats,
  .dashboard,
  .story-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .main-book,
  .story-card,
  .word-card {
    grid-template-columns: 1fr;
  }

  .mode-switch,
  .tabs,
  .word-tabs {
    min-width: 0;
    width: 100%;
  }

  .tab {
    min-height: 42px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 1.2;
  }

  .tab {
    min-height: 42px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 1.2;
  }

  .reader-panel {
    padding: 26px 20px;
    line-height: 2.04;
  }

  .word-actions {
    justify-content: start;
  }

  .float-left,
  .float-right {
    display: none;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar .nav {
    margin-left: auto;
  }

  .tab {
    min-height: 42px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 1.2;
  }
}

@media (max-width: 760px) {
  .reader-top {
    padding: 18px;
    border: 1px solid #dce5f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--shadow-soft);
    gap: 16px;
  }

  .reader-top > div:first-child {
    display: grid;
    gap: 6px;
  }

  .reader-title {
    font-size: 30px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  .reader-actions {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
  }

  .reader-actions > .ghost {
    grid-column: 1;
    min-height: 46px;
    padding: 0 12px;
  }

  .mode-switch {
    grid-column: 2;
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .reader-title {
    font-size: 27px;
  }

  .reader-actions {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    grid-column: auto;
  }

  .reader-actions > .ghost {
    grid-column: auto;
    order: 2;
  }
}

/* Final user-requested fixes: keep these at the real end of the stylesheet. */
.nav [data-go="/admin"] {
  display: none !important;
}

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

.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;
}

/* Final fixes requested after UI remake */
.nav [data-go="/admin"] {
  display: none !important;
}

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

.design-cover {
  padding: 0 !important;
  overflow: visible !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(120px, 1fr) auto minmax(120px, 1fr) !important;
  gap: 16px !important;
  align-items: center !important;
}

.reader-controls > button {
  width: auto !important;
  min-width: 116px !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;
}

/* Final fixes requested after UI remake */
.nav [data-go="/admin"] {
  display: none !important;
}

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

.design-cover {
  padding: 0 !important;
  overflow: visible !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(120px, 1fr) auto minmax(120px, 1fr) !important;
  gap: 16px !important;
  align-items: center !important;
}

.reader-controls > button {
  width: auto !important;
  min-width: 116px !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;
}

.chip.lock-chip {
  border-color: #ead7bd;
  background: #fff4e5;
  color: #9a5d16;
}

.chip.unlock-chip {
  border-color: #cfdfd9;
  background: #edf7f3;
  color: #27634d;
}

/* Design remake: warm reading UI */
:root {
  --warm-bg: #fbf7f1;
  --warm-panel: #fffdf9;
  --warm-ink: #2f2118;
  --warm-muted: #8c735e;
  --warm-line: #eadbcd;
  --warm-soft: #f3e7d8;
  --warm-accent: #c88c61;
  --warm-accent-dark: #9d6f4d;
  --warm-brown: #4e3d2e;
  --warm-green: #dfeee5;
  --warm-shadow: 0 18px 44px rgba(81, 57, 38, .08);
  --warm-serif: "Noto Serif SC", "Noto Sans SC", Georgia, serif;
}

html,
body {
  background: var(--warm-bg) !important;
  color: var(--warm-ink);
}

body {
  background:
    radial-gradient(circle at 16% 88%, rgba(234, 219, 205, .25), transparent 18rem),
    radial-gradient(circle at 80% 16%, rgba(234, 219, 205, .24), transparent 22rem),
    var(--warm-bg) !important;
}

.page {
  width: min(100% - 56px, 1060px) !important;
  padding: 22px 0 80px !important;
}

.topbar {
  height: 48px !important;
  margin: 0 0 60px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.brand {
  gap: 12px !important;
  color: var(--warm-ink) !important;
  font-family: var(--warm-serif);
  font-weight: 800;
}

.brand-mark {
  width: 36px !important;
  height: 36px !important;
  border-radius: 9px !important;
  background: var(--warm-accent) !important;
  color: #fff !important;
  box-shadow: none !important;
  font-family: var(--warm-serif);
}

.nav {
  gap: 20px !important;
}

.nav .ghost {
  min-height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--warm-muted) !important;
  box-shadow: none !important;
  font-weight: 700;
}

.home-intro,
.reading-section,
.library-head {
  width: min(100%, 980px);
  margin-inline: auto;
}

.home-intro h1 {
  margin: 0 0 10px;
  font-family: var(--warm-serif);
  font-size: 34px;
  letter-spacing: 0;
}

.home-intro p {
  margin: 0 0 34px;
  color: var(--warm-muted);
  font-size: 16px;
}

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

.home-stats div {
  min-height: 96px;
  padding: 22px 24px;
  border: 1px solid var(--warm-line);
  border-radius: 16px;
  background: rgba(255, 253, 249, .82);
  box-shadow: none;
}

.home-stats strong {
  display: block;
  font-family: var(--warm-serif);
  font-size: 36px;
  line-height: 1;
}

.home-stats span {
  display: block;
  margin-top: 8px;
  color: var(--warm-muted);
  font-weight: 700;
}

.reading-section h2,
.library-head h2 {
  margin: 0 0 16px;
  font-family: var(--warm-serif);
  font-size: 25px;
}

.featured-book {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  min-height: 176px;
  margin-bottom: 36px;
  padding: 28px 24px;
  border: 1px solid var(--warm-line);
  border-radius: 18px;
  background: var(--warm-panel);
  box-shadow: none;
}

.featured-info h3,
.design-card-info h3 {
  margin: 0;
  font-family: var(--warm-serif);
  font-weight: 900;
}

.featured-info h3 {
  margin-top: 10px;
  font-size: 22px;
}

.featured-info p,
.design-card-info p {
  color: var(--warm-muted);
}

.reading-metrics {
  display: flex;
  gap: 34px;
  margin-top: 18px;
  color: var(--warm-muted);
  font-size: 13px;
}

.reading-metrics strong {
  display: block;
  margin-top: 6px;
  color: var(--warm-ink);
  font-size: 16px;
}

.featured-actions {
  display: flex;
  gap: 12px;
}

.book-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm-accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.primary,
.auth-submit {
  min-height: 44px !important;
  padding: 0 24px !important;
  border: 1px solid var(--warm-accent) !important;
  border-radius: 11px !important;
  background: var(--warm-accent) !important;
  color: #fff !important;
  box-shadow: 0 10px 18px rgba(200, 140, 97, .22) !important;
  font-weight: 900 !important;
}

.ghost,
.pill,
.locked-button {
  min-height: 42px !important;
  padding: 0 18px !important;
  border: 1px solid var(--warm-line) !important;
  border-radius: 9px !important;
  background: rgba(255, 253, 249, .76) !important;
  color: var(--warm-accent-dark) !important;
  box-shadow: none !important;
  font-weight: 800 !important;
}

.tabs.home-tabs {
  width: max-content;
  margin: 0 auto 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px;
}

.home-tabs .tab {
  min-width: 58px;
  border-radius: 999px;
  border-color: var(--warm-line);
  background: transparent;
  color: var(--warm-muted);
}

.home-tabs .tab.active {
  background: var(--warm-accent);
  color: #fff;
}

.story-grid.design-grid {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.story-card.design-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--warm-line);
  border-radius: 16px;
  background: var(--warm-panel);
  box-shadow: none;
  cursor: pointer;
}

.design-cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 100px;
  padding: 0;
  border-radius: 8px;
  background: #c99372;
  color: #fff;
  box-shadow: 0 10px 18px rgba(76, 45, 24, .15);
  text-align: center;
  font-family: var(--warm-serif);
  font-weight: 900;
  line-height: 1.35;
  overflow: visible;
}

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

.story-card.is-locked .design-cover::after,
.featured-book.is-locked .design-cover::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--warm-brown);
  box-shadow: 0 10px 18px rgba(78, 61, 46, .18);
}

.story-card.is-locked .design-cover::before,
.featured-book.is-locked .design-cover::before {
  content: "锁";
  position: absolute;
  right: -4px;
  top: -3px;
  z-index: 1;
  color: #fff;
  font-size: 13px;
  font-family: var(--font-ui);
  font-style: normal;
}

.design-cover.large {
  width: 100px;
  height: 140px;
}

.design-cover.kaoyan { background: #6289a0; }
.design-cover.cet4 { background: #d49a83; }
.design-cover.cet6 { background: #7cb27d; }
.design-cover.ielts { background: #b7839f; }
.design-cover.other { background: #8f795a; }

.design-card-info {
  display: grid;
  align-content: center;
}

.design-card-info h3 {
  font-size: 17px;
}

.design-card-info p {
  margin: 28px 0 4px;
  font-size: 13px;
}

.mini-progress {
  height: 4px;
  border-radius: 999px;
  background: #eee4db;
  overflow: hidden;
}

.mini-progress span {
  display: block;
  width: var(--value);
  height: 100%;
  background: var(--warm-accent);
}

.auth-layout {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}

.auth-box {
  position: relative;
  width: min(420px, 100%);
  padding: 48px 40px !important;
  border: 1px solid var(--warm-line) !important;
  border-radius: 22px !important;
  background: rgba(255, 253, 249, .94) !important;
  box-shadow: 0 20px 46px rgba(76, 45, 24, .08) !important;
}

.auth-box::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 48px;
  height: 3px;
  transform: translateX(-50%);
  background: var(--warm-accent);
  border-radius: 999px;
}

.auth-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 17px;
  background: var(--warm-soft);
  color: var(--warm-accent);
  font-size: 28px;
}

.auth-box h1 {
  margin: 0 0 10px;
  text-align: center;
  font-family: var(--warm-serif);
  font-size: 28px;
}

.auth-subtitle {
  margin: 0 0 30px;
  text-align: center;
  color: var(--warm-muted);
}

.field {
  gap: 8px;
  margin-bottom: 18px;
  color: var(--warm-ink);
  font-weight: 900;
}

.field input,
.field textarea,
.admin-tools select,
.admin-tools input {
  min-height: 48px;
  border: 1px solid var(--warm-line) !important;
  border-radius: 12px !important;
  background: rgba(255, 253, 249, .72) !important;
  color: var(--warm-ink);
}

.auth-format {
  margin: -8px 0 22px;
  color: var(--warm-muted);
  font-size: 13px;
}

.auth-format span {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--warm-soft);
  color: var(--warm-accent-dark);
  font-weight: 900;
}

.forgot-link {
  display: block;
  margin: -8px 4px 26px auto;
  text-align: right;
}

.link-inline {
  border: 0;
  background: transparent;
  color: var(--warm-accent-dark);
  font-weight: 900;
  cursor: pointer;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  color: var(--warm-muted);
}

.auth-submit {
  width: 100%;
}

.auth-switch.split-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.auth-switch.split-line::before,
.auth-switch.split-line::after {
  content: "";
  flex: 1 1 70px;
  max-width: 110px;
  height: 1px;
  background: var(--warm-line);
}

.reader {
  width: 100% !important;
  padding: 0 !important;
}

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 60px;
  padding: 0 34px;
  border-bottom: 1px solid var(--warm-line);
  background: rgba(255, 250, 244, .94);
  backdrop-filter: blur(10px);
}

.center-brand {
  justify-self: center;
}

.text-link,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--warm-accent-dark);
  font-weight: 800;
  cursor: pointer;
}

.icon-button {
  justify-self: end;
  width: 38px;
  height: 38px;
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  background: rgba(255, 253, 249, .8);
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 820px) 280px;
  gap: 0;
  width: min(100%, 1140px);
  margin: 0 auto;
}

.chapter-main {
  padding: 34px 34px 80px;
}

.reader-sidebar {
  min-height: calc(100vh - 60px);
  padding: 28px 22px;
  border-left: 1px solid var(--warm-line);
  background: rgba(255, 253, 249, .6);
}

.reader-sidebar section {
  padding-bottom: 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--warm-line);
}

.reader-sidebar h3 {
  margin: 0 0 14px;
  color: var(--warm-accent-dark);
  font-size: 15px;
}

.reader-sidebar button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--warm-ink);
  text-align: left;
  cursor: pointer;
}

.reader-sidebar small {
  color: #c0a895;
}

.reader-book-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.reader-book-head h1 {
  margin: 12px 0 8px;
  font-family: var(--warm-serif);
  font-size: 30px;
}

.reader-book-head p {
  color: var(--warm-muted);
}

.reader-mode-actions {
  display: flex;
  gap: 10px;
  align-items: start;
  flex-wrap: wrap;
  justify-content: end;
}

.reader-mode-actions .active {
  border-color: var(--warm-accent) !important;
  background: #fff5eb !important;
}

.chapter-progress-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  align-items: center;
  margin-bottom: 26px;
}

.chapter-progress-head span {
  justify-self: end;
  color: #b79d87;
  font-size: 13px;
}

.chapter-progress {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: #eee4db;
  overflow: hidden;
}

.chapter-progress span {
  display: block;
  width: var(--value);
  height: 100%;
  background: var(--warm-accent);
}

.chapter-title {
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--warm-line);
  font-family: var(--warm-serif);
  font-size: 25px;
}

.reader-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 16px;
  margin: 24px 0 20px;
}

.reader-controls > button {
  width: auto;
  min-width: 116px;
}

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

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

.font-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--warm-line);
  border-radius: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.font-controls .pill {
  border: 0 !important;
  min-height: 34px !important;
  padding: 0 12px !important;
}

.font-controls strong {
  padding: 0 12px;
  font-size: 13px;
}

.reader-panel {
  padding: 22px 0 !important;
  border: 1px solid var(--warm-line) !important;
  border-radius: 16px !important;
  background: var(--warm-panel) !important;
  box-shadow: none !important;
  font-family: var(--font-ui);
  font-size: var(--reader-size, 20px) !important;
  line-height: 2.45 !important;
}

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

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

.blank-pair {
  min-height: 2.25em !important;
  margin: 0 .18em !important;
  padding: .16em .5em !important;
  border: 1px solid #edc59e !important;
  border-radius: 8px !important;
  background: #fff5eb !important;
  box-shadow: none !important;
}

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

.chapter-done {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px auto !important;
  padding: 20px 24px !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: var(--warm-brown) !important;
  color: #fff !important;
  box-shadow: 0 14px 32px rgba(78, 61, 46, .22) !important;
}

.chapter-done div {
  display: grid;
  gap: 6px;
}

.chapter-done span {
  color: #eadbcd;
  font-size: 13px;
}

.word-section {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.word-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 20px;
}

.word-section-head h2 {
  margin: 0;
  font-family: var(--warm-serif);
  font-size: 28px;
}

.word-section-head p {
  margin: 4px 0 0;
  color: var(--warm-muted);
}

.word-summary {
  min-width: 110px;
  padding: 12px 18px;
  border: 1px solid var(--warm-line);
  border-radius: 12px;
  background: var(--warm-panel);
  color: var(--warm-accent);
}

.word-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 20px;
  padding: 4px !important;
  border: 1px solid var(--warm-line);
  border-radius: 12px;
  background: rgba(255, 253, 249, .72);
}

.word-tabs .tab {
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--warm-muted);
}

.word-tabs .tab.active {
  background: var(--warm-soft);
  color: var(--warm-accent-dark);
}

.word-tabs span {
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
}

.word-list {
  gap: 14px;
}

.word-card {
  display: grid !important;
  grid-template-columns: 170px minmax(220px, 1fr) auto !important;
  align-items: center;
  gap: 20px;
  min-height: 92px;
  padding: 18px 24px !important;
  border: 1px solid var(--warm-line) !important;
  border-left: 4px solid var(--warm-accent) !important;
  border-radius: 14px !important;
  background: var(--warm-panel) !important;
  box-shadow: none !important;
}

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

.word-main strong {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 25px;
  letter-spacing: .08em;
}

.word-status,
.phonetic {
  color: var(--warm-accent-dark);
  font-size: 12px;
}

.word-meaning {
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #f2eadf;
  font-weight: 900;
}

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

.word-actions .audio-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: #eef5ee;
  color: #5f8b68;
  box-shadow: none;
}

.word-actions .ghost {
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
}

.toast {
  border-radius: 12px;
  background: var(--warm-brown);
  color: #fff;
}

@media (max-width: 980px) {
  .page {
    width: min(100% - 28px, 760px) !important;
  }

  .home-stats,
  .story-grid.design-grid,
  .featured-book,
  .reader-layout,
  .word-card {
    grid-template-columns: 1fr !important;
  }

  .reader-sidebar {
    display: none;
  }

  .chapter-main {
    padding: 24px 18px 70px;
  }

  .reader-book-head,
  .chapter-done {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Active final reader skin: keep this block last. */
body {
  background:
    linear-gradient(90deg, rgba(210, 216, 207, .72), rgba(255, 252, 245, .08) 18%, rgba(255, 252, 245, .08) 82%, rgba(210, 216, 207, .72)),
    linear-gradient(180deg, #fbfaf5 0, #f5f4ef 46%, #f2f5f0 100%);
}

.reader {
  width: min(1160px, calc(100vw - 48px));
  padding-top: 28px;
}

.reader .topbar {
  top: 14px;
  margin-bottom: 24px;
  border-color: rgba(212, 205, 190, .86);
  background: rgba(255, 252, 246, .88);
  box-shadow: 0 18px 44px rgba(42, 46, 54, .075);
}

.reader-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin: 0 0 14px;
  padding: 28px;
  border: 1px solid rgba(31, 36, 45, .88);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 36, 45, .98), rgba(52, 59, 69, .96)),
    linear-gradient(90deg, rgba(199, 144, 63, .14), rgba(37, 91, 175, .12));
  color: #fffaf1;
  box-shadow: 0 24px 70px rgba(35, 40, 48, .11);
}

.reader-top::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .08), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 36px);
}

.reader-top > * {
  position: relative;
}

.reader-heading {
  display: grid;
  gap: 12px;
  align-items: start;
}

.reader-title {
  max-width: 720px;
  color: #fffaf1;
  font-size: 41px;
  line-height: 1.14;
  font-weight: 900;
  text-wrap: balance;
}

.reader-category {
  width: max-content;
  min-height: 30px;
  padding: 0 12px;
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: rgba(255, 250, 241, .84);
  transform: none;
}

.reader-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.reader-actions > .ghost {
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: #fffaf1;
}

.mode-switch {
  min-width: 444px;
  padding: 5px;
  border: 1px solid rgba(255, 250, 241, .18);
  background: rgba(12, 15, 20, .26);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
}

.mode-switch .pill {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: rgba(255, 250, 241, .74);
}

.mode-switch .pill.active {
  background: #fffaf1;
  color: #1f242d;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.chapter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: center;
  margin: 16px 0 12px;
  padding: 24px 26px;
  border: 1px solid #ded7c8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .96), rgba(255, 252, 246, .98)),
    linear-gradient(180deg, rgba(199, 144, 63, .08), transparent);
  box-shadow: 0 14px 34px rgba(35, 40, 48, .075);
}

.chapter-header .eyebrow {
  color: #157f73;
  font-weight: 900;
}

.chapter-header h2 {
  margin-top: 8px;
  color: #202329;
  font-size: 29px;
  line-height: 1.25;
  font-weight: 900;
}

.chapter-progress {
  height: 10px;
  background: #e7dfd0;
}

.chapter-progress span {
  background: linear-gradient(90deg, #157f73, #255baf);
}

.tool-row {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid #ded7c8;
  border-radius: 8px;
  background: rgba(255, 252, 246, .82);
  box-shadow: none;
}

.tool-row + .tool-row {
  min-height: 44px;
  justify-content: flex-end;
  margin-top: -4px;
  background: transparent;
  border-color: transparent;
}

.reader .ghost,
.reader .pill {
  min-height: 40px;
  border-color: #d8d0c1;
  background: rgba(255, 252, 246, .9);
  color: #3a414d;
}

.reader-panel {
  position: relative;
  margin-top: 14px;
  padding: 54px 74px 58px;
  border: 1px solid #ded7c8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .965), rgba(255, 250, 241, .965)),
    repeating-linear-gradient(0deg, transparent 0, transparent 43px, rgba(120, 96, 62, .045) 44px);
  color: #202329;
  font-family: var(--font-reading);
  font-size: var(--reader-size, 20px);
  line-height: 2.12;
  font-weight: 500;
  box-shadow: 0 24px 70px rgba(35, 40, 48, .11);
}

.reader-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 32px;
  width: 1px;
  background: rgba(199, 144, 63, .26);
}

.reader-panel p {
  max-width: 820px;
  margin: 0 auto 30px;
}

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

.blank-pair {
  min-height: 1.5em;
  padding: 0 .48em;
  margin: 0 .18em;
  border: 1px solid rgba(142, 74, 115, .26);
  border-radius: 8px;
  background: rgba(255, 247, 251, .82);
  color: #8e4a73;
  box-shadow: inset 0 -1px rgba(255, 255, 255, .7);
}

.blank-pair:has(.english-blank) {
  border-color: rgba(37, 91, 175, .24);
  background: rgba(242, 247, 255, .86);
  color: #255baf;
}

.inline-blank {
  min-width: 6em;
  height: .86em;
  border-bottom-width: 2px;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(142, 74, 115, .12) 16px);
}

.english-blank {
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(37, 91, 175, .12) 16px);
}

.chapter-done {
  border: 1px solid rgba(31, 36, 45, .86);
  background: linear-gradient(135deg, #1f242d, #343b45);
}

.word-section {
  border: 1px solid #ded7c8;
  background: rgba(255, 252, 246, .94);
  box-shadow: 0 24px 70px rgba(35, 40, 48, .11);
}

.word-card {
  border-color: #e3dacb;
  background: #fffaf1;
}

.word-meaning {
  border-color: #e7dece;
  background: #f7efe2;
}

@media (max-width: 980px) {
  .reader {
    width: min(100vw - 24px, 760px);
  }

  .reader-top,
  .chapter-header,
  .tool-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .reader-title {
    font-size: 32px;
  }

  .reader-actions {
    justify-items: stretch;
  }

  .mode-switch {
    min-width: 0;
    width: 100%;
  }

  .reader-panel {
    padding: 34px 24px;
    line-height: 2.02;
  }

  .reader-panel::before {
    display: none;
  }

  .reader-panel p {
    max-width: none;
  }
}

/* Reader polish pass */
:root {
  --reader-bg: #f2f5f0;
  --reader-cream: #fffaf1;
  --reader-cream-deep: #f6eddc;
  --reader-ink: #202329;
  --reader-muted: #6c7280;
  --reader-line: #ded7c8;
  --reader-blue: #255baf;
  --reader-teal: #157f73;
  --reader-plum: #8e4a73;
  --reader-shadow: 0 24px 70px rgba(35, 40, 48, .11);
  --reader-soft-shadow: 0 14px 34px rgba(35, 40, 48, .075);
}

body {
  background:
    linear-gradient(90deg, rgba(210, 216, 207, .72), rgba(255, 252, 245, .08) 18%, rgba(255, 252, 245, .08) 82%, rgba(210, 216, 207, .72)),
    linear-gradient(180deg, #fbfaf5 0, #f5f4ef 46%, var(--reader-bg) 100%);
}

.reader {
  width: min(1160px, calc(100vw - 48px));
  padding-top: 28px;
}

.reader .topbar {
  top: 14px;
  margin-bottom: 24px;
  padding: 9px 10px 9px 12px;
  border: 1px solid rgba(212, 205, 190, .86);
  background: rgba(255, 252, 246, .86);
  box-shadow: 0 18px 44px rgba(42, 46, 54, .075);
}

.reader .brand-mark {
  background: #1f242d;
}

.reader .ghost,
.reader .pill,
.reader .primary,
.reader .dark,
.reader .tab,
.reader .audio-button {
  border-radius: 8px;
}

.reader-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin: 0 0 14px;
  padding: 28px;
  border: 1px solid rgba(31, 36, 45, .88);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 36, 45, .98), rgba(52, 59, 69, .96)),
    linear-gradient(90deg, rgba(199, 144, 63, .14), rgba(37, 91, 175, .12));
  color: #fffaf1;
  box-shadow: var(--reader-shadow);
}

.reader-top::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .08), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 36px);
}

.reader-top > * {
  position: relative;
}

.reader-heading {
  display: grid;
  gap: 12px;
  align-items: start;
}

.reader-title {
  max-width: 720px;
  color: #fffaf1;
  font-size: 41px;
  line-height: 1.14;
  font-weight: 900;
  text-wrap: balance;
}

.reader-category {
  width: max-content;
  min-height: 30px;
  padding: 0 12px;
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: rgba(255, 250, 241, .84);
  transform: none;
}

.reader-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.reader-actions > .ghost {
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: #fffaf1;
}

.mode-switch {
  min-width: 444px;
  padding: 5px;
  border: 1px solid rgba(255, 250, 241, .18);
  background: rgba(12, 15, 20, .26);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
}

.mode-switch .pill {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: rgba(255, 250, 241, .74);
}

.mode-switch .pill.active {
  background: var(--reader-cream);
  color: #1f242d;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.chapter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: center;
  margin: 16px 0 12px;
  padding: 24px 26px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .96), rgba(255, 252, 246, .98)),
    linear-gradient(180deg, rgba(199, 144, 63, .08), transparent);
  box-shadow: var(--reader-soft-shadow);
}

.chapter-header .eyebrow {
  color: var(--reader-teal);
  font-weight: 900;
}

.chapter-header h2 {
  margin-top: 8px;
  color: var(--reader-ink);
  font-size: 29px;
  line-height: 1.25;
  font-weight: 900;
}

.chapter-progress {
  height: 10px;
  background: #e7dfd0;
}

.chapter-progress span {
  background: linear-gradient(90deg, var(--reader-teal), var(--reader-blue));
}

.tool-row {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background: rgba(255, 252, 246, .82);
  box-shadow: none;
}

.tool-row + .tool-row {
  min-height: 44px;
  justify-content: flex-end;
  margin-top: -4px;
  background: transparent;
  border-color: transparent;
}

.tool-group .muted {
  color: #707581;
  font-weight: 700;
}

.reader .ghost,
.reader .pill {
  min-height: 40px;
  border-color: #d8d0c1;
  background: rgba(255, 252, 246, .9);
  color: #3a414d;
}

.reader .ghost:hover,
.reader .pill:hover,
.reader .audio-button:hover {
  box-shadow: 0 12px 28px rgba(42, 46, 54, .1);
}

.reader-panel {
  position: relative;
  margin-top: 14px;
  padding: 54px 74px 58px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .965), rgba(255, 250, 241, .965)),
    repeating-linear-gradient(0deg, transparent 0, transparent 43px, rgba(120, 96, 62, .045) 44px);
  color: var(--reader-ink);
  font-family: var(--font-reading);
  font-size: var(--reader-size, 20px);
  line-height: 2.12;
  font-weight: 500;
  box-shadow: var(--reader-shadow);
}

.reader-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 32px;
  width: 1px;
  background: rgba(199, 144, 63, .26);
}

.reader-panel p {
  max-width: 820px;
  margin: 0 auto 30px;
}

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

.blank-pair {
  min-height: 1.5em;
  padding: 0 .48em;
  margin: 0 .18em;
  border: 1px solid rgba(142, 74, 115, .26);
  border-radius: 8px;
  background: rgba(255, 247, 251, .82);
  color: var(--reader-plum);
  box-shadow: inset 0 -1px rgba(255, 255, 255, .7);
}

.blank-pair:has(.english-blank) {
  border-color: rgba(37, 91, 175, .24);
  background: rgba(242, 247, 255, .86);
  color: var(--reader-blue);
}

.inline-blank {
  min-width: 6em;
  height: .86em;
  border-bottom-width: 2px;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(142, 74, 115, .12) 16px);
}

.english-blank {
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(37, 91, 175, .12) 16px);
}

.chapter-done {
  border: 1px solid rgba(31, 36, 45, .86);
  background: linear-gradient(135deg, #1f242d, #343b45);
}

.word-section {
  border: 1px solid var(--reader-line);
  background: rgba(255, 252, 246, .94);
  box-shadow: var(--reader-shadow);
}

.word-section h2 {
  color: var(--reader-ink);
}

.word-summary {
  background: #1f242d;
}

.word-card {
  border-color: #e3dacb;
  background: #fffaf1;
}

.word-meaning {
  border-color: #e7dece;
  background: #f7efe2;
}

.word-card::before {
  background: var(--reader-teal);
}

.audio-button.us {
  border-color: rgba(37, 91, 175, .22);
  background: #f3f7ff;
  color: var(--reader-blue);
}

.audio-button.uk {
  border-color: rgba(142, 74, 115, .24);
  background: #fff5fa;
  color: var(--reader-plum);
}

.catalog {
  border-right-color: var(--reader-line);
  background: #fffaf1;
}

@media (max-width: 980px) {
  .reader {
    width: min(100vw - 24px, 760px);
  }

  .reader-top,
  .chapter-header,
  .tool-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .reader-title {
    font-size: 32px;
  }

  .reader-actions {
    justify-items: stretch;
  }

  .mode-switch {
    min-width: 0;
    width: 100%;
  }

  .reader-panel {
    padding: 34px 24px;
    line-height: 2.02;
  }

  .reader-panel::before {
    display: none;
  }

  .reader-panel p {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .reader {
    width: min(100vw - 18px, 560px);
  }

  .reader .topbar {
    margin-bottom: 14px;
  }

  .reader-top {
    padding: 22px 18px;
  }

  .reader-title {
    font-size: 27px;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .reader-panel {
    padding: 26px 18px;
  }

  .blank-pair {
    padding: 0 .34em;
  }
}

.reader-heading {
  display: flex;
  align-items: end;
  gap: 14px;
  min-width: 0;
}

.reader-category {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #eef3f9;
  color: #59687d;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  transform: translateY(-5px);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #141820;
  color: #fff;
  box-shadow: 0 18px 38px rgba(20, 29, 43, .18);
  font-weight: 800;
}

@media (max-width: 760px) {
  .reader-heading {
    display: grid;
    gap: 8px;
  }

  .reader-category {
    width: max-content;
    transform: none;
  }
}

@media (max-width: 760px) {
  .reader-top {
    padding: 18px;
    border: 1px solid #dce5f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--shadow-soft);
    gap: 16px;
  }

  .reader-top > div:first-child {
    display: grid;
    gap: 6px;
  }

  .reader-title {
    font-size: 30px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  .reader-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
    align-items: stretch;
  }

  .reader-actions > .ghost {
    min-height: 46px;
    padding: 0 12px;
  }

  .mode-switch {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .reader-title {
    font-size: 27px;
  }

  .reader-actions {
    grid-template-columns: 1fr;
  }

  .reader-actions > .ghost {
    order: 2;
  }
}

@media (max-width: 760px) {
  .reader-top {
    padding: 18px;
    border: 1px solid #dce5f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--shadow-soft);
    gap: 16px;
  }

  .reader-top > div:first-child {
    display: grid;
    gap: 6px;
  }

  .reader-title {
    font-size: 30px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  .reader-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
    align-items: stretch;
  }

  .reader-actions > .ghost {
    min-height: 46px;
    padding: 0 12px;
  }

  .mode-switch {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .reader-title {
    font-size: 27px;
  }

  .reader-actions {
    grid-template-columns: 1fr;
  }

  .reader-actions > .ghost {
    order: 2;
  }
}

:root {
  --bg: #f7f8fb;
  --paper: #ffffff;
  --ink: #17191f;
  --muted: #667085;
  --line: #e3e8ef;
  --soft: #f1f5f9;
  --pink: #ffe7f2;
  --pink-line: #f2aeca;
  --blue: #2563eb;
  --green: #168a63;
  --black: #17191f;
  --amber: #bc7b24;
  --shadow: 0 22px 58px rgba(15, 23, 42, .075);
  --shadow-soft: 0 14px 34px rgba(15, 23, 42, .055);
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(226, 232, 240, .72), rgba(255, 255, 255, .22) 14%, rgba(255, 255, 255, .22) 86%, rgba(226, 232, 240, .72)),
    radial-gradient(circle at 50% 0%, #ffffff 0, #f8fbff 260px, var(--bg) 720px);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1110px, calc(100vw - 34px));
  margin: 0 auto;
  padding: 54px 0 52px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill,
.ghost,
.primary,
.dark {
  min-height: 38px;
  padding: 0 17px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.pill:hover,
.ghost:hover,
.primary:hover,
.dark:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(32, 28, 22, .08);
}

.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.dark,
.pill.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

.ghost {
  color: #6f6b62;
  background: rgba(255, 255, 255, .74);
}

.hero-title {
  margin: 0;
  font-size: 42px;
  line-height: 1.16;
  font-weight: 950;
}

.hero-subtitle {
  margin: 10px 0 54px;
  color: var(--muted);
  font-size: 17px;
}

.shelf-head {
  width: min(690px, 100%);
  margin: 0 auto 16px;
}

.eyebrow {
  color: #827d73;
  font-size: 13px;
  font-weight: 800;
}

.shelf-title {
  margin: 4px 0 14px;
  font-size: 35px;
  line-height: 1.2;
  font-weight: 950;
}

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

.main-book,
.metric,
.story-card,
.reader-panel,
.chapter-header,
.tool-row,
.admin-box,
.word-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.main-book {
  min-height: 248px;
  border-radius: 8px;
  padding: 34px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.cover {
  width: 100%;
  aspect-ratio: 13 / 18;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 34px rgba(21, 18, 16, .18);
  background: #1b1a18;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f2f0ec;
  color: #6f6b62;
  font-size: 13px;
  font-weight: 760;
}

.book-title {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.24;
}

.progress-line {
  height: 7px;
  border-radius: 999px;
  background: #e9e6df;
  overflow: hidden;
  margin: 12px 0 18px;
}

.progress-line span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--blue);
}

.metrics {
  display: grid;
  gap: 14px;
}

.metric {
  border-radius: 8px;
  padding: 22px;
  min-height: 86px;
}

.metric strong {
  display: block;
  margin: 4px 0 4px;
  font-size: 30px;
  line-height: 1;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 54px 0 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.section-row h2 {
  margin: 0;
  font-size: 36px;
}

.tabs {
  width: min(560px, 100%);
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
}

.tab {
  min-height: 32px;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
}

.tab.active {
  background: #fff;
  box-shadow: 0 8px 20px rgba(26, 23, 18, .08);
}

.word-tabs {
  width: min(660px, 100%);
  grid-template-columns: repeat(4, 1fr);
}

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

.story-card {
  border-radius: 8px;
  padding: 30px;
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  min-height: 184px;
}

.story-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.small-cover {
  width: 100%;
  aspect-ratio: 13 / 18;
  border-radius: 7px;
  object-fit: cover;
  background: #1b1a18;
}

.reader {
  width: min(980px, calc(100vw - 34px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.reader-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.reader-title {
  margin: 0;
  font-size: 36px;
  line-height: 1.18;
  font-weight: 950;
  letter-spacing: 0;
}

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

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .76);
  min-width: 360px;
}

.chapter-header {
  margin: 18px auto 8px;
  border-radius: 8px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chapter-header h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: 0;
}

.tool-row {
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reader-panel {
  border-radius: 8px;
  padding: 38px 44px;
  font-size: var(--reader-size, 20px);
  line-height: 2.12;
  min-height: 520px;
  font-family: var(--font-reading);
  font-weight: 400;
  color: #26231f;
  box-shadow: var(--shadow-soft);
}

.reader-panel p {
  margin: 0 0 24px;
}

.blank-pair {
  display: inline-flex;
  align-items: center;
  gap: .1em;
  white-space: nowrap;
  vertical-align: baseline;
  min-height: 1.52em;
  padding: 0 .38em;
  margin: 0 .16em;
  border: 1px solid #efd0de;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffafd, #fff1f7);
  color: #ad4f78;
  box-shadow: inset 0 -1px rgba(255, 255, 255, .8), 0 4px 12px rgba(185, 93, 132, .07);
}

.inline-blank {
  display: inline-block;
  width: var(--blank-size, 8.5em);
  min-width: 5.4em;
  height: .9em;
  margin: 0 .06em;
  border: 0;
  border-bottom: 2px solid #bb5d84;
  border-radius: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 13px, rgba(217, 112, 158, .1) 14px);
  transform: translateY(.08em);
}

.english-blank {
  border-bottom-color: #537ea8;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 13px, rgba(37, 99, 235, .1) 14px);
}

.blank-pair:has(.english-blank) {
  border-color: #cbdced;
  background: linear-gradient(180deg, #fbfdff, #eef6ff);
  color: #496d96;
}

.reader-panel strong,
.reader-panel b {
  font-weight: 600;
}

.term,
.blank-term {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  margin: 0 2px;
  border-radius: 999px;
  background: var(--pink);
  border: 1px solid var(--pink-line);
  color: #292323;
  vertical-align: baseline;
  box-shadow: inset 0 -1px rgba(255, 255, 255, .5);
}

.term b,
.blank-term b {
  font-weight: 950;
}

.term .answer,
.blank-term .answer {
  color: #745269;
}

.term .eye {
  color: #8b6a7d;
  font-size: .85em;
}

.chapter-done {
  margin: 22px 0;
  min-height: 64px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.word-section {
  margin-top: 26px;
  padding: 30px 28px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.word-section h2 {
  margin: 4px 0 4px;
  font-size: 30px;
}

.word-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.word-card {
  border-radius: 8px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  box-shadow: none;
  background: linear-gradient(90deg, #ffffff, #f8fbff);
  border-color: #dfe7f1;
  position: relative;
}

.word-card::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 4px;
  border-radius: 0 8px 8px 0;
  background: #d5c0a0;
}

.word-card.is-new::before {
  background: #d978a3;
}

.word-card.is-learned::before {
  background: var(--green);
}

.word-main strong {
  display: block;
  font-family: Inter, var(--font-ui);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 850;
  color: #1f1d1a;
}

.word-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f0ece5;
  color: #756b5e;
  font-size: 12px;
  font-weight: 800;
}

.word-card.is-new .word-status {
  background: #fde8f0;
  color: #a74d77;
}

.word-card.is-learned .word-status {
  background: #e7f5ef;
  color: #257453;
}

.phonetic {
  display: block;
  margin-top: 8px;
  color: #777168;
  font-size: 13px;
  font-weight: 700;
}

.word-meaning {
  color: #1f2937;
  font-size: 18px;
  line-height: 1.7;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e6edf5;
}

.word-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
}

.audio-button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid #d8e2ee;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .045);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.audio-button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .08);
}

.audio-button:hover {
  transform: translateY(-1px);
  border-color: #9fb7d2;
  background: #f8fbff;
}

.audio-button.us {
  color: #1f5fbf;
}

.audio-button.uk {
  color: #8a3d75;
}

.tiny {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.float-left,
.float-right {
  position: fixed;
  z-index: 10;
  top: 52%;
  transform: translateY(-50%);
  box-shadow: 0 16px 42px rgba(22, 19, 16, .18);
}

.float-left {
  left: 18px;
}

.float-right {
  right: 22px;
}

.catalog {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(360px, 88vw);
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 22px 0 60px rgba(24, 20, 16, .12);
  transform: translateX(-105%);
  transition: transform .2s ease;
  z-index: 30;
  padding: 24px;
  overflow: auto;
}

.catalog.open {
  transform: translateX(0);
}

.catalog h2 {
  margin: 0 0 18px;
}

.chapter-link {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  padding: 0 10px;
  display: block;
  font-weight: 800;
}

.chapter-link.active {
  background: var(--soft);
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
}

.admin-box {
  border-radius: 8px;
  padding: 24px;
}

.admin-box h2,
.admin-box h3 {
  margin: 0 0 16px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: 0;
}

.field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  background: #edf7f3;
  color: #23604a;
  border: 1px solid #cce7dd;
  margin: 12px 0;
  font-weight: 760;
}

.error {
  background: #fff0f0;
  color: #a33a3a;
  border-color: #f1c3c3;
}

.footer {
  margin-top: 58px;
  color: #aaa49b;
  text-align: center;
  font-size: 13px;
}

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

.empty {
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 880px) {
  .page,
  .reader {
    width: min(100vw - 22px, 720px);
    padding-top: 24px;
  }

  .topbar,
  .reader-top,
  .chapter-header,
  .tool-row,
  .chapter-done {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .reader-top {
    display: flex;
  }

  .dashboard,
  .story-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .main-book,
  .story-card {
    grid-template-columns: 112px minmax(0, 1fr);
    padding: 18px;
    gap: 16px;
  }

  .book-title {
    font-size: 23px;
  }

  .hero-title {
    font-size: 34px;
  }

  .reader-title {
    font-size: 28px;
  }

  .mode-switch,
  .tabs {
    min-width: 0;
    width: 100%;
  }

  .reader-panel {
    padding: 22px 18px;
    line-height: 2;
  }

  .word-card {
    grid-template-columns: 1fr;
    padding: 17px 18px;
  }

  .word-actions {
    justify-content: start;
  }

  .float-left,
  .float-right {
    display: none;
  }
}

/* Final visual pass */
:root {
  --bg: #f5f7fb;
  --paper: #ffffff;
  --ink: #171a22;
  --muted: #647084;
  --line: #dce5f0;
  --soft: #eef3f9;
  --blue: #245fce;
  --green: #158765;
  --black: #141820;
  --rose: #c85a8a;
  --amber: #c7903f;
  --shadow: 0 20px 50px rgba(22, 34, 52, .08);
  --shadow-soft: 0 12px 28px rgba(22, 34, 52, .055);
}

body {
  background:
    linear-gradient(90deg, rgba(222, 230, 241, .82), rgba(250, 252, 255, .26) 17%, rgba(250, 252, 255, .26) 83%, rgba(222, 230, 241, .82)),
    linear-gradient(180deg, #fbfdff 0, #f6f9fd 42%, #eef3f9 100%);
}

.page {
  width: min(1180px, calc(100vw - 44px));
  padding: 42px 0 64px;
}

.reader {
  width: min(1080px, calc(100vw - 44px));
  padding: 32px 0 72px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 34px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 228, 239, .86);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 14px 36px rgba(20, 29, 43, .07);
  backdrop-filter: blur(16px);
}

.brand {
  gap: 12px;
  font-size: 15px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #141820, #2d3442);
  box-shadow: 0 10px 20px rgba(20, 24, 32, .16);
}

.pill,
.ghost,
.primary,
.dark,
.tab,
.audio-button {
  letter-spacing: 0;
}

.pill,
.ghost,
.primary,
.dark {
  min-height: 40px;
  border-radius: 8px;
  border-color: #dce5f0;
  background: #fff;
  color: #263244;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}

.primary {
  background: linear-gradient(135deg, #245fce, #174ea8);
  border-color: #174ea8;
  color: #fff;
}

.dark,
.pill.active {
  background: #141820;
  border-color: #141820;
  color: #fff;
}

.ghost {
  color: #4e5b6f;
  background: rgba(255, 255, 255, .8);
}

.ghost:hover,
.pill:hover,
.primary:hover,
.dark:hover,
.audio-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(22, 34, 52, .1);
}

.home-hero {
  min-height: 214px;
  margin-bottom: 22px;
  padding: 34px;
  border: 1px solid #dbe6f2;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(242, 247, 253, .9)),
    linear-gradient(90deg, rgba(36, 95, 206, .08), rgba(200, 90, 138, .08));
  box-shadow: var(--shadow);
}

.hero-title {
  max-width: 680px;
  font-size: 46px;
  line-height: 1.08;
}

.hero-subtitle {
  margin: 12px 0 0;
  font-size: 18px;
  color: #58667a;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
}

.hero-stats div,
.metric {
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .84);
  box-shadow: var(--shadow-soft);
}

.hero-stats div {
  min-width: 98px;
  padding: 16px 18px;
}

.hero-stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.main-book,
.metric,
.story-card,
.chapter-header,
.tool-row,
.admin-box,
.word-card,
.word-section {
  border-color: #dce5f0;
  background: rgba(255, 255, 255, .94);
}

.main-book {
  min-height: 236px;
  padding: 28px;
  border-radius: 8px;
  grid-template-columns: 150px minmax(0, 1fr);
  box-shadow: var(--shadow);
}

.cover,
.small-cover {
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 18px 34px rgba(20, 29, 43, .16);
}

.chip {
  border: 1px solid #dfe7f1;
  background: #eef3f9;
  color: #516074;
}

.book-title {
  font-size: 31px;
}

.progress-line {
  height: 8px;
  background: #e6edf5;
}

.progress-line span,
.chapter-progress span {
  background: linear-gradient(90deg, #245fce, #19a177);
}

.metric {
  padding: 20px;
  box-shadow: none;
}

.metric strong {
  color: #182033;
}

.section-row {
  margin-top: 42px;
  border-color: #dce5f0;
}

.section-row h2,
.shelf-title {
  font-size: 32px;
}

.tabs {
  border-radius: 8px;
  background: rgba(238, 243, 249, .72);
  border-color: #dce5f0;
}

.tab {
  min-height: 38px;
  border-radius: 7px;
  color: #536174;
}

.tab.active {
  color: #141820;
  background: #fff;
  box-shadow: 0 10px 22px rgba(22, 34, 52, .08);
}

.story-grid {
  gap: 16px;
}

.story-card {
  min-height: 196px;
  padding: 22px;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: start;
  box-shadow: var(--shadow-soft);
}

.story-card h3 {
  margin-bottom: 10px;
  font-size: 21px;
}

.story-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.reader-top {
  margin-bottom: 14px;
  padding: 0 0 18px;
  border-color: #dce5f0;
  align-items: end;
}

.reader-title {
  font-size: 38px;
}

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

.mode-switch {
  min-width: 382px;
  padding: 5px;
  border-radius: 8px;
  background: #eef3f9;
  border-color: #dce5f0;
}

.chapter-header {
  margin: 16px 0 10px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  box-shadow: var(--shadow-soft);
}

.chapter-header h2 {
  margin-top: 6px;
  font-size: 28px;
}

.chapter-progress {
  height: 9px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.chapter-progress span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
}

.tool-row {
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: none;
}

.reader-panel {
  margin-top: 12px;
  padding: 46px 52px;
  border-radius: 8px;
  border-color: #dce5f0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .965), rgba(255, 255, 255, .965)),
    repeating-linear-gradient(0deg, transparent 0, transparent 41px, rgba(36, 95, 206, .025) 42px);
  color: #20242d;
  line-height: 2.18;
  box-shadow: 0 28px 70px rgba(22, 34, 52, .08);
}

.reader-panel p {
  margin-bottom: 28px;
}

.blank-pair {
  min-height: 1.42em;
  padding: 0 .34em;
  border-radius: 8px;
  box-shadow: none;
}

.inline-blank {
  height: .82em;
}

.chapter-done {
  margin: 24px 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #141820, #263244);
}

.word-section {
  margin-top: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.word-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.word-section h2 {
  margin-top: 6px;
  font-size: 32px;
}

.word-summary {
  min-width: 82px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #141820;
  color: #fff;
  text-align: center;
}

.word-summary strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.word-summary span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 800;
}

.word-tabs {
  width: 100%;
  max-width: 760px;
  margin-left: 0;
}

.word-list {
  gap: 10px;
}

.word-card {
  min-height: 92px;
  padding: 16px 18px 16px 22px;
  grid-template-columns: minmax(170px, 230px) minmax(280px, 1fr) minmax(258px, auto);
  gap: 16px;
  background: #fbfdff;
  box-shadow: none;
}

.word-card::before {
  inset: 14px auto 14px 0;
  background: #d3a760;
}

.word-main strong {
  font-size: 25px;
}

.word-status {
  min-height: 24px;
  margin-top: 7px;
  background: #f4efe6;
}

.word-meaning {
  min-height: 52px;
  padding: 12px 14px;
  background: #f4f7fb;
  border-color: #e0e8f1;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.word-actions {
  gap: 7px;
}

.audio-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

.audio-button.us {
  border-color: #cfe0f8;
  background: #f4f8ff;
  color: #1f5fbf;
}

.audio-button.uk {
  border-color: #efd0de;
  background: #fff6fa;
  color: #8a3d75;
}

.float-left,
.float-right {
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(20, 29, 43, .14);
}

.float-left {
  left: 20px;
}

.float-right {
  right: 20px;
}

.catalog {
  width: min(390px, 88vw);
  padding: 28px;
  box-shadow: 24px 0 70px rgba(20, 29, 43, .16);
}

.chapter-link {
  min-height: 44px;
  padding: 9px 12px;
  line-height: 1.45;
}

.admin-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.admin-box {
  box-shadow: var(--shadow-soft);
}

.field input,
.field textarea {
  border-color: #dce5f0;
  background: #fbfdff;
}

.field input:focus,
.field textarea:focus {
  border-color: #9fb7d2;
  box-shadow: 0 0 0 4px rgba(36, 95, 206, .08);
}

@media (max-width: 1080px) {
  .word-card {
    grid-template-columns: minmax(160px, 220px) minmax(260px, 1fr);
  }

  .word-actions {
    grid-column: 1 / -1;
    justify-content: start;
  }
}

@media (max-width: 980px) {
  .page,
  .reader {
    width: min(100vw - 24px, 760px);
    padding-top: 22px;
  }

  .topbar,
  .home-hero,
  .reader-top,
  .chapter-header,
  .tool-row,
  .chapter-done,
  .word-section-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .home-hero {
    padding: 24px;
  }

  .hero-title,
  .reader-title {
    font-size: 31px;
  }

  .hero-stats,
  .dashboard,
  .story-grid,
  .admin-layout,
  .main-book,
  .story-card,
  .word-card {
    grid-template-columns: 1fr;
  }

  .mode-switch,
  .tabs,
  .word-tabs {
    min-width: 0;
    width: 100%;
  }

  .reader-panel {
    padding: 26px 20px;
    line-height: 2.04;
  }

  .word-section {
    padding: 22px 16px;
    scroll-margin-top: 112px;
  }

  .word-actions {
    grid-column: auto;
    justify-content: start;
  }

  .float-left,
  .float-right {
    display: none;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar .nav {
    margin-left: auto;
  }

  .tab {
    min-height: 42px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 1.2;
  }
}

@media (max-width: 760px) {
  .reader-top {
    padding: 18px;
    border: 1px solid #dce5f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--shadow-soft);
    gap: 16px;
  }

  .reader-top > div:first-child {
    display: grid;
    gap: 6px;
  }

  .reader-title {
    font-size: 30px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  .reader-actions {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
  }

  .reader-actions > .ghost {
    grid-column: 1;
    min-height: 46px;
    padding: 0 12px;
  }

  .mode-switch {
    grid-column: 2;
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .reader-title {
    font-size: 27px;
  }

  .reader-actions {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    grid-column: auto;
  }

  .reader-actions > .ghost {
    grid-column: auto;
    order: 2;
  }
}
