*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: 245 247 250;
  --fg: 20 23 30;
  --card: 255 255 255;
  --card-alt: 244 245 249;
  --primary: 14 165 233;
  --primary-dim: 14 165 233 / .12;
  --accent: 99 102 241;
  --accent-dim: 99 102 241 / .12;
  --muted: 234 236 240;
  --muted-fg: 100 116 139;
  --border: 222 226 230;
  --danger: 239 68 68;
  --ring: 14 165 233 / .25;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .06), 0 2px 4px rgba(0, 0, 0, .04);
  --btn-radius: 0.5rem;
  --radius: .875rem;
  --sidebar-w: 258px;
  --topbar-h: 60px;
}

.dark {
  --bg: 14 17 22;
  --fg: 230 230 230;
  --card: 26 29 36;
  --card-alt: 19 22 32;
  --primary: 34 211 238;
  --primary-dim: 34 211 238 / .1;
  --accent: 129 140 248;
  --accent-dim: 129 140 248 / .1;
  --muted: 42 47 58;
  --muted-fg: 156 163 175;
  --border: 42 47 58;
  --danger: 252 100 100;
  --ring: 34 211 238 / .2;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, .6);
}

body {
  font-family: var(--app-font, 'Space Grotesk Qwantium', sans-serif);
  background-color: rgb(var(--bg));
  color: rgb(var(--fg));
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color .2s;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  height: 100%;
}

/* ── APP SHELL ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid rgb(var(--border));
  background-color: rgb(var(--card));
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid rgb(var(--border));
  height: var(--topbar-h);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem .9rem;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .6rem;
  border-radius: .55rem;
  font-size: .82rem;
  font-weight: 500;
  color: rgb(var(--muted-fg));
  text-decoration: none;
  transition: background-color .12s, color .12s;
}

.sidebar-nav a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav a:hover {
  background-color: rgb(var(--muted));
  color: rgb(var(--fg));
}

.sidebar-nav a.active {
  background-color: rgb(var(--primary-dim));
  color: rgb(var(--primary));
}

.sidebar-footer {
  padding: .9rem .9rem 1.1rem;
  border-top: 1px solid rgb(var(--border));
}

.theme-switch-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .6rem;
  border-radius: .55rem;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--card-alt));
  color: rgb(var(--fg));
  font-family: inherit;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s;
}

.theme-switch-btn:hover {
  background-color: rgb(var(--muted));
}

.theme-switch-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
}

.sidebar-backdrop {
  display: none;
}

/* ── MAIN COLUMN ── */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: rgb(var(--bg));
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgb(var(--border));
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgb(var(--bg) / .85);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  display: none !important;
}

/* ── SECTION GROUP (sidebar-nav anchors) ── */
.section-group {
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.section-group-label {
  display: none;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: rgb(var(--fg));
  text-decoration: none;
}

.logo-small img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.icon-btn {
  background: none;
  border: none;
  padding: .5rem;
  border-radius: .375rem;
  cursor: pointer;
  color: rgb(var(--fg));
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: .2s;
}

.icon-btn:hover {
  background-color: rgb(var(--muted));
}

.topbar-search-link {
  flex-shrink: 0;
  margin-left: auto;
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* ── SEARCH BAR ── */
.settings-searchbar {
  flex: 1;
  max-width: 380px;
}

.settings-searchbar-inner {
  position: relative;
}

.ssb-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: rgb(var(--muted-fg));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  pointer-events: none;
}

.ssb-input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 40px;
  background-color: rgb(var(--bg));
  border: 1px solid rgb(var(--border));
  border-radius: .5rem;
  font-family: inherit;
  font-size: .9rem;
  color: rgb(var(--fg));
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}

.ssb-input::placeholder {
  color: rgb(var(--muted-fg));
}

.ssb-input::-webkit-search-cancel-button {
  display: none;
}

.ssb-input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / 0.15);
}

.ssb-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  background: rgb(var(--muted));
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ssb-clear.visible {
  display: flex;
}

.ssb-clear svg {
  width: 10px;
  height: 10px;
  stroke: rgb(var(--muted-fg));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

/* ── MAIN ── */
.settings-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.25rem 2rem 4rem;
}

.settings-header {
  margin-bottom: 2rem;
}

.settings-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.settings-header p {
  color: rgb(var(--muted-fg));
}

