:root {
  --ink: #101419;
  --ink-soft: #27303a;
  --muted: #5f6977;
  --paper: #f7f4ed;
  --surface: #ffffff;
  --surface-soft: #f4f0e8;
  --surface-strong: #fcfbf7;
  --line: #d8d1c5;
  --line-strong: #b9ab99;
  --accent: #b91f4e;
  --accent-dark: #8f173b;
  --teal: #0b756b;
  --blue: #275f8c;
  --amber: #a85d13;
  --success: #167451;
  --danger: #b42318;
  --shadow: 0 20px 46px rgba(28, 24, 18, .12);
  --shadow-soft: 0 10px 26px rgba(28, 24, 18, .08);
  --shadow-lift: 0 26px 60px rgba(28, 24, 18, .16);
  --focus: rgba(39, 95, 140, .42);
  --radius: 8px;
  --space-1: .35rem;
  --space-2: .6rem;
  --space-3: .9rem;
  --space-4: 1.2rem;
  --space-5: 1.6rem;
  --space-6: 2.1rem;
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(16, 20, 25, .045) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, #fbf9f3 0, var(--paper) 42%, #eef3f2 100%);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body[data-page="admin"] {
  background:
    linear-gradient(90deg, rgba(39, 95, 140, .055) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, #f8f7f2 0, #eef2f4 100%);
}

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

button,
a,
summary,
label[for],
.story-card,
.pending-card,
.draft-row {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: .75rem;
  z-index: 20;
  transform: translateY(-150%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: .65rem .85rem;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .62rem 1rem;
  background: linear-gradient(180deg, #171c22 0%, var(--ink) 100%);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(16, 20, 25, .13);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.button:hover {
  background: var(--ink-soft);
  box-shadow: 0 16px 30px rgba(16, 20, 25, .18);
  transform: translateY(-1px);
}

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

.button.secondary {
  border-color: rgba(16, 20, 25, .14);
  background: rgba(255, 255, 255, .78);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(28, 24, 18, .06);
}

.button.secondary:hover {
  border-color: var(--ink);
  background: #fff;
}

.button.accent {
  background: linear-gradient(180deg, #cf2b5d 0%, var(--accent) 100%);
}

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

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.button.danger {
  background: var(--danger);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(16, 20, 25, .12);
  padding: .22rem .62rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, .64);
}

.badge.world {
  color: #1f4f7a;
  border-color: rgba(47, 111, 159, .28);
  background: rgba(47, 111, 159, .08);
}

.badge.economy {
  color: #8a4307;
  border-color: rgba(180, 83, 9, .28);
  background: rgba(180, 83, 9, .09);
}

.badge.ai {
  color: #0b665f;
  border-color: rgba(15, 118, 110, .28);
  background: rgba(15, 118, 110, .09);
}

.badge.video {
  color: #981744;
  border-color: rgba(194, 31, 90, .28);
  background: rgba(194, 31, 90, .08);
}

.status-line {
  min-height: 1.5rem;
  color: var(--muted);
  font-size: .92rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  max-width: min(380px, calc(100vw - 2rem));
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  padding: .8rem 1rem;
  color: var(--ink);
}

.empty-state {
  border: 1px dashed #bfb6a9;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .7);
  padding: var(--space-5);
  color: var(--muted);
}

.public-header {
  border-bottom: 1px solid rgba(16, 20, 25, .08);
  background: rgba(250, 248, 242, .9);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 10px 28px rgba(28, 24, 18, .05);
  backdrop-filter: blur(18px);
}

.public-header__inner,
.admin-header__inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .78rem;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .18), transparent 42%),
    linear-gradient(180deg, #202832, var(--ink));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(16, 20, 25, .22);
}

.brand-text {
  display: grid;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand-text small {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.public-nav,
.filter-row,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.filter-button,
.tab-button {
  min-height: 40px;
  border: 1px solid rgba(16, 20, 25, .13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
  padding: .48rem .82rem;
  font-weight: 800;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

.filter-button:hover,
.tab-button:hover {
  border-color: rgba(16, 20, 25, .34);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.filter-button[aria-pressed="true"],
.tab-button[aria-selected="true"] {
  border-color: var(--ink);
  background: linear-gradient(180deg, #202832, var(--ink));
  color: #fff;
  box-shadow: 0 12px 28px rgba(16, 20, 25, .14);
}

.search-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 240px;
  border: 1px solid rgba(16, 20, 25, .13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .76);
  padding: .25rem .75rem;
  box-shadow: 0 8px 20px rgba(28, 24, 18, .05);
}

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

.public-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: var(--space-5);
  padding-block: var(--space-5) 3rem;
}

.lead-story {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  overflow: hidden;
  border: 1px solid rgba(16, 20, 25, .1);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .9)),
    var(--surface);
  box-shadow: var(--shadow-lift);
}

.lead-story__content {
  display: grid;
  align-content: center;
  padding: 2rem;
}

.lead-story h1,
.story-detail h1 {
  margin: .65rem 0 .75rem;
  font-family: Georgia, "Times New Roman", "SimSun", serif;
  font-size: 2.15rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.lead-story p,
.story-card p,
.story-detail p {
  color: var(--muted);
}

.lead-story__image,
.story-image {
  min-height: 310px;
  background: var(--surface-soft);
}

.lead-story__image img,
.story-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.story-card {
  display: grid;
  gap: var(--space-3);
  min-height: 100%;
  border: 1px solid rgba(16, 20, 25, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  padding: var(--space-4);
  box-shadow: var(--shadow-soft);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}

.story-card:hover,
.pending-card:hover,
.draft-row:hover {
  border-color: rgba(17, 19, 22, .38);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  background: #fff;
}

.story-card h2,
.pending-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "SimSun", serif;
  font-size: 1.26rem;
  line-height: 1.28;
}

.story-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  color: var(--muted);
  font-size: .9rem;
}

.public-aside {
  display: grid;
  gap: var(--space-4);
  align-self: start;
  position: sticky;
  top: 92px;
}

.aside-panel,
.story-detail,
.admin-panel,
.editor-panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow-soft);
}

.aside-panel {
  padding: var(--space-4);
}

.aside-panel h2,
.admin-section-title,
.editor-panel h2,
.login-panel h1 {
  margin: 0 0 .7rem;
  font-size: 1.08rem;
  line-height: 1.3;
}

.metric-list {
  display: grid;
  gap: .78rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(16, 20, 25, .09);
  padding-bottom: .55rem;
}

.metric-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.story-detail {
  margin-top: var(--space-5);
  overflow: hidden;
}

.story-detail__body {
  padding: var(--space-5);
}

.article-body {
  display: grid;
  gap: var(--space-3);
}

.article-body p {
  margin: 0;
}

.source-list {
  margin: .75rem 0 0;
  padding-left: 1.1rem;
}

.source-list a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.admin-header {
  border-bottom: 1px solid rgba(16, 20, 25, .08);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 10px 26px rgba(28, 24, 18, .05);
  backdrop-filter: blur(18px);
}

.admin-shell {
  min-height: 100vh;
}

.login-wrap {
  display: grid;
  min-height: calc(100vh - 72px);
  place-items: center;
  padding: 3rem 1rem;
}

.login-panel {
  width: min(100%, 460px);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.form-stack {
  display: grid;
  gap: var(--space-3);
}

.field {
  display: grid;
  gap: .35rem;
}

.field label {
  color: var(--ink);
  font-weight: 800;
  font-size: .92rem;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #c8bfb2;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: .72rem .82rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(39, 95, 140, .11);
  outline: 0;
}

.field textarea {
  min-height: 160px;
  resize: vertical;
}

.field-help {
  color: var(--muted);
  font-size: .86rem;
}

.admin-main {
  display: grid;
  gap: var(--space-4);
  padding-block: var(--space-5) 3rem;
}

.admin-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-4);
}

