:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #fff;
  --surface-muted: #f7f9fc;
  --text: #172033;
  --muted: #65718a;
  --border: #dfe6f0;
  --line: #e8edf5;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf1ff;
  --shadow: 0 16px 38px rgba(30, 50, 90, 0.08);
  --fdl: #2563eb;
  --ww: #15803d;
  --zl: #b7791f;
  --bw: #dc2626;
  --lrf: #8a7500;
}

body.dark {
  color-scheme: dark;
  --bg: #0d1422;
  --surface: rgba(20, 29, 46, 0.9);
  --surface-solid: #141d2e;
  --surface-muted: #19243a;
  --text: #e8edf7;
  --muted: #9aa8c0;
  --border: #2a3851;
  --line: #26334a;
  --accent: #8bb5ff;
  --accent-strong: #b3ceff;
  --accent-soft: #1b2d4d;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  --fdl: #93c5fd;
  --ww: #86efac;
  --zl: #f5c56b;
  --bw: #fca5a5;
  --lrf: #f3e66e;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(37, 99, 235, 0.09), transparent 38rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
  transition: background-color 180ms ease, color 180ms ease;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
.help-btn,
.back-btn,
.btn-secondary,
.nav-link,
.buttons a {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button,
.help-btn,
.back-btn,
.btn-secondary,
.nav-link,
.site-nav a,
.site-actions a,
.buttons a {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}

button:hover,
.help-btn:hover,
.back-btn:hover,
.btn-secondary:hover,
.nav-link:hover,
.site-nav a:hover,
.site-actions a:hover,
.buttons a:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

input,
textarea {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--text);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.container {
  width: min(100%, 1120px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 28px;
  padding: 12px 0;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}

.site-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 20px;
}

.site-nav,
.site-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.site-nav a,
.site-actions a,
.site-actions button,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 13px;
}

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 24px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.page-intro p {
  margin: 8px 0 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px !important;
  color: var(--accent-strong) !important;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.card,
.legend,
.image-placeholder {
  border-color: var(--border) !important;
  border-radius: 16px !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.cards .card:hover,
.users-list li:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 18px 38px rgba(30, 50, 90, 0.12);
  transform: translateY(-2px);
}

h2,
h3 {
  color: var(--text);
  letter-spacing: -0.025em;
}

body > .container > h3,
.section-title {
  margin-top: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.search-field {
  min-height: 52px;
  margin: 0 0 24px !important;
  padding: 12px 16px !important;
  border-color: var(--border) !important;
  background: var(--surface-solid) !important;
  box-shadow: 0 6px 20px rgba(30, 50, 90, 0.05);
}

.card-entry {
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

.card-entry:last-child {
  border-bottom: 0;
}

.card-entry a,
.users-list > li > a {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.users-list li {
  border: 1px solid var(--border);
  background: var(--surface) !important;
  box-shadow: 0 4px 14px rgba(30, 50, 90, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.legend {
  padding: 16px !important;
}

.legend h4 {
  letter-spacing: -0.02em;
}

.legend-block {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.legend-block:last-of-type {
  border-bottom: 0;
}

.admin-page {
  width: min(100%, 1440px);
  margin: 0 auto;
}

.admin-header {
  position: static;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.admin-header .site-actions {
  margin-left: auto;
}

.admin-page .save-error {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid #dc2626;
  border-radius: 11px;
  background: color-mix(in srgb, #dc2626 8%, var(--surface));
  color: var(--text);
}

.admin-page .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 34px 0 18px;
  font-size: 1.35rem;
}

.admin-page .grid {
  gap: 18px;
}

.admin-page .card {
  padding: 20px;
}

.admin-page .entry {
  align-items: center;
}

.admin-page .entry input {
  min-height: 40px;
  padding: 8px 10px;
}

.admin-page .delete-entry,
.admin-page .delete-group {
  border-radius: 9px;
}

.admin-page .delete-entry {
  min-height: 38px;
  padding: 0 12px;
}

.admin-page .group-title {
  min-height: 40px;
  background: var(--surface-muted);
}

.admin-page .savebar {
  z-index: 5;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface) !important;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.admin-page .savebar button,
.admin-page .section-title button,
.admin-page #users + button {
  min-height: 42px;
  padding: 9px 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.admin-page .savebar button:hover,
.admin-page .section-title button:hover,
.admin-page #users + button:hover {
  background: var(--accent-strong);
}

.content-page,
.guide-page {
  width: min(100%, 900px);
  margin-inline: auto;
}

.content-page .card,
.guide-page .card {
  padding: clamp(20px, 4vw, 34px);
}

.content-page .card h2,
.guide-page .card h2 {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--accent-strong);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.content-page .card h3,
.guide-page .card h3 {
  margin-top: 30px;
  color: var(--accent-strong);
}

.content-page .card hr,
.guide-page .card hr {
  border: 0 !important;
  border-top: 1px solid var(--border) !important;
}

.content-page .card p,
.guide-page .card p,
.content-page .card li,
.guide-page .card li {
  color: var(--muted);
}

.content-page .card strong,
.guide-page .card strong {
  color: var(--text);
}



.guide-page .nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 18px;
}

.guide-page .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
}

.guide-page .nav-link.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.guide-page .image-placeholder {
  padding: 18px;
}

.guide-page .image-grid {
  width: 100%;
}

.guide-page code,
.content-page code {
  border-radius: 6px;
  background: var(--accent-soft) !important;
  color: var(--accent-strong);
}

.embed-page {
  display: grid;
  min-height: 100vh;
  padding: clamp(10px, 2vw, 22px);
  place-items: stretch;
}

.embed-frame {
  width: 100%;
  height: calc(100vh - clamp(20px, 4vw, 44px));
  min-height: 400px;
  border: 1px solid var(--border) !important;
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .site-header,
  .page-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    margin-bottom: 18px;
  }

  .site-nav,
  .site-actions {
    width: 100%;
  }

  .site-nav a,
  .site-actions a,
  .site-actions button,
  .theme-toggle {
    flex: 1 1 auto;
  }

  .admin-header .site-actions {
    margin-left: 0;
  }

  .admin-page {
    padding: 20px !important;
  }

  .admin-page .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page .entry {
    flex-wrap: wrap;
  }

  .admin-page .entry input {
    flex: 1 1 120px;
  }

  .meta {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.login-page {
  display: grid;
  min-height: 100vh;
  padding: 20px;
  place-items: center;
}

.login-page .login-card {
  width: min(100%, 390px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-page .login-card h2 {
  margin: 0 0 20px;
}

.login-page .login-card input,
.login-page .login-card button {
  min-height: 44px;
  margin: 8px 0;
  padding: 10px 12px;
}

.login-page .login-card button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.login-page .error {
  margin-bottom: 12px;
  color: #dc2626;
}
.container {
  max-width: 1120px;
}

.guide-page .container {
  max-width: 900px;
}

.embed-page {
  margin: 0;
}
@media (min-width: 1201px) {
  body > .container {
    padding-right: 280px;
  }
}

.users-list > li {
  align-items: center;
}