:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --panel: #17191f;
  --panel-soft: #20232c;
  --text: #f4f5f7;
  --muted: #a6adbb;
  --line: #2d323d;
  --accent: #66e3c4;
  --green: #20c970;
  --red: #ee5b5b;
  --violet: #a774ff;
  --question: #d8dce7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(12, 13, 16, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 19px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  letter-spacing: 0;
}

.search-wrap {
  flex: 1;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 227, 196, 0.14);
}

.back-link {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.nav-links .back-link {
  margin-left: 0;
}

.back-link:hover {
  color: var(--text);
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 22px;
  align-items: end;
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

.intro-copy {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 22px;
}

.filter {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.filter:hover,
.filter.active {
  border-color: var(--accent);
  color: var(--text);
}

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

.card {
  position: relative;
  min-height: 342px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 18px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
}

.card-thumb {
  display: block;
  width: calc(100% + 36px);
  height: 154px;
  margin: 0 -18px;
  object-fit: cover;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.placeholder-thumb {
  display: grid;
  place-items: center;
  color: rgba(244, 245, 247, 0.9);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.placeholder-thumb span {
  padding: 8px 11px;
  border: 1px solid rgba(244, 245, 247, 0.18);
  border-radius: 8px;
  background: rgba(12, 13, 16, 0.32);
}

.placeholder-jobs {
  background: linear-gradient(135deg, #233142, #3a6ea5);
}

.placeholder-healthcare {
  background: linear-gradient(135deg, #153b3f, #2f8f83);
}

.placeholder-education {
  background: linear-gradient(135deg, #33284e, #7f5af0);
}

.placeholder-entertainment {
  background: linear-gradient(135deg, #3b2142, #d65a8a);
}

.placeholder-fraud {
  background: linear-gradient(135deg, #421f2b, #c44545);
}

.placeholder-environment {
  background: linear-gradient(135deg, #1f3d31, #6fae4f);
}

.placeholder-policy {
  background: linear-gradient(135deg, #2a3140, #8892b0);
}

.placeholder-ai {
  background: linear-gradient(135deg, #20232c, #66e3c4);
}

.card:hover,
.card:focus-visible {
  border-color: rgba(102, 227, 196, 0.7);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.sentiment {
  color: #08100d;
}

.tag.great {
  background: var(--green);
}

.tag.terrible {
  background: var(--red);
  color: #170606;
}

.tag.strange {
  background: var(--violet);
  color: #10081d;
}

.tag.soon {
  background: var(--question);
  color: #11141a;
}

.date {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.card h2 {
  margin: auto 0 0;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

.summary-hover {
  position: absolute;
  inset: auto 0 0;
  padding: 16px 18px;
  background: rgba(12, 13, 16, 0.94);
  border-top: 1px solid var(--line);
  color: var(--text);
  line-height: 1.5;
  transform: translateY(100%);
  transition: transform 160ms ease;
}

.card:hover .summary-hover,
.card:focus-visible .summary-hover {
  transform: translateY(0);
}

.empty {
  color: var(--muted);
  margin: 28px 0 0;
}

.notice {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.notice h2 {
  margin: 0 0 8px;
}

.notice p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-shell {
  width: min(880px, calc(100% - 32px));
}

.story-detail {
  padding-top: 18px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.story-detail h1 {
  margin-bottom: 24px;
}

.detail-block {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.detail-block h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--accent);
  text-transform: uppercase;
}

.detail-block p {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}

.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.source-link:hover {
  border-color: var(--accent);
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
}

.admin-intro h1 {
  font-size: clamp(34px, 5vw, 58px);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.admin-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.admin-panel label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-panel input,
.admin-panel select,
.admin-panel textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #111319;
  color: var(--text);
  font: inherit;
}

.admin-panel textarea {
  min-height: 96px;
  resize: vertical;
}

.admin-panel input:focus,
.admin-panel select:focus,
.admin-panel textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 227, 196, 0.14);
}

.primary-button,
.secondary-button,
.admin-story button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: #06110e;
  border-color: var(--accent);
}

.secondary-button,
.admin-story button {
  background: var(--panel-soft);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.story-list-panel {
  margin-top: 18px;
}

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

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

.admin-story strong,
.admin-story span {
  display: block;
}

.admin-story strong {
  line-height: 1.35;
}

.admin-story span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .intro,
  .story-grid,
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .intro {
    align-items: start;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .back-link {
    margin-left: 0;
  }

  .intro,
  .story-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 318px;
  }
}