.admin-topline h1 {
  margin: 0;
  font-size: 1.72rem;
  letter-spacing: 0;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.metric-card {
  border: 1px solid rgba(16, 20, 25, .1);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .78));
  padding: var(--space-4);
  box-shadow: var(--shadow-soft);
}

.metric-card strong {
  display: block;
  margin-top: .15rem;
  font-size: 1.65rem;
  line-height: 1.1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, .86fr) minmax(0, 1.14fr);
  gap: var(--space-4);
}

.admin-panel,
.editor-panel {
  min-width: 0;
  padding: var(--space-4);
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pending-list,
.draft-list,
.published-list {
  display: grid;
  gap: var(--space-3);
}

.pending-card,
.draft-row,
.published-row {
  border: 1px solid rgba(16, 20, 25, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .84);
  padding: var(--space-4);
  box-shadow: var(--shadow-soft);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}

.pending-card {
  display: grid;
  gap: var(--space-3);
}

.draft-row,
.published-row {
  display: grid;
  gap: .5rem;
}

.draft-row[aria-current="true"] {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal), var(--shadow-soft);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: var(--space-4);
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: 1rem;
}

.upload-box {
  display: grid;
  gap: var(--space-3);
  border: 1px dashed #b8aea0;
  border-radius: var(--radius);
  background: rgba(252, 251, 247, .8);
  padding: var(--space-4);
}