/* ── SECTION ── */
.settings-section {
  background-color: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section.search-hidden {
  display: none;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgb(var(--border));
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title svg {
  width: 18px;
  height: 18px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* ── SETTING ROW ── */
.setting-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-info {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.setting-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(var(--primary) / 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.setting-row-icon svg {
  width: 16px;
  height: 16px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.setting-text {
  flex: 1;
}

.setting-label {
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}

.setting-desc {
  font-size: 0.875rem;
  color: rgb(var(--muted-fg));
}

/* ── CONTROLS ── */
.toggle-input {
  appearance: none;
  width: 3rem;
  height: 1.5rem;
  background-color: rgb(var(--muted));
  border-radius: 1rem;
  position: relative;
  cursor: pointer;
  transition: .3s;
  flex-shrink: 0;
}

.toggle-input::before {
  content: "";
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
  background-color: white;
  border-radius: 50%;
  top: 0.15rem;
  left: 0.15rem;
  transition: .3s;
}

.toggle-input:checked {
  background-color: rgb(var(--primary));
}

.toggle-input:checked::before {
  left: 1.65rem;
}

.range-row {
  margin-bottom: 1.25rem;
  opacity: .5;
  pointer-events: none;
  transition: opacity .2s;
}

.range-row.active {
  opacity: 1;
  pointer-events: auto;
}

.sub-setting-row {
  margin-top: -0.5rem;
  opacity: .5;
  pointer-events: none;
  transition: opacity .2s;
}

.sub-setting-row.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── COLOR PICKER WIDGET ── */
.color-picker-widget {
  padding-left: 42px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  flex-shrink: 0;
  position: relative;
  outline: none;
}

.color-swatch:hover {
  transform: scale(1.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.color-swatch.is-selected {
  border-color: rgb(var(--fg));
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgb(var(--bg)), 0 0 0 4px rgb(var(--fg));
}

.color-swatch-custom {
  overflow: hidden;
  border-color: rgb(var(--border));
}

.color-swatch-custom:hover {
  border-color: rgb(var(--fg));
}

.color-swatch-custom.is-selected {
  border-color: rgb(var(--fg));
  box-shadow: 0 0 0 2px rgb(var(--bg)), 0 0 0 4px rgb(var(--fg));
}

/* hide native color input but keep it clickable */
#linkColorOwn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.color-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-preview-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgb(var(--border));
  transition: background .15s;
}

.color-hex-input {
  width: 96px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg));
  color: rgb(var(--fg));
  font-family: 'Cascadia_Mono', monospace, inherit;
  font-size: 0.82rem;
  outline: none;
  transition: border-color .2s;
  text-transform: uppercase;
}

.color-hex-input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 2px rgba(var(--primary) / 0.15);
}

.color-preview-link-example {
  font-size: 0.88rem;
  font-weight: 500;
  transition: color .15s;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: .9;
}

.range-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: rgb(var(--muted-fg));
  margin-bottom: 0.4rem;
  padding-left: 42px;
}

.range-input {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgb(var(--muted));
  outline: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgb(var(--primary));
  cursor: pointer;
}

.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: rgb(var(--primary));
  cursor: pointer;
}


select {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(var(--border));
  background-color: rgb(var(--bg));
  color: rgb(var(--fg));
  font-family: inherit;
  outline: none;
  min-width: 150px;
}

.radio-group {
  display: flex;
  gap: 0.5rem;
  background: rgb(var(--muted));
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.radio-group label {
  padding: 0.4rem 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: .2s;
}

.radio-group input {
  display: none;
}

.radio-group label:has(input:checked) {
  background: rgb(var(--card));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* ── THEME PICKER ── */
.theme-picker {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 0.75rem;
}

.theme-card {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
  border: 2px solid rgb(var(--border));
  border-radius: 0.75rem;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
  background-color: rgb(var(--muted));
}

.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.theme-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-card-preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.theme-card-preview-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgb(var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgb(var(--muted-fg));
}

.theme-card-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: rgb(var(--card));
  border-top: 1px solid rgb(var(--border));
}

.theme-card-radio-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgb(var(--border));
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
  background: transparent;
}

.theme-card:has(input:checked) {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / 0.2);
}

.theme-card:has(input:checked) .theme-card-radio-dot {
  background: rgb(var(--primary));
  border-color: rgb(var(--primary));
}

.theme-card:has(input:checked) .theme-card-label {
  font-weight: 600;
}

.setting-item-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 0;
}

