:root[data-theme="light"] {
  color-scheme: light;
  --ink: #202124;
  --muted: #5f646a;
  --paper: #f2efe8;
  --panel: #ffffff;
  --line: #c9d7df;
  --accent: #0069b4;
  --accent-strong: #00528d;
  --action-background: #0069b4;
  --action-background-hover: #00528d;
  --action-border: #0069b4;
  --action-foreground: #ffffff;
  --action-outline: rgba(0, 105, 180, 0.28);
  --gold: #b7822e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f7fb;
  --muted: #c8d0d9;
  --paper: #101418;
  --panel: #171d22;
  --line: #324453;
  --accent: #78c7ff;
  --accent-strong: #a8dbff;
  --action-background: #12384f;
  --action-background-hover: #1b5475;
  --action-border: #78c7ff;
  --action-foreground: #ffffff;
  --action-outline: rgba(120, 199, 255, 0.38);
  --gold: #e2bd6f;
}

:root[data-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 239, 232, 0.98)),
    var(--paper);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(16, 20, 24, 0.98), rgba(23, 29, 34, 0.98)),
    var(--paper);
}

:root[data-theme="light"] body:has(.page-shell) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(242, 239, 232, 0.96)),
    linear-gradient(135deg, rgba(0, 105, 180, 0.10), transparent 46%),
    linear-gradient(315deg, rgba(183, 130, 46, 0.10), transparent 52%),
    var(--paper);
}

:root[data-theme="dark"] body:has(.page-shell) {
  background:
    linear-gradient(180deg, rgba(16, 20, 24, 0.98), rgba(23, 29, 34, 0.98)),
    linear-gradient(135deg, rgba(120, 199, 255, 0.12), transparent 46%),
    linear-gradient(315deg, rgba(226, 189, 111, 0.10), transparent 52%),
    var(--paper);
}

:root[data-theme="light"] .faq-helper-dialog,
:root[data-theme="light"] .page-gate-dialog,
:root[data-theme="light"] .site-menu-toggle,
:root[data-theme="light"] .site-menu-panel {
  background: #ffffff;
}

:root[data-theme="light"] .page-gate {
  background: var(--paper);
}

:root[data-theme="light"] .page-gate-input {
  background: #ffffff;
  border-color: rgba(32, 33, 36, 0.24);
}

:root[data-theme="dark"] .faq-helper-dialog,
:root[data-theme="dark"] .page-gate-dialog,
:root[data-theme="dark"] .site-menu-toggle,
:root[data-theme="dark"] .site-menu-panel {
  background: var(--panel);
  border-color: rgba(200, 208, 217, 0.2);
}

.site-menu-panel {
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.site-menu-group {
  border-top: 1px solid rgba(0, 105, 180, 0.18);
  margin-top: 4px;
  padding-top: 4px;
}

.site-menu-group-summary {
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-weight: 700;
  justify-content: space-between;
  list-style: none;
  padding: 10px 12px;
}

.site-menu-group-summary::-webkit-details-marker {
  display: none;
}

.site-menu-group-summary:hover,
.site-menu-group-summary:focus-visible {
  background: rgba(0, 105, 180, 0.10);
  color: var(--accent-strong);
  outline: none;
}

.site-menu-group-chevron {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  height: 8px;
  margin-left: 16px;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  width: 8px;
}

.site-menu-group[open] .site-menu-group-chevron {
  transform: rotate(225deg);
}

.site-menu-group-links {
  border-left: 2px solid rgba(0, 105, 180, 0.18);
  display: grid;
  margin: 0 8px 5px 13px;
  padding-left: 5px;
}

.site-menu-panel .site-menu-group-links a {
  font-weight: 600;
  padding-left: 12px;
}

.site-menu-panel a[aria-current="page"] {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .site-menu-group,
:root[data-theme="dark"] .site-menu-group-links {
  border-color: rgba(120, 199, 255, 0.24);
}

:root[data-theme="dark"] .site-menu-group-summary:hover,
:root[data-theme="dark"] .site-menu-group-summary:focus-visible {
  background: rgba(120, 199, 255, 0.16);
  color: #ffffff;
}

:root[data-theme="dark"] .legal-content section + section,
:root[data-theme="dark"] .faq-item,
:root[data-theme="dark"] .legal-return {
  border-color: rgba(200, 208, 217, 0.16);
}

:root[data-theme="dark"] .page-gate-input {
  background: #101418;
  border-color: rgba(200, 208, 217, 0.26);
}

:root[data-theme="light"] .site-footer {
  background: #ffffff;
  border-top-color: rgba(32, 33, 36, 0.10);
}

:root[data-theme="dark"] .site-footer {
  background: rgba(16, 20, 24, 0.92);
  border-top-color: rgba(200, 208, 217, 0.16);
}

.theme-toggle {
  border: 1px solid var(--accent-strong);
  border-radius: 4px;
  background: var(--panel);
  color: var(--accent-strong);
  cursor: pointer;
  font: 700 0.84rem Arial, Helvetica, sans-serif;
  min-height: 38px;
  padding: 8px 11px;
}

.theme-toggle-footer {
  display: block;
  margin: 28px auto 36px;
}

body:has(.site-footer) .theme-toggle-footer {
  margin: 22px auto 30px;
}

.theme-toggle-menu {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 0.93rem;
  min-height: 0;
  padding: 11px 12px;
  text-align: left;
  width: 100%;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(0, 105, 180, 0.10);
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .theme-toggle:focus-visible {
  background: rgba(120, 199, 255, 0.16);
}

.protected-page:not(.is-unlocked) .theme-toggle {
  display: none;
}

@media (max-width: 520px) {
  .theme-toggle {
    font-size: 0.78rem;
    min-height: 34px;
    padding: 7px 9px;
  }

  body:has(.site-footer) .theme-toggle-footer {
    margin: 20px auto 26px;
  }

  .theme-toggle-menu {
    font-size: 0.9rem;
    min-height: 0;
    padding: 11px 12px;
  }
}
