:root {
  color-scheme: dark;
  --bg: #000;
  --bg-rgb: 0 0 0;
  --glow-a: 45 42 122;
  --glow-b: 58 36 120;
  --blinds: 0;
  --brand: linear-gradient(90deg, #1a1f70, #5900f0, #c200eb);
  --ink: #fff;
  --ink-2: rgba(255, 255, 255, 0.78);
  --ink-3: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.2);
  --accent: #b98cff;
  --tagline: linear-gradient(90deg, #00D9D0, #3CC8F0, #0EA7FF);
  --glow-shadow: rgba(80, 40, 200, 0.35);
  --drop-shadow: rgba(0, 0, 0, 0.6);
  --caption-bg: rgba(0, 0, 0, 0.62);
  --caption-ink: #fff;
  --finish-ink: #fff;

  --chrome: #fff;
  --chrome-text: rgba(255, 255, 255, 0.9);
  --chrome-fill: rgba(255, 255, 255, 0.08);
  --chrome-fill-hover: rgba(255, 255, 255, 0.16);
  --chrome-line: rgba(255, 255, 255, 0.22);
  --chrome-dot: rgba(255, 255, 255, 0.35);
  --chrome-dot-hover: rgba(255, 255, 255, 0.7);
  --chrome-glow: 0 0 3px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.85), 0 0 26px rgba(0, 0, 0, 0.7);
  --chrome-soft-glow: 0 1px 8px rgba(0, 0, 0, 0.45);

  --row: #111215;
  --row-hover: #17181c;
  --row-gap: #000;
  --ink-dim: rgba(255, 255, 255, 0.66);
  --ink-faint: rgba(255, 255, 255, 0.42);
  --cyan: #2AE2EC;
  --link-line: none;
  --text: rgba(255, 255, 255, 0.78);
  --ink-55: rgba(255, 255, 255, 0.55);
  --ink-70: rgba(255, 255, 255, 0.7);
  --ink-50: rgba(255, 255, 255, 0.5);
  --ink-30: rgba(255, 255, 255, 0.3);

  --footer-ink: rgba(255, 255, 255, 0.7);
  --footer-link: rgba(255, 255, 255, 0.9);
}

:root[data-theme="noir"] {
  color-scheme: light;
  --bg: #C8CCD4;
  --bg-rgb: 200 204 212;
  --glow-a: 226 229 234;
  --glow-b: 215 219 226;
  --blinds: 0.66;
  --brand: linear-gradient(90deg, #0A0A0C, #2A2C31, #3A3D44);
  --ink: #0A0A0C;
  --ink-2: rgba(10, 10, 12, 0.76);
  --ink-3: rgba(10, 10, 12, 0.6);
  --line: rgba(10, 10, 12, 0.16);
  --accent: #2A2C31;
  --tagline: linear-gradient(90deg, #0A0A0C, #5A5E67, #0A0A0C);
  --glow-shadow: rgba(10, 10, 12, 0.14);
  --drop-shadow: rgba(10, 10, 12, 0.26);
  --caption-bg: rgba(226, 229, 234, 0.82);
  --caption-ink: #0A0A0C;
  --finish-ink: #0A0A0C;
  --chrome: #0A0A0C;
  --chrome-text: rgba(10, 10, 12, 0.86);
  --chrome-fill: rgba(10, 10, 12, 0.05);
  --chrome-fill-hover: rgba(10, 10, 12, 0.1);
  --chrome-line: rgba(10, 10, 12, 0.22);
  --chrome-dot: rgba(10, 10, 12, 0.28);
  --chrome-dot-hover: rgba(10, 10, 12, 0.6);
  --chrome-glow: 0 0 3px rgba(226, 229, 234, 0.95), 0 0 12px rgba(226, 229, 234, 0.9), 0 0 26px rgba(226, 229, 234, 0.75);
  --chrome-soft-glow: 0 1px 8px rgba(226, 229, 234, 0.75);
  --row: #E2E5EA;
  --row-hover: #D7DBE2;
  --row-gap: #B9BEC8;
  --ink-dim: rgba(10, 10, 12, 0.72);
  --ink-faint: rgba(10, 10, 12, 0.54);
  --cyan: #0A0A0C;
  --link-line: underline;
  --text: rgba(10, 10, 12, 0.8);
  --ink-55: rgba(10, 10, 12, 0.62);
  --ink-70: rgba(10, 10, 12, 0.72);
  --ink-50: rgba(10, 10, 12, 0.58);
  --ink-30: rgba(10, 10, 12, 0.34);
  --footer-ink: rgba(10, 10, 12, 0.66);
  --footer-link: rgba(10, 10, 12, 0.88);
}

.theme-chooser {
  position: fixed; z-index: 45;
  left: var(--gutter); bottom: calc(16px + env(safe-area-inset-bottom));
}
.theme-toggle {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border-radius: 50%; border: 1px solid var(--chrome-line); --ring-r: 24px;
  background: var(--chrome-fill); color: var(--chrome); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background-color 0.2s ease;
}
.theme-toggle:hover, .is-open > .theme-toggle { background: var(--chrome-fill-hover); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.theme-toggle svg .fill { fill: currentColor; stroke: none; }

.theme-panel {
  position: absolute; left: 0; bottom: calc(100% + 12px);
  padding: 14px 16px 16px; border-radius: 20px;
  background: rgba(17, 18, 21, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(0.98); transform-origin: 24px 100%;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
.is-open > .theme-panel { opacity: 1; visibility: visible; transform: none; transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s; }

.theme-title {
  margin: 0 0 12px; padding: 0 2px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700; font-size: 11.5px; line-height: 1.4; letter-spacing: 0.13em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.theme-swatches { display: flex; gap: 12px; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none; cursor: pointer; color: #fff; --ring-r: 10px;
  font: 600 12px/1.2 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.theme-card {
  position: relative; display: grid; place-items: center;
  width: 72px; height: 96px; border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}
.theme-card-neon { background: linear-gradient(#1A1F70, #5900F0, #C200EB); }
.theme-card-noir { background: linear-gradient(#303137, #0A0A0C); }
.theme-card img { display: block; width: 27px; height: auto; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25)); }
.theme-swatch:hover .theme-card { filter: brightness(1.1); }
.theme-swatch[aria-pressed="true"] .theme-card { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 0 0 2px #fff; }

.theme-tick {
  position: absolute; right: 5px; bottom: 5px; width: 20px; height: 20px;
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.theme-tick circle { fill: #fff; }
.theme-tick path { fill: none; stroke: #000; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-swatch[aria-pressed="true"] .theme-tick { opacity: 1; transform: none; }
.theme-name { white-space: nowrap; }