/* ── BUTTONS ── */
.footer-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-primary {
  background-color: rgb(var(--primary));
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--btn-radius, 0.5rem);
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: opacity .2s, border-radius .2s, clip-path .2s;
  font-family: inherit;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: none;
  border: 1px solid rgb(var(--border));
  color: rgb(var(--fg));
  padding: 0.75rem 1rem;
  border-radius: var(--btn-radius, 0.5rem);
  cursor: pointer;
  transition: background .2s, border-radius .2s, clip-path .2s;
  font-family: inherit;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn-secondary svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.btn-secondary:hover {
  background: rgb(var(--muted));
}

/* ── KIDS MODE ── */
.kids-mode-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(var(--primary) / 0.08);
  border: 1.5px solid rgba(var(--primary) / 0.25);
  border-radius: .75rem;
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
}

.kids-mode-banner svg {
  width: 20px;
  height: 20px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.kids-mode-banner-text {
  flex: 1;
  font-size: .85rem;
  color: rgb(var(--fg));
}

.kids-mode-banner-text strong {
  display: block;
  margin-bottom: 2px;
  color: rgb(var(--primary));
}

.kids-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgb(var(--primary));
  color: white;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.kids-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.kids-modal-overlay.open {
  display: flex;
}

.kids-modal {
  background: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kids-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.kids-modal h3 svg {
  width: 20px;
  height: 20px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.kids-modal p {
  font-size: .875rem;
  color: rgb(var(--muted-fg));
  line-height: 1.5;
}

.kids-modal-fields {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.kids-modal-fields label {
  font-size: .8rem;
  font-weight: 600;
  color: rgb(var(--muted-fg));
  display: block;
  margin-bottom: 4px;
}

.kids-modal-input {
  width: 100%;
  height: 40px;
  padding: 0 .75rem;
  background: rgb(var(--bg));
  border: 1px solid rgb(var(--border));
  border-radius: .5rem;
  font-family: inherit;
  font-size: .9rem;
  color: rgb(var(--fg));
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.kids-modal-input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / .15);
}

.kids-modal-error {
  font-size: .8rem;
  color: #ef4444;
  min-height: 1.1em;
}

.kids-modal-actions {
  display: flex;
  gap: .75rem;
}

.kids-modal-actions .btn-primary {
  flex: 1;
}

.kids-modal-actions .btn-secondary {
  flex: none;
}

.kids-locked .radio-group label:not(:has(input[value="strict"])) {
  pointer-events: none;
  opacity: .35;
}

/* ── AGE GATE MODAL ── */
.agegate-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.agegate-modal-overlay.open {
  display: flex;
}

.agegate-modal {
  background: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  margin: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: center;
}

.agegate-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(var(--primary) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.agegate-modal-icon svg {
  width: 24px;
  height: 24px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.agegate-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.agegate-modal p {
  font-size: .875rem;
  color: rgb(var(--muted-fg));
  line-height: 1.5;
}

.agegate-modal-actions {
  display: flex;
  gap: .75rem;
}

.agegate-modal-actions .btn-primary,
.agegate-modal-actions .btn-secondary {
  flex: 1;
}

/* ── NO RESULTS ── */
.no-results {
  display: none;
  text-align: center;
  padding: 2rem 1rem;
  color: rgb(var(--muted-fg));
}

.no-results svg {
  width: 36px;
  height: 36px;
  stroke: rgb(var(--border));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  display: block;
  margin: 0 auto 10px;
}

.no-results p {
  font-size: 14px;
}

/* ── FOOTER ── */
.footer {
  border-top: 1px solid rgb(var(--border));
  font-size: .875rem;
  color: rgb(var(--muted-fg));
  margin-top: auto;
}

.footer-inner {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: rgb(var(--muted-fg));
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .18s;
}

.footer-link svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.footer-link:hover {
  color: rgb(var(--fg));
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 90;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .sidebar-toggle {
    display: flex !important;
  }

  .settings-main {
    padding: 1.75rem 1.1rem 3.5rem;
  }

  .topbar-inner {
    padding: 0 1.1rem;
  }
}

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .settings-searchbar {
    display: none;
  }

  .topbar-inner {
    justify-content: space-between;
  }

  .setting-item {
    flex-direction: column;
  }

  select {
    width: 100%;
  }

  .theme-picker {
    flex-direction: column;
  }

  .theme-card {
    min-width: unset;
  }

  .settings-section {
    padding: 1.25rem 1rem;
  }

  .radio-group {
    flex-wrap: wrap;
  }

  .radio-group label {
    flex: 1 1 auto;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
  }

  .color-picker-widget,
  .range-head {
    padding-left: 0;
  }

  .color-hex-input {
    width: 84px;
  }
}

/* ── BUTTON SHAPE STYLES (Default / Square / Futuristic) ── */
/* Square: no rounding at all */
html.btn-style-square .btn-primary,
html.btn-style-square .btn-secondary {
  border-radius: 0 !important;
  clip-path: none !important;
}

/* Futuristic: sharp cut corners (top-left + bottom-right), like a cyber/HUD button */
html.btn-style-futuristic .btn-primary,
html.btn-style-futuristic .btn-secondary {
  border-radius: 0 !important;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

/* btn-secondary has a real border, but clip-path slices straight through it at
   the cut corners, leaving the diagonal edges without an outline. Fix: drop the
   native border and fake it with a ::before behind the button, clipped to the
   exact same cut-corner shape but 1px larger on every side. Only that 1px ring
   remains visible, giving a continuous border that follows the cut too. */
html.btn-style-futuristic .btn-secondary {
  position: relative;
  border-color: transparent;
  background: rgb(var(--bg));
  z-index: 0;
}

html.btn-style-futuristic .btn-secondary::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: rgb(var(--border));
  clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px);
  z-index: -1;
}

/* ── BUTTON STYLE PICKER (settings UI) ── */
.button-style-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-style-card {
  position: relative;
  flex: 1 1 140px;
  min-width: 120px;
  border: 1.5px solid rgb(var(--border));
  border-radius: 0.75rem;
  padding: .9rem .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: rgb(var(--bg));
}

.button-style-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.button-style-card:hover {
  border-color: rgba(var(--primary) / .5);
}

.button-style-card:has(input:checked) {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / .2);
}

.button-style-preview-btn {
  width: 100%;
  height: 34px;
  background: rgb(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  pointer-events: none;
}

.button-style-preview-btn.style-default {
  border-radius: 0.5rem;
}

.button-style-preview-btn.style-square {
  border-radius: 0;
}

.button-style-preview-btn.style-futuristic {
  border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.button-style-card-label {
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.button-style-card:has(input:checked) .button-style-card-label {
  font-weight: 700;
  color: rgb(var(--primary));
}

/* ── SEARCH BAR STYLE PREVIEW (reuses .button-style-picker/.button-style-card) ── */
.search-style-preview-bar {
  width: 100%;
  height: 34px;
  background: rgb(var(--card));
  border: 1.5px solid rgb(var(--border));
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
  pointer-events: none;
}

.search-style-preview-bar svg {
  width: 14px;
  height: 14px;
  stroke: rgb(var(--muted-fg));
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-style-preview-bar .search-style-preview-dot {
  margin-left: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgb(var(--primary));
  flex-shrink: 0;
}

.search-style-preview-bar.style-default {
  border-radius: 9999px;
}

.search-style-preview-bar.style-default .search-style-preview-dot {
  border-radius: 50%;
}

.search-style-preview-bar.style-square {
  border-radius: 0;
}

.search-style-preview-bar.style-square .search-style-preview-dot {
  border-radius: 0;
}

.search-style-preview-bar.style-futuristic {
  border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.search-style-preview-bar.style-futuristic .search-style-preview-dot {
  border-radius: 0;
  clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

/* ── LOGO ICON PICKER (icon.php) ── */
.icon-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 2.5rem 1rem;
  margin-bottom: 1.5rem;
  border: 1.5px dashed rgb(var(--border));
  border-radius: 1rem;
  background: rgb(var(--bg));
}

.icon-preview-logo {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.icon-preview-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

.icon-preview-text {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -1px;
  color: rgb(var(--fg));
  margin: 0;
}

.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-picker-card {
  position: relative;
  flex: 1 1 120px;
  min-width: 100px;
  border: 1.5px solid rgb(var(--border));
  border-radius: 0.75rem;
  padding: .9rem .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: rgb(var(--bg));
}

.icon-picker-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.icon-picker-card:hover {
  border-color: rgba(var(--primary) / .5);
}

.icon-picker-card:has(input:checked) {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / .2);
}

.icon-picker-swatch {
  width: 100%;
  height: 56px;
  border-radius: 0.5rem;
  background: rgb(var(--card));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icon-picker-swatch img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: none;
}

.icon-picker-swatch svg {
  width: 22px;
  height: 22px;
  stroke: rgb(var(--muted-fg));
  pointer-events: none;
}

.icon-picker-swatch-none {
  color: rgb(var(--muted-fg));
}

.icon-picker-card-label {
  font-size: .82rem;
  font-weight: 500;
  text-align: center;
}

.icon-picker-card:has(input:checked) .icon-picker-card-label {
  font-weight: 700;
  color: rgb(var(--primary));
}
