:root {
  color-scheme: dark;
  --bg: #070b0f;
  --panel: #0c1318;
  --panel-2: #101a21;
  --panel-3: #152029;
  --line: rgba(140, 165, 150, 0.18);
  --accent-rgb: 83, 215, 129;
  --line-strong: rgba(var(--accent-rgb), 0.38);
  --text: #eef5ef;
  --muted: #9db0a4;
  --dim: #6f8277;
  --accent: #53d781;
  --accent-2: #9fe7b6;
  --accent-on: #06100a;
  --field-bg: #071016;
  --sigil-bg: #09110d;
  --warning: #f0c674;
  --danger: #ff8a8a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --sidebar: 288px;
  --radius: 8px;
  --motion-fast: 140ms;
  --motion-normal: 220ms;
  --motion-slow: 300ms;
  --motion-ease: cubic-bezier(0.22, 0.72, 0.24, 1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
}

:root[data-world="slavia"] {
  --accent-rgb: 72, 137, 255;
  --accent: #4889ff;
  --accent-2: #a8c8ff;
  --accent-on: #050b16;
  --field-bg: #070d19;
  --sigil-bg: #080d1a;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.026) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 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,
a {
  transition:
    border-color var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    opacity var(--motion-fast) ease,
    transform var(--motion-fast) var(--motion-ease);
}

input,
select,
textarea {
  transition:
    border-color var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease;
}

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 {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 104px;
  height: 104px;
  padding: 10px;
  margin-bottom: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--sigil-bg);
}

.sigil-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  object-position: center;
}

.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: var(--field-bg);
  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(var(--accent-rgb), 0.12);
}

.auth-row button,
.auth-form > button,
.top-action,
.mobile-toggle {
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-on);
  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(var(--accent-rgb), 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;
  transform-origin: left center;
}

.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(var(--accent-rgb), 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 {
  right: auto;
  width: min(820px, calc(100vw - 360px));
}

.search-controls {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: rgba(8, 13, 17, 0.98);
  backdrop-filter: blur(16px);
}

.search-controls label {
  display: grid;
  gap: 5px;
  color: var(--dim);
  font-size: 0.72rem;
}

.search-controls select,
.search-controls input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--text);
  background: var(--field-bg);
}

.search-result-summary {
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
  color: var(--dim);
  font-size: 0.78rem;
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.search-result-meta > span:not(.canon-status) {
  color: var(--dim);
  font-size: 0.72rem;
}

.search-result mark {
  border-radius: 3px;
  padding: 0 2px;
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.26);
}

.search-results.open {
  display: block;
  animation: popover-enter var(--motion-normal) var(--motion-ease) both;
}

.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%;
}

.world-switch {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 15, 19, 0.86);
  white-space: nowrap;
}

.world-switch-button {
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.world-switch-button:hover {
  color: var(--text);
}

.world-switch-button.active {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 760;
  box-shadow: 0 3px 12px rgba(var(--accent-rgb), 0.18);
}

.world-switch-divider {
  color: var(--line-strong);
  font-size: 0.75rem;
}

.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: var(--accent-on);
  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;
  animation: popover-enter var(--motion-normal) var(--motion-ease) both;
}

.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: var(--field-bg);
  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;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.page-edit-action {
  min-height: 40px;
  padding: 0 14px;
}

.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;
}

.content > .page-head,
.content > .section-block,
.content > .archive-canon-notice {
  animation: page-enter var(--motion-slow) var(--motion-ease) both;
}

.content > :nth-child(2) {
  animation-delay: 35ms;
}

.content > :nth-child(3) {
  animation-delay: 70ms;
}

.content > :nth-child(n + 4) {
  animation-delay: 105ms;
}

.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;
}

.quick-link,
.entity-card,
.meta-card,
.timeline-card,
.term-card,
.archive-card {
  transition:
    border-color var(--motion-normal) ease,
    background-color var(--motion-normal) ease,
    box-shadow var(--motion-normal) ease,
    transform var(--motion-normal) var(--motion-ease);
}

.quick-grid > *,
.card-grid > *,
.meta-grid > *,
.timeline-list > *,
.term-grid > *,
.archive-grid > * {
  animation: card-enter var(--motion-slow) var(--motion-ease) backwards;
}

.quick-grid > :nth-child(2),
.card-grid > :nth-child(2),
.meta-grid > :nth-child(2),
.timeline-list > :nth-child(2),
.term-grid > :nth-child(2),
.archive-grid > :nth-child(2) {
  animation-delay: 35ms;
}

.quick-grid > :nth-child(3),
.card-grid > :nth-child(3),
.meta-grid > :nth-child(3),
.timeline-list > :nth-child(3),
.term-grid > :nth-child(3),
.archive-grid > :nth-child(3) {
  animation-delay: 70ms;
}

.quick-grid > :nth-child(n + 4),
.card-grid > :nth-child(n + 4),
.meta-grid > :nth-child(n + 4),
.timeline-list > :nth-child(n + 4),
.term-grid > :nth-child(n + 4),
.archive-grid > :nth-child(n + 4) {
  animation-delay: 105ms;
}

.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: var(--accent-on);
  background: var(--accent);
}

.entity-actions .archive-source-link {
  color: var(--accent-2);
  background: rgba(var(--accent-rgb), 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: var(--accent-on);
  background: var(--accent);
  font-size: 0.88rem;
  font-weight: 760;
}

.article-nav-link.secondary {
  border-color: var(--line);
  color: var(--accent-2);
  background: rgba(var(--accent-rgb), 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-title-with-status,
.article-editor-buttons,
.archive-card-title,
.timeline-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.canon-status {
  display: inline-flex;
  width: fit-content;
  min-height: 23px;
  align-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--accent-2);
  background: rgba(var(--accent-rgb), 0.09);
  font-size: 0.7rem;
  font-weight: 720;
  line-height: 1.2;
}

.canon-status-partial,
.canon-status-needs-review {
  border-color: rgba(236, 183, 72, 0.42);
  color: #f1c56b;
  background: rgba(236, 183, 72, 0.1);
}

.canon-status-outdated {
  border-color: rgba(255, 138, 138, 0.38);
  color: #ff9d9d;
  background: rgba(255, 138, 138, 0.08);
}

.canon-status-alternative {
  border-color: rgba(179, 141, 255, 0.4);
  color: #cbb0ff;
  background: rgba(179, 141, 255, 0.09);
}

.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;
  scroll-margin-top: 96px;
}

.article h4 {
  scroll-margin-top: 96px;
}

.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;
}

.section-editor-actions,
.content-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-editor-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content-entry-heading {
  align-items: flex-start;
  margin-bottom: 8px;
}

.entry-edit-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
}

.timeline-card h3 {
  margin: 0;
  font-size: 1rem;
}

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

.timeline-controls {
  display: grid;
  grid-template-columns: minmax(310px, 1.5fr) repeat(3, minmax(120px, 0.7fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(7, 16, 22, 0.64);
}

.timeline-controls > label {
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 0.76rem;
}

.timeline-controls select,
.timeline-controls input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: var(--field-bg);
}

.timeline-world-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-result-summary {
  margin-bottom: 12px;
  color: var(--dim);
  font-size: 0.82rem;
}

.timeline-track {
  position: relative;
  padding-left: 22px;
}

.timeline-track::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: linear-gradient(var(--accent), rgba(var(--accent-rgb), 0.08));
  content: "";
}

.timeline-track .timeline-card {
  position: relative;
}

.timeline-track .timeline-card::before {
  position: absolute;
  top: 23px;
  left: -21px;
  width: 10px;
  height: 10px;
  border: 2px solid #081015;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.13);
  content: "";
}

.timeline-world-slavia {
  border-left: 3px solid #4b8cff;
}

.timeline-world-common {
  border-left: 3px solid #cbb0ff;
}

.timeline-world-label {
  display: inline-block;
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 0.75rem;
}

.timeline-group-title {
  margin: 12px 0 0;
  color: var(--accent-2);
  font-size: 0.95rem;
}

.timeline-article-link {
  display: inline-flex;
  margin-top: 10px;
}

.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: 0;
  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-canon-notice {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: -8px 0 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(var(--accent-rgb), 0.07);
}

.archive-canon-notice strong {
  flex: 0 0 auto;
  color: var(--accent-2);
}

.archive-canon-notice span {
  line-height: 1.5;
}

.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(var(--accent-rgb), 0.08);
}

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

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

.archive-card-shell {
  position: relative;
  display: grid;
  min-width: 0;
}

.archive-card-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-height: 34px;
  border-color: var(--line-strong);
  padding: 0 10px;
  color: var(--accent-on);
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

.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;
  transition: transform var(--motion-normal) var(--motion-ease);
}

.archive-model-preview {
  display: block;
  width: 100%;
  height: 220px;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, rgba(var(--accent-rgb), 0.12), transparent 50%),
    #05090c;
  --poster-color: transparent;
  --progress-bar-color: var(--accent);
  transition: transform var(--motion-normal) var(--motion-ease);
}

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

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

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

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

.archive-card-ocr {
  display: -webkit-box;
  overflow: hidden;
  color: var(--dim);
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

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

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

.archive-modal.open .archive-modal-backdrop {
  animation: backdrop-enter var(--motion-normal) ease both;
}

.archive-modal.open .archive-modal-panel {
  animation: modal-enter var(--motion-normal) var(--motion-ease) both;
}

.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;
  isolation: isolate;
  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.model-mode .archive-modal-panel {
  width: min(100%, 640px);
}

.archive-modal-stage {
  position: relative;
  width: 100%;
  height: min(50vh, 420px);
  min-height: 280px;
  overflow: hidden;
  contain: layout paint;
  background:
    radial-gradient(circle at 50% 45%, rgba(var(--accent-rgb), 0.12), transparent 50%),
    #05090c;
}

.archive-modal-stage[hidden] {
  display: none;
}

.archive-modal-model {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  --poster-color: transparent;
  --progress-bar-color: var(--accent);
}

.archive-model-status[hidden] {
  display: none;
}

.archive-model-status {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  max-width: calc(100% - 80px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: rgba(5, 9, 12, 0.86);
  font-size: 0.82rem;
  pointer-events: none;
}

.archive-model-toolbar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.archive-model-toolbar button {
  flex: 0 0 auto;
  padding: 7px 10px;
  background: rgba(5, 9, 12, 0.88);
  pointer-events: auto;
}

.archive-model-toolbar span {
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  background: rgba(5, 9, 12, 0.78);
  font-size: 0.72rem;
  text-align: right;
}

.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;
  z-index: 5;
}

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

.archive-modal-caption {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
  background: #080d11;
}

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

.archive-modal-ocr {
  display: block;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.archive-modal-ocr strong {
  color: var(--accent-2);
}

.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);
  animation: backdrop-enter var(--motion-normal) ease both;
}

.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;
  animation: modal-enter var(--motion-normal) var(--motion-ease) both;
}

.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-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.editor-fieldset legend {
  padding: 0 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.editor-form .editor-checkbox {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.04);
}

.editor-form .editor-checkbox input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

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

.editor-form label small {
  color: var(--dim);
  font-size: 0.8rem;
  font-weight: 400;
}

.editor-status {
  min-height: 1.25em;
  margin: 0;
  color: var(--accent-2);
  font-size: 0.86rem;
}

.editor-status.error {
  color: #ff8f8f;
}

.image-editor-preview {
  display: block;
  width: min(100%, 520px);
  max-height: 280px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  object-fit: contain;
  background: #05080b;
}

.model-editor-preview {
  display: grid;
  width: min(100%, 520px);
  min-height: 150px;
  margin: 0 auto;
  place-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--accent-2);
  text-align: center;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.14), #05080b 70%);
}

.model-editor-preview span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
}

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

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

.workflow-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(var(--accent-rgb), 0.035);
}

.workflow-card h3 {
  margin: 5px 0 8px;
  font-size: 1rem;
}

.workflow-card-meta,
.workflow-card-badges,
.workflow-change-line {
  color: var(--dim);
  font-size: 0.78rem;
}

.workflow-card-badges,
.workflow-change-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.draft-button {
  gap: 6px;
}

#draft-count:not(:empty) {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-on);
  background: rgba(255, 255, 255, 0.28);
  font-size: 0.72rem;
}

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

.subarticle-editor-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--accent-rgb), 0.035);
  padding: 14px;
}

.subarticle-editor-heading,
.subarticle-order-actions,
.subarticle-toc-fields {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subarticle-editor-heading {
  justify-content: space-between;
}

.subarticle-editor-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.subarticle-order-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.subarticle-order-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.subarticle-toc-fields {
  align-items: end;
}

.subarticle-toc-fields > label:first-child {
  flex: 1 1 280px;
}

.subarticle-toc-fields .editor-checkbox {
  flex: 1 1 280px;
  min-height: 42px;
}

.danger-action {
  min-height: 40px;
  border-color: rgba(255, 138, 138, 0.5);
  color: var(--danger);
  background: rgba(255, 138, 138, 0.08);
}

.danger-action:hover {
  border-color: var(--danger);
  color: #fff;
  background: rgba(255, 138, 138, 0.18);
}

.danger-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.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;
}

.assistant-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
}

