:root {
  color-scheme: dark;
  --bg: #070b0f;
  --panel: #0c1318;
  --panel-2: #101a21;
  --panel-3: #152029;
  --line: rgba(140, 165, 150, 0.18);
  --line-strong: rgba(82, 220, 132, 0.38);
  --text: #eef5ef;
  --muted: #9db0a4;
  --dim: #6f8277;
  --accent: #53d781;
  --accent-2: #9fe7b6;
  --warning: #f0c674;
  --danger: #ff8a8a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --sidebar: 288px;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(83, 215, 129, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 215, 129, 0.026) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(83, 215, 129, 0.12), transparent 34rem),
    #070b0f;
  background-size: 40px 40px, 40px 40px, auto, auto;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

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

.auth-panel {
  width: min(100%, 480px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 19, 24, 0.92);
  box-shadow: var(--shadow);
  padding: 28px;
}

.sigil-frame {
  width: 104px;
  height: 104px;
  padding: 10px;
  margin-bottom: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #09110d;
}

.sigil-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 740;
  line-height: 1.14;
  letter-spacing: 0;
}

.auth-panel h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

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

.auth-panel .muted {
  margin: 14px 0 0;
  line-height: 1.65;
}

.auth-form {
  margin-top: 28px;
}

.auth-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.auth-row input,
.auth-form > input,
.auth-form select,
.auth-form textarea,
.search-box input,
.term-filter,
.editor-form input,
.editor-form select,
.editor-form textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #071016;
  color: var(--text);
  outline: none;
}

.auth-row input {
  height: 46px;
  padding: 0 14px;
}

.auth-row input:focus,
.auth-form > input:focus,
.auth-form select:focus,
.auth-form textarea:focus,
.search-box input:focus,
.term-filter:focus,
.editor-form input:focus,
.editor-form select:focus,
.editor-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 215, 129, 0.12);
}

.auth-row button,
.auth-form > button,
.top-action,
.mobile-toggle {
  border-radius: var(--radius);
  background: var(--accent);
  color: #06100a;
  font-weight: 760;
}

.auth-row button {
  height: 46px;
  padding: 0 18px;
}

.auth-form > input,
.auth-form select {
  width: 100%;
  height: 46px;
  margin-bottom: 14px;
  padding: 0 14px;
}

.auth-form > button,
.auth-wide-button {
  min-height: 46px;
  padding: 0 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 24px;
}

.auth-tabs button,
.ghost-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-weight: 720;
}

.auth-tabs button.active,
.ghost-action:hover {
  border-color: var(--line-strong);
  color: var(--accent-2);
  background: rgba(83, 215, 129, 0.08);
}

.auth-error {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-width: 0;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(7, 11, 15, 0.92);
  overflow-y: auto;
}

.sidebar-inner {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.78rem;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.93rem;
}

.nav-link:hover {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.nav-link.active {
  border-color: var(--line-strong);
  color: var(--accent-2);
  background: rgba(83, 215, 129, 0.08);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.main {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) max-content;
  gap: 12px;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 15, 0.9);
  padding: 12px 28px;
  backdrop-filter: blur(16px);
}

.mobile-toggle {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  background: var(--panel-3);
  color: var(--text);
}

.search-wrap {
  position: relative;
  min-width: 0;
}

.search-box {
  position: relative;
  min-width: 0;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 42px;
}

.search-box::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--dim);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.search-box::after {
  position: absolute;
  z-index: 1;
  top: 26px;
  left: 27px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--dim);
  content: "";
  transform: rotate(45deg);
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  display: none;
  max-height: min(62vh, 620px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 16, 21, 0.98);
  box-shadow: var(--shadow);
}

.search-results.open {
  display: block;
}

.search-result {
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-2);
}

.search-result span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.top-action {
  height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
}

.user-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.notification-button span:not(:empty) {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  border-radius: 999px;
  background: #06100a;
  color: var(--accent-2);
  font-size: 0.76rem;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 28px;
  display: none;
  width: min(420px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 16, 21, 0.98);
  box-shadow: var(--shadow);
  padding: 12px;
}

.notification-panel.open {
  display: grid;
  gap: 10px;
}

