:root {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

body {
  transition: background-color .18s ease, color .18s ease;
}

/* Google Identity Services adds a light safety gutter around its cross-origin
   button iframe. Crop only that gutter so the dark header never flashes white. */
#gsiButton:not(:empty) iframe {
  clip-path: inset(6px 10px round 9999px);
}

html[data-theme="light"] body {
  background: #f3f6fb;
  color: #1e293b;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  color-scheme: light;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #94a3b8;
}

html[data-theme="light"] [class~="bg-slate-950"],
html[data-theme="light"] [class~="bg-slate-950/95"],
html[data-theme="light"] [class~="bg-slate-950/90"],
html[data-theme="light"] [class~="bg-slate-950/80"],
html[data-theme="light"] [class~="bg-slate-950/70"],
html[data-theme="light"] [class~="bg-slate-950/60"],
html[data-theme="light"] [class~="bg-slate-950/50"],
html[data-theme="light"] [class~="bg-slate-950/45"],
html[data-theme="light"] [class~="bg-slate-950/40"],
html[data-theme="light"] [class~="bg-slate-950/35"] {
  background-color: rgb(255 255 255 / .97) !important;
}

html[data-theme="light"] [class~="bg-slate-900"],
html[data-theme="light"] [class~="bg-slate-900/95"],
html[data-theme="light"] [class~="bg-slate-900/90"],
html[data-theme="light"] [class~="bg-slate-900/85"],
html[data-theme="light"] [class~="bg-slate-900/80"],
html[data-theme="light"] [class~="bg-slate-900/70"],
html[data-theme="light"] [class~="bg-slate-900/65"],
html[data-theme="light"] [class~="bg-slate-900/60"],
html[data-theme="light"] [class~="bg-slate-900/55"],
html[data-theme="light"] [class~="bg-slate-900/50"],
html[data-theme="light"] [class~="bg-slate-900/40"],
html[data-theme="light"] [class~="bg-slate-900/30"],
html[data-theme="light"] [class~="bg-slate-900/20"] {
  background-color: rgb(248 250 255 / .96) !important;
}

html[data-theme="light"] [class~="bg-slate-800"],
html[data-theme="light"] [class~="bg-slate-800/80"],
html[data-theme="light"] [class~="bg-slate-800/70"],
html[data-theme="light"] [class~="bg-slate-800/65"],
html[data-theme="light"] [class~="bg-slate-800/60"],
html[data-theme="light"] [class~="bg-slate-800/50"],
html[data-theme="light"] [class~="bg-slate-800/45"],
html[data-theme="light"] [class~="bg-slate-800/40"] {
  background-color: rgb(245 243 255 / .96) !important;
}

html[data-theme="light"] [class~="bg-slate-700"],
html[data-theme="light"] [class~="bg-slate-700/60"],
html[data-theme="light"] [class~="bg-slate-700/50"],
html[data-theme="light"] [class~="bg-slate-700/40"] {
  background-color: #e0f2fe !important;
}

html[data-theme="light"] [class~="bg-red-950/45"] {
  background-color: #ffe4e6 !important;
}

html[data-theme="light"] [class~="bg-cyan-950/15"] {
  background-color: #cffafe !important;
}

html[data-theme="light"] [class~="bg-emerald-950/15"] {
  background-color: #d1fae5 !important;
}

html[data-theme="light"] [class~="bg-fuchsia-950/15"] {
  background-color: #fae8ff !important;
}

html[data-theme="light"] [class~="border-slate-800"],
html[data-theme="light"] [class~="border-slate-800/80"],
html[data-theme="light"] [class~="border-slate-700"],
html[data-theme="light"] [class~="border-slate-700/80"],
html[data-theme="light"] [class~="border-slate-700/70"] {
  border-color: #c4b5fd !important;
}

html[data-theme="light"] [class~="border-slate-600"],
html[data-theme="light"] [class~="border-slate-500"],
html[data-theme="light"] [class~="border-slate-400"] {
  border-color: #93c5fd !important;
}

