:root {
  color-scheme: light;
  --accent: #c93452;
  --accent-dark: #ac2344;
  --ink: #1d1d1f;
  --muted: #5d5d65;
  --paper: #f5f5f7;
  --surface: #fff;
  --surface-soft: #eeeef3;
  --line: #d2d2da;
  --glass: rgb(255 255 255 / 64%);
  --glass-solid: #f5f4f8;
  --glass-menu: rgb(250 248 253 / 98%);
  --glass-border: rgb(255 255 255 / 92%);
  --glass-edge: rgb(50 30 60 / 10%);
  --glass-highlight: rgb(255 255 255 / 80%);
  --glass-shadow: 0 12px 36px rgb(30 20 40 / 8%), inset 0 1px 0 var(--glass-highlight);
  --glass-sheen: linear-gradient(145deg, rgb(255 255 255 / 48%), transparent 42%, rgb(255 255 255 / 14%));
  --glow-rose: rgb(220 62 111 / 13%);
  --glow-blue: rgb(135 143 244 / 13%);
  --button-glass: linear-gradient(165deg, #c93452, #bc284b);
  --button-hover: linear-gradient(165deg, #be2b4c, #a92040);
  --on-filled: #fff;
  --link: #a91d3d;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #ff7894;
  --accent-dark: #ff99ad;
  --ink: #f3f1f7;
  --muted: #b5b0c0;
  --paper: #0b0b10;
  --surface: #111017;
  --surface-soft: #211e2b;
  --line: #37333f;
  --glass: rgb(38 34 49 / 72%);
  --glass-solid: #23202c;
  --glass-menu: rgb(39 35 48 / 98%);
  --glass-border: rgb(255 255 255 / 16%);
  --glass-edge: rgb(0 0 0 / 22%);
  --glass-highlight: rgb(255 255 255 / 12%);
  --glass-shadow: 0 16px 44px rgb(0 0 0 / 24%), inset 0 1px 0 var(--glass-highlight);
  --glass-sheen: linear-gradient(145deg, rgb(255 255 255 / 9%), transparent 42%, rgb(255 255 255 / 3%));
  --glow-rose: rgb(198 49 99 / 23%);
  --glow-blue: rgb(93 77 170 / 20%);
  --button-glass: linear-gradient(165deg, #f38ca5, #ed6487);
  --button-hover: linear-gradient(165deg, #ff9db5, #f97999);
  --on-filled: #2b0914;
  --link: #ff97ae;
}

.theme-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.theme-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 12px;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--glass);
  background-image: var(--glass-sheen);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 2px 10px var(--glass-edge);
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease, transform 280ms cubic-bezier(.22,1,.36,1);
}
.theme-picker svg {
  display: block;
  width: 18px;
  height: 18px;
  pointer-events: none;
  flex-shrink: 0;
}
.theme-current-label {
  min-width: 65px;
  text-align: left;
}
.theme-picker .theme-chevron {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 260ms cubic-bezier(.22,1,.36,1);
}
.theme-trigger[aria-expanded="true"] .theme-chevron { transform: rotate(180deg); }
.theme-trigger[aria-expanded="true"] { background-color: var(--surface-soft); }
.theme-trigger:focus-visible, .theme-option:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.theme-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 12px);
  left: var(--theme-menu-offset, 0px);
  width: min(288px, calc(100vw - 32px));
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  padding: 9px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  color: var(--ink);
  background: var(--glass-menu);
  background-image: var(--glass-sheen);
  box-shadow: var(--glass-shadow), 0 20px 60px rgb(18 10 32 / 18%), 0 0 0 1px var(--glass-edge);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  animation: theme-menu-enter 220ms cubic-bezier(.22,1,.36,1);
  transform-origin: top center;
}
.theme-menu[hidden] { display: none; }
.theme-menu-heading {
  margin: 6px 12px 7px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .03em;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  margin: 3px 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.theme-option-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface);
  flex: 0 0 auto;
}
.theme-option-copy { display: grid; gap: 3px; }
[data-theme-option-label] { font-size: .875rem; font-weight: 650; }
.theme-option-description { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.theme-option .theme-option-check { width: 16px; height: 16px; margin-left: auto; color: var(--accent); opacity: 0; }
.theme-option[aria-checked="true"] { background: var(--surface-soft); border-color: var(--glass-edge); }
.theme-option[aria-checked="true"] .theme-option-icon { color: var(--accent); }
.theme-option[aria-checked="true"] .theme-option-check { opacity: 1; }
.theme-option:active { transform: scale(.98); }
@media (hover: hover) {
  .theme-trigger:hover { background-color: var(--surface-soft); }
  .theme-option:hover { background: var(--surface-soft); }
}
@keyframes theme-menu-enter {
  from { opacity: 0; translate: 0 -6px; scale: .97; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-menu { animation: none; }
  .theme-trigger, .theme-chevron, .theme-option { transition: none; }
  .theme-option:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--glass-solid); --glass-menu: var(--glass-solid); --glass-sheen: none; }
  .theme-menu { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (forced-colors: active) {
  .theme-trigger, .theme-menu { border: 1px solid ButtonText; background: Canvas; color: ButtonText; box-shadow: none; }
  .theme-option-icon { background: Canvas; }
  .theme-option[aria-checked="true"] { border-color: Highlight; }
  .theme-option .theme-option-check { color: Highlight; }
}