.notification-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.notification-item span,
.notification-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

.notification-item select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #071016;
  color: var(--text);
  padding: 0 10px;
}

.notification-actions {
  display: flex;
  gap: 8px;
}

.content {
  width: min(100%, 1180px);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0 auto;
  padding: 34px 28px 60px;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 280px);
  gap: 28px;
  align-items: end;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.page-head > * {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.page-title {
  font-size: clamp(2rem, 4vw, 4.25rem);
}

.page-lead {
  width: 100%;
  max-width: min(100%, 820px);
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.72;
  overflow-wrap: break-word;
  word-break: normal;
}

.hero-media {
  overflow: hidden;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08110e;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: 10px;
}

.hero-media figcaption {
  border-top: 1px solid var(--line);
  padding: 8px 10px 10px;
  color: var(--dim);
  font-size: 0.82rem;
  text-align: center;
}

.section-block {
  min-width: 0;
  margin-top: 32px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title-row h2 {
  font-size: 1.25rem;
}

.source-label,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--dim);
  font-size: 0.78rem;
}

.status-pill {
  color: var(--warning);
}

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

.quick-link,
.entity-card,
.timeline-card,
.term-card,
.article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 19, 24, 0.76);
  overflow-wrap: break-word;
  word-break: normal;
}

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

.meta-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 19, 24, 0.76);
  padding: 14px 16px;
}

.meta-card small {
  display: block;
  margin-bottom: 8px;
  color: var(--dim);
  font-size: 0.78rem;
}

.meta-card strong {
  display: block;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.quick-link {
  min-height: 72px;
  padding: 16px;
}

.quick-link span {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-2);
  font-weight: 740;
}

.quick-link small {
  color: var(--dim);
  line-height: 1.45;
}

.entity-card {
  display: grid;
  overflow: hidden;
  min-height: 210px;
}

.entity-card.has-image {
  grid-template-rows: 150px 1fr;
}

.entity-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.entity-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.entity-card h3 {
  font-size: 1.02rem;
}

.entity-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.entity-card .source-link {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 720;
}

.entity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.entity-actions .source-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
}

.entity-actions .primary-source-link {
  border-color: var(--line-strong);
  color: #06100a;
  background: var(--accent);
}

.entity-actions .archive-source-link {
  color: var(--accent-2);
  background: rgba(83, 215, 129, 0.08);
}

.article {
  padding: 24px;
  line-height: 1.72;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.article-nav-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  color: #06100a;
  background: var(--accent);
  font-size: 0.88rem;
  font-weight: 760;
}

.article-nav-link.secondary {
  border-color: var(--line);
  color: var(--accent-2);
  background: rgba(83, 215, 129, 0.08);
}

.article + .article {
  margin-top: 18px;
}

.article h2 {
  margin: 0 0 18px;
  color: var(--accent-2);
  font-size: 1.45rem;
}

.article-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.article-heading h2 {
  margin: 0;
}

.article-edit-button {
  flex: 0 0 auto;
  padding: 0 12px;
}

.article-toc {
  display: grid;
  gap: 10px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 16, 22, 0.68);
  padding: 14px 16px;
}

.article-toc strong {
  color: var(--accent-2);
  font-size: 0.92rem;
}

.article-toc div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-toc a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.article-toc a:hover {
  border-color: var(--line-strong);
  color: var(--accent-2);
}

.article-toc a.nested {
  color: var(--dim);
}

.article h3 {
  margin: 24px 0 10px;
  color: var(--text);
  font-size: 1.16rem;
}

.article h4 {
  margin: 20px 0 8px;
  color: var(--text);
}

.article p {
  margin: 0 0 14px;
  color: #dce7df;
}

.article ul,
.article ol {
  margin: 0 0 16px 1.25rem;
  padding: 0;
  color: #dce7df;
}

.article li {
  margin: 6px 0;
}

.article strong {
  color: #f6fff8;
}

.article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.timeline-list {
  display: grid;
  gap: 12px;
}

.timeline-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.timeline-date {
  color: var(--accent-2);
  font-size: 1.05rem;
  font-weight: 800;
}