.upload-box.is-dragover {
  border-color: var(--blue);
  background: rgba(47, 111, 159, .08);
}

.image-preview {
  display: grid;
  min-height: 190px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(39, 95, 140, .08), rgba(185, 31, 78, .06)),
    var(--surface-soft);
}

.image-preview img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
}

.preview-card {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(16, 20, 25, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-soft);
}

.preview-card__body {
  padding: var(--space-4);
}

.preview-card h3 {
  margin: .4rem 0;
  font-family: Georgia, "Times New Roman", "SimSun", serif;
  font-size: 1.35rem;
  line-height: 1.25;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-input {
  min-height: 42px;
  border: 1px solid #cbd2dc;
  border-radius: var(--radius);
  background: #fff;
  padding: .45rem;
}

.file-input::file-selector-button {
  min-height: 32px;
  margin-right: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1040px) {
  .public-header__inner,
  .admin-header__inner {
    align-items: flex-start;
    flex-direction: column;
    padding-block: var(--space-3);
  }

  .public-main,
  .workspace-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .public-aside {
    order: -1;
    position: static;
  }

  .lead-story {
    grid-template-columns: 1fr;
  }

  .lead-story__image {
    min-height: 260px;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 1rem, var(--container));
  }

  .lead-story,
  .story-grid,
  .admin-metrics,
  .admin-topline {
    grid-template-columns: 1fr;
  }

  .lead-story h1,
  .story-detail h1 {
    font-size: 1.55rem;
  }

  .lead-story__content,
  .story-detail__body,
  .login-panel,
  .admin-panel,
  .editor-panel,
  .aside-panel,
  .metric-card,
  .pending-card,
  .draft-row,
  .published-row,
  .story-card,
  .preview-card__body {
    padding: var(--space-3);
  }

  .public-main,
  .admin-main {
    padding-block: var(--space-3) var(--space-5);
  }

  .search-field {
    width: 100%;
    min-width: 0;
  }

  .public-nav,
  .admin-tabs,
  .filter-row,
  .editor-actions,
  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-button,
  .tab-button,
  .button {
    width: 100%;
  }

  .lead-story__image,
  .story-image {
    min-height: 220px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }
}

.text-only-lead {
  grid-template-columns: 1fr;
}

.text-only-lead .lead-story__content {
  min-height: 310px;
  max-width: 860px;
}

.text-only-detail .story-detail__body,
.text-only-preview .preview-card__body {
  max-width: 900px;
}

.article-deck {
  font-size: 1.05rem;
  line-height: 1.75;
}

.compact-note {
  padding: var(--space-3);
}

.compact-note h3 {
  margin: 0 0 .5rem;
  font-size: 1rem;
}

.dedupe-note {
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text-soft);
  line-height: 1.65;
}

.duplicate-flag {
  display: inline-flex;
  width: fit-content;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(202, 138, 4, .12);
  color: #a16207;
  font-size: .78rem;
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: .62;
}

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