:root {
  --clock-color: #ffffff;
  --clock-size: 14vw;
  --date-size: 2vw;
  --overlay-opacity: 0.35;
  --clock-font: 'Inter', system-ui, sans-serif;
  --clock-weight: 100;
  --transition-ms: 1500;
}

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

html, body { width: 100%; background: #000; }
body { font-family: 'Inter', system-ui, sans-serif; color: #fff; }

/* Clock page: lock to viewport, no scroll */
html:has(body.clock-page),
body.clock-page { height: 100%; overflow: hidden; }

/* ============================================================
 * CLOCK PAGE — background, overlay, HUD
 * ============================================================ */
.clock-page { cursor: none; }
.clock-page.show-cursor { cursor: default; }

.bg-layer {
  position: fixed; inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity calc(var(--transition-ms) * 1ms) ease-in-out;
  z-index: 0;
}
.bg-layer.active { opacity: 1; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, var(--overlay-opacity));
  z-index: 1;
  pointer-events: none;
  transition: background 400ms;
}

.clock-wrap {
  position: fixed; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.clock-wrap[data-pos="top"]     { justify-content: flex-start; padding-top: 8vh; }
.clock-wrap[data-pos="bottom"]  { justify-content: flex-end;   padding-bottom: 8vh; }
.clock-wrap[data-pos="left"]    { align-items: flex-start;     padding-left: 6vw; }
.clock-wrap[data-pos="right"]   { align-items: flex-end;       padding-right: 6vw; }
.clock-wrap[data-pos="top-left"]    { justify-content: flex-start; align-items: flex-start; padding: 8vh 0 0 6vw; }
.clock-wrap[data-pos="top-right"]   { justify-content: flex-start; align-items: flex-end;   padding: 8vh 6vw 0 0; }
.clock-wrap[data-pos="bottom-left"] { justify-content: flex-end;   align-items: flex-start; padding: 0 0 8vh 6vw; }
.clock-wrap[data-pos="bottom-right"]{ justify-content: flex-end;   align-items: flex-end;   padding: 0 6vw 8vh 0; }

/* ============================================================
 * DIGITAL CLOCK — slots + layers (4 animation modes)
 * ============================================================ */
.time {
  font-family: var(--clock-font);
  font-weight: var(--clock-weight);
  font-size: var(--clock-size);
  color: var(--clock-color);
  line-height: 1;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-variant-numeric: tabular-nums;
}

.time .sep {
  opacity: 0.5;
  margin: 0 0.05em;
  animation: pulse 1s ease-in-out infinite;
  display: inline-block;
}

@keyframes pulse { 50% { opacity: 0.2; } }

.time .ampm {
  font-size: 0.25em;
  margin-left: 0.4em;
  opacity: 0.7;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.time .sec-wrap { display: inline; }

/* digit slot — reserves space via invisible sizer, layers stack on top */
.slot {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
  text-align: center;
}
.slot .sizer {
  visibility: hidden;
  display: inline-block;
}
.slot .layer {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  display: inline-block;
  will-change: transform, opacity;
}
.slot .layer.current { /* default rest state — animation transitions to/from here */ }

/* --- anim-none: no transition, no overlap --- */
.time.anim-none .slot { overflow: visible; }
.time.anim-none .slot .layer { position: static; width: auto; }
.time.anim-none .slot .sizer { display: none; }

/* --- anim-fade --- */
.time.anim-fade .slot .layer {
  transition: opacity 350ms ease-in-out;
}
.time.anim-fade .slot .layer.incoming { opacity: 0; }
.time.anim-fade .slot .layer.leaving  { opacity: 0; }

/* --- anim-slide (odometer) --- */
.slot { overflow: hidden; }  /* clip the sliding digit */
.time.anim-slide .slot { overflow: hidden; }
.time.anim-slide .slot .layer {
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1), opacity 500ms;
}
.time.anim-slide .slot .layer.incoming {
  transform: translateY(-100%);
  opacity: 0;
}
.time.anim-slide .slot .layer.leaving {
  transform: translateY(100%);
  opacity: 0;
}

/* --- anim-flip (3D card flip) --- */
.time.anim-flip .slot { perspective: 600px; overflow: visible; }
.time.anim-flip .slot .layer {
  transform-origin: center;
  backface-visibility: hidden;
  transition: transform 500ms cubic-bezier(0.55, 0, 0.1, 1), opacity 300ms;
}
.time.anim-flip .slot .layer.incoming {
  transform: rotateX(-90deg);
  opacity: 0;
}
.time.anim-flip .slot .layer.leaving {
  transform: rotateX(90deg);
  opacity: 0;
}

/* ============================================================
 * DATE
 * ============================================================ */
.date {
  font-family: var(--clock-font);
  font-weight: 300;
  font-size: var(--date-size);
  color: var(--clock-color);
  opacity: 0.85;
  margin-bottom: 0.5em;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.date:empty { display: none; }
.analog-date, .word-date, .binary-date {
  margin-top: 1em;
  margin-bottom: 0;
}

/* ============================================================
 * ANALOG CLOCK (SVG)
 * ============================================================ */
.mode-analog .analog-clock {
  width: calc(var(--clock-size) * 2.5);
  height: calc(var(--clock-size) * 2.5);
  max-width: 80vh;
  max-height: 80vh;
}
.analog-clock .face {
  fill: rgba(0,0,0,0.25);
  stroke: var(--clock-color);
  stroke-width: 1.5;
  opacity: 0.35;
}
.analog-clock .tick {
  stroke: var(--clock-color);
  stroke-width: 1;
  opacity: 0.4;
}
.analog-clock .tick.major {
  stroke-width: 2.5;
  opacity: 0.9;
}
.analog-clock .hand {
  stroke: var(--clock-color);
  stroke-linecap: round;
}
.analog-clock .hand.hour   { stroke-width: 5; }
.analog-clock .hand.minute { stroke-width: 3; }
.analog-clock .hand.second {
  stroke-width: 1.5;
  stroke: #ff6b6b;
  filter: drop-shadow(0 0 4px rgba(255,107,107,0.6));
}
.analog-clock .center-pin {
  fill: var(--clock-color);
}

/* ============================================================
 * WORD CLOCK (Italian)
 * ============================================================ */
.word-clock {
  font-family: var(--clock-font);
  font-weight: var(--clock-weight);
  color: var(--clock-color);
  text-align: center;
  line-height: 1.05;
}
.word-pre {
  font-size: calc(var(--clock-size) * 0.3);
  opacity: 0.65;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}
.word-hour {
  font-size: var(--clock-size);
  text-transform: lowercase;
  letter-spacing: -0.01em;
}
.word-min {
  font-size: calc(var(--clock-size) * 0.42);
  opacity: 0.85;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  min-height: 0.5em;
}
.word-secs {
  font-family: 'JetBrains Mono', monospace;
  font-size: calc(var(--clock-size) * 0.14);
  opacity: 0.5;
  letter-spacing: 0.2em;
  margin-top: 0.8em;
}

/* ============================================================
 * BINARY CLOCK (BCD)
 * ============================================================ */
.binary-clock {
  --bin-dot: calc(var(--clock-size) * 0.18);
  display: flex; flex-direction: column; align-items: center;
}
.bin-grid {
  display: flex;
  align-items: center;
  gap: calc(var(--bin-dot) * 0.35);
}
.bin-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--bin-dot) * 0.3);
}
.bin-label, .bin-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: calc(var(--bin-dot) * 0.45);
  color: var(--clock-color);
  opacity: 0.4;
  letter-spacing: 0.05em;
}
.bin-val {
  margin-top: calc(var(--bin-dot) * 0.2);
  font-size: calc(var(--bin-dot) * 0.7);
  opacity: 0.8;
}
.bin-dot {
  width: var(--bin-dot);
  height: var(--bin-dot);
  border-radius: 50%;
  border: 2px solid var(--clock-color);
  opacity: 0.25;
  transition: opacity 200ms, background 200ms, box-shadow 200ms;
}
.bin-dot.on {
  background: var(--clock-color);
  opacity: 1;
  box-shadow: 0 0 calc(var(--bin-dot) * 0.4) var(--clock-color);
}
.bin-dot.disabled {
  border-color: transparent;
  opacity: 0;
}
.bin-sep {
  font-family: 'JetBrains Mono', monospace;
  font-size: calc(var(--bin-dot) * 1.5);
  color: var(--clock-color);
  opacity: 0.4;
  animation: pulse 1s ease-in-out infinite;
}

/* ============================================================
 * HUD
 * ============================================================ */
.hud {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  display: flex; gap: 0.5rem;
  z-index: 10;
  opacity: 0;
  transition: opacity 300ms;
  align-items: center;
}
.hud.visible { opacity: 1; }

.hud-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms, transform 200ms;
}
.hud-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.sync-status {
  font-size: 11px;
  opacity: 0.7;
  padding: 0 8px;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
 * SETTINGS PAGE — visual pickers + glass aesthetic
 * ============================================================ */

:root {
  --accent: #8b9cff;
  --accent-strong: #6b80ff;
  --bg-base: #0a0a10;
  --panel-bg: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-strong: rgba(255, 255, 255, 0.14);
  --text-1: rgba(255, 255, 255, 0.96);
  --text-2: rgba(255, 255, 255, 0.65);
  --text-3: rgba(255, 255, 255, 0.42);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

.settings-page {
  cursor: default;
  background: var(--bg-base);
  color: var(--text-1);
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  padding-bottom: 120px;
}

/* ----- Ambient blurred panorama backdrop ----- */
.ambient-bg {
  position: fixed; inset: -10vw;
  background-size: cover;
  background-position: center;
  filter: blur(80px) saturate(1.4) brightness(0.6);
  z-index: -2;
  transition: background-image 1.5s ease-in-out;
  transform: scale(1.2);
}
.ambient-veil {
  position: fixed; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(10,10,16,0.4) 0%, rgba(10,10,16,0.85) 60%, rgba(10,10,16,0.98) 100%);
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
 * HERO — live preview + nav
 * ============================================================ */
.hero {
  padding: 1.5rem 2rem 2.5rem;
  max-width: 1180px;
  margin: 0 auto;
}

.hero-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.75rem;
}

.nav-back {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  transition: all 200ms;
  flex-shrink: 0;
}
.nav-back:hover { color: var(--text-1); border-color: var(--panel-border-strong); transform: translateX(-2px); }

.nav-title {
  flex: 1;
}
.nav-title-eyebrow {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.nav-title h1 {
  font-size: 1.6rem;
  font-weight: 200;
  letter-spacing: -0.01em;
  color: var(--text-1);
  line-height: 1.1;
}

.nav-actions {
  display: flex; gap: 0.5rem;
  flex-shrink: 0;
}

/* Buttons */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 180ms;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(107, 128, 255, 0.6);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(107, 128, 255, 0.7);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--panel-bg);
  border-color: var(--panel-border);
  color: var(--text-2);
  backdrop-filter: blur(20px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-1);
  border-color: var(--panel-border-strong);
}

/* Hero preview */
.hero-preview {
  position: relative;
  width: 100%;
  min-height: 60vh;
  max-height: 70vh;
  border-radius: 24px;
  overflow: hidden;
  background-size: cover; background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 20px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  /* preview clock scales relative to hero size; vars override the renderer's defaults */
  --clock-size: 120px;
  --date-size: 16px;
  isolation: isolate;
}
.hero-preview::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0, var(--overlay-opacity));
  z-index: 1;
}

.preview-clock {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-shadow: 0 4px 30px rgba(0,0,0,0.6);
  padding: 2rem;
}
.preview-clock.mode-analog .analog-clock {
  width: 320px; height: 320px;
}
.preview-clock.mode-binary { --clock-size: 80px; }
.preview-clock.mode-word   { --clock-size: 100px; }

.hero-hint {
  position: absolute;
  bottom: 1rem; left: 0; right: 0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.55);
  z-index: 3;
  text-transform: uppercase;
  pointer-events: none;
}

/* ============================================================
 * CONTAINER + PANELS
 * ============================================================ */
.settings-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(40px) saturate(1.3);
  -webkit-backdrop-filter: blur(40px) saturate(1.3);
  box-shadow: 0 8px 32px -16px rgba(0,0,0,0.4);
}

.panel-head {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--panel-border);
}
.panel-head h2 {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 0.35rem;
  color: var(--text-1);
}
.panel-head p {
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 400;
}

/* ============================================================
 * STYLE CARDS (clock type grid)
 * ============================================================ */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}
.style-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: rgba(255,255,255,0.025);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 0;
  cursor: pointer;
  transition: all 200ms;
  font-family: inherit;
  color: var(--text-1);
  overflow: hidden;
}
.style-card:hover {
  border-color: var(--panel-border-strong);
  background: rgba(255,255,255,0.05);
  transform: translateY(-2px);
}
.style-card.active {
  border-color: var(--accent);
  background: rgba(107, 128, 255, 0.12);
  box-shadow:
    0 0 0 4px rgba(107, 128, 255, 0.15),
    0 12px 30px -12px rgba(107, 128, 255, 0.5);
}
.style-card-art {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
  border-bottom: 1px solid var(--panel-border);
  position: relative;
  overflow: hidden;
}
.style-card-info {
  padding: 0.75rem 0.9rem 0.9rem;
}
.style-card-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}
.style-card-desc {
  font-size: 0.75rem;
  color: var(--text-3);
  line-height: 1.3;
}

/* Mini art per style */
.art-digital-min {
  font-family: 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 200;
  letter-spacing: -0.02em;
}
.art-fade {
  font-family: 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 200;
  position: relative;
}
.art-fade .ghost {
  position: absolute;
  top: 4px; left: 4px;
  opacity: 0.4;
  filter: blur(0.5px);
}
.art-slide {
  font-family: 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 200;
  display: flex; align-items: center; gap: 0.4em;
  color: var(--text-1);
}
.art-flip {
  font-family: 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 200;
  transform: perspective(80px) rotateX(28deg);
  transform-origin: center bottom;
}
.art-analog {
  width: 70px; height: 70px;
}
.art-analog .art-face   { fill: transparent; stroke: rgba(255,255,255,0.3); stroke-width: 1.5; }
.art-analog .art-hour   { stroke: var(--text-1); stroke-width: 3; stroke-linecap: round; }
.art-analog .art-minute { stroke: var(--text-1); stroke-width: 2; stroke-linecap: round; }
.art-analog .art-second { stroke: #ff6b6b; stroke-width: 1; stroke-linecap: round; }
.art-analog .art-pin    { fill: var(--text-1); }
.art-word {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  text-align: center;
  line-height: 1.05;
  color: var(--text-1);
}
.art-word small { display: block; font-size: 0.6rem; opacity: 0.55; letter-spacing: 0.1em; text-transform: lowercase; }
.art-word strong { display: block; font-size: 1.6rem; font-weight: 400; text-transform: lowercase; }
.art-word span { display: block; font-size: 0.75rem; opacity: 0.85; text-transform: lowercase; }
.art-binary {
  display: grid;
  grid-template-columns: repeat(6, 8px);
  grid-template-rows: repeat(4, 8px);
  gap: 5px;
}
.art-binary .b {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
}
.art-binary .b.on {
  background: var(--text-1);
  border-color: var(--text-1);
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
}

/* ============================================================
 * FONT STRIP
 * ============================================================ */
.font-strip {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: -0.5rem;
  padding: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
}
.font-strip::-webkit-scrollbar { width: 6px; }
.font-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.font-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}
.font-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}
.font-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.5rem 0.7rem;
  background: rgba(255,255,255,0.025);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 180ms;
  color: var(--text-1);
  text-align: center;
  min-height: 88px;
}
.font-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--panel-border-strong);
  transform: translateY(-1px);
}
.font-card.active {
  border-color: var(--accent);
  background: rgba(107, 128, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(107, 128, 255, 0.18);
}
.font-card-sample {
  font-size: 1.5rem;
  line-height: 1;
  font-feature-settings: 'tnum';
}
.font-card-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* ============================================================
 * ROWS (color, weight, sliders, position)
 * ============================================================ */
.row {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.row:last-child { border-bottom: none; }
.row:first-of-type { padding-top: 0.25rem; }

.row-label {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.row-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-1);
}
.row-sub {
  font-size: 0.78rem;
  color: var(--text-3);
}

.row-position {
  align-items: flex-start;
  padding: 1.5rem 0;
}

/* ----- Color picker ----- */
.color-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}
.swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 150ms, box-shadow 150ms;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.08);
}
.swatch:hover { transform: scale(1.1); }
.swatch.active {
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.4),
    0 0 0 2px var(--bg-base),
    0 0 0 4px var(--accent);
}
.swatch[data-color="#000000"] {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.3),
    0 0 0 1px rgba(255,255,255,0.08);
}
.swatch.swatch-custom {
  background: conic-gradient(from 0deg, #ff6b6b, #ffd700, #50fa7b, #8be9fd, #bd93f9, #ff79c6, #ff6b6b);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  overflow: hidden;
}
.swatch.swatch-custom input[type="color"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
}
.swatch.swatch-custom svg { pointer-events: none; mix-blend-mode: difference; }

/* ----- Pill group (weights) ----- */
.pill-group {
  display: flex;
  gap: 0.3rem;
  background: rgba(0,0,0,0.3);
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  flex-wrap: wrap;
}
.pill {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 180ms;
}
.pill:hover { color: var(--text-1); background: rgba(255,255,255,0.04); }
.pill.active {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(107, 128, 255, 0.6);
}

/* ----- Sliders with floating value chip ----- */
.slider-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.slider-wrap input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right,
    var(--accent-strong) 0%,
    var(--accent-strong) var(--pct, 0%),
    rgba(255,255,255,0.12) var(--pct, 0%),
    rgba(255,255,255,0.12) 100%);
  outline: none;
  cursor: pointer;
}
.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-strong);
  cursor: grab;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.5);
  transition: transform 150ms;
}
.slider-wrap input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-wrap input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-strong);
  cursor: grab;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.5);
}
.slider-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-1);
  font-weight: 500;
  min-width: 64px;
  text-align: right;
  padding: 0.35rem 0.7rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

/* ----- Position picker (3x3 in mini-screen) ----- */
.position-picker {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}
.position-screen {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 9;
  background: rgba(0,0,0,0.45);
  border: 1.5px solid var(--panel-border);
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 14px;
  gap: 4px;
  position: relative;
}
.position-screen::before {
  content: '';
  position: absolute;
  top: 6px; right: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,107,107,0.4);
}
.position-dot {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 150ms;
}
.position-dot:hover { background: rgba(255,255,255,0.04); }
.position-dot::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 180ms;
}
.position-dot:hover::after { background: rgba(255,255,255,0.6); transform: scale(1.2); }
.position-dot.active::after {
  background: var(--accent);
  width: 16px; height: 16px;
  box-shadow: 0 0 12px var(--accent), 0 0 0 4px rgba(107,128,255,0.15);
}

/* Position dots within the grid use alignment to match the actual clock position */
.position-dot[data-value="top-left"]     { justify-content: flex-start; align-items: flex-start; }
.position-dot[data-value="top"]          { justify-content: center;     align-items: flex-start; }
.position-dot[data-value="top-right"]    { justify-content: flex-end;   align-items: flex-start; }
.position-dot[data-value="left"]         { justify-content: flex-start; align-items: center; }
.position-dot[data-value="center"]       { justify-content: center;     align-items: center; }
.position-dot[data-value="right"]        { justify-content: flex-end;   align-items: center; }
.position-dot[data-value="bottom-left"]  { justify-content: flex-start; align-items: flex-end; }
.position-dot[data-value="bottom"]       { justify-content: center;     align-items: flex-end; }
.position-dot[data-value="bottom-right"] { justify-content: flex-end;   align-items: flex-end; }

