:root {
  color-scheme: dark;
  --bg: #11110f;
  --panel: #171714;
  --panel-raised: #1d1c18;
  --line: #302d25;
  --line-strong: #494332;
  --text: #f1eee5;
  --muted: #a19b8b;
  --quiet: #918b7d;
  --gold: #d8b66c;
  --gold-bright: #f0d28a;
  --green: #a9c4a2;
  --content-width: 1320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

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

button, a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

/* Master Layout Container - Synchronized across all pages */
.shell {
  width: min(var(--content-width, 1320px), calc(100% - 64px));
  margin-inline: auto;
}

/* Topbar Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 76px;
  background: var(--bg);
  border-bottom: 1px solid #28261f;
}

.topbar-inner {
  height: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -.055em;
}

.brand-logo {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #806b40;
  color: var(--gold-bright);
  font: 13px Georgia, serif;
  transform: rotate(45deg);
}

.brand-mark span {
  transform: rotate(-45deg);
}

.brand em {
  color: var(--gold);
  font-style: normal;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--muted);
  font-size: 13px;
}

.topnav a {
  transition: color 150ms ease;
}

.topnav a:hover, .topnav a[aria-current="page"], .footer-links a:hover {
  color: var(--text);
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-inline-start: auto;
}

.submit-link, .button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #5a4c30;
  border-radius: 4px;
  background: #211e17;
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 12px;
}

.submit-link:hover, .button:hover {
  background: #2a251b;
}

.button.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
}

main {
  min-height: 65vh;
  padding-block: 56px 90px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  max-width: 800px;
  margin: 0;
  font: 400 clamp(36px, 5vw, 56px) / 1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}

h1 span {
  color: var(--gold-bright);
  font-style: italic;
}

.lede {
  max-width: 680px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.panel {
  min-width: 0;
  margin-top: 30px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.eyebrow + .panel {
  margin-top: 24px;
}

.section-title {
  margin: 0 0 12px;
  font: 400 24px Georgia, serif;
}

.muted {
  color: var(--muted);
  line-height: 1.75;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid #343229;
  border-radius: 3px;
  color: #c9c0ac;
  font-size: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: #d3cbbb;
  font-size: 13px;
}

.feature-list li::before {
  content: "✓";
  margin-inline-end: 9px;
  color: var(--green);
}

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

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

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

.field label {
  color: #d3cbbb;
  font-size: 12px;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px;
  border: 1px solid #37342c;
  border-radius: 3px;
  background: #171714;
  color: var(--text);
  font-size: 13px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field-hint {
  color: var(--quiet);
  font-size: 11px;
}

.suggest-captcha {
  margin-top: 16px;
}

.suggest-captcha-challenge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggest-captcha-image {
  width: 205px;
  height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.status {
  min-height: 1.5em;
  color: var(--green);
  font-size: 12px;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}

.app-table th, .app-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  font-size: 12px;
}

.app-table th {
  color: var(--muted);
  font-weight: 600;
}

.app-table button {
  margin-inline-end: 5px;
}

.danger {
  color: #e2a79b;
}

.legal-note {
  border-inline-start: 2px solid var(--gold);
  border-radius: 4px;
  padding: 14px 16px;
  background: #171612;
  color: #d3cbbb;
  line-height: 1.7;
}

.footer {
  border-top: 1px solid #29271f;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-block: 19px 24px;
  font-size: 10px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-fallback {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 1px solid #77613b;
  border-radius: 50%;
  color: var(--gold-bright);
  font: 30px Georgia, serif;
}

.logo-fallback[src] {
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.install-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 16px;
}

.install-tab {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.install-tab[aria-pressed="true"] {
  border-color: var(--gold);
  background: #211e17;
  color: var(--gold-bright);
}

.install-command {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #11110f;
}

.install-command code {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.install-command button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.install-status {
  min-height: 1.5em;
  margin-bottom: 0;
  color: var(--green);
  font-size: 12px;
}

.breadcrumbs {
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.preview {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #151512;
}

.preview h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

footer {
  border-top: 1px solid #29271f;
}

@media (max-width: 960px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 40px, var(--content-width, 1320px));
  }
}

@media (max-width: 760px) {
  .form-grid, .feature-list, .admin-layout {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .app-table th:nth-child(3), .app-table td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 650px) {
  .shell {
    width: calc(100% - 32px);
  }
  .topbar {
    height: auto;
  }
  .topbar-inner {
    min-height: auto;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 10px;
  }
  .brand {
    font-size: 16px;
  }
  .brand-logo, .brand-mark {
    width: 27px;
    height: 27px;
  }
  .topnav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 12px;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
  }
  .topnav::-webkit-scrollbar {
    display: none;
  }
  .topbar-end .submit-link {
    display: none;
  }
  main {
    padding-block: 24px 60px;
  }
  h1 {
    font-size: clamp(28px, 7vw, 40px);
    line-height: 1.15;
  }
  .lede {
    font-size: 13px;
    line-height: 1.65;
  }
  .panel {
    padding: 20px 16px;
    margin-top: 20px;
    border-radius: 8px;
  }
  .section-title {
    font-size: 20px;
  }
  .legal-note {
    padding: 12px 14px;
    font-size: 12.5px;
  }
  .breadcrumbs {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    font-size: 11.5px;
    margin-bottom: 18px;
    padding-bottom: 2px;
  }
  .breadcrumbs::-webkit-scrollbar {
    display: none;
  }
  .tags {
    gap: 6px;
  }
  .tag {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 11px;
  }
  .actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-top: 20px;
  }
  .actions .button, .panel > .button {
    width: 100%;
    min-height: 44px;
    text-align: center;
    justify-content: center;
    font-size: 13px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 14px;
    text-align: center;
    align-items: center;
    padding-block: 20px 28px;
  }
  .footer-links {
    justify-content: center;
    gap: 16px;
  }
  .app-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .app-table::-webkit-scrollbar {
    display: none;
  }
  .app-table th, .app-table td {
    white-space: nowrap;
  }
  .logo-fallback {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  .install-command {
    align-items: stretch;
    flex-direction: column;
  }
  .install-command .button {
    width: 100%;
    min-height: 44px;
  }
}

/* Suggestion Modal & Interactive Suggest Form */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  background: rgba(8, 8, 7, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: grid; }
.modal-window {
  position: relative;
  width: min(100%, 680px);
  max-height: min(820px, calc(100dvh - 48px));
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
  animation: modalFadeIn .22s cubic-bezier(.16, 1, .3, 1);
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title { margin: 0; color: var(--text); font: 400 28px/1.2 Georgia, serif; letter-spacing: -.03em; }
.modal-title span { color: var(--gold-bright); font-style: italic; }
.modal-subtitle { max-width: 540px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-close-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: -6px -6px 0 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: color .15s ease, background .15s ease;
}
.modal-close-btn:hover { border-color: var(--line-strong); background: var(--panel-raised); color: var(--text); }
.modal-window .form-grid { gap: 18px 16px; }
.modal-window .field { display: grid; min-width: 0; gap: 10px; }
.modal-window .field label { color: #d3cbbb; font-size: 12px; font-weight: 550; line-height: 1.4; }
.modal-window .field input,
.modal-window .field select,
.modal-window .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #403c32;
  border-radius: 4px;
  background: #11110f;
  color: var(--text);
  font-size: 13px;
}
.modal-window .field textarea { min-height: 104px; line-height: 1.55; resize: vertical; }
.modal-window .field input:focus-visible,
.modal-window .field select:focus-visible,
.modal-window .field textarea:focus-visible { outline-offset: 1px; }
.modal-window .field input::placeholder,
.modal-window .field textarea::placeholder { color: var(--quiet); opacity: 1; }
.modal-window .field input:focus-visible,
.modal-window .field select:focus-visible,
.modal-window .field textarea:focus-visible { border-color: var(--gold); }
.modal-window .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px !important; }
.modal-window .actions .button { min-height: 44px; padding-inline: 18px; }
.modal-window .actions .button[type="submit"] { background: #302719; }
.modal-window .actions .button:disabled { cursor: wait; opacity: .7; }
.suggest-feedback {
  display: none;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 14px;
  animation: modalFadeIn 0.2s ease;
}
.suggest-feedback.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}
.suggest-feedback.success {
  background: rgba(46, 160, 67, 0.14);
  border: 1px solid rgba(46, 160, 67, 0.35);
  color: #3fb950;
}
.suggest-feedback.error {
  background: rgba(248, 81, 73, 0.14);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: #f85149;
}
.suggest-feedback.loading {
  background: rgba(216, 182, 108, 0.14);
  border: 1px solid rgba(216, 182, 108, 0.35);
  color: var(--gold-bright);
}

/* Floating Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 95;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--panel-raised, #1d1c18);
  border: 1px solid var(--line, #302d25);
  color: var(--muted, #a19b8b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.back-to-top:hover {
  background: #25241f;
  border-color: var(--gold, #d8b66c);
  color: var(--gold-bright, #f0d28a);
  transform: translateY(0) scale(1.06);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--gold, #d8b66c);
  outline-offset: 2px;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 650px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-window {
    width: 100%;
    max-height: min(92dvh, 900px);
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
  }
  .modal-title { font-size: 25px; }
  .modal-window .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .modal-window .field.full { grid-column: auto; }
  .modal-window .actions { flex-direction: column-reverse; }
  .modal-window .actions .button { width: 100%; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-window { animation: none; }
}

@media (max-width: 650px) {
  .topnav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .field input, .field select, .field textarea,
  .modal-window .field input, .modal-window .field select, .modal-window .field textarea {
    min-height: 44px;
    font-size: 16px;
  }
  .back-to-top {
    bottom: max(16px, env(safe-area-inset-bottom));
    inset-inline-end: 16px;
    width: 44px;
    height: 44px;
  }
  .modal-backdrop {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-window {
    max-height: calc(92dvh - env(safe-area-inset-top));
  }
  .install-tab {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