.assistant-toggle {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent-on);
  background: var(--accent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.assistant-toggle:hover {
  background: var(--accent-2);
}

.assistant-toggle svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  display: none;
  width: min(420px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 13, 17, 0.98);
  box-shadow: var(--shadow);
}

.assistant-panel.open {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto;
  animation: popover-enter var(--motion-normal) var(--motion-ease) both;
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.assistant-header strong {
  display: block;
  color: var(--accent-2);
}

.assistant-header span {
  display: block;
  margin-top: 2px;
  color: var(--dim);
  font-size: 0.8rem;
}

.assistant-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assistant-clear {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.82rem;
  font-weight: 720;
}

.assistant-clear:hover {
  border-color: var(--line-strong);
  color: var(--accent-2);
  background: rgba(var(--accent-rgb), 0.08);
}

.assistant-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  font-size: 1.2rem;
  line-height: 1;
}

.assistant-model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.assistant-control {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.assistant-model-row label {
  color: var(--dim);
  font-size: 0.78rem;
}

.assistant-model-row select,
.assistant-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
}

.assistant-model-row select {
  height: 38px;
  padding: 0 10px;
}

.assistant-mode-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--dim);
  font-size: 0.76rem;
  line-height: 1.4;
}

.assistant-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px 16px;
}

.assistant-empty,
.assistant-status {
  color: var(--dim);
  font-size: 0.86rem;
  line-height: 1.45;
}

.assistant-message {
  max-width: 94%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.assistant-message.user {
  justify-self: end;
  border-color: var(--line-strong);
  color: var(--accent-on);
  background: var(--accent);
}

.assistant-message.assistant {
  justify-self: start;
  background: rgba(12, 19, 24, 0.82);
}

.assistant-thinking {
  display: inline-flex;
  align-items: baseline;
  color: var(--accent-2);
  font-weight: 720;
}

.assistant-thinking-dots {
  display: inline-flex;
  min-width: 1.15em;
}

.assistant-thinking-dots span {
  opacity: 0.22;
  animation: assistant-thinking-dot 1.15s infinite ease-in-out;
}

.assistant-thinking-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.assistant-thinking-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes assistant-thinking-dot {
  0%,
  60%,
  100% {
    opacity: 0.22;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-0.12em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-thinking-dots span {
    opacity: 1;
    animation: none;
  }
}

.assistant-sources {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.assistant-sources span {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 740;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.assistant-sources a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--accent-2);
  font-size: 0.78rem;
  background: rgba(var(--accent-rgb), 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
}

.assistant-form textarea {
  resize: none;
  padding: 10px 11px;
  line-height: 1.35;
}

.assistant-form button {
  align-self: end;
}

.assistant-status {
  min-height: 20px;
  margin: 0;
  padding: 0 16px 12px;
}

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .nav-link:hover,
  .search-result:hover {
    transform: translateX(2px);
  }

  .quick-link:hover,
  .archive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.2);
  }

  .quick-link:hover {
    border-color: var(--line-strong);
    background: rgba(var(--accent-rgb), 0.06);
  }

  .archive-card:hover img,
  .archive-card:hover .archive-model-preview {
    transform: scale(1.012);
  }

  .article-toc a:hover,
  .article-nav-link:hover,
  .entity-actions .source-link:hover {
    transform: translateY(-1px);
  }
}

button:active:not(:disabled),
a:active {
  transform: scale(0.98);
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popover-enter {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }

  .assistant-thinking-dots span {
    opacity: 1;
    animation: none !important;
  }
}

@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;
  }

  .search-controls {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .timeline-controls {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (min-width: 861px) and (max-width: 1450px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

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

@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;
  }

  .search-results {
    width: min(720px, calc(100vw - 28px));
  }

  .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) {
  .archive-canon-notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .archive-modal-stage {
    min-height: 240px;
  }

  .archive-model-toolbar span {
    display: none;
  }

  .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;
  }

  .editor-field-grid,
  .editor-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .subarticle-editor-heading,
  .subarticle-toc-fields {
    align-items: stretch;
    flex-direction: column;
  }

  .subarticle-order-actions {
    justify-content: flex-start;
  }

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

  .search-controls,
  .timeline-controls {
    grid-template-columns: 1fr;
  }

  .timeline-world-filter {
    min-width: 0;
  }

  .timeline-track {
    padding-left: 16px;
  }

  .assistant-widget {
    right: 14px;
    bottom: 14px;
  }

  .assistant-panel {
    position: fixed;
    right: 12px;
    bottom: 78px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 92px);
  }

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

  .assistant-mode-hint {
    grid-column: 1;
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .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);
  }
}
