:root {
  color-scheme: light;
  --bg: #f8f8f5;
  --surface: #ffffff;
  --surface-muted: #f0f1ed;
  --ink: #1f2421;
  --muted: #6d746d;
  --line: #ddded8;
  --line-strong: #c8cbc2;
  --accent: #2f6b4f;
  --accent-strong: #1f4e3a;
  --accent-soft: #e4ece5;
  --danger: #9a342d;
  --warning: #8a5a20;
  --shadow: 0 18px 48px rgb(31 36 33 / 0.08);
  --radius: 8px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 1180px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

button:hover {
  background: var(--accent-strong);
}

button:active {
  transform: translateY(1px);
}

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

a {
  color: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfa;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.75;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(47 107 79 / 0.14);
}

.desktop-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 100dvh;
}

body.auth-active .desktop-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.auth-active .desktop-sidebar {
  display: none;
}

body.auth-active .desktop-main {
  width: 100%;
  padding: 28px;
}

.desktop-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100dvh;
  padding: 18px 14px;
  color: var(--ink);
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 32px rgb(31 36 33 / 0.04);
  overflow: hidden;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #eaf4ed;
  background: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

.brand-logo {
  display: block;
  object-fit: cover;
  object-position: center;
  flex: 0 0 auto;
}

.brand-logo-small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 8px 18px rgb(31 78 58 / 0.14);
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block strong {
  font-size: 14px;
}

.brand-block span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.desktop-nav {
  display: grid;
  gap: 6px;
}

.tab {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  color: #314038;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
}

.tab:hover,
.tab.active {
  color: var(--accent-strong);
  background: #eef3ef;
  border-color: #e3e9e4;
}

.tab span {
  font-weight: 700;
  font-size: 14px;
}

.tab small {
  color: var(--muted);
  font-size: 11px;
}

.sidebar-status {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin-top: auto;
}

.sidebar-status .badge,
.sidebar-status .credit-badge {
  width: 100%;
  justify-content: center;
}

.credit-badge {
  color: var(--warning);
  background: #fff7e8;
  border-color: rgb(138 90 32 / 0.28);
}

.mobile-link {
  display: block;
  max-width: 100%;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  background: #fbfcfa;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.sidebar-user > div {
  min-width: 0;
}

.avatar-dot {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgb(47 107 79 / 0.18), transparent),
    #dbe6de;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  font-size: 13px;
}

.sidebar-user small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.desktop-main {
  width: min(100%, 1660px);
  padding: 28px;
}

.tab-view {
  display: grid;
  gap: 18px;
}

.hidden,
.tab-view.hidden,
.work-subview.hidden,
.screen-hidden {
  display: none !important;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 0.95fr);
  min-height: calc(100dvh - 56px);
  margin: -28px;
  background: #fff;
}

body.auth-active .auth-view {
  min-height: 100dvh;
}

.auth-view.hidden {
  display: none !important;
}

.auth-brand-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 70px;
  min-height: 100dvh;
  padding: 72px 76px;
  border-right: 1px solid rgba(221, 222, 216, 0.72);
  background:
    linear-gradient(180deg, rgba(249, 252, 250, 0.9), rgba(235, 244, 239, 0.86)),
    radial-gradient(circle at 8% 2%, rgba(47, 107, 79, 0.16), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(217, 184, 108, 0.16), transparent 32%);
}

.auth-brand-panel::before,
.auth-brand-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.auth-brand-panel::before {
  inset: auto -4% 0 -4%;
  height: 34%;
  background:
    radial-gradient(ellipse at 18% 75%, rgba(47, 107, 79, 0.16), transparent 42%),
    radial-gradient(ellipse at 72% 58%, rgba(7, 61, 50, 0.13), transparent 46%),
    linear-gradient(180deg, transparent, rgba(236, 245, 240, 0.92));
}

.auth-brand-panel::after {
  top: 0;
  left: 0;
  width: 230px;
  height: 210px;
  background:
    radial-gradient(ellipse at 18% 12%, rgba(47, 107, 79, 0.16), transparent 56%),
    linear-gradient(135deg, rgba(47, 107, 79, 0.08), transparent 62%);
  clip-path: polygon(0 0, 100% 0, 44% 100%, 0 78%);
}

.auth-brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.auth-logo {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  box-shadow: 0 24px 44px rgb(31 78 58 / 0.22);
}