.timeline-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.timeline-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.term-filter {
  width: min(100%, 520px);
  height: 42px;
  margin-bottom: 16px;
  padding: 0 14px;
}

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

.term-card {
  padding: 16px;
}

.term-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.term-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.term-card small {
  display: block;
  margin-top: 10px;
  color: var(--dim);
  font-size: 0.8rem;
}

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.archive-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(12, 19, 24, 0.72);
}

.archive-filter:hover,
.archive-filter.active {
  border-color: var(--line-strong);
  color: var(--accent-2);
  background: rgba(83, 215, 129, 0.08);
}

.archive-filter small {
  color: var(--dim);
}

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

.archive-card {
  display: grid;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: inherit;
  text-align: left;
  background: rgba(12, 19, 24, 0.76);
}

.archive-card:hover {
  border-color: var(--line-strong);
  background: rgba(16, 26, 33, 0.9);
}

.archive-card img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #05090c;
  padding: 10px;
}

.archive-card-body {
  display: grid;
  gap: 5px;
  padding: 13px 14px 15px;
}

.archive-card strong {
  font-size: 0.98rem;
}

.archive-card small,
.archive-card em {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
  line-height: 1.4;
}

.archive-card em {
  color: var(--dim);
}

.archive-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
}

.archive-modal.open {
  display: grid;
}

.archive-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.archive-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #080d11;
  box-shadow: var(--shadow);
}

.archive-modal-panel img {
  width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  background: #05090c;
  padding: 10px;
}

.archive-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  color: var(--text);
  background: rgba(7, 11, 15, 0.82);
  font-size: 1.4rem;
  line-height: 1;
}

.archive-modal-close span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  line-height: 1;
}

.archive-modal-caption {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
}

.archive-modal-caption span {
  color: var(--muted);
  font-size: 0.92rem;
}

.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}

.editor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
}

.editor-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 860px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #080d11;
  box-shadow: var(--shadow);
  padding: 22px;
}

.editor-modal-panel h2 {
  margin-bottom: 16px;
}

.editor-form {
  display: grid;
  gap: 14px;
}

.editor-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-form input,
.editor-form select {
  height: 42px;
  padding: 0 12px;
}

.editor-form textarea {
  width: 100%;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

.editor-note {
  margin: 0;
  color: var(--dim);
  font-size: 0.86rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--muted);
}

.loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1120px) {
  .quick-grid,
  .card-grid,
  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    grid-template-columns: auto minmax(180px, 1fr) max-content;
  }
}

@media (max-width: 860px) {
  .site-shell {
    display: block;
    width: 100%;
    max-width: 100vw;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    width: min(88vw, 320px);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgba(0, 0, 0, 0.52);
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .topbar {
    width: 100%;
    max-width: 100vw;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px 14px;
  }

  .top-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: flex-start;
    justify-self: stretch;
  }

  .top-action {
    min-width: 0;
    padding: 0 10px;
  }

  .content {
    width: 100%;
    max-width: 100vw;
    padding: 26px 16px 44px;
  }

  .page-head {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
  }

  .page-lead {
    max-width: calc(100vw - 32px);
  }

  .hero-media {
    width: min(100%, 280px);
    max-width: 280px;
  }

  .quick-grid,
  .card-grid,
  .meta-grid,
  .term-grid,
  .archive-grid {
    grid-template-columns: 1fr;
  }

  .timeline-card {
    grid-template-columns: 1fr;
  }

  .article {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .auth-panel {
    padding: 22px;
  }

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

  .auth-row button {
    width: 100%;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .top-action {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    white-space: normal;
  }

  .user-badge {
    max-width: min(100%, 260px);
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-results {
    position: fixed;
    top: 62px;
    right: 12px;
    left: 12px;
  }

  .page-lead,
  .meta-grid,
  .quick-grid,
  .card-grid,
  .term-grid,
  .archive-grid,
  .timeline-list,
  .article {
    max-width: min(100%, 330px);
  }

  .meta-card,
  .quick-link,
  .entity-card,
  .term-card,
  .timeline-card,
  .archive-card {
    max-width: min(100%, 330px);
  }
}
