:root {
  --brand: #07c75f;
  --brand-dark: #04a94f;
  --brand-ink: #02592f;
  --ink: #171a1c;
  --muted: #7a8388;
  --soft: #f6f8f7;
  --paper: #ffffff;
  --panel: #f2f4f4;
  --line: #e7ece9;
  --line-dark: #d7dfda;
  --blue: #3267d6;
  --violet: #6956c9;
  --amber: #d58a16;
  --success: #10b76a;
  --warn: #e4a52f;
  --danger: #df5f52;
  --shadow: 0 26px 80px rgba(0, 67, 35, 0.26);
  --shadow-soft: 0 14px 34px rgba(21, 44, 32, 0.08);
  --reader-font-size: 16px;
  --reader-line-height: 2;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--brand);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  letter-spacing: 0;
}

body.reader-font-small {
  --reader-font-size: 15px;
  --reader-line-height: 1.9;
}

body.reader-font-medium {
  --reader-font-size: 16px;
  --reader-line-height: 2;
}

body.reader-font-large {
  --reader-font-size: 18px;
  --reader-line-height: 2.05;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.24;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.brand-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 24px clamp(18px, 3.4vw, 48px) 32px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: white;
  color: var(--brand);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.brand-mark i {
  font-size: 34px;
}

.brand-lockup strong {
  display: block;
  font-size: clamp(34px, 4.2vw, 50px);
  line-height: 0.95;
  font-weight: 850;
}

.brand-lockup span:not(.brand-mark) {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  opacity: 0.8;
}

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

.ghost-button,
.tool-button,
.small-icon,
.nav-item,
.mode-tab,
.agent-action {
  border: 0;
  cursor: pointer;
  color: inherit;
}

.ghost-button {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.18);
  color: white;
  text-decoration: none;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.workspace-window {
  min-height: min(780px, calc(100vh - 118px));
  display: grid;
  grid-template-columns: 276px minmax(520px, 1fr) 360px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.library {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #eef3f0;
  border-right: 1px solid var(--line);
}

.traffic-lights {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}

.traffic-lights span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: block;
}

.traffic-lights .red {
  background: #ff625d;
}

.traffic-lights .yellow {
  background: #ffbd40;
}

.traffic-lights .green {
  background: #31c84a;
}

.project-card {
  margin: 2px 12px 12px;
  padding: 14px 14px 15px;
  border: 1px solid rgba(7, 199, 95, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 26px rgba(16, 45, 29, 0.06);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.project-card h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.project-stats {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.project-progress {
  height: 7px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e3;
}

.project-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.project-badges {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.project-badges span {
  padding: 4px 8px;
  border-radius: 7px;
  background: #edf7f2;
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 800;
}

.main-nav {
  display: grid;
  gap: 6px;
  padding: 0 12px 14px;
}

.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: #4c5558;
  text-align: left;
}

.nav-item i {
  font-size: 18px;
  color: #929b9d;
}

.nav-item:hover,
.nav-item.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(18, 41, 29, 0.06);
}

.nav-item.active i {
  color: var(--brand-dark);
}

.search-row {
  position: relative;
  padding: 0 12px 10px;
}

.search-row i {
  position: absolute;
  left: 24px;
  top: 11px;
  color: #9ca6a7;
}

.search-row input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px 0 34px;
  outline-color: var(--brand);
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(18, 41, 29, 0.05);
}

.chapter-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 8px 18px;
  color: var(--muted);
  font-size: 12px;
}

.small-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: #7f898b;
}

.small-icon:hover {
  background: #e6ece9;
}

.chapter-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px 18px;
}

.library-brief {
  display: none;
  margin: 0 12px 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.library-brief h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.library-brief p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.library-metrics span {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f2faf6;
  color: #667276;
  font-size: 12px;
}

.library-metrics strong {
  display: block;
  margin-bottom: 2px;
  color: var(--brand-ink);
  font-size: 20px;
}

.library-mode .chapter-tools,
.library-mode .chapter-list {
  display: none;
}

.library-mode .library-brief {
  display: block;
}

.draft-mode .library-brief {
  display: none;
}

.chapter-group h2 {
  margin: 16px 8px 8px;
  color: #90999b;
  font-size: 12px;
  font-weight: 800;
}

.chapter-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.chapter-item:hover,
.chapter-item.active {
  background: white;
  box-shadow: 0 8px 18px rgba(18, 41, 29, 0.06);
}

.chapter-item.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.chapter-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.chapter-sub {
  color: #929b9d;
  font-size: 11px;
  white-space: nowrap;
}

.workbench {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fbfcfb;
}

.top-toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.chapter-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

#currentUnit {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
}

#currentPath {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.mobile-only {
  display: none;
}

.mobile-drawer-close {
  display: none;
}

.tool-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #3e4649;
  box-shadow: 0 7px 16px rgba(24, 44, 33, 0.04);
}

.tool-button:hover {
  background: var(--soft);
}

.tool-button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.save-status {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(7, 199, 95, 0.22);
  border-radius: 8px;
  background: #eefaf4;
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.save-status.saving {
  border-color: rgba(213, 138, 22, 0.28);
  background: #fff8e8;
  color: #9a6508;
}

.save-status.error {
  border-color: rgba(223, 95, 82, 0.28);
  background: #fff0ee;
  color: #b23a2f;
}

.save-status.success {
  border-color: rgba(7, 199, 95, 0.32);
  background: #e9faf1;
  color: var(--brand-ink);
}

.mode-tabs {
  height: 52px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.mode-tab {
  height: 38px;
  position: relative;
  padding: 0 14px;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #7d8789;
  font-size: 13px;
  font-weight: 750;
}

.mode-tab.active {
  color: var(--ink);
  background: white;
}

.mode-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: var(--brand);
}

.canvas {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 30px 34px 46px;
}

.content-panel {
  display: none;
}

.content-panel.active {
  display: block;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.section-heading p:not(.eyebrow) {
  max-width: 620px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.local-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.continue-card {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 13px 15px;
  border: 1px solid rgba(7, 199, 95, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, #effbf4, #ffffff);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.continue-card:hover {
  border-color: rgba(7, 199, 95, 0.48);
  transform: translateY(-1px);
}

.continue-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 22px;
}

.continue-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.continue-copy strong {
  font-size: 17px;
}

.continue-copy small {
  min-width: 0;
  overflow: hidden;
  color: #51605a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-meta {
  padding: 5px 9px;
  border-radius: 8px;
  background: #e4f8ee;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-card,
.dashboard-metrics article,
.dashboard-columns section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.dashboard-card {
  min-height: 116px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 18px;
}

.dashboard-card i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf8f1;
  color: var(--brand-dark);
  font-size: 22px;
}

.dashboard-card strong,
.dashboard-card span {
  display: block;
}

.dashboard-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-metrics article {
  min-height: 96px;
  padding: 14px;
}

.dashboard-metrics span,
.dashboard-metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-metrics strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 28px;
  line-height: 1;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-columns section {
  min-width: 0;
  padding: 14px;
}

.dashboard-columns h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.dashboard-link,
.quality-hit {
  width: 100%;
  min-height: 52px;
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
}

.dashboard-link {
  cursor: pointer;
}

.dashboard-link:hover {
  border-color: rgba(7, 199, 95, 0.38);
  background: #f2fbf6;
}

.dashboard-link strong,
.quality-hit strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.dashboard-link span,
.quality-hit span,
.dashboard-empty {
  color: var(--muted);
  font-size: 12px;
}

.quality-hit span {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 7px;
  background: #fff5d7;
  color: #9a6508;
  font-weight: 800;
}

.insight-strip article {
  position: relative;
  min-height: 118px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.insight-strip article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand);
}

.insight-strip article:nth-child(2)::before {
  background: var(--amber);
}

.insight-strip article:nth-child(3)::before {
  background: var(--blue);
}

.insight-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.insight-strip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 19px;
}

.insight-strip p {
  margin: 0;
  color: #637074;
  font-size: 13px;
  line-height: 1.6;
}

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

.note-card,
.review-card,
.memory-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 20px rgba(18, 42, 31, 0.04);
}

.note-card {
  position: relative;
  min-height: 148px;
  padding: 18px 19px 18px 22px;
  overflow: hidden;
}

.note-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cfd9d4;
}

.note-card.locked::after,
.note-card:nth-child(2)::after {
  background: var(--success);
}

.note-card:nth-child(3)::after {
  background: var(--blue);
}

.note-card:nth-child(4)::after {
  background: var(--amber);
}

.card-status {
  width: fit-content;
  margin-bottom: 9px;
  padding: 3px 8px;
  border-radius: 7px;
  background: #e8f8ef;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.note-card h3,
.review-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.note-card p,
.review-card p,
.outline-item p,
.agent-output p,
.agent-header p,
.mascot-card p {
  margin: 0;
  color: #626c70;
  line-height: 1.7;
  font-size: 14px;
}

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

.outline-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.outline-item span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf7f1;
  color: var(--brand-dark);
  font-weight: 850;
}

.outline-item.active {
  border-color: rgba(7, 199, 95, 0.45);
  box-shadow: inset 4px 0 0 var(--brand);
}