.auth-brand-lockup strong,
.auth-brand-lockup span {
  display: block;
}

.auth-brand-lockup strong {
  color: var(--accent-strong);
  font-size: 40px;
  line-height: 1;
}

.auth-brand-lockup span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  text-align: center;
}

.auth-brand-copy h1 {
  color: var(--accent-strong);
  font-size: 40px;
  line-height: 1.16;
  letter-spacing: 0;
}

.auth-brand-copy p {
  max-width: 500px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
}

.auth-feature-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 650px;
  margin: 0 auto;
}

.auth-feature-row div {
  display: grid;
  gap: 10px;
  min-height: 96px;
  padding: 8px 26px;
  border-left: 1px solid rgba(31, 78, 58, 0.12);
  text-align: center;
}

.auth-feature-row div:first-child {
  border-left: 0;
}

.auth-feature-row strong {
  color: var(--ink);
  font-size: 18px;
}

.auth-feature-row span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-card {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 22px;
  width: min(520px, calc(100% - 80px));
  padding: 44px 40px;
  border: 1px solid rgba(221, 222, 216, 0.8);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 32px 84px rgb(31 36 33 / 0.14);
}

.auth-card-head {
  text-align: center;
}

.auth-card-head h2 {
  color: var(--accent-strong);
  font-size: 18px;
}

.auth-card-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.auth-field input {
  min-height: 52px;
  font-size: 15px;
}

.auth-form button {
  min-height: 52px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 900;
}

.auth-options {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.auth-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  white-space: nowrap;
}

