.site-settings { position: relative; flex: 0 0 auto; color: var(--text); }
.settings-trigger {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; list-style: none;
  border: 1px solid transparent; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--text);
}
.settings-trigger::-webkit-details-marker { display: none; }
.settings-trigger svg { width: 21px; height: 21px; flex-shrink: 0; }
.settings-trigger:hover, .site-settings[open] > .settings-trigger { background: var(--surface); border-color: var(--border); }
.settings-trigger:focus-visible, .settings-panel button:focus-visible, .settings-panel a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.settings-panel {
  position: absolute; z-index: 120; top: calc(100% + 10px); right: 0;
  width: 280px; max-width: calc(100vw - 32px); padding: 18px;
  background: var(--background); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .16); text-align: left;
  max-height: calc(100dvh - 100px); overflow-y: auto; overscroll-behavior: contain;
  font: 14px/1.45 var(--font-body, system-ui, sans-serif);
}
.site-settings:not([open]) > .settings-panel { display: none; }
.settings-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.settings-section + .settings-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.settings-section legend, .settings-label {
  display: block; margin: 0 0 10px; padding: 0; color: var(--muted-text);
  font-size: 12px; line-height: 1.4; font-weight: 600;
}
.settings-theme-options { display: flex; gap: 6px; }
.settings-theme-options button {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px;
  border: 1px solid var(--glass-control-border); border-radius: 10px;
  font: inherit; font-weight: 500; cursor: pointer; color: var(--text); background: var(--surface);
  transition: background-color 160ms ease, border-color 160ms ease;
}
.settings-theme-options button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.settings-panel .language-switcher { display: flex; flex-wrap: nowrap; gap: 4px; margin: 0; padding: 0; }
.settings-panel .language-switcher a {
  display: flex; align-items: center; justify-content: center; flex: 1;
  min-width: 0; min-height: 44px; padding: 5px 3px;
  border: 1px solid transparent; border-radius: 10px; color: var(--text);
  font: inherit; font-size: 12px; text-decoration: none; white-space: nowrap;
}
.settings-panel .language-switcher a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.settings-panel button:hover, .settings-panel .language-switcher a:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .settings-theme-options button { transition: none; }
}
@media (max-width: 767px) {
  .nav .settings-panel { right: -52px; }
  .legal-nav-actions .site-settings { order: 2; }
  .legal-nav-actions .legal-back-button { order: 1; }
}