html[data-theme="light"] [class~="bg-slate-800/65"] {
  background: linear-gradient(135deg,#fff 0%,#f5f3ff 48%,#ecfeff 100%) !important;
  box-shadow: 0 0 0 1px rgb(139 92 246 / .16), 0 14px 34px rgb(124 58 237 / .18), 0 0 28px rgb(6 182 212 / .08) !important;
}

html[data-theme="light"] [class~="text-white"],
html[data-theme="light"] [class~="text-slate-100"],
html[data-theme="light"] [class~="text-slate-200"] {
  color: #0f172a !important;
}

html[data-theme="light"] [class~="text-slate-300"] {
  color: #1e293b !important;
}

html[data-theme="light"] [class~="text-slate-400"] {
  color: #475569 !important;
}

html[data-theme="light"] [class~="text-slate-500"],
html[data-theme="light"] [class~="text-slate-600"] {
  color: #64748b !important;
}

html[data-theme="light"] [class~="text-brand-g"] { color: #047857 !important; }
html[data-theme="light"] [class~="text-brand-y"] { color: #92400e !important; }
html[data-theme="light"] [class~="text-brand-r"] { color: #be123c !important; }
html[data-theme="light"] [class~="text-brand-b"] { color: #1d4ed8 !important; }

html[data-theme="light"] [class~="text-violet-100"],
html[data-theme="light"] [class~="text-violet-200"],
html[data-theme="light"] [class~="text-violet-300"] { color: #6d28d9 !important; }
html[data-theme="light"] [class~="text-cyan-100"],
html[data-theme="light"] [class~="text-cyan-200"],
html[data-theme="light"] [class~="text-cyan-300"] { color: #0e7490 !important; }
html[data-theme="light"] [class~="text-emerald-100"],
html[data-theme="light"] [class~="text-emerald-200"],
html[data-theme="light"] [class~="text-emerald-300"] { color: #047857 !important; }
html[data-theme="light"] [class~="text-amber-50"],
html[data-theme="light"] [class~="text-amber-100"],
html[data-theme="light"] [class~="text-amber-200"],
html[data-theme="light"] [class~="text-amber-300"] { color: #92400e !important; }
html[data-theme="light"] [class~="text-fuchsia-100"],
html[data-theme="light"] [class~="text-fuchsia-200"] { color: #a21caf !important; }
html[data-theme="light"] [class~="text-rose-100"],
html[data-theme="light"] [class~="text-rose-200"],
html[data-theme="light"] [class~="text-rose-300"],
html[data-theme="light"] [class~="text-red-100"],
html[data-theme="light"] [class~="text-red-200"],
html[data-theme="light"] [class~="text-red-300"] { color: #be123c !important; }

html[data-theme="light"] [class~="placeholder:text-slate-600"]::placeholder,
html[data-theme="light"] [class~="placeholder:text-slate-500"]::placeholder {
  color: #94a3b8 !important;
}

html[data-theme="light"] [class~="from-slate-950"],
html[data-theme="light"] [class~="from-slate-900"] {
  --tw-gradient-from: #fff var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] [class~="via-slate-900"] {
  --tw-gradient-to: rgb(248 250 252 / 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), #f8fafc var(--tw-gradient-via-position), var(--tw-gradient-to) !important;
}

html[data-theme="light"] [class~="to-slate-950"],
html[data-theme="light"] [class~="to-slate-900"] {
  --tw-gradient-to: #f8fafc var(--tw-gradient-to-position) !important;
}

/* Dark-theme accent surfaces become bright, vivid washes in light mode. */
html[data-theme="light"] [class~="from-violet-950/90"],
html[data-theme="light"] [class~="from-violet-950/55"] {
  --tw-gradient-from: #ede9fe var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgb(237 233 254 / 0) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] [class~="via-violet-950/55"] {
  --tw-gradient-to: rgb(221 214 254 / 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), #ddd6fe var(--tw-gradient-via-position), var(--tw-gradient-to) !important;
}

html[data-theme="light"] [class~="to-indigo-950/90"] {
  --tw-gradient-to: #dbeafe var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] [class~="from-fuchsia-950/40"] {
  --tw-gradient-from: #fae8ff var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgb(250 232 255 / 0) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] [class~="from-cyan-950/40"] {
  --tw-gradient-from: #cffafe var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgb(207 250 254 / 0) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] [class~="via-amber-950/35"] {
  --tw-gradient-to: rgb(254 243 199 / 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), #fef3c7 var(--tw-gradient-via-position), var(--tw-gradient-to) !important;
}

html[data-theme="light"] [class~="shadow-violet-950/10"],
html[data-theme="light"] [class~="shadow-violet-950/20"],
html[data-theme="light"] [class~="shadow-violet-950/30"] {
  --tw-shadow-color: rgb(124 58 237 / .34) !important;
}

html[data-theme="light"] [class~="shadow-cyan-950/20"],
html[data-theme="light"] [class~="shadow-cyan-950/30"] {
  --tw-shadow-color: rgb(6 182 212 / .34) !important;
}

html[data-theme="light"] [class~="shadow-emerald-950/20"] {
  --tw-shadow-color: rgb(16 185 129 / .3) !important;
}

html[data-theme="light"] [class~="shadow-fuchsia-950/20"] {
  --tw-shadow-color: rgb(217 70 239 / .32) !important;
}

html[data-theme="light"] [class~="shadow-amber-950/20"] {
  --tw-shadow-color: rgb(245 158 11 / .32) !important;
}

html[data-theme="light"] [class~="shadow-slate-950/40"],
html[data-theme="light"] [class~="shadow-black/50"],
html[data-theme="light"] [class~="shadow-black/10"] {
  --tw-shadow-color: rgb(79 70 229 / .16) !important;
}

html[data-theme="light"] .lounge-pro-badge {
  color: #92400e !important;
  border-color: #f59e0b !important;
  background: linear-gradient(135deg,#fff7c2 0%,#fde047 52%,#fff1a6 100%) !important;
  animation-name: lounge-pro-glow-light;
}

html[data-theme="light"] .lounge-pro-badge::after {
  background: linear-gradient(110deg,transparent 32%,rgb(255 255 255 / .95) 50%,transparent 68%);
}

html[data-theme="light"] .lounge-admin-badge {
  color: #fff !important;
  border-color: #7c3aed !important;
  background: linear-gradient(135deg,#a855f7,#6366f1) !important;
  box-shadow: 0 0 0 1px rgb(139 92 246 / .28), 0 0 20px rgb(168 85 247 / .55) !important;
}

html[data-theme="light"] .supporter-badge {
  color: #312e81 !important;
  background: linear-gradient(110deg,#fff 18%,var(--supporter-glow) 47%,#fff 76%) !important;
  background-size: 250% 100% !important;
  box-shadow: 0 0 0 1px var(--supporter-main), 0 0 20px var(--supporter-glow) !important;
}

html[data-theme="light"] .supporter-profile-ring {
  background: #fff;
  box-shadow: 0 0 10px var(--supporter-main), 0 0 26px var(--supporter-glow) !important;
}

html[data-theme="light"] .supporter-profile-ring--4 {
  box-shadow: 0 0 12px #facc15, 0 0 34px rgb(245 158 11 / .65) !important;
}

@keyframes lounge-pro-glow-light {
  0%,100% { filter: brightness(1); box-shadow: 0 0 0 1px rgb(245 158 11 / .35), 0 0 12px rgb(250 204 21 / .48); }
  50% { filter: brightness(1.08) saturate(1.15); box-shadow: 0 0 0 2px rgb(245 158 11 / .45), 0 0 26px rgb(250 204 21 / .8); }
}

html[data-theme="light"] .tab-btn {
  color: #334155;
  border-color: #cbd5e1;
  background: rgb(255 255 255 / .72);
}

html[data-theme="light"] .tab-btn:hover {
  border-color: #94a3b8;
  background: #fff;
}

html[data-theme="light"] .tab-btn.active {
  color: #0f172a;
  border-color: #059669;
  background: #ecfdf5;
}

html[data-theme="light"] .tab-btn.ai-tab-btn,
html[data-theme="light"] .tab-btn.ai-tab-btn.active {
  color: #fff !important;
  border-color: #7c3aed !important;
  background: linear-gradient(135deg,#8b5cf6,#4f46e5) !important;
}

html[data-theme="light"] [class~="bg-brand-b"],
html[data-theme="light"] [class~="bg-violet-600"],
html[data-theme="light"] [class~="bg-indigo-600"] {
  color: #fff !important;
}

html[data-theme="light"] .chart-scroll {
  scrollbar-color: #8b5cf6 #e2e8f0;
}

html[data-theme="light"] .chart-scroll::-webkit-scrollbar-track,
html[data-theme="light"] .chart-pan-range::-webkit-slider-runnable-track,
html[data-theme="light"] .chart-pan-range::-moz-range-track {
  background: #e2e8f0;
  border-color: #94a3b8;
}

html[data-theme="light"] .chart-scroll::-webkit-scrollbar-thumb {
  border-color: #e2e8f0;
}

html[data-theme="light"] .site-footer {
  background: #eaf0f8;
  color: #475569;
}

.site-footer__title {
  padding-bottom: .75rem;
  border-bottom: 1px solid rgb(71 85 105 / .55);
}

html[data-theme="light"] .site-footer__title {
  border-color: #cbd5e1;
  color: #0f172a !important;
}

.site-footer__list {
  display: grid;
  gap: .55rem;
  margin-top: 1rem;
}

.site-footer__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: .65rem;
  align-items: start;
}

.site-footer__row dt {
  color: #94a3b8;
}

html[data-theme="light"] .site-footer__row dt {
  color: #64748b;
}

.site-footer__link {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2rem;
  color: #cbd5e1;
  font-weight: 700;
}

.site-footer__link:hover {
  color: #fff;
}

html[data-theme="light"] .site-footer__link {
  color: #334155;
}

html[data-theme="light"] .site-footer__link:hover {
  color: #4f46e5;
}

#themeToggle {
  white-space: nowrap;
}

@media (max-width: 639px) {
  .site-footer__row {
    grid-template-columns: 1fr;
    gap: .1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