.auth-options input[type="checkbox"] {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.dev-token-box {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgb(138 90 32 / 0.28);
  border-radius: var(--radius);
  background: #fff7e8;
}

.dev-token-box span {
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
}

.dev-token-box code {
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.5;
}

.dev-token-box button {
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
}

.auth-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.ok {
  color: var(--accent-strong);
}

.auth-switch-line,
.auth-text-link {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.auth-switch-line button,
.auth-text-link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 950;
}

.auth-switch-line button:hover,
.auth-text-link:hover {
  color: var(--accent);
  background: transparent;
}

.screen-header,
.panel,
.entry-card,
.continue-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.screen-header {
  padding: 24px;
}

.home-header {
  padding: 28px 24px;
}

.compact-header {
  max-width: 980px;
}

.header-row,
.section-heading,
.page-title,
.generation-line,
.segment-title,
.inline-actions,
.chapter-actions,
.project-actions,
.icon-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-kicker,
.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.header-copy,
.section-heading p,
.muted-line {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

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

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.panel {
  padding: 18px;
}

.compact,
.mini-action {
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.secondary-btn,
.mini-action.secondary-btn,
.shortcut,
.quick-card,
.workspace-tab,
.segmented button,
.chip,
.style-card,
.inspiration-card,
.danger-btn {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.secondary-btn:hover,
.shortcut:hover,
.quick-card:hover,
.workspace-tab:hover,
.segmented button:hover,
.chip:hover,
.style-card:hover,
.inspiration-card:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.danger,
.danger-btn {
  color: var(--danger);
  border-color: rgb(154 52 45 / 0.32);
}

.danger:hover,
.danger-btn:hover {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 700;
}

.badge.ok {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgb(47 107 79 / 0.25);
}

.badge.bad {
  color: var(--danger);
  background: #f8e5e1;
  border-color: rgb(154 52 45 / 0.25);
}

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

.entry-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  min-height: 220px;
  padding: 26px;
}

.entry-card span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.entry-card h2 {
  margin-top: 10px;
  font-size: 26px;
}

.entry-card p {
  margin-top: 12px;
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.7;
}

.round-next {
  align-self: flex-end;
  min-width: 84px;
}

.entry-warm {
  background: #fbfaf5;
}

.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.writing-path-panel[aria-hidden="true"] {
  display: none !important;
}

.book-cover {
  width: 46px;
  height: 62px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgb(47 107 79 / 0.9), rgb(31 36 33 / 0.92)),
    var(--accent);
}

.book-cover.small {
  width: 36px;
  height: 48px;
}

.continue-main {
  flex: 1;
}

.continue-main span,
.continue-main p {
  color: var(--muted);
  font-size: 13px;
}

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

.quick-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.quick-card span {
  color: var(--muted);
  font-size: 13px;
}

.page-title {
  align-items: flex-start;
  margin-bottom: 16px;
}

.back-mark {
  flex: 0 0 auto;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.segmented button {
  min-width: 110px;
  border-color: transparent;
}

.segmented button.active,
.workspace-tab.active,
.chip.active,
.style-card.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.inspiration-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.inspiration-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 16px;
  text-align: left;
}

.inspiration-card span,
.style-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.inspiration-card p,
.style-card p,
.style-card small {
  color: var(--muted);
  line-height: 1.65;
}

.step-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.step-pills span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
}

.step-pills .active,
.step-pills .done {
  color: var(--accent-strong);
  border-color: rgb(47 107 79 / 0.35);
  background: var(--accent-soft);
}

.starter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.starter-main,
.starter-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.input-count-wrap {
  position: relative;
}

.input-count-wrap span {
  position: absolute;
  right: 10px;
  top: 50%;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.field-label {
  display: block;
  margin-top: 2px;
  color: #344039;
  font-size: 13px;
  font-weight: 700;
}

.field-helper {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.chapter-word-helper {
  display: block;
  margin: -4px 0 12px;
  line-height: 1.55;
}

.chapter-word-helper span {
  display: block;
}

.choice-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.compact-heading {
  margin-bottom: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 220px;
  min-height: 36px;
  padding: 8px 10px;
  text-align: left;
}

.chip small {
  margin-top: 4px;
  color: inherit;
  opacity: 0.76;
}

.sticky-form-actions {
  position: sticky;
  bottom: 0;
  justify-content: flex-end;
  margin: 18px -18px -18px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 0.96);
}

.workspace-subnav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(245 246 242 / 0.94);
}

.workspace-tab {
  min-width: 96px;
}

.overview-grid,
.versions-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(360px, 1fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.project-list-panel {
  min-height: 420px;
}

.status-grid,
.flow-meta,
.memory-grid {
  display: grid;
  gap: 10px;
}

.kv,
.flow-meta div,
.memory-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.kv span,
.flow-meta span,
.memory-grid span {
  color: var(--muted);
  font-size: 12px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.flow-step {
  min-height: 44px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfa;
  text-align: center;
  font-size: 13px;
}

.flow-step.done {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgb(47 107 79 / 0.32);
}

.flow-step.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.flow-callout {
  padding: 12px;
  border: 1px solid rgb(47 107 79 / 0.24);
  border-radius: 6px;
  background: var(--accent-soft);
}

.flow-callout p {
  margin-top: 6px;
  color: #405348;
  line-height: 1.65;
}

.flow-actions {
  margin-top: 14px;
}

.project-list {
  display: grid;
  gap: 10px;
  max-height: 62dvh;
  overflow: auto;
}

.project-item,
.version-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.project-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-item strong,
.version-item strong {
  display: block;
  margin-bottom: 5px;
}

.project-item span,
.version-item span,
.version-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.outline-heading {
  align-items: flex-start;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.shortcut {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  text-align: left;
}

.shortcut strong {
  font-size: 16px;
}

.shortcut span {
  color: inherit;
  font-size: 12px;
  opacity: 0.78;
}

.generation-panel {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgb(47 107 79 / 0.24);
  border-radius: 6px;
  background: #f7faf6;
}

.generation-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe2da;
}

.generation-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.generation-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.outline-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.outline-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
}

.outline-block.locked-open summary {
  cursor: default;
}

.outline-block.locked-open summary::-webkit-details-marker {
  display: none;
}

.outline-block.locked-open summary::marker {
  content: "";
}

.outline-block summary span {
  color: var(--muted);
  font-size: 12px;
}

.outline-block .field-label,
.outline-block textarea {
  margin: 0 12px 12px;
  width: calc(100% - 24px);
}

.outline-editor {
  font-family:
    "Cascadia Mono",
    "Microsoft YaHei",
    monospace;
  font-size: 13px;
}

.chapter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.chapter-editor-panel {
  min-height: calc(100dvh - 176px);
}

.inline-actions.tight {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chapter-title-row {
  display: grid;
  grid-template-columns: minmax(240px, 0.6fr) minmax(360px, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.chapter-title-row span {
  display: block;
  margin-bottom: 6px;
  color: #344039;
  font-size: 13px;
  font-weight: 700;
}

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

.segment {
  display: grid;
  gap: 8px;
}

.segment-title {
  color: var(--muted);
  font-size: 13px;
}

.segment textarea {
  min-height: 200px;
  font-size: 16px;
  line-height: 1.9;
}

.segment:first-child textarea {
  min-height: 560px;
}

.chapter-side {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 14px;
  max-height: calc(100dvh - 92px);
  overflow: auto;
}

.chapter-side textarea {
  margin-bottom: 10px;
}

.full {
  width: 100%;
}

.chapter-library {
  background: #fff;
}

.chapter-browser-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.chapter-browser-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.chapter-browser-head span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.secondary-btn.compact {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.chapter-browser-body {
  margin-top: 12px;
}

.chapter-browser-list {
  display: grid;
  gap: 8px;
}

.chapter-browser-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.chapter-browser-item.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.chapter-browser-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.chapter-browser-item span,
.chapter-browser-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.chapter-browser-item em {
  justify-self: end;
  font-weight: 850;
}

.chapter-actions {
  align-items: stretch;
  flex-direction: column;
}

.sticky-chapter-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 18px -18px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 0.96);
}

.mirror-only {
  display: none;
}

.versions-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.world-empty {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 420px;
  gap: 18px;
  min-height: calc(100dvh - 56px);
}

.world-illustration,
.world-card {
  min-height: 560px;
}

.world-illustration {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.82), rgb(241 244 239 / 0.92)),
    #f7f8f4;
  box-shadow: var(--shadow);
}

.mountain-line {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 34%;
  height: 180px;
  border-bottom: 1px solid #d8e0d7;
  border-radius: 50% 45% 0 0;
}

.mountain-line::before,
.mountain-line::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 45%;
  height: 96px;
  border-bottom: 1px solid #c9d4cc;
  border-radius: 50% 45% 0 0;
}

.mountain-line::before {
  left: 2%;
  transform: rotate(-12deg);
}

.mountain-line::after {
  right: 8%;
  transform: rotate(14deg);
}

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

.coming-soon {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.coming-soon strong {
  color: var(--ink);
  font-size: 20px;
}

.coming-soon p {
  max-width: 26ch;
  line-height: 1.7;
}

.brand-mark.large {
  width: 48px;
  height: 48px;
  font-size: 20px;
}

.brand-logo-large {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  box-shadow: 0 14px 28px rgb(31 78 58 / 0.18);
}

.mine-layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.user-center {
  display: grid;
  gap: 14px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

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

.avatar {
  display: inline-block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgb(47 107 79 / 0.18), transparent),
    #dbe6de;
}

.avatar.large {
  width: 52px;
  height: 52px;
}

.mine-list {
  display: grid;
  gap: 8px;
}

.mine-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.mine-row:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.mine-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.billing-panel {
  align-content: start;
}

.billing-products,
.ledger-list,
.order-list {
  display: grid;
  gap: 10px;
}

.billing-product,
.ledger-item,
.order-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
}

.billing-product:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.billing-product strong,
.ledger-item strong,
.order-item strong {
  display: block;
  font-size: 14px;
}

.billing-product span,
.ledger-item span,
.order-item span,
.ledger-item em,
.order-item em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.55;
}

