*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-w: 258px;
  --topbar-h: 60px;
}

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 {
  display: flex;
  min-height: 100vh;
}

.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: 1.8;
  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-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;
}

.settings-chips {
  display: none;
  --chips-h: 52px;
}

.settings-chips-track {
  display: flex;
  align-items: center;
  gap: .4rem;
  height: var(--chips-h);
  padding: 0 1.1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.settings-chips-track::-webkit-scrollbar {
  display: none;
}

.settings-chips a {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .8rem;
  border: 1px solid rgb(var(--border));
  border-radius: 999px;
  background-color: rgb(var(--card));
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  color: rgb(var(--muted-fg));
  text-decoration: none;
  transition: background-color .12s, color .12s, border-color .12s;
}

.settings-chips a svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.settings-chips a:hover {
  color: rgb(var(--fg));
}

.settings-chips a.active {
  background-color: rgb(var(--primary-dim));
  border-color: transparent;
  color: rgb(var(--primary));
}

.settings-chips-sep {
  flex-shrink: 0;
  width: 1px;
  height: 20px;
  margin: 0 .2rem;
  background-color: rgb(var(--border));
}

.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: 1.8;
}

.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: 1.8;
  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: 1.8;
}

.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));
}

.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-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));
}

.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 {
  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));
}

#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 {
  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-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5%;
  overflow: hidden;
  background: rgb(var(--bg));
}

.theme-preview span {
  display: block;
  flex-shrink: 0;
  border-radius: 999px;
}

.theme-preview .tp-logo {
  position: relative;
  width: 12%;
  height: 4%;
  background: rgb(var(--fg) / .6);
}

.theme-preview .tp-logo::before {
  content: '';
  position: absolute;
  top: 50%;
  right: calc(100% + 3px);
  height: 160%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgb(var(--primary) / .8);
}

.theme-preview .tp-search {
  position: relative;
  width: 38%;
  height: 7%;
  border: 1px solid rgb(var(--border));
}

.theme-preview .tp-search::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 3%;
  height: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgb(var(--fg) / .35);
}

.theme-preview .tp-dots {
  display: flex;
  gap: 4px;
}

.theme-preview .tp-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgb(var(--fg) / .3);
}

.theme-preview .tp-dots i:nth-child(2) {
  background: rgb(var(--fg) / .85);
}

.theme-preview .tp-line {
  width: 20%;
  height: 2.5%;
  background: rgb(var(--border));
}

.theme-preview--minimal::before,
.theme-preview--orbit::before {
  content: '';
  position: absolute;
  top: 6%;
  left: 4%;
  right: 4%;
  height: 4px;
  --tp-dot: radial-gradient(circle, rgb(var(--fg) / .45) 1.6px, transparent 2px);
  background:
    var(--tp-dot) no-repeat right 0 center / 4px 4px,
    var(--tp-dot) no-repeat right 7px center / 4px 4px,
    linear-gradient(rgb(var(--fg) / .45), rgb(var(--fg) / .45)) no-repeat left 0 center / 5px 1.5px,
    linear-gradient(rgb(var(--fg) / .3), rgb(var(--fg) / .3)) no-repeat left 8px center / 9px 2px;
}

.theme-preview--minimal::after,
.theme-preview--orbit::after {
  content: '';
  position: absolute;
  right: 4%;
  bottom: 7%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid rgb(var(--fg) / .4);
}

.theme-preview--orbit {
  background:
    radial-gradient(130% 75% at 50% -22%, rgb(var(--primary) / .2), transparent 70%),
    rgb(var(--bg));
}

.theme-preview--orbit .tp-search {
  border-color: rgb(var(--fg) / .1);
  background: linear-gradient(180deg, rgb(255 255 255 / .55), transparent 60%), rgb(var(--bg));
  box-shadow: 0 1px 1px rgb(20 20 30 / .06), 0 3px 8px rgb(20 20 30 / .1), inset 0 1px 0 rgb(255 255 255 / .75);
}

.dark .theme-preview--orbit .tp-search {
  background: linear-gradient(180deg, rgb(255 255 255 / .07), transparent 60%), rgb(var(--bg));
  box-shadow: 0 1px 1px rgb(0 0 0 / .3), 0 3px 8px rgb(0 0 0 / .45), inset 0 1px 0 rgb(255 255 255 / .07);
}

.theme-preview--orbit .tp-search::after {
  background: linear-gradient(155deg, color-mix(in srgb, rgb(var(--primary)) 78%, #fff), rgb(var(--primary)));
  box-shadow: 0 0 5px rgb(var(--primary) / .45);
}

.theme-preview--orbit .tp-dots i {
  background: rgb(var(--fg) / .22);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12), 0 1px 2px rgb(0 0 0 / .25);
}

.theme-preview--orbit .tp-dots i:nth-child(2) {
  background: rgb(var(--primary));
}

.theme-preview--lite .tp-search::after {
  display: none;
}

.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;
}

.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: 1.8;
}

.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: 1.8;
}

.btn-secondary:hover {
  background: rgb(var(--muted));
}

.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;
}

.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 {
  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.8;
  display: block;
  margin: 0 auto 10px;
}

.no-results p {
  font-size: 14px;
}

.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: 1.8;
}

