:root {
  --bg: #f6f2eb;
  --panel: #fffdfa;
  --panel-soft: #f2ebe1;
  --panel-muted: #f8f5ef;
  --text: #241d16;
  --muted: #726657;
  --line: #ded3c4;
  --line-strong: #c7b39b;
  --accent: #8f5b35;
  --accent-strong: #744724;
  --accent-soft: #ebdccd;
  --success-soft: #edf3ea;
  --danger-soft: #f7e7e4;
  --shadow-soft: 0 8px 24px rgba(54, 36, 21, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.9), rgba(246, 242, 235, 1)),
    var(--bg);
  color: var(--text);
  font: 16px/1.72 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin-top: 0; }

.shell {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(36, 29, 22, 0.08);
  background: rgba(246, 242, 235, 0.92);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 18px;
}

.site-nav a {
  color: var(--muted);
  font-weight: 600;
}

.page { padding: 42px 0 72px; }
.public-page { padding-top: 44px; }
.auth-page { min-height: 100vh; }

.muted,
.summary,
.hero p,
.compact-text { color: var(--muted); }

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.sidebar-card,
.article-card,
.article-detail,
.panel-card,
.auth-card {
  padding: 22px;
}

.minimal-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.8);
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 260px;
  gap: 36px;
  align-items: start;
  margin-bottom: 42px;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy h1 {
  margin-bottom: 16px;
  font-size: 54px;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.hero-lead {
  max-width: 700px;
  font-size: 18px;
}

.hero-actions,
.topbar-actions,
.editor-actions,
.filter-actions,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-aside {
  display: grid;
  gap: 12px;
}

.metric-tile {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.72);
}

.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.layout,
.admin-grid,
.editor-layout,
.article-shell {
  display: grid;
  gap: 30px;
}

.layout { grid-template-columns: minmax(0, 1fr) 300px; }
.home-layout-balanced { grid-template-columns: minmax(0, 1.18fr) 300px; }
.admin-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.82fr); }
.editor-layout { grid-template-columns: minmax(0, 1.48fr) 320px; align-items: start; }
.article-shell { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }

.content-column,
.sidebar-column,
.editor-main,
.editor-side {
  min-width: 0;
}

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

.section-head-tight { margin-top: 22px; }

.section-head h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.featured-post-card {
  margin-bottom: 18px;
  padding: 26px 0 30px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.featured-post-meta,
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.featured-post-card h2 {
  margin-bottom: 12px;
  font-size: 38px;
  line-height: 1.08;
}

.featured-post-card p {
  max-width: 760px;
  margin-bottom: 16px;
}

.featured-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.library-tools { display: flex; align-items: center; gap: 12px; }
.library-search { width: min(320px, 100%); }

.topic-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.topic-chip,
.pill-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.topic-chip.active,
.pill-link.active {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--accent-strong);
}

.library-feedback {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.post-list {
  display: grid;
  gap: 0;
}

.article-list-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.article-list-item:first-child { border-top: 1px solid var(--line); }

.article-list-item h3 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.16;
}

.article-list-item p {
  max-width: 760px;
  margin-bottom: 0;
}

.public-sidebar,
.admin-side-stack {
  display: grid;
  gap: 18px;
}

.sidebar-card h3 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.2;
}

.simple-list,
.ranking-list,
.category-grid {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.simple-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ranking-list li,
.category-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
}

.rank-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.article-detail {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.article-detail-flow h1 {
  margin-bottom: 14px;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.article-detail-flow .summary {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: 19px;
}

.article-actions {
  margin-bottom: 26px;
}

.markdown-body {
  max-width: 760px;
  font-size: 17px;
  line-height: 1.9;
}

.markdown-body h2,
.markdown-body h3 {
  margin-top: 1.9em;
  margin-bottom: 0.65em;
  line-height: 1.25;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
  margin-bottom: 1.1em;
}

.markdown-body pre,
.markdown-body code {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-muted);
}

.markdown-body blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.button-link,
button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button:hover,
.button-link:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

button,
.button-link {
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #b14a32;
  color: #fff;
}

.danger-button:hover {
  background: #983d28;
}

.full-width { width: 100%; }

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input,
select {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  padding: 14px 15px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 18px;
  font-weight: 700;
}

.field-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.editor-field-shell {
  margin-bottom: 18px;
}

.editor-section-head {
  margin-bottom: 10px;
}

.editor-block-label {
  display: block;
  margin: 0;
}

.summary-editor {
  min-height: 132px;
  margin-top: 8px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  white-space: pre-wrap;
  line-height: 1.75;
  outline: none;
}

.summary-editor:empty::before {
  content: attr(data-placeholder);
  color: #9d8f7f;
}

.summary-editor:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(143, 91, 53, 0.08);
}

.markdown-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.editor-inline-error {
  margin: 4px 0 0;
  color: #a1452e;
  font-size: 14px;
  font-weight: 600;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.flash-success { background: var(--success-soft); }
.flash-danger { background: var(--danger-soft); }

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 32px;
  width: min(980px, 100%);
}

.auth-copy {
  padding: 36px 6px;
}

.auth-copy h1 {
  margin-bottom: 14px;
  font-size: 48px;
  line-height: 1.06;
}

.auth-card h2 {
  margin-bottom: 18px;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #f1eadf;
}

.brand-admin {
  display: inline-block;
  margin-bottom: 6px;
}

.admin-brand p {
  margin: 0;
  color: var(--muted);
}

.admin-nav {
  display: grid;
  gap: 10px;
  margin: 28px 0;
}

.admin-nav-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text);
}

.admin-nav-link span,
.admin-nav-link small {
  display: block;
}

.admin-nav-link small {
  color: var(--muted);
}

.admin-nav-link.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.65);
}

.sidebar-panel {
  padding: 18px;
  border: 1px solid rgba(125, 84, 47, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.sidebar-panel h3 { margin-bottom: 8px; }

.admin-main {
  padding: 28px;
}

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

.admin-topbar h1 {
  margin-bottom: 0;
  font-size: 34px;
}

.admin-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 26px;
}

.admin-hero h2 {
  margin-bottom: 0;
  max-width: 720px;
  font-size: 28px;
  line-height: 1.15;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.stats-grid-admin {
  margin-bottom: 22px;
}

.stat-card {
  padding: 20px;
}

.stat-card span,
.stat-card small {
  display: block;
}

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

.stat-card strong {
  display: block;
  margin: 6px 0;
  font-size: 34px;
}

.stat-card small { color: var(--muted); }

.accent-card {
  background: #fbf3eb;
}

.panel-card {
  padding: 24px;
}

.side-panel-compact {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table tr:last-child td { border-bottom: 0; }

.status-pill,
.metric-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
}

.status-draft { background: #f7efe2; }
.status-published { background: #eef5ec; }

.search-box { flex: 1 1 320px; }

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sticky-panel {
  position: sticky;
  top: 24px;
}

.editor-main-clean textarea[name="content_md"] {
  min-height: 560px;
}

.editor-metrics {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

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

.metric-row:last-child { border-bottom: 0; }

.preview-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-muted);
}

.preview-card h4 {
  margin: 14px 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.toastui-editor-defaultUI {
  border: 0 !important;
}

.toastui-editor-defaultUI-toolbar {
  border-bottom-color: var(--line) !important;
  background: #fbf8f3 !important;
}

.toastui-editor-toolbar-icons {
  border-radius: 8px;
}

.toastui-editor-main,
.toastui-editor-md-container,
.toastui-editor-ww-container {
  background: #fff !important;
}

.toastui-editor-contents {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif !important;
  line-height: 1.8;
}

.toastui-editor-md-tab-container,
.toastui-editor-mode-switch {
  background: #fbf8f3 !important;
  border-top-color: var(--line) !important;
}

.stack-form { display: grid; }

.category-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.quick-links { display: grid; gap: 10px; }

.quick-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.empty-state {
  padding: 24px 0;
  color: var(--muted);
}

.hidden { display: none !important; }

.reveal-card {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.reveal-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.journal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 320px;
  gap: 34px;
  align-items: start;
  padding: 12px 0 34px;
  border-bottom: 1px solid rgba(36, 29, 22, 0.14);
}

.journal-hero-main h1 {
  max-width: 860px;
  margin-bottom: 18px;
  font-size: clamp(48px, 8vw, 88px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.journal-lead {
  max-width: 700px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 18px;
}

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

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

.journal-note,
.side-column-block {
  padding: 20px 0;
  border-top: 1px solid rgba(36, 29, 22, 0.14);
}

.journal-note:first-child,
.side-column-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.journal-note-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.journal-note p,
.side-column-block p {
  margin-bottom: 0;
  color: var(--muted);
}

.journal-stats {
  display: grid;
  gap: 0;
}

.journal-stat {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid rgba(36, 29, 22, 0.14);
}

.journal-stat span {
  color: var(--muted);
  font-size: 14px;
}

.journal-stat strong {
  font-size: 30px;
  line-height: 1;
}

.signal-strip {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 22px;
  padding: 24px 0 26px;
  border-bottom: 1px solid rgba(36, 29, 22, 0.14);
}

.signal-strip-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.signal-strip-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.signal-index {
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
}

.signal-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.signal-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(36, 29, 22, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 310px;
  gap: 38px;
  padding-top: 30px;
}

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

.lead-story {
  padding: 0 0 28px;
  border-bottom: 1px solid rgba(36, 29, 22, 0.14);
}

.lead-story-meta,
.story-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.lead-story-kicker {
  color: var(--accent-strong);
  font-weight: 700;
}

.lead-story h2 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lead-story p {
  max-width: 760px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 18px;
}

.library-shell {
  padding-top: 22px;
}

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

.library-bar h2 {
  margin-bottom: 0;
  font-size: 32px;
}

.story-list {
  display: grid;
  gap: 0;
}

.story-list-item {
  padding: 22px 0 24px;
  border-top: 1px solid rgba(36, 29, 22, 0.14);
}

.story-list-item:last-child {
  border-bottom: 1px solid rgba(36, 29, 22, 0.14);
}

.story-list-item h3 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.story-list-item p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.editorial-side {
  display: grid;
  gap: 0;
}

.side-column-block h3 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.18;
}

.side-column-block .panel-head {
  margin-bottom: 14px;
}

.side-column-block .simple-list li,
.side-column-block .ranking-list li {
  padding: 8px 0;
}

.side-column-block .ranking-list li {
  grid-template-columns: 28px 1fr;
}

@media (max-width: 1080px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .public-hero,
  .journal-hero,
  .signal-strip,
  .editorial-grid,
  .layout,
  .home-layout-balanced,
  .admin-grid,
  .editor-layout,
  .article-shell,
  .stats-grid,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .hero-aside {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signal-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(1120px, calc(100vw - 28px));
  }

  .header-inner,
  .section-head,
  .admin-topbar,
  .admin-hero,
  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-copy h1,
  .journal-hero-main h1,
  .article-detail-flow h1,
  .auth-copy h1 {
    font-size: 36px;
  }

  .hero-aside {
    grid-template-columns: 1fr;
  }

  .library-bar,
  .signal-strip-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-main { padding: 20px; }
  .table { display: block; overflow-x: auto; }
}