.billing-product em {
  color: var(--accent-strong);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

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

.billing-actions .mini-action {
  width: auto;
}

.billing-note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dfe8de;
  border-radius: 6px;
  background: #f7faf5;
}

.billing-note strong {
  color: var(--ink);
  font-size: 14px;
}

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

.voice-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(400px, 1fr) minmax(400px, 1fr);
  gap: 18px;
  align-items: start;
}

.style-card-list,
.analysis-result,
.issue-list {
  display: grid;
  gap: 10px;
}

.style-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  text-align: left;
}

.score-card,
.issue-card,
.guide-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.score-card strong {
  font-size: 30px;
  color: var(--accent);
}

.issue-card span,
.issue-card p,
.guide-block li {
  color: var(--muted);
  line-height: 1.65;
}

.prompt-block,
#log {
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #2f3a34;
  background: #f7f8f4;
  white-space: pre-wrap;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfa;
}

@media (max-width: 1280px) {
  html {
    min-width: 1024px;
  }

  .desktop-shell {
    grid-template-columns: 164px minmax(0, 1fr);
  }

  .overview-grid,
  .voice-grid,
  .outline-grid,
  .world-empty,
  .mine-layout {
    grid-template-columns: 1fr;
  }

  .shortcut-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chapter-layout {
    grid-template-columns: 1fr;
  }

  .chapter-side {
    position: static;
    max-height: none;
  }
}