.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;
  }

  .settings-chips {
    display: block;
    position: sticky;
    top: var(--topbar-h);
    z-index: 19;
    border-bottom: 1px solid rgb(var(--border));
    background-color: rgb(var(--bg) / .85);
    backdrop-filter: blur(10px);
  }

  .section-group {
    scroll-margin-top: calc(var(--topbar-h) + 52px + 1rem);
  }
}

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .settings-searchbar {
    max-width: none;
  }

  .topbar-inner {
    justify-content: space-between;
    gap: .5rem;
  }

  .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;
  }
}

html.btn-style-square .btn-primary,
html.btn-style-square .btn-secondary {
  border-radius: 0 !important;
  clip-path: none !important;
}

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);
}

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 {
  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-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: 1.8;
  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);
}

.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));
}

.icon-style-preview {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.icon-style-preview svg {
  width: 18px;
  height: 18px;
  stroke: rgb(var(--primary));
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.fx-setting .fx-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .75rem 0 1.25rem 42px;
}

.fx-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.fx-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fx-chip span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg));
  color: rgb(var(--muted-fg));
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background .15s, border-color .15s, color .15s;
}

.fx-chip:hover span {
  border-color: rgb(var(--primary));
  color: rgb(var(--fg));
}

.fx-chip input:checked + span {
  background: rgb(var(--primary) / .12);
  border-color: rgb(var(--primary));
  color: rgb(var(--primary));
}

.fx-chip input:checked + span::before {
  content: "✓";
  font-size: .75rem;
}

.fx-chip input:focus-visible + span {
  outline: 2px solid rgb(var(--primary));
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .fx-setting .fx-picker { margin-left: 0; }
}

.bg-preview-setting .bg-preview {
  width: calc(100% - 42px);
  max-width: 560px;
  aspect-ratio: 16 / 7;
  margin: .75rem 0 1.25rem 42px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg));
  box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}

.bg-preview-setting .bg-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

@media (max-width: 768px) {
  .bg-preview-setting .bg-preview {
    width: min(100%, 300px);
    margin-left: auto;
    margin-right: auto;
  }
}

.app-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .75rem;
}

.app-icon-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  min-width: 5.75rem;
  padding: .7rem .8rem .6rem;
  border: 2px solid rgb(var(--border));
  border-radius: 0.9rem;
  background-color: rgb(var(--muted));
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}

.app-icon-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.app-icon-option img {
  width: 60px;
  height: 60px;
  border-radius: 22%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.app-icon-option span {
  font-size: .85rem;
  font-weight: 600;
}

.app-icon-option:has(input:checked) {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(var(--primary) / 0.2);
}

.app-icon-option:has(input:focus-visible) {
  outline: 2px solid rgb(var(--primary));
  outline-offset: 2px;
}

.app-icon-option:active {
  transform: scale(.97);
}

#appIconItem[hidden] {
  display: none;
}

.tab-order-item {
    flex-wrap: wrap;
}

.tab-order {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    min-width: 230px;
}

.tab-order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.tab-order-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .4rem .35rem .7rem;
    border: 1px solid rgb(var(--border));
    border-radius: .65rem;
    background: rgb(var(--bg));
    transition: transform .18s ease, opacity .18s ease;
}

.tab-order-row > svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: rgb(var(--primary));
}

.tab-order-row.is-off {
    opacity: .5;
}

.tab-order-label {
    flex: 1;
    font-size: .88rem;
}

.tab-order-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: .5rem;
    background: transparent;
    color: rgb(var(--muted-fg));
    cursor: pointer;
}

.tab-order-btn svg {
    width: 16px;
    height: 16px;
}

.tab-order-btn:hover:not(:disabled) {
    border-color: rgb(var(--border));
    color: rgb(var(--primary));
}

.tab-order-btn:disabled {
    opacity: .3;
    cursor: default;
}

.tab-order-row.is-moved {
    animation: tab-order-flash .5s ease;
}

@keyframes tab-order-flash {
    from {
        background: rgb(var(--primary) / .15);
    }
}

html.hide-ai .tab-order-row[data-type="ai"] {
    display: none;
}

.unsaved-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px;
  border-radius: 14px;
  background: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.12);
  color: rgb(var(--fg));
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.unsaved-bar.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.unsaved-actions {
  display: flex;
  gap: 8px;
}

.unsaved-btn {
  padding: 7px 16px;
  border-radius: var(--btn-radius, 0.5rem);
  border: 1px solid rgb(var(--border));
  background: none;
  color: rgb(var(--fg));
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.unsaved-btn:hover {
  background: rgb(var(--muted));
}

.unsaved-btn-save {
  border-color: transparent;
  background: rgb(var(--primary));
  color: #fff;
}

.unsaved-btn-save:hover {
  background: rgb(var(--primary));
  opacity: 0.9;
}

.footer-actions [hidden] {
  display: none;
}

@media (max-width: 480px) {
  .footer-actions {
    flex-wrap: wrap;
  }

  .footer-actions .btn-primary {
    flex: 1 1 100%;
  }
}

.setting-desc a {
  color: rgb(var(--primary));
  font-weight: 600;
  text-decoration: none;
}

.setting-desc a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.search-block-hidden,
.setting-item.search-item-hidden,
.settings-section.search-hidden {
  display: none !important;
}

@media (min-width: 861px) {
  .settings-searchbar {
    position: absolute;
    top: 50%;
    left: calc(50% - var(--sidebar-w) / 2);
    width: min(380px, calc(100% - var(--sidebar-w) - 2rem));
    max-width: none;
    transform: translate(-50%, -50%);
  }
}
