:root {
  --bg: #f4f7f9;
  --paper: #ffffff;
  --ink: #111820;
  --muted: #677383;
  --soft: #94a0ad;
  --line: #dfe5ea;
  --line-strong: #b9c6d2;
  --accent: #176f90;
  --accent-2: #9b6b2f;
  --locked: #efe7da;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 111, 144, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 111, 144, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 70px 70px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(244, 247, 249, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  gap: 0;
}

.brand strong {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 1.1;
}

.brand span,
.nav {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 760;
}

.nav {
  display: flex;
  gap: clamp(14px, 3vw, 32px);
}

.shell {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(34px, 6vw, 76px) 0 96px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
  border: 1px solid var(--line);
  padding: clamp(30px, 6vw, 70px);
  background: rgba(255, 255, 255, 0.76);
}

.kicker,
.meta {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(3.2rem, 8vw, 7.2rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.8rem, 3.3vw, 3.4rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.28rem;
  line-height: 1.25;
}

.lead {
  max-width: 680px;
  color: #26313d;
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
  font-weight: 680;
}

.panel,
.episode-card,
.chapter-page,
.paywall,
.character-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.panel {
  padding: clamp(22px, 4vw, 38px);
}

.hero-status {
  display: grid;
  gap: 14px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.status-row strong {
  font-size: 1.4rem;
}

.status-row span {
  color: var(--muted);
  font-weight: 760;
}

.section {
  margin-top: 26px;
}

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

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

.episode-card {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.episode-card.is-paid {
  background: color-mix(in srgb, var(--locked) 72%, white);
}

.episode-card p,
.character-card p,
.paywall p {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line-strong);
  padding: 4px 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 850;
}

.badge.free {
  border-color: rgba(23, 111, 144, 0.36);
  color: var(--accent);
}

.badge.paid {
  border-color: rgba(155, 107, 47, 0.42);
  color: var(--accent-2);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  padding: 0 18px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 860;
}

.button.primary {
  border-color: rgba(23, 111, 144, 0.36);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

.chapter-page {
  display: grid;
  gap: 24px;
  padding: clamp(26px, 5vw, 58px);
}

.chapter-body {
  max-width: 820px;
  color: #1e2935;
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
}

.chapter-body p {
  margin-bottom: 1.15em;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.paywall {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 24px;
  background: color-mix(in srgb, var(--locked) 74%, white);
}

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

.catalog-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.8);
}

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

.character-card {
  padding: 22px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

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

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 780;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

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

.auth-status {
  min-height: 1.6em;
  color: var(--muted);
  font-weight: 760;
}

.auth-status[data-tone="success"] {
  color: var(--accent);
}

.auth-status[data-tone="error"] {
  color: #a33f2f;
}

.account-panel {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.publish-form {
  margin-top: 26px;
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 0;
  min-height: calc(100vh - 72px);
}

.writer-pane {
  padding: clamp(32px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.72);
}

.settings-pane {
  position: sticky;
  top: 72px;
  align-self: start;
  min-height: calc(100vh - 72px);
  border-left: 1px solid var(--line);
  padding: 32px;
  background: rgba(244, 247, 249, 0.96);
}

.admin-topline,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.publish-editor {
  display: grid;
  gap: 18px;
  max-width: 920px;
  margin-top: 28px;
}

.title-input,
.summary-input,
.body-editor,
.publish-editor textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}

.title-input {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  font-weight: 860;
  line-height: 1.05;
}

.summary-input {
  color: var(--muted);
  font-size: 1.28rem;
}

.body-editor {
  min-height: 56vh;
  border: 0;
  color: #1f2a35;
  font-size: 1.2rem;
  line-height: 1.9;
  resize: vertical;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-block: 1px solid var(--line);
  padding: 10px 0;
  color: var(--muted);
}

.editor-toolbar button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.editor-toolbar span {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.author-note-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.author-note-block h2,
.settings-card h2 {
  font-size: 1.15rem;
}

.settings-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  margin-bottom: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.86);
}

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

.compact-head h2 {
  margin-bottom: 0;
}

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

.draft-item {
  display: grid;
  justify-items: start;
  min-height: auto;
  border-color: var(--line);
  padding: 10px 12px;
  text-align: left;
}

.draft-item span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.publish-confirm {
  display: grid;
  gap: 4px;
}

.structure-dialog {
  width: min(760px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.structure-dialog::backdrop {
  background: rgba(17, 24, 32, 0.32);
}

.structure-form {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.settings-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 780;
}

.settings-card input,
.settings-card select {
  width: 100%;
  border: 1px solid var(--line-strong);
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.toggle-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
}

.toggle-row input {
  width: 22px;
  height: 22px;
}

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

.footer {
  border-top: 1px solid var(--line);
  padding: 30px 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .hero,
  .grid,
  .character-grid,
  .auth-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
  }

  .catalog-row {
    grid-template-columns: 1fr;
  }

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

  .settings-pane {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