.doc-browser {
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.doc-sidebar,
.doc-reader {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.doc-sidebar {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 230px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.doc-toolbar strong {
  font-size: 15px;
}

.doc-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.doc-search {
  position: relative;
  padding: 12px 12px 8px;
}

.doc-search i {
  position: absolute;
  left: 23px;
  top: 22px;
  color: #9ca6a7;
}

.doc-search input,
.doc-folder-row select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline-color: var(--brand);
  background: #fbfdfc;
  color: var(--ink);
}

.doc-search input {
  padding: 0 12px 0 33px;
}

.doc-folder-row {
  padding: 0 12px 10px;
}

.doc-folder-row select {
  padding: 0 10px;
}

.doc-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
}

.doc-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  margin-bottom: 7px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.doc-item:hover,
.doc-item.active {
  border-color: rgba(7, 199, 95, 0.28);
  background: #f4fbf7;
}

.doc-item span {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 7px;
  background: #edf8f2;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 850;
}

.doc-item strong {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.doc-item small,
.doc-empty {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.doc-empty {
  padding: 18px 10px;
}

.doc-reader {
  padding: 22px;
}

.doc-reader-head {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.doc-reader-head h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.doc-reader-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chapter-view {
  max-width: 760px;
  margin: 0 auto;
  color: #202629;
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
}

.chapter-view h1 {
  margin: 0 0 24px;
  font-size: 28px;
  line-height: 1.35;
}

.chapter-view h2,
.chapter-view h3 {
  margin: 32px 0 12px;
}

.chapter-view p {
  margin: 0 0 16px;
}

.chapter-view blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--brand);
  background: #f1faf5;
  border-radius: 0 8px 8px 0;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state i {
  font-size: 44px;
  color: var(--brand);
  margin-bottom: 12px;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.empty-state p {
  max-width: 450px;
  margin: 0 auto;
}

.empty-state.compact {
  min-height: 280px;
  grid-column: 1 / -1;
}

.editor {
  width: min(920px, 100%);
  min-height: calc(100vh - 265px);
  display: block;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  outline-color: var(--brand);
  resize: vertical;
  color: var(--ink);
  background: #fcfffd;
  font-size: var(--reader-font-size);
  line-height: calc(var(--reader-line-height) - 0.12);
  box-shadow: 0 18px 45px rgba(17, 38, 28, 0.08);
}

.chapter-stepper {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  margin: 22px auto 0;
}

.stepper-button,
.stepper-current {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 24px rgba(20, 43, 31, 0.05);
}

.stepper-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  color: var(--brand-ink);
  font-weight: 850;
  cursor: pointer;
}

.stepper-button:disabled {
  cursor: not-allowed;
  color: #a3adaa;
  background: #f5f7f5;
}

.stepper-current {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 14px;
  text-align: center;
}

.stepper-current strong {
  color: var(--brand-ink);
  font-size: 13px;
}

.stepper-current span {
  min-width: 0;
  overflow: hidden;
  color: #56615e;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.reader-settings-panel {
  position: fixed;
  right: clamp(18px, 4vw, 52px);
  top: 92px;
  z-index: 70;
  width: min(330px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid rgba(7, 199, 95, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 36, 24, 0.18);
  backdrop-filter: blur(18px);
}

.reader-settings-head {
  display: grid;
  gap: 3px;
}

.reader-settings-head strong {
  font-size: 16px;
}

.reader-settings-head span {
  color: var(--muted);
  font-size: 12px;
}

.reader-setting-group {
  display: grid;
  grid-template-columns: 46px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.reader-setting-group > span {
  color: #65716d;
  font-size: 13px;
  font-weight: 850;
}

.reader-setting-group button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
}

.reader-setting-group button.active {
  border-color: rgba(7, 199, 95, 0.44);
  background: #ddf8e9;
  color: var(--brand-ink);
}

.reader-theme-sepia .canvas,
.reader-theme-sepia .workbench {
  background: #f4ede1;
}

.reader-theme-sepia .top-toolbar,
.reader-theme-sepia .mode-tabs {
  background: rgba(250, 244, 234, 0.96);
}

.reader-theme-sepia .chapter-view,
.reader-theme-sepia .editor,
.reader-theme-sepia .chapter-stepper .stepper-current,
.reader-theme-sepia .chapter-stepper .stepper-button {
  border-color: #e0d4c3;
  background: #fff9ee;
  color: #35281d;
}

.reader-theme-night .canvas,
.reader-theme-night .workbench {
  background: #101814;
}

.reader-theme-night .top-toolbar,
.reader-theme-night .mode-tabs,
.reader-theme-night .reader-settings-panel {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(20, 31, 26, 0.96);
  color: #eaf3ed;
}

.reader-theme-night .chapter-meta span,
.reader-theme-night #currentPath,
.reader-theme-night .reader-settings-head span,
.reader-theme-night .reader-setting-group > span {
  color: #91a49b;
}

.reader-theme-night .chapter-view,
.reader-theme-night .editor,
.reader-theme-night .chapter-stepper .stepper-current,
.reader-theme-night .chapter-stepper .stepper-button {
  border-color: rgba(255, 255, 255, 0.1);
  background: #14201a;
  color: #dce8e0;
}

.reader-theme-night .chapter-view h1,
.reader-theme-night .stepper-current span {
  color: #f4fbf7;
}

.reader-theme-night .reader-setting-group button {
  border-color: rgba(255, 255, 255, 0.1);
  background: #1b2a22;
  color: #dce8e0;
}

.reader-theme-night .reader-setting-group button.active {
  border-color: rgba(16, 183, 106, 0.5);
  background: #153d29;
  color: #bff4d6;
}

.review-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.review-card {
  padding: 16px;
}

.review-card span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.review-card.pass span {
  background: #e7f9ef;
  color: #0b9852;
}

.review-card.warn span {
  background: #fff5d7;
  color: #a26900;
}

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

.memory-grid article {
  padding: 16px;
}

.memory-grid strong {
  display: block;
  margin-bottom: 8px;
}

.memory-grid span {
  color: #626c70;
  line-height: 1.7;
  font-size: 14px;
}

.character-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.character-filters {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.chip {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5f696d;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.chip.active,
.chip:hover {
  background: #edf8f2;
  color: var(--brand-ink);
}

.character-workspace {
  display: grid;
  gap: 18px;
  align-items: start;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.character-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.character-card.active {
  border-color: rgba(7, 199, 95, 0.5);
  box-shadow: 0 0 0 2px rgba(7, 199, 95, 0.12), var(--shadow-soft);
}

.character-image-wrap {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(7, 199, 95, 0.1), rgba(50, 103, 214, 0.08)),
    #f5f8f6;
}

.character-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 8px;
}

.character-fallback {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: white;
  color: var(--brand-dark);
}

.character-fallback i {
  font-size: 28px;
}

.character-image-wrap .skill-card-thumb {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 58px;
  height: 82px;
  object-fit: cover;
  padding: 0;
  border: 2px solid white;
  border-radius: 7px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.character-meta {
  padding: 12px 13px 14px;
}

.character-meta span {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 3px 8px;
  border-radius: 7px;
  background: #edf8f2;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 850;
}

.character-meta strong,
.character-meta small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-meta strong {
  margin-bottom: 5px;
  font-size: 15px;
}

.character-meta small {
  color: var(--muted);
  font-size: 12px;
}

.character-open {
  width: 100%;
  min-height: 32px;
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--brand-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.character-open:hover {
  border-color: rgba(7, 199, 95, 0.45);
  background: #eefaf4;
}

.character-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.character-detail[hidden] {
  display: none;
}

.character-detail-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 18px;
  align-items: start;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}

.detail-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #667276;
  cursor: pointer;
}

.detail-close:hover {
  background: #f2f7f4;
  color: var(--brand-ink);
}

.character-detail-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.character-detail-head p:not(.eyebrow) {
  margin: 0;
  color: #667276;
  line-height: 1.7;
}

.character-detail-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-right: 38px;
}

.character-detail-images img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f6;
}

.character-brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.character-brief {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.character-brief i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf8f1;
  color: var(--brand-dark);
  font-size: 18px;
}

.character-brief strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.character-brief p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.character-docs {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.character-docs section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.character-docs h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.markdown-body {
  color: #263034;
  line-height: 1.85;
  font-size: 14px;
}

.markdown-body h1 {
  display: none;
}

.markdown-body h2 {
  margin: 24px 0 10px;
  font-size: 18px;
}

.markdown-body h2:first-child {
  margin-top: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body blockquote {
  margin: 0 0 12px;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body blockquote {
  padding: 10px 12px;
  border-left: 4px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: #f1faf5;
  color: #4e5d61;
}

.agent-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #f7faf8;
}

.agent-header {
  min-height: 62px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.agent-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 5px rgba(7, 199, 95, 0.12);
}

.agent-header strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.mascot-card {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.mascot-image {
  width: 100%;
  height: 300px;
  margin-bottom: 12px;
  border-radius: 8px;
  background-image: url("/assets/wanjie-system-shop-cover.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62), 0 14px 26px rgba(19, 50, 33, 0.1);
}

.mascot-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.agent-actions {
  display: grid;
  gap: 8px;
}

.agent-action {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #3e474a;
  text-align: left;
}

.agent-action i {
  color: var(--brand-dark);
  font-size: 19px;
}

.agent-action:hover,
.agent-action.active {
  border-color: rgba(7, 199, 95, 0.44);
  background: #f0fbf5;
}

.agent-output {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.agent-command {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.agent-command label {
  color: #1e282b;
  font-size: 13px;
  font-weight: 850;
}

.agent-command textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline-color: var(--brand);
  color: var(--ink);
  background: #fbfdfc;
  line-height: 1.55;
}

.agent-command .tool-button {
  justify-content: center;
}

.agent-output h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.agent-output ul {
  margin: 14px 0 0;
  padding-left: 18px;
  color: #566064;
  line-height: 1.8;
  font-size: 13px;
}

.context-pack h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.context-pack > p:not(.eyebrow) {
  margin: 0 0 12px;
  color: #566064;
  line-height: 1.7;
  font-size: 13px;
}

.context-pack section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.context-pack h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.context-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.context-tags span {
  padding: 4px 8px;
  border-radius: 7px;
  background: #edf8f2;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 800;
}

.nearby-list {
  display: grid;
  gap: 7px;
}

.nearby-list button {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.nearby-list button:hover {
  border-color: rgba(7, 199, 95, 0.4);
  background: #f2fbf6;
}

.nearby-list span,
.context-docs small {
  color: var(--muted);
  font-size: 12px;
}

.context-docs {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

.context-docs li {
  padding-left: 4px;
}

.context-docs strong,
.context-docs small {
  display: block;
}

.context-docs p {
  margin: 4px 0 0;
  color: #647074;
  line-height: 1.6;
  font-size: 12px;
}

.library-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.24), transparent 28%),
    linear-gradient(135deg, #08c861 0%, #02763e 58%, #023f28 100%);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

body.library-page::before {
  display: none;
}

.writer-hub {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 18px;
  margin: 0 auto;
  padding: 24px 0 42px;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: white;
}

.hub-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.hub-brand strong {
  display: block;
  font-size: 25px;
  line-height: 1;
}

.hub-brand small {
  display: block;
  margin-top: 5px;
  opacity: 0.82;
  font-weight: 750;
}

.hub-actions,
.book-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hub-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.hub-link.primary {
  border-color: white;
  background: white;
  color: var(--brand-ink);
}

.hub-link.disabled {
  width: fit-content;
  border-color: var(--line);
  background: #f1f5f2;
  color: #8a9691;
  cursor: not-allowed;
}

.hub-hero {
  min-height: 232px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  align-items: end;
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(5, 25, 17, 0.86), rgba(5, 41, 26, 0.68) 52%, rgba(255, 255, 255, 0.12)),
    url("/assets/wanjie-system-shop-cover.png") center 32% / cover;
  color: white;
  box-shadow: var(--shadow);
}

.hub-hero h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 74px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hub-hero p:not(.eyebrow) {
  max-width: 650px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  line-height: 1.75;
}

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

.hub-hero-stats span {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(14px);
}

.hub-hero-stats strong {
  color: white;
  font-size: 30px;
  line-height: 1;
}

.shelf-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.shelf-search {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #5f6c67;
  box-shadow: 0 14px 34px rgba(4, 66, 36, 0.12);
}

.shelf-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.shelf-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.shelf-filters::-webkit-scrollbar {
  display: none;
}

.shelf-filter {
  height: 42px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.shelf-filter.active {
  background: white;
  color: var(--brand-ink);
}

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

.book-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px rgba(2, 58, 31, 0.18);
}

.book-cover {
  position: relative;
  min-height: 270px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #09251a;
  color: white;
  text-decoration: none;
  box-shadow: 0 18px 34px rgba(8, 30, 19, 0.18);
}

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

.book-cover-empty {
  border: 1px dashed rgba(7, 199, 95, 0.38);
  background:
    linear-gradient(135deg, rgba(7, 199, 95, 0.14), rgba(50, 103, 214, 0.08)),
    #f5faf7;
  color: var(--brand-ink);
}

.book-cover-empty i {
  font-size: 42px;
}

.book-cover-empty span {
  align-self: start;
  margin-top: -70px;
  font-weight: 850;
}

.book-cover.skeleton {
  background: linear-gradient(90deg, #e7f0eb, #f7faf8, #e7f0eb);
}

.book-info {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.book-status {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 8px;
  background: #e5f8ee;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 850;
}

.book-status.muted {
  background: #eef2f1;
  color: #66736e;
}

.book-info h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.book-info p {
  margin: 0;
  color: #5d6a65;
  line-height: 1.7;
  font-size: 14px;
}

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

.book-meta span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 8px;
  background: #f1f6f3;
  color: #42524b;
  font-size: 12px;
  font-weight: 800;
}

.book-latest {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.book-latest span,
.book-latest small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-latest strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-actions .hub-link {
  border-color: var(--line);
  background: white;
  color: var(--brand-ink);
}

.book-actions .hub-link.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.library-page {
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 16% 10%, rgba(38, 221, 132, 0.5), transparent 30%),
    linear-gradient(135deg, #0aba60 0%, #04733e 52%, #05291d 100%);
  background-size: 48px 48px, 48px 48px, auto, auto;
}

.writer-hub {
  width: min(1160px, calc(100% - 40px));
  gap: 14px;
  padding-top: 22px;
}

.hub-header {
  min-height: 58px;
}

.hub-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.hub-brand strong {
  font-size: 24px;
}

.hub-actions .hub-link {
  min-height: 38px;
}

.hub-hero {
  min-height: 206px;
  grid-template-columns: minmax(0, 1fr) 330px;
  padding: 30px 34px;
  background:
    linear-gradient(100deg, rgba(4, 24, 15, 0.92), rgba(5, 43, 27, 0.7) 58%, rgba(255, 255, 255, 0.1)),
    url("/assets/wanjie-system-shop-cover.png") center 30% / cover;
}

.hub-hero h1 {
  font-size: clamp(42px, 5.2vw, 68px);
}

.hub-hero p:not(.eyebrow) {
  max-width: 720px;
  font-size: 15px;
}

.hub-hero-stats {
  align-self: end;
}

.hub-quicklook {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hub-quicklook article {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  backdrop-filter: blur(12px);
}

.hub-quicklook span,
.hub-quicklook small {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.hub-quicklook strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}

.shelf-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 2px;
}

.book-shelf {
  grid-template-columns: minmax(0, 1.16fr) minmax(360px, 0.84fr);
  align-items: stretch;
}

.book-card {
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  background: rgba(250, 254, 252, 0.96);
}

.book-card.featured {
  grid-template-columns: 210px minmax(0, 1fr);
}

.book-card.planned {
  grid-template-columns: 150px minmax(0, 1fr);
  background: rgba(250, 254, 252, 0.9);
}

.book-cover {
  min-height: 250px;
  align-self: stretch;
}

.book-card.featured .book-cover {
  min-height: 318px;
  padding: 8px;
  background:
    linear-gradient(135deg, #071f16, #0d3a28);
}

.book-cover img {
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
}

.book-card.featured .book-cover img {
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.22));
}

.book-cover-empty {
  min-height: 250px;
}

.book-info h2 {
  font-size: 28px;
}

.book-card.planned .book-info h2 {
  font-size: 24px;
}

.book-progress-row {
  position: relative;
  min-height: 44px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 9px 11px 12px;
  overflow: hidden;
  border: 1px solid #dce9e2;
  border-radius: 8px;
  background: #f4faf6;
}

.book-progress-row span {
  color: #65716d;
  font-size: 12px;
  font-weight: 850;
}

.book-progress-row strong {
  color: var(--brand-ink);
  font-size: 13px;
}

.book-progress-row i {
  grid-column: 1 / -1;
  height: 7px;
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #31d2a0);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 52px);
  background:
    radial-gradient(circle at 16% 18%, rgba(14, 214, 118, 0.28), transparent 32%),
    linear-gradient(90deg, rgba(2, 12, 9, 0.84), rgba(3, 28, 18, 0.58) 46%, rgba(2, 13, 10, 0.9)),
    url("/assets/wanjie-system-shop-cover.png") center / cover fixed;
  overflow: hidden;
}

body.login-page::before {
  background:
    radial-gradient(circle at 74% 42%, rgba(9, 225, 124, 0.2), transparent 26%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 48%, rgba(0, 0, 0, 0.42));
  background-size: auto;
  opacity: 1;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-height: min(660px, calc(100vh - 52px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: clamp(18px, 3vw, 42px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(6, 18, 14, 0.72), rgba(8, 24, 18, 0.28) 54%, rgba(248, 255, 250, 0.12));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 26%);
}

.login-hero {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  min-height: 560px;
  padding: clamp(30px, 5vw, 58px);
  color: white;
}

.login-work-meta {
  position: relative;
  display: grid;
  gap: 12px;
  max-width: 500px;
  min-width: 0;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.46);
}

.login-work-meta span {
  width: max-content;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(197, 255, 219, 0.28);
  background: rgba(5, 24, 17, 0.46);
  color: rgba(222, 255, 235, 0.92);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.login-work-meta h1 {
  margin: 0;
  font-size: clamp(46px, 5.2vw, 72px);
  line-height: 0.98;
  font-weight: 900;
  overflow-wrap: break-word;
}

.login-work-meta p {
  margin: 0;
  color: rgba(236, 255, 244, 0.84);
  font-size: clamp(16px, 1.8vw, 22px);
}

.login-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.login-meta-row strong {
  min-width: 74px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(6, 21, 15, 0.42);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: center;
  gap: 28px;
  min-height: 500px;
  margin: clamp(16px, 2.4vw, 28px);
  padding: clamp(30px, 4vw, 46px);
  border: 1px solid rgba(196, 255, 221, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 22, 17, 0.88), rgba(8, 29, 19, 0.76));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  color: white;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand .brand-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 28px rgba(7, 199, 95, 0.3);
}

.login-brand .brand-mark i {
  font-size: 28px;
}

.login-brand strong {
  display: block;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.1;
  font-weight: 850;
  color: white;
}

.login-brand span:not(.brand-mark) {
  display: block;
  margin-top: 6px;
  color: rgba(224, 244, 233, 0.68);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  color: rgba(233, 250, 241, 0.86);
  font-weight: 700;
  font-size: 14px;
}

.password-field {
  height: 54px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  border: 1px solid rgba(218, 255, 234, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.password-field:focus-within {
  border-color: rgba(88, 236, 151, 0.72);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(7, 199, 95, 0.14);
}

.password-field i {
  color: rgba(108, 242, 164, 0.92);
  text-align: center;
  font-size: 20px;
}

.password-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
}

.password-field input::placeholder {
  color: rgba(233, 250, 241, 0.5);
}

.login-submit {
  width: 100%;
  height: 50px;
  justify-content: center;
  margin-top: 8px;
  box-shadow: 0 16px 32px rgba(7, 199, 95, 0.22);
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-footnote {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(142, 236, 180, 0.18);
  border-radius: 8px;
  background: rgba(6, 39, 24, 0.54);
  color: rgba(222, 255, 235, 0.78);
  line-height: 1.45;
  font-size: 13px;
}

.login-footnote i {
  color: rgba(91, 238, 153, 0.95);
  font-size: 18px;
}

.login-dialog {
  width: min(390px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(0, 33, 17, 0.36);
}

.login-dialog h2 {
  margin: 0 0 8px;
}

.login-dialog p {
  color: var(--muted);
  line-height: 1.7;
}

.login-dialog input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline-color: var(--brand);
}

.form-message {
  min-height: 20px;
  margin: 10px 0;
  color: var(--danger);
  font-size: 13px;
}

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

.focus-mode .brand-bar,
.focus-mode .agent-panel,
.focus-mode .library {
  display: none;
}

.focus-mode .brand-stage {
  padding: 0;
}

.focus-mode .workspace-window {
  min-height: 100vh;
  grid-template-columns: 1fr;
  border-radius: 0;
}

@media (max-width: 1120px) {
  .workspace-window {
    grid-template-columns: 230px minmax(390px, 1fr);
  }

  .agent-panel {
    display: none;
  }

  .insight-strip,
  .dashboard-metrics,
  .dashboard-columns,
  .brief-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  html,
  body {
    height: 100%;
  }

  body {
    background: #f4f7f4;
  }

  body::before {
    display: none;
  }

  .library-page {
    height: auto;
    min-height: 100%;
    overflow: auto;
    background:
      radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.2), transparent 30%),
      linear-gradient(160deg, #09bd5d 0%, #03723d 58%, #06291e 100%);
  }

  .writer-hub {
    width: min(100% - 20px, 640px);
    min-height: 100svh;
    gap: 12px;
    padding: 10px 0 22px;
  }

  .hub-header {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -10px;
    padding: 9px 10px;
    background: rgba(4, 119, 62, 0.92);
    backdrop-filter: blur(14px);
  }

  .hub-brand .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .hub-brand .brand-mark i {
    font-size: 24px;
  }

  .hub-brand strong {
    font-size: 18px;
  }

  .hub-brand small {
    margin-top: 2px;
    font-size: 12px;
  }

  .hub-actions {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .hub-header .hub-link {
    min-height: 36px;
    min-width: 54px;
    padding: 0 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  .hub-header .hub-link i {
    display: none;
  }

  .hub-header .hub-link span {
    display: none;
  }

  .hub-header .hub-link[href*="login"]::after {
    content: "登录";
  }

  .hub-header .hub-link.primary::after {
    content: "创作";
  }

  .hub-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 16px;
    background:
      linear-gradient(180deg, rgba(5, 25, 17, 0.72), rgba(4, 38, 26, 0.88)),
      url("/assets/wanjie-system-shop-cover.png") center 26% / cover;
  }

  .hub-hero h1 {
    font-size: 40px;
  }

  .hub-hero p:not(.eyebrow) {
    font-size: 14px;
    line-height: 1.65;
  }

  .hub-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .hub-hero-stats span {
    min-height: 68px;
    padding: 10px;
  }

  .hub-hero-stats strong {
    font-size: 23px;
  }

  .shelf-toolbar {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .shelf-search {
    height: 44px;
  }

  .shelf-filters {
    padding-bottom: 2px;
  }

  .shelf-filter {
    height: 38px;
    padding: 0 13px;
  }

  .book-shelf {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .book-cover {
    min-height: 168px;
  }

  .book-cover-empty i {
    font-size: 30px;
  }

  .book-cover-empty span {
    margin-top: -40px;
    font-size: 12px;
  }

  .book-info {
    gap: 9px;
  }

  .book-info h2 {
    font-size: 20px;
  }

  .book-info p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    font-size: 13px;
    line-height: 1.55;
  }

  .book-meta {
    gap: 5px;
  }

  .book-meta span {
    min-height: 28px;
    padding: 0 7px;
  }

  .book-meta span:nth-child(n+3) {
    display: none;
  }

  .book-latest {
    padding: 9px;
  }

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

  .book-actions .hub-link {
    min-height: 36px;
    width: 100%;
    padding: 0 8px;
    white-space: nowrap;
  }

  .library-page {
    background:
      radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.22), transparent 28%),
      linear-gradient(165deg, #09b85b 0%, #047640 48%, #06291e 100%);
  }

  .writer-hub {
    width: min(100% - 18px, 640px);
    gap: 10px;
    padding-top: 0;
  }

  .hub-hero {
    gap: 14px;
    padding: 18px 15px;
  }

  .hub-hero h1 {
    font-size: 38px;
  }

  .hub-hero-stats span {
    min-height: 62px;
  }

  .hub-quicklook {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .hub-quicklook::-webkit-scrollbar {
    display: none;
  }

  .hub-quicklook article {
    flex: 0 0 174px;
    padding: 11px 12px;
  }

  .shelf-toolbar {
    margin-top: 0;
  }

  .book-card,
  .book-card.featured,
  .book-card.planned {
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 11px;
    padding: 11px;
  }

  .book-card.featured .book-cover,
  .book-cover,
  .book-cover-empty {
    align-self: start;
    height: 178px;
    min-height: 178px;
    padding: 5px;
  }

  .book-cover img {
    border-radius: 5px;
    object-fit: contain;
  }

  .book-card.planned {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .book-card.planned .book-cover {
    height: 138px;
    min-height: 138px;
  }

  .book-progress-row {
    min-height: 38px;
    padding: 8px 9px 10px;
  }

  .brand-stage {
    min-height: 100svh;
    padding: 0;
    gap: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .login-page {
    padding: 12px;
    place-items: stretch;
    overflow: auto;
    background-position: 48% center;
  }

  .login-shell {
    min-height: calc(100vh - 24px);
    grid-template-columns: 1fr;
    gap: 0;
  }

  .login-hero {
    min-height: 300px;
    padding: 26px;
    align-items: flex-end;
  }

  .login-work-meta {
    gap: 9px;
  }

  .login-work-meta h1 {
    font-size: clamp(42px, 14vw, 62px);
  }

  .login-work-meta p {
    max-width: 290px;
    font-size: 15px;
  }

  .login-meta-row {
    gap: 7px;
  }

  .login-meta-row strong {
    min-width: auto;
    padding: 7px 10px;
    font-size: 12px;
  }

  .login-panel {
    min-height: auto;
    margin: 0;
    padding: 26px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, rgba(6, 20, 15, 0.94), rgba(5, 26, 16, 0.92));
  }

  .login-brand .brand-mark {
    width: 44px;
    height: 44px;
  }

  .login-brand strong {
    font-size: 28px;
  }

  .brand-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 56px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(4, 120, 58, 0.96);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 28px rgba(0, 61, 31, 0.14);
  }

  .brand-lockup {
    gap: 9px;
    min-width: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .brand-mark i {
    display: none;
  }

  .brand-mark::after {
    content: "万";
    font-size: 18px;
    font-weight: 900;
  }

  .hub-brand .brand-mark i {
    display: block;
  }

  .hub-brand .brand-mark::after {
    content: none;
  }

  .brand-lockup strong {
    font-size: 20px;
    line-height: 1;
  }

  .brand-lockup span:not(.brand-mark) {
    max-width: 168px;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .brand-actions span {
    display: none;
  }

  .brand-actions {
    gap: 6px;
  }

  .ghost-button {
    width: auto;
    min-width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
  }

  .ghost-button i {
    display: none;
  }

  #libraryHomeButton::after {
    content: "书库";
  }

  #focusModeButton::after {
    content: "专注";
  }

  #loginButton::after {
    content: "登录";
  }

  .workspace-window {
    min-height: 0;
    height: calc(100svh - 56px - env(safe-area-inset-top));
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #f4f7f4;
    box-shadow: none;
  }

  .library {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(86vw, 340px);
    padding-top: max(10px, env(safe-area-inset-top));
    transform: translateX(-100%);
    transition: transform 180ms ease;
    background: #f8fbf8;
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.26);
  }

  .mobile-drawer-close {
    display: block;
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    z-index: 2;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: #4e5b57;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(20, 43, 31, 0.08);
  }

  body.library-open .library {
    transform: translateX(0);
  }

  body.library-open .brand-stage::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(3, 20, 12, 0.48);
    backdrop-filter: blur(4px);
  }

  .traffic-lights {
    display: none;
  }

  .project-card {
    margin: 12px;
    padding: 14px;
    padding-right: 74px;
  }

  .project-card h1 {
    font-size: 23px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
  }

  .nav-item {
    height: 44px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
  }

  .nav-item.active {
    border-color: rgba(7, 199, 95, 0.36);
    background: #eefaf4;
  }

  .search-row {
    margin: 0 12px 10px;
  }

  .chapter-tools {
    padding: 0 12px 8px;
  }

  .chapter-list {
    padding: 0 12px 22px;
  }

  .chapter-item {
    min-height: 56px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
  }

  .chapter-title {
    font-size: 14px;
  }

  .chapter-sub {
    font-size: 12px;
  }

  .library-brief {
    display: none !important;
  }

  .workbench {
    height: 100%;
    min-height: 0;
    background: #f4f7f4;
  }

  .top-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 58px;
    padding: 8px 12px;
    gap: 10px;
    background: rgba(251, 253, 251, 0.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(25, 48, 34, 0.08);
  }

  .chapter-meta {
    flex: 0 1 118px;
    gap: 2px;
    min-width: 0;
  }

  #currentUnit {
    font-size: 15px;
  }

  #currentPath {
    max-width: 118px;
  }

  .toolbar-actions {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
    max-width: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .toolbar-actions::-webkit-scrollbar {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .tool-button span {
    display: none;
  }

  .tool-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 42px;
    min-height: 38px;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
  }

  .tool-button i {
    display: none;
  }

  .tool-button::after {
    white-space: nowrap;
  }

  #mobileLibraryButton::after {
    content: "目录";
  }

  #contextButton::after {
    content: "文包";
  }

  #readerSettingsButton::after {
    content: "阅读";
  }

  #editButton::after {
    content: "编辑";
  }

  #saveButton::after {
    content: "保存";
  }

  #saveButton[data-save-state="saving"]::after {
    content: "保存中";
  }

  #saveButton[data-save-state="saved"]::after {
    content: "已存";
  }

  #saveButton[data-save-state="error"]::after {
    content: "失败";
  }

  #cancelButton::after {
    content: "退出";
  }

  #saveButton,
  #cancelButton,
  #editButton,
  #mobileLibraryButton {
    display: inline-flex;
  }

  .save-status {
    display: none;
  }

  .mode-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    height: auto;
    display: flex;
    align-items: stretch;
    gap: 7px;
    overflow-x: auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -14px 32px rgba(20, 43, 31, 0.1);
    backdrop-filter: blur(16px);
    scrollbar-width: none;
  }

  .mode-tabs::-webkit-scrollbar {
    display: none;
  }

  .mode-tab {
    flex: 0 0 auto;
    min-width: 62px;
    height: 40px;
    padding: 0 13px;
    border-radius: 999px;
    background: #f2f5f2;
    white-space: nowrap;
    color: #5e6967;
    font-size: 0;
  }

  .mode-tab::before {
    content: attr(data-short);
    font-size: 13px;
    font-weight: 850;
  }

  .mode-tab.active {
    background: #dff8eb;
    color: var(--brand-ink);
  }

  .mode-tab.active::after {
    display: none;
  }

  .canvas {
    flex: 1;
    height: calc(100% - 58px);
    overflow: auto;
    padding: 18px 14px calc(92px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .canvas::-webkit-scrollbar,
  .chapter-list::-webkit-scrollbar,
  .doc-list::-webkit-scrollbar {
    display: none;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .section-heading h2 {
    font-size: 22px;
  }

  .section-heading p:not(.eyebrow) {
    font-size: 13px;
    line-height: 1.6;
  }

  .dashboard-card,
  .dashboard-metrics article,
  .dashboard-columns section,
  .insight-strip article,
  .doc-sidebar,
  .doc-reader,
  .character-card,
  .character-detail,
  .mascot-card {
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(20, 43, 31, 0.06);
  }

  .dashboard-card {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    padding: 16px;
  }

  .dashboard-card i {
    display: none;
  }

  .dashboard-card strong {
    font-size: 16px;
  }

  .dashboard-card span {
    margin-top: 6px;
    line-height: 1.55;
  }

  .continue-card {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 68px;
    padding: 12px;
  }

  .continue-icon {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .continue-meta {
    grid-column: 2;
    width: fit-content;
    padding: 3px 8px;
  }

  .insight-strip,
  .brief-grid,
  .doc-browser,
  .character-workspace,
  .review-board,
  .memory-grid,
  .character-grid {
    grid-template-columns: 1fr;
  }

  .doc-sidebar {
    position: static;
    max-height: none;
  }

  .doc-browser {
    gap: 12px;
  }

  .doc-toolbar,
  .doc-search,
  .doc-folder-row,
  .doc-list {
    padding-left: 12px;
    padding-right: 12px;
  }

  .doc-list {
    max-height: 44svh;
  }

  .doc-item {
    min-height: 56px;
    padding: 11px 10px;
  }

  .doc-reader {
    padding: 18px 16px;
  }

  .doc-reader-head h2 {
    font-size: 22px;
    line-height: 1.25;
  }

  .chapter-view {
    max-width: none;
    padding: 4px 2px 12px;
    font-size: var(--reader-font-size);
    line-height: var(--reader-line-height);
  }

  #draftPanel.active {
    display: flex;
    flex-direction: column;
  }

  #chapterView,
  #editor {
    order: 2;
  }

  .chapter-view h1 {
    margin-bottom: 18px;
    font-size: 24px;
  }

  .chapter-view p {
    margin-bottom: 15px;
  }

  .editor {
    width: 100%;
    min-height: calc(100svh - 184px - env(safe-area-inset-bottom));
    padding: 16px;
    border-radius: 8px;
    font-size: var(--reader-font-size);
    line-height: calc(var(--reader-line-height) - 0.12);
    resize: none;
  }

  .chapter-stepper {
    order: 1;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 14px;
  }

  .stepper-current {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 48px;
  }

  .stepper-button {
    min-height: 46px;
    padding: 0 10px;
  }

  .reader-settings-panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    width: auto;
    padding: 14px;
    box-shadow: 0 -20px 50px rgba(15, 36, 24, 0.22);
  }

  .reader-setting-group {
    grid-template-columns: 42px repeat(3, minmax(0, 1fr));
  }

  .empty-state {
    min-height: calc(100svh - 230px);
    padding: 0 18px;
  }

  .character-detail-head,
  .character-brief-grid {
    grid-template-columns: 1fr;
  }

  .character-detail-images {
    padding-right: 0;
  }

  .character-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .character-filters {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .chip {
    flex: 0 0 auto;
  }
}

@media (min-width: 1280px) {
  .writer-hub {
    width: min(1680px, calc(100% - clamp(48px, 5vw, 96px)));
  }

  .hub-hero {
    min-height: 236px;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  }

  .hub-hero p:not(.eyebrow) {
    max-width: 820px;
  }

  .hub-quicklook {
    gap: 12px;
  }

  .shelf-toolbar {
    gap: 16px;
  }

  .book-shelf {
    grid-template-columns: minmax(0, 1.22fr) minmax(440px, 0.78fr);
    gap: 18px;
  }

  .book-card {
    padding: 16px;
  }

  .book-card.featured {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .book-card.planned {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .book-card.featured .book-cover {
    min-height: 350px;
  }

  .book-cover-empty {
    min-height: 310px;
  }
}

@media (min-width: 1760px) {
  .writer-hub {
    width: calc(100% - 80px);
    max-width: 2200px;
  }

  .hub-hero {
    min-height: 276px;
    padding: 38px 44px;
    grid-template-columns: minmax(0, 1fr) minmax(460px, 560px);
  }

  .hub-hero h1 {
    font-size: 76px;
  }

  .hub-hero p:not(.eyebrow) {
    max-width: 920px;
    font-size: 16px;
  }

  .hub-hero-stats span {
    min-height: 108px;
  }

  .hub-hero-stats strong {
    font-size: 40px;
  }

  .hub-quicklook article {
    min-height: 104px;
    padding: 17px 18px;
  }

  .hub-quicklook strong {
    font-size: 22px;
  }

  .shelf-search {
    height: 54px;
  }

  .shelf-filter {
    height: 48px;
    padding: 0 20px;
  }

  .book-shelf {
    grid-template-columns: minmax(0, 1.25fr) minmax(520px, 0.75fr);
    gap: 22px;
  }

  .book-card {
    padding: 18px;
  }

  .book-card.featured {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .book-card.planned {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .book-card.featured .book-cover {
    min-height: 430px;
  }

  .book-cover-empty {
    min-height: 390px;
  }

  .book-info {
    gap: 14px;
  }

  .book-info h2 {
    font-size: 34px;
  }

  .book-card.planned .book-info h2 {
    font-size: 30px;
  }

  .book-info p {
    font-size: 15px;
  }

  .book-progress-row {
    min-height: 52px;
  }

  .book-latest {
    padding: 15px;
  }
}
