:root {
  color-scheme: dark;
  --bg: #080a0f;
  --bg-soft: #10141d;
  --surface: rgba(18, 22, 31, 0.86);
  --surface-strong: #171d28;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f7fb;
  --muted: #94a3b8;
  --muted-strong: #cbd5e1;
  --accent: #14f1d9;
  --accent-2: #ff6b5f;
  --accent-3: #f8d35b;
  --good: #68e08d;
  --danger: #ff5f7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --max: 1180px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(rgba(20, 241, 217, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 10% 0%, rgba(20, 241, 217, 0.14), transparent 34%),
    linear-gradient(135deg, #080a0f 0%, #121722 48%, #0d1117 100%);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

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

button {
  border: 0;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 15, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(20, 241, 217, 0.44);
  border-radius: 8px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 28px rgba(20, 241, 217, 0.28);
  font-weight: 900;
}

.brand-title {
  display: block;
  font-weight: 820;
  line-height: 1;
}

.brand-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sync-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  white-space: nowrap;
}

.sync-pill::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--accent-3);
  content: "";
}

.sync-pill.is-online::before {
  background: var(--good);
  box-shadow: 0 0 14px rgba(104, 224, 141, 0.72);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 42px 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: 0;
}

.search-box input:focus {
  border-color: rgba(20, 241, 217, 0.7);
  box-shadow: 0 0 0 3px rgba(20, 241, 217, 0.14);
}

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

.icon-button,
.text-button,
.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button {
  width: 38px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.06);
}

.icon-button:hover,
.text-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.text-button,
.ghost-button {
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.06);
}

.primary-button {
  padding: 0 15px;
  color: #061014;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(20, 241, 217, 0.22);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  border: 1px solid rgba(255, 95, 122, 0.35);
  padding: 0 12px;
  color: #ffe4ea;
  background: rgba(255, 95, 122, 0.12);
}

.page-band {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 28px;
  align-items: stretch;
  padding: 42px 0 28px;
}

.hero-copy {
  display: flex;
  min-height: 440px;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 241, 217, 0.28);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent);
  background: rgba(20, 241, 217, 0.08);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.hero h1,
.post-title {
  max-width: 820px;
  margin: 18px 0 14px;
  font-size: clamp(38px, 7vw, 78px);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 18px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
  max-width: 620px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 850;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.hero-visual {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1219;
  box-shadow: var(--shadow);
}

#signalCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-featured {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 8px;
  padding: 16px;
  background: rgba(8, 10, 15, 0.72);
  backdrop-filter: blur(18px);
}

.hero-featured small {
  color: var(--accent-3);
  font-weight: 760;
}

.hero-featured h2 {
  margin: 8px 0 10px;
  font-size: 22px;
  line-height: 1.15;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 26px;
  align-items: start;
  padding: 12px 0 56px;
}

.filter-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.chip.is-active {
  border-color: rgba(20, 241, 217, 0.58);
  color: var(--bg);
  background: var(--accent);
}

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

.post-card,
.side-panel,
.admin-panel,
.metric-card,
.editor-panel,
.post-article,
.comment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22);
}

.post-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.post-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.post-card p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.cover-art {
  position: relative;
  min-height: 188px;
  overflow: hidden;
  background: #111827;
}

.cover-art::before,
.cover-art::after {
  position: absolute;
  content: "";
  inset: 0;
}

.cover-art::before {
  background:
    linear-gradient(120deg, var(--cover-a), transparent 42%),
    linear-gradient(300deg, var(--cover-b), transparent 48%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px);
}

.cover-art::after {
  opacity: 0.54;
  background:
    radial-gradient(circle at 20% 24%, rgba(255, 255, 255, 0.82) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 58%, rgba(255, 255, 255, 0.46) 0 1px, transparent 3px),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.5));
}

.cover-content {
  position: absolute;
  inset: auto 16px 16px 16px;
  z-index: 2;
}

.cover-kicker {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 6px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  font-size: 12px;
  font-weight: 760;
}

.cover-neon {
  --cover-a: rgba(20, 241, 217, 0.88);
  --cover-b: rgba(255, 107, 95, 0.78);
}

.cover-ember {
  --cover-a: rgba(248, 211, 91, 0.88);
  --cover-b: rgba(255, 95, 122, 0.78);
}

.cover-orbit {
  --cover-a: rgba(104, 224, 141, 0.78);
  --cover-b: rgba(77, 171, 247, 0.78);
}

.cover-ink {
  --cover-a: rgba(189, 147, 249, 0.74);
  --cover-b: rgba(20, 241, 217, 0.7);
}

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

.side-panel {
  padding: 16px;
}

.side-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
}

.trend-list,
.taxonomy-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trend-list a,
.taxonomy-list button {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  cursor: pointer;
}

.trend-list a:hover,
.taxonomy-list button:hover {
  border-color: var(--line);
  color: var(--text);
}

.ad-slot {
  display: grid;
  min-height: 110px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(20, 241, 217, 0.36);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted-strong);
  background:
    linear-gradient(135deg, rgba(20, 241, 217, 0.11), rgba(255, 107, 95, 0.08)),
    rgba(255, 255, 255, 0.04);
  text-align: center;
}

.ad-slot strong {
  display: block;
  color: var(--text);
}

.newsletter-form {
  display: grid;
  gap: 10px;
}

.newsletter-form input,
.form-grid input,
.form-grid textarea,
.form-grid select,
.compact-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: 0;
}

.newsletter-form input:focus,
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus,
.compact-input:focus {
  border-color: rgba(20, 241, 217, 0.7);
  box-shadow: 0 0 0 3px rgba(20, 241, 217, 0.13);
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.post-page {
  padding: 34px 0 64px;
}

.post-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 26px;
  align-items: stretch;
}

.post-hero .cover-art {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.post-kicker {
  color: var(--accent);
  font-weight: 780;
}

.post-title {
  margin-top: 12px;
}

.post-deck {
  color: var(--muted-strong);
  font-size: 18px;
  line-height: 1.7;
}

.post-body-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 26px;
  align-items: start;
  margin-top: 24px;
}

.post-article {
  padding: 28px;
}

.post-article h2 {
  margin: 32px 0 12px;
  font-size: 28px;
}

.post-article p,
.post-article li {
  color: #d7dee9;
  font-size: 17px;
  line-height: 1.86;
}

.post-article ul {
  display: grid;
  gap: 8px;
  padding-left: 22px;
}

.toc {
  position: sticky;
  top: 86px;
}

.toc a {
  display: block;
  border-left: 2px solid var(--line);
  padding: 8px 0 8px 12px;
  color: var(--muted-strong);
}

.toc a:hover {
  border-color: var(--accent);
  color: var(--text);
}

.comment-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.comment-card {
  padding: 14px;
}

.comment-card strong {
  display: block;
  margin-bottom: 6px;
}

.admin-page {
  padding: 28px 0 64px;
}

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

.admin-header h1 {
  margin: 0 0 8px;
  font-size: 40px;
  line-height: 1;
}

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

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

.admin-tabs {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.admin-tabs button {
  justify-content: flex-start;
  width: 100%;
}

.admin-tabs button.is-active {
  color: #061014;
  background: var(--accent);
}

.admin-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-title {
  margin-bottom: 10px;
}

.compact-title small {
  color: var(--muted);
}

.panel-title h2 {
  margin: 0;
}

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

.metric-card {
  padding: 16px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
}

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

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

.status-published {
  border-color: rgba(104, 224, 141, 0.44);
  color: #b9ffd1;
  background: rgba(104, 224, 141, 0.12);
}

.status-draft {
  border-color: rgba(248, 211, 91, 0.44);
  color: #ffeeb1;
  background: rgba(248, 211, 91, 0.12);
}

.status-approved {
  border-color: rgba(104, 224, 141, 0.44);
  color: #b9ffd1;
  background: rgba(104, 224, 141, 0.12);
}

.status-pending {
  border-color: rgba(248, 211, 91, 0.44);
  color: #ffeeb1;
  background: rgba(248, 211, 91, 0.12);
}

.status-spam {
  border-color: rgba(255, 95, 122, 0.42);
  color: #ffd6df;
  background: rgba(255, 95, 122, 0.12);
}

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

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

.field label {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 720;
}

.field.full {
  grid-column: 1 / -1;
}

.form-grid textarea {
  min-height: 150px;
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
}

.inline-check input {
  width: 18px;
  height: 18px;
}

.backup-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  margin-top: 18px;
}

.analytics-grid > section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.bar-list,
.analytics-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
}

.bar-row span,
.analytics-row small,
.muted-copy {
  color: var(--muted);
}

.bar-row strong,
.analytics-row b {
  text-align: right;
}

.bar-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.analytics-row strong,
.analytics-row small {
  display: block;
}

.analytics-row small {
  overflow-wrap: anywhere;
  margin-top: 3px;
}

.muted-copy {
  margin: 0;
  line-height: 1.7;
}

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

.media-card {
  display: grid;
  gap: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.media-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.media-card strong,
.media-card small,
.media-card code {
  display: block;
}

.media-card small {
  color: var(--muted);
  margin-top: 3px;
}

.media-card code {
  overflow-wrap: anywhere;
  margin-top: 8px;
  color: #c7f9ff;
  font-size: 11px;
  line-height: 1.5;
}

.revision-panel {
  margin-top: 18px;
}

.code-box {
  overflow: auto;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: #c7f9ff;
  background: #07090d;
  font-size: 12px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(20, 241, 217, 0.34);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(11, 15, 22, 0.92);
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .topbar-inner,
  .hero,
  .content-layout,
  .post-hero,
  .post-body-layout,
  .admin-layout,
  .backup-box {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    gap: 12px;
  }

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

  .hero-copy,
  .hero-visual {
    min-height: 360px;
  }

  .content-layout {
    padding-bottom: 34px;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

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

  .toc,
  .admin-tabs {
    position: static;
  }

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

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

@media (max-width: 720px) {
  .topbar-inner,
  .post-grid,
  .form-grid,
  .metric-grid,
  .hero-stats,
  .admin-tabs {
    grid-template-columns: 1fr;
  }

  .page-band {
    width: min(var(--max), calc(100% - 24px));
  }

  .topbar-inner {
    width: min(var(--max), calc(100% - 24px));
  }

  .hero {
    padding-top: 28px;
  }

  .hero h1,
  .post-title {
    font-size: 42px;
  }

  .post-article {
    padding: 18px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }
}
