:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #6f7772;
  --subtle: #9aa39d;
  --bg: #f5f7f4;
  --card: #ffffff;
  --card-soft: #fbfcf9;
  --line: #dbe3de;
  --green: #073d32;
  --green-deep: #052e27;
  --green-soft: #eaf3ef;
  --gold: #d9b86c;
  --gold-soft: #fff6df;
  --danger: #b04435;
  --danger-soft: #fff1ee;
  --shadow: 0 12px 28px rgba(17, 33, 28, 0.09);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2ee;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0, rgba(217, 184, 108, 0.18), transparent 32%),
    #eef2ee;
}

.app {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 14px 94px;
  background: var(--bg);
  box-shadow: 0 24px 60px rgba(7, 61, 50, 0.16);
}

.device-status {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin: 0 -14px;
  padding: 7px 18px 4px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

body.auth-active .device-status {
  display: none;
}

body.auth-active .app {
  padding-top: 0;
}

.status-meta {
  font-size: 11px;
  letter-spacing: 0;
}

.view-switch-link {
  color: inherit;
  font-weight: 900;
  text-decoration: none;
}

.tab-view {
  display: block;
}

.hidden {
  display: none !important;
}

.screen-hidden {
  display: none !important;
}

.auth-view {
  display: grid;
  gap: 16px;
  min-height: calc(100dvh - 28px);
  padding: 20px 2px 30px;
}

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

.auth-brand-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 24px;
  min-height: 310px;
  padding: 28px 20px;
  border: 1px solid rgba(219, 227, 222, 0.84);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(245, 250, 247, 0.88), rgba(237, 246, 241, 0.94)),
    radial-gradient(circle at 10% 0, rgba(47, 107, 79, 0.18), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(217, 184, 108, 0.18), transparent 34%);
}

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

.auth-brand-panel::before {
  inset: auto -18px -24px -18px;
  height: 116px;
  background:
    radial-gradient(ellipse at 20% 75%, rgba(47, 107, 79, 0.14), transparent 42%),
    radial-gradient(ellipse at 78% 48%, rgba(7, 61, 50, 0.12), transparent 50%);
}

.auth-brand-panel::after {
  top: 12px;
  left: 12px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 107, 79, 0.12), transparent 66%);
}

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

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

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(7, 61, 50, 0.2);
}

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

.auth-brand-lockup strong {
  color: var(--green);
  font-size: 24px;
  line-height: 1.1;
}

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

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

.auth-brand-copy h1 {
  color: var(--green);
  font-size: 28px;
  line-height: 1.18;
}

.auth-brand-copy p {
  max-width: 24em;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.auth-feature-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.auth-feature-row div {
  display: grid;
  gap: 5px;
  min-height: 66px;
  padding: 9px 6px;
  border-left: 1px solid rgba(7, 61, 50, 0.12);
  text-align: center;
}

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

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

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

.auth-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(219, 227, 222, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 58px rgba(17, 33, 28, 0.12);
}

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

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

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

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

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

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

.auth-field input {
  min-height: 48px;
}

.auth-form button {
  margin-top: 2px;
  min-height: 48px;
}

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

.auth-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  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: 8px;
  padding: 10px;
  border: 1px solid rgba(217, 184, 108, 0.55);
  border-radius: 8px;
  background: var(--gold-soft);
}

.dev-token-box span {
  color: #775d16;
  font-size: 12px;
  font-weight: 900;
}

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

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

.auth-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

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

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

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

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

h1 {
  font-size: 24px;
  line-height: 1.18;
  font-weight: 900;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

h3 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
}

.screen-header {
  margin: 0 -14px 14px;
  padding: 22px 20px 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--green);
  color: #fff;
}

.home-header {
  min-height: 118px;
}

.project-header,
.compact-header {
  min-height: 96px;
  padding-bottom: 18px;
}

.header-row,
.page-title,
.section-heading,
.kv,
.generation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  justify-content: flex-start;
}

.inspiration-title {
  align-items: flex-start;
}

.inspiration-title > div {
  flex: 1;
  min-width: 0;
}

.inspiration-title .mini-action {
  flex: 0 0 auto;
  width: auto;
}

.page-title p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.screen-header .page-title p,
.screen-header .header-copy {
  color: rgba(255, 255, 255, 0.76);
}

.header-copy {
  margin-top: 6px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.back-mark {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  color: currentColor;
  font-size: 24px;
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  color: #d8efe3;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.ok {
  border-color: rgba(126, 205, 160, 0.6);
  color: #9ee6be;
}

.badge.bad {
  border-color: rgba(255, 176, 160, 0.65);
  color: #ffb0a0;
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 178px;
}

.credit-badge {
  border-color: rgba(217, 184, 108, 0.5);
  color: #ffe2a4;
}

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

.panel {
  margin-top: 12px;
  padding: 14px;
}

.home-actions {
  display: grid;
  gap: 12px;
  margin-top: -2px;
}

.entry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 112px;
  padding: 18px;
}

.entry-primary {
  background:
    linear-gradient(135deg, rgba(7, 61, 50, 0.05), rgba(7, 61, 50, 0.01)),
    #fff;
}

.entry-warm {
  border-color: #eadab5;
  background:
    linear-gradient(135deg, rgba(217, 184, 108, 0.2), rgba(255, 255, 255, 0.55)),
    #fffaf0;
}

.entry-card h2 {
  margin-bottom: 10px;
}

.entry-card p,
.recent-placeholder p,
.muted-line {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.round-next,
.icon-btn,
.mini-action {
  width: auto;
}

.round-next {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  border-color: #e1e8e3;
  background: #fff;
  color: var(--green);
  font-size: 26px;
  line-height: 1;
}

.round-next.warm {
  border-color: #efd7a4;
  background: #fff;
  color: #b98635;
}

.continue-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
}

.book-cover {
  width: 54px;
  height: 70px;
  border-radius: 7px;
  border: 1px solid rgba(7, 61, 50, 0.18);
  background:
    linear-gradient(160deg, rgba(7, 61, 50, 0.95), rgba(11, 30, 26, 0.84)),
    #073d32;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

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

.continue-main {
  min-width: 0;
}

.continue-card span,
.section-heading span,
.flow-meta span,
.flow-callout p,
.project-item span,
.version-item span,
.memory-grid span,
.chapter-card p,
.avatar-row p,
.continue-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.continue-card strong,
.project-item strong,
.flow-meta strong,
.flow-callout strong,
.avatar-row strong,
.recent-placeholder strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

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

.section-heading span {
  font-weight: 800;
  white-space: nowrap;
}

.recent-placeholder {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 82px;
}

.writing-path-panel {
  background: var(--card);
}

#starterPanel,
#inspirationPanel {
  scroll-margin-top: 40px;
}

button,
input,
textarea,
select {
  width: 100%;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
  font: inherit;
}

button {
  min-height: 42px;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(7, 61, 50, 0.42);
  outline-offset: 2px;
}

button.compact {
  width: auto;
  min-width: 70px;
  min-height: 34px;
  padding: 0 12px;
}

button.warm,
.warm {
  border-color: #b98635;
  background: var(--gold);
  color: #fff;
}

button.secondary-btn,
.secondary-btn {
  border-color: #e4ebe6;
  background: #f8faf7;
  color: var(--ink);
}

button.danger-btn,
.shortcut.danger {
  border-color: #f0c7be;
  background: var(--danger-soft);
  color: var(--danger);
}

button:disabled {
  border-color: #d9e2dd;
  background: #dce6e1;
  color: #63736b;
  opacity: 1;
  cursor: not-allowed;
}

input,
textarea,
select {
  display: block;
  margin-bottom: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.68;
}

select {
  min-height: 42px;
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: #273b34;
  font-size: 12px;
  font-weight: 900;
}

.field-helper {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.field-helper strong {
  flex: 0 0 auto;
  color: #485750;
  font-size: 11px;
}

.field-helper.over-limit,
.field-helper.over-limit strong {
  color: var(--danger);
}

.chapter-word-helper {
  display: block;
  margin-top: -4px;
  line-height: 1.5;
}

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

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

.input-count-wrap input {
  padding-right: 58px;
}

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

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 9px;
}

.sticky-form-actions {
  padding: 9px;
  margin: 12px -2px -2px;
  border: 1px solid rgba(7, 61, 50, 0.1);
  border-radius: 8px;
  background: #fff;
}

.step-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0 16px;
}

.step-pills span {
  display: grid;
  place-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #eef2ef;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 850;
}

.step-pills .done,
.step-pills .active {
  background: var(--green);
  color: #fff;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0 14px;
  padding: 5px;
  border-radius: 8px;
  background: #eef2ef;
}

.segmented span,
.segmented button {
  display: grid;
  place-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #6d746f;
  font-size: 13px;
  font-weight: 850;
}

.segmented .active {
  background: var(--green);
  color: #fff;
}

.choice-block {
  margin: 14px 0;
}

.compact-heading {
  margin-bottom: 8px;
}

.compact-heading h3 {
  font-size: 14px;
}

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

.chip {
  width: auto;
  min-height: 32px;
  padding: 0 12px;
  border-color: transparent;
  background: #f1f3f0;
  color: #3d4943;
  font-size: 12px;
  font-weight: 850;
}

.chip.has-detail {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 9px 11px;
  text-align: left;
}

.chip.has-detail strong {
  display: block;
  color: inherit;
  font-size: 13px;
  line-height: 1.25;
}

.chip.has-detail small {
  display: block;
  margin-top: 4px;
  color: #65746d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.chip.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.chip.active small {
  color: rgba(255, 255, 255, 0.76);
}

.inspiration-list {
  display: grid;
  gap: 10px;
}

.inspiration-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.inspiration-card::before {
  content: "";
  width: 58px;
  height: 76px;
  grid-row: 1 / span 3;
  border-radius: 7px;
  background:
    linear-gradient(150deg, rgba(7, 61, 50, 0.95), rgba(217, 184, 108, 0.55)),
    #073d32;
}

.inspiration-card span {
  display: inline-flex;
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.inspiration-card h3 {
  font-size: 14px;
}

.inspiration-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 17px;
}

.icon-btn::before,
.icon-btn::after {
  content: "";
  position: absolute;
  display: block;
}

.icon-search::before {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translate(-2px, -2px);
}

.icon-search::after {
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(6px, 6px) rotate(45deg);
}

.icon-plus::before,
.icon-plus::after {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-plus::after {
  transform: rotate(90deg);
}

.workspace-subnav {
  position: sticky;
  top: 28px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: -12px 0 12px;
  padding: 6px;
  border: 1px solid rgba(7, 61, 50, 0.12);
  border-radius: 8px;
  background: rgba(245, 247, 244, 0.96);
  backdrop-filter: blur(10px);
}

.workspace-tab {
  min-height: 34px;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
  color: #586760;
  font-size: 12px;
}

.workspace-tab.active {
  background: var(--green);
  color: #fff;
}

.work-subview {
  display: block;
}

.overview-panel {
  margin-top: 10px;
}

.status-grid {
  display: grid;
  gap: 8px;
}

.kv {
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #e5ece7;
  border-radius: 8px;
  background: var(--card-soft);
}

.kv strong {
  max-width: 230px;
  text-align: right;
  overflow-wrap: anywhere;
}

.flow-panel {
  border-color: #ecd9ad;
  background: var(--gold-soft);
}

.flow-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.flow-meta div,
.flow-callout {
  padding: 10px;
  border: 1px solid #e5ece7;
  border-radius: 8px;
  background: #fff;
}

.flow-meta strong {
  margin-top: 3px;
  font-size: 13px;
}

.flow-steps {
  position: relative;
  display: grid;
  gap: 0;
  margin: 8px 0 12px;
  padding-left: 13px;
}

.flow-steps::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 18px;
  width: 1px;
  background: #d9e1dc;
}

.flow-step {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6d746f;
  font-size: 13px;
  font-weight: 850;
}

.flow-step::before {
  content: "";
  position: relative;
  z-index: 1;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border: 2px solid #cdd8d1;
  border-radius: 999px;
  background: #fff;
}

.flow-step.done::before {
  border-color: var(--green);
  background: var(--green);
}

.flow-step.active {
  color: #a5732a;
}

.flow-step.active::before {
  border-color: var(--gold);
  background: var(--gold);
}

.flow-callout {
  margin-bottom: 12px;
}

.flow-callout strong {
  font-size: 14px;
}

.flow-callout p {
  margin-top: 5px;
}

.flow-callout.warning {
  border-color: #ecd3a4;
  background: #fff8ea;
}

.flow-callout.warning strong {
  color: #9b641e;
}

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

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

.project-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-item::before {
  content: "";
  width: 58px;
  height: 76px;
  grid-row: 1 / span 2;
  border-radius: 7px;
  background:
    linear-gradient(150deg, rgba(7, 61, 50, 0.96), rgba(27, 31, 28, 0.78)),
    #073d32;
}

.project-item.active {
  border-color: var(--green);
  background: #f5fbf8;
}

.project-item span {
  display: block;
  margin-top: 5px;
}

.project-actions {
  display: flex;
  gap: 8px;
  grid-column: 2;
}

.project-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

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

.outline-block-actions {
  margin: 0 0 10px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px;
  border-color: #e5ece7;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.shortcut strong {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
}

.shortcut span {
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.shortcut.danger strong {
  background: var(--danger);
}

.process-card {
  display: grid;
  gap: 0;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.process-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
}

.process-row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 38px;
  bottom: -16px;
  width: 1px;
  background: #d9e1dc;
}

.process-row > span {
  position: relative;
  z-index: 1;
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cfd9d3;
  background: #fff;
}

.process-row.done > span,
.process-row.active > span {
  border-color: var(--green);
  background: var(--green);
}

.process-row.active > span {
  border-color: var(--gold);
  background: var(--gold);
}

.process-row p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.process-row.active em {
  color: #a5732a;
}

.generation-panel {
  margin: 0 0 12px;
  padding: 11px;
  border: 1px solid #ecd3a4;
  border-radius: 8px;
  background: #fff8ea;
}

.generation-line {
  color: var(--ink);
  font-size: 13px;
}

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

.generation-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.generation-panel p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.outline-editor {
  min-height: 142px;
  font-family: Consolas, "SFMono-Regular", "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.58;
}

.outline-block {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.outline-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

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

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

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

.outline-block summary strong {
  color: var(--ink);
  font-size: 14px;
}

.outline-block summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.outline-block[open] summary {
  margin-bottom: 8px;
}

.chapter-workspace {
  padding-bottom: 78px;
}

.chapter-topbar {
  margin: 0 -2px 10px;
}

.chapter-current-hint {
  padding: 10px 12px;
  border: 1px solid #dfe8e2;
  border-radius: 8px;
  background: #f8fbf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.mini-action {
  min-width: 78px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.chapter-library,
.review-panel {
  background: #fff;
}

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

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

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

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

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

.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: 11px;
  font-style: normal;
  line-height: 1.35;
}

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

.chapter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.chapter-actions button {
  min-height: 36px;
  padding: 0 8px;
}

.chapter-actions .danger-btn {
  grid-column: 1 / -1;
}

.editor-actions,
.detail-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-panel textarea {
  min-height: 112px;
  border-color: #e7d5ba;
  background: #fffaf0;
}

.review-panel .inline-actions {
  margin-top: 10px;
}

.sticky-chapter-actions {
  position: sticky;
  bottom: 74px;
  z-index: 18;
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 8px;
  margin: 10px 0 0;
  padding: 9px;
  border: 1px solid rgba(7, 61, 50, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(17, 33, 28, 0.14);
  backdrop-filter: blur(10px);
}

.segment {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #46584f;
  font-size: 12px;
  font-weight: 850;
}

.segment textarea {
  min-height: 220px;
  margin-bottom: 0;
}

.empty {
  padding: 12px;
  border: 1px dashed #d7e0da;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  background: #fbfcf9;
}

.version-item {
  position: relative;
  padding: 12px 0 12px 18px;
  border-left: 1px solid #d9e1dc;
}

.version-item::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -5px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--card);
}

.version-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
}

.version-item p {
  margin: 8px 0 10px;
  color: #3c473f;
  font-size: 13px;
  line-height: 1.55;
}

.version-item button {
  min-height: 34px;
  border-color: #e4ebe6;
  background: #f8faf7;
  color: var(--ink);
}

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

.memory-grid div {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid #e5ece7;
  border-radius: 8px;
  background: #fff;
}

.memory-grid strong {
  color: var(--green);
  font-size: 24px;
  line-height: 1;
}

.avatar-row,
.user-card {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  display: block;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #fff 0 18%, transparent 19%),
    radial-gradient(circle at 50% 78%, #fff 0 26%, transparent 27%),
    #8fb5a7;
}

.avatar.large {
  flex-basis: 54px;
  width: 54px;
  height: 54px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  font-size: 22px;
}

.brand-logo-small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(7, 61, 50, 0.16);
}

.brand-logo-large {
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(7, 61, 50, 0.18);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.style-card-list {
  display: grid;
  gap: 10px;
}

.style-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.style-card.active {
  border-color: var(--green);
  background: #f5fbf8;
}

.style-card strong {
  display: block;
  font-size: 14px;
}

.style-card span,
.style-card p,
.analysis-result p,
.analysis-result li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.style-card ul,
.analysis-result ul {
  padding-left: 18px;
  margin: 8px 0 0;
}

.analysis-result {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-hero {
  margin: 0 -14px 0;
  min-height: 248px;
  padding: 0 14px 18px;
  background: var(--green);
  color: #fff;
}

.profile-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-top: 24px;
}

.profile-tabs button {
  min-height: 38px;
  border-color: transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
}

.profile-tabs button.active {
  color: #fff;
  box-shadow: inset 0 -3px 0 #fff;
}

.coming-soon {
  display: grid;
  place-items: center;
  min-height: 176px;
  text-align: center;
}

.logo-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}

.logo-dot::before,
.logo-dot::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.logo-dot::before {
  width: 18px;
  height: 18px;
  border: 3px solid var(--green);
}

.logo-dot::after {
  width: 7px;
  height: 7px;
  background: var(--green);
  transform: translate(8px, -7px);
}

.coming-soon strong {
  font-size: 16px;
}

.coming-soon p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  line-height: 1.6;
}

.world-placeholder .coming-soon p {
  color: var(--muted);
}

.user-panel {
  margin-top: -42px;
}

.user-card {
  justify-content: space-between;
  margin-bottom: 14px;
}

.user-card > div {
  flex: 1;
  min-width: 0;
}

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

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ef;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.mine-list {
  display: grid;
  border-top: 1px solid var(--line);
  margin-bottom: 12px;
}

.mine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

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

.billing-panel {
  background: #fff;
}

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

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

.billing-product {
  grid-template-columns: minmax(0, 1fr);
}

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

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

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

.billing-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.billing-actions .mini-action {
  width: 100%;
}

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

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

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

.order-item .mini-action {
  width: 100%;
}

.debug-panel {
  box-shadow: none;
}

pre {
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #101c18;
  color: #d8efe3;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 430px);
  min-height: 70px;
  transform: translateX(-50%);
  border-top: 1px solid rgba(7, 61, 50, 0.12);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -10px 28px rgba(17, 33, 28, 0.08);
  backdrop-filter: blur(12px);
}

.tab {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 64px;
  padding: 7px 4px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #26372f;
  font-size: 11px;
  font-weight: 800;
}

.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: currentColor;
  font-size: 14px;
}

.tab-icon::before,
.tab-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.tab-write::before {
  width: 13px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.tab-write::after {
  width: 4px;
  height: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(6px, 6px) rotate(45deg);
}

.tab-world::before {
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.tab-books::before {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.tab-books::after {
  width: 5px;
  height: 9px;
  border-left: 2px solid currentColor;
  transform: translateX(-2px);
}

.tab-mine::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-4px);
}

.tab-mine::after {
  width: 14px;
  height: 7px;
  border-radius: 999px 999px 3px 3px;
  background: currentColor;
  transform: translateY(6px);
}

.tab.active {
  color: var(--green);
}

.tab.active .tab-icon {
  background: var(--green);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app {
    min-height: calc(100vh - 48px);
    border-radius: 18px;
    overflow: hidden;
  }

  .device-status {
    position: relative;
  }

  .tabbar {
    border-radius: 0 0 18px 18px;
  }
}

@media (max-width: 360px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

  .screen-header,
  .device-status,
  .profile-hero {
    margin-left: -10px;
    margin-right: -10px;
  }

  h1 {
    font-size: 22px;
  }

  .flow-meta {
    grid-template-columns: 1fr;
  }

  .outline-actions,
  .chapter-actions {
    grid-template-columns: 1fr;
  }
}
