/* ===== THEME HUB (L3) — scoped to #settingsL3Theme ===== */
#settingsL3Theme {
  position: absolute;
  inset: 0;
  z-index: 28;
  background: var(--colorNeutralBackground1, #f5f5f5);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2,0.9,0.3,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#settingsL3Theme.visible {
  transform: translateX(0);
}

/* ── Header ── */
#settingsL3Theme .settings-l3-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
  background: var(--colorNeutralBackground1, #f5f5f5);
  position: sticky;
  top: 0;
  z-index: 2;
}
#settingsL3Theme .settings-l3-back {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 40px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  color: var(--colorBrandForeground1, #2169eb);
}
#settingsL3Theme .settings-l3-back svg {
  width: 12px;
  height: 20px;
}
.settings-l3-title-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.settings-l3-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--colorNeutralForeground1, #242424);
  letter-spacing: -0.43px;
}
#settingsL3Theme .settings-l3-done {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  color: var(--colorBrandForeground1, #2169eb);
  letter-spacing: -0.43px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

/* Beta badge */
.settings-beta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: #ebebeb;
  font-size: 14px;
  font-weight: 400;
  color: rgba(39,35,32,1);
  line-height: 18px;
  flex-shrink: 0;
}

/* ── Preview area — two phone mockups matching Figma node 2581-3313 ── */
.theme-preview-area {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 12px 16px 16px;
  align-items: flex-start;
}

/* Left phone: dark NTP with wallpaper */
.theme-preview-left {
  width: 140px;
  height: 258px;
  border-radius: 12.564px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #0c0c40;
  box-shadow:
    0px 3.784px 8.257px 0px rgba(51,51,51,0.10),
    0px 15.137px 15.137px 0px rgba(51,51,51,0.09),
    0px 34.403px 20.642px 0px rgba(51,51,51,0.05),
    0px 61.237px 24.426px 0px rgba(51,51,51,0.01);
}
.theme-preview-wallpaper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 4 shortcut icons (frosted glass) */
.theme-preview-shortcuts {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}
.theme-preview-shortcut-icon {
  width: 21.5px;
  height: 21.5px;
  border-radius: 7.2px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  flex-shrink: 0;
}

/* Omni bar on left phone */
.theme-preview-omni {
  position: absolute;
  bottom: 21px;
  left: 7px;
  right: 7px;
  height: 17px;
  border-radius: 28px;
  background: rgba(255,255,255,0.7);
  border: 0.179px solid rgba(0,0,0,0.06);
  box-shadow: 0px 3.949px 7.538px 0px rgba(0,0,0,0.07);
}

/* Right phone: browser with acrylic toolbar */
.theme-preview-right {
  width: 140px;
  height: 258px;
  border-radius: 12.564px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #fff;
  box-shadow:
    0px 3.784px 8.257px 0px rgba(51,51,51,0.10),
    0px 15.137px 15.137px 0px rgba(51,51,51,0.09),
    0px 34.403px 20.642px 0px rgba(51,51,51,0.05),
    0px 61.237px 24.426px 0px rgba(51,51,51,0.01);
  display: flex;
  flex-direction: column;
}

/* Page content area in right phone */
.theme-preview-page-content {
  flex: 1;
  padding: 12px 17px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  background: white;
}
.theme-preview-page-block {
  width: 99px;
  height: 47px;
  border-radius: 8px;
  background: #f0f0f0;
  flex-shrink: 0;
}
.theme-preview-page-bar {
  height: 8px;
  border-radius: 8px;
  background: #f0f0f0;
  flex-shrink: 0;
}

/* Toolbar — acrylic with accent color */
.theme-preview-toolbar {
  flex-shrink: 0;
  background: var(--theme-toolbar-bg, #2169eb);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  transition: background-color 0.2s ease;
  border-radius: 0 0 12.564px 12.564px;
  padding: 2px 4px 0;
}
.theme-preview-toolbar-omni {
  height: 18px;
  border-radius: 28px;
  background: rgba(255,255,255,0.7);
  border: 0.179px solid rgba(255,255,255,0.24);
  box-shadow: 0px 3.949px 7.538px 0px rgba(0,0,0,0.07);
  margin: 0 1px 2px;
}
.theme-preview-toolbar-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 16px;
}
.theme-preview-toolbar-icon {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: rgba(255,255,255,0.8);
}
.theme-preview-home-indicator {
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-preview-home-indicator::after {
  content: '';
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.5);
}

/* ── Colors section ── */
.theme-colors-label {
  font-size: 13px;
  font-weight: 400;
  color: rgba(0,0,0,0.56);
  letter-spacing: -0.08px;
  text-transform: uppercase;
  padding: 8px 20px 4px;
}