/* ============================================================
 * TOGGLE CARDS
 * ============================================================ */
.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.toggle-grid.one-col { grid-template-columns: 1fr; margin-top: 1rem; }
.toggle-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: rgba(255,255,255,0.025);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 180ms;
}
.toggle-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--panel-border-strong);
}
.toggle-card input { display: none; }
.toggle-card-info { flex: 1; }
.toggle-card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 0.1rem;
}
.toggle-card-desc {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.3;
}
.toggle-switch {
  position: relative;
  width: 40px; height: 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 200ms;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.toggle-card input:checked ~ .toggle-switch {
  background: var(--accent-strong);
  box-shadow: 0 0 12px rgba(107,128,255,0.4);
}
.toggle-card input:checked ~ .toggle-switch::after { transform: translateX(16px); }

.toggle-card:has(input:checked) {
  border-color: rgba(107, 128, 255, 0.4);
  background: rgba(107, 128, 255, 0.05);
}

/* ============================================================
 * NATIVE SELECT (timezone, locale)
 * ============================================================ */
.native-select {
  flex: 1;
  max-width: 280px;
  background: rgba(0,0,0,0.4);
  border: 1.5px solid var(--panel-border);
  color: var(--text-1);
  padding: 0.7rem 2.5rem 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'><polyline points='1 1.5 6 6.5 11 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  transition: border-color 200ms;
}
.native-select:hover { border-color: var(--panel-border-strong); }
.native-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(107,128,255,0.2); }
.native-select option { background: #1a1a24; color: #fff; padding: 4px; }

/* ============================================================
 * STICKY SAVE BAR
 * ============================================================ */
.footer-spacer { height: 1rem; }

.save-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(900px, calc(100% - 2rem));
  pointer-events: none;
}
.save-bar-inner {
  background: rgba(20, 20, 28, 0.85);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid var(--panel-border-strong);
  border-radius: 16px;
  padding: 0.8rem 1rem 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  pointer-events: auto;
  box-shadow:
    0 20px 50px -20px rgba(0,0,0,0.8),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  transition: all 220ms;
}
.save-bar.dirty .save-bar-inner {
  border-color: rgba(107, 128, 255, 0.5);
  box-shadow:
    0 20px 50px -20px rgba(0,0,0,0.8),
    0 0 0 1px rgba(107,128,255,0.2) inset,
    0 0 30px -10px rgba(107,128,255,0.4);
}
.save-status {
  font-size: 0.85rem;
  color: var(--text-2);
  display: flex; align-items: center; gap: 0.5rem;
}
.save-bar.dirty .save-status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { opacity: 0.4; } }
.save-bar-actions { display: flex; gap: 0.5rem; }

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 720px) {
  .hero { padding: 1rem; }
  .hero-nav { flex-wrap: wrap; gap: 1rem; }
  .nav-title h1 { font-size: 1.25rem; }
  .hero-preview { min-height: 40vh; --clock-size: 64px; }
  .preview-clock.mode-analog .analog-clock { width: 200px; height: 200px; }
  .settings-container { padding: 0 1rem; }
  .panel { padding: 1.25rem; }
  .row { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .row-label { flex: none; }
  .style-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .font-cards { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