/* Swatch card */
.theme-swatch-card {
  background: rgba(255,255,255,0.85);
  border-radius: 21px;
  margin: 0 16px 8px;
  padding: 16px 16px 16px 23px;
  position: relative;
  overflow: hidden;
  min-height: 82px;
}
.theme-swatch-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Reserve room for the selected swatch's outer ring (extends 5px outside the circle) */
  padding: 6px 6px 6px 6px;
  margin: -6px 0;
}
.theme-swatch-row::-webkit-scrollbar { display: none; }

/* Each swatch button — 50px, inner circle fills button (50px), tintLight=top-half, tintMid=bottom-right quadrant */
.theme-swatch {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Selected state: show outer ring via box-shadow matching Figma reference */
.theme-swatch.selected {
  box-shadow: 0 0 0 2px white, 0 0 0 5px #0078d4;
  border-radius: 50%;
}

/* Inner circle: same 48px as button, overflow:hidden clips tints */
.theme-swatch-inner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
}

/* Base color fills the whole circle */
.theme-swatch-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
/* tintLight: top half, full width */
.theme-swatch-tint-light {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
}
/* tintMid: bottom-right quadrant */
.theme-swatch-tint-mid {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 50%;
}
/* White inset ring */
.theme-swatch-white-ring {
  position: absolute;
  inset: 1.5px;
  border-radius: 50%;
  border: 1.5px solid white;
  pointer-events: none;
}
/* Check icon on selected swatch */
.theme-swatch-check {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.theme-swatch.selected .theme-swatch-check {
  display: flex;
}

/* Scroll fade arrows for swatch row */
.theme-swatch-scroll-right,
.theme-swatch-scroll-left {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  display: none;
  align-items: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.theme-swatch-scroll-right {
  right: 0;
  border-radius: 0 21px 21px 0;
  justify-content: flex-end;
  padding-right: 6px;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 60%, rgba(255,255,255,1) 100%);
}
.theme-swatch-scroll-left {
  left: 0;
  border-radius: 21px 0 0 21px;
  justify-content: flex-start;
  padding-left: 6px;
  background: linear-gradient(to left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 60%, rgba(255,255,255,1) 100%);
}
.theme-swatch-scroll-right.visible,
.theme-swatch-scroll-left.visible {
  display: flex;
}
.theme-swatch-scroll-chevron {
  width: 16px;
  height: 16px;
  color: #999;
}

/* ── Themes section ── */
.theme-themes-label {
  font-size: 13px;
  font-weight: 400;
  color: rgba(0,0,0,0.56);
  letter-spacing: -0.08px;
  text-transform: uppercase;
  padding: 8px 20px 2px;
}
.theme-themes-desc {
  font-size: 13px;
  font-weight: 400;
  color: rgba(0,0,0,0.56);
  letter-spacing: -0.08px;
  padding: 0 20px 4px;
}

/* Theme card container */
.theme-card-container {
  background: rgba(255,255,255,0.8);
  border-radius: 21px;
  margin: 0 16px;
  padding: 16px;
}
.theme-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
/* Each card */
.theme-card {
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 0.55;
  -webkit-tap-highlight-color: transparent;
  border: 3px solid transparent;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
  display: block;
  background: #e0e0e0;
  padding: 0;
}
.theme-card.selected {
  border-color: #0078d4;
}
.theme-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 9px;
}

/* "Current" badge overlay at bottom of current card */
.theme-card-current-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  height: 17px;
  padding: 0 8px;
  border-radius: 8.5px;
  background: rgba(0,0,0,0.86);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  letter-spacing: -0.08px;
  pointer-events: none;
  z-index: 2;
}

/* ── Reset button row ── */
.theme-reset-row {
  background: white;
  border-radius: 21px;
  margin: 8px 16px 32px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-reset-btn {
  background: none;
  border: none;
  font-size: 17px;
  font-weight: 400;
  color: #2169eb;
  letter-spacing: -0.43px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.theme-reset-btn:active {
  opacity: 0.6;
}

/* ── Settings L2 additions ── */
.settings-section-label {
  font-size: 12px;
  font-weight: 500;
  color: #8e8e93;
  letter-spacing: 0.04em;
  padding: 16px 16px 6px;
  text-transform: uppercase;
}
.settings-color-mode-check {
  display: none;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.settings-color-mode-row.selected .settings-color-mode-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Color mode */
html[data-color-mode='dark']  { color-scheme: dark; }
html[data-color-mode='light'] { color-scheme: light; }
