/* Flux: shared palette for desktop and companions. Violet, cyan and rose light on ink or porcelain. */
html[data-theme="flux"] {
  color-scheme:dark;
  --tint:#8b5cf6; --accent:#8b5cf6; --accent-2:#22d3ee; --accent-3:#f472b6;
  --font:"Plus Jakarta Sans","Avenir Next",system-ui,sans-serif;
  --bg:#07080f; --panel:#11131f; --panel-2:#1a1d2e; --border:#2c3050;
  --text:#f4f5ff; --muted:#a6abc9; --input-bg:#0c0e18; --link:#8be3f5;
  --green:#6ee7b7; --red:#fda4af; --amber:#fcd34d; --orange:#fdba74;
  --radius:22px; --radius-btn:999px; --radius-input:14px;
  --surface:var(--panel); --surface-border-color:var(--border);
  --grad-brand:linear-gradient(100deg,#c4b5fd,#67e8f9 40%,#f9a8d4 70%,#c4b5fd);
  --grad-primary:linear-gradient(120deg,#6d28d9,#4338ca 45%,#0e7490 90%,#6d28d9);
  --grad-primary-hover:linear-gradient(120deg,#7c3aed,#4f46e5 45%,#0e7490 90%,#7c3aed);
  --btn-soft:linear-gradient(var(--panel-2),var(--panel-2));
  --btn-soft-hover:linear-gradient(var(--border),var(--border));
  --app-bg:var(--bg); --shadow:0 24px 48px -28px #000c; --shadow-glow:0 10px 30px -12px #8b5cf699;
}
html[data-theme="flux"][data-mode="light"] {
  color-scheme:light;
  --accent:#6d28d9; --accent-2:#0e7490; --accent-3:#be185d;
  --bg:#f3f4fb; --panel:#ffffff; --panel-2:#eef0fa; --border:#d3d7ee;
  --text:#14162b; --muted:#53587a; --input-bg:#ffffff; --link:#5b21b6;
  --green:#047857; --red:#be123c; --amber:#92400e; --orange:#c2410c;
  --grad-brand:linear-gradient(100deg,#6d28d9,#0e7490 40%,#be185d 70%,#6d28d9);
  --shadow:0 24px 48px -30px #1e1b4b40; --shadow-glow:0 10px 30px -14px #6d28d966;
}

/* ---------- Motion primitives ---------- */
@property --flux-angle { syntax:'<angle>'; initial-value:0deg; inherits:false; }
@property --flux-spot { syntax:'<percentage>'; initial-value:0%; inherits:false; }
html[data-theme="flux"] {
  --flux-spring:cubic-bezier(.2,1.4,.4,1);
  --flux-ease:cubic-bezier(.16,1,.3,1);
  --flux-glass:linear-gradient(160deg,color-mix(in srgb,var(--panel-2) 72%,transparent),color-mix(in srgb,var(--panel) 56%,transparent));
  --flux-hair:color-mix(in srgb,var(--text) 11%,transparent);
  --cur-hand:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23a78bfa'/%3E%3Cstop offset='.55' stop-color='%2322d3ee'/%3E%3Cstop offset='1' stop-color='%23f472b6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M4 3L22 12.5L13.6 14.6L9.8 23Z' fill='url(%23g)' stroke='%2307080f' stroke-width='3.4' stroke-linejoin='round' paint-order='stroke'/%3E%3Cpath d='M4 3L22 12.5L13.6 14.6L9.8 23Z' fill='none' stroke='%23fff' stroke-width='1.2' stroke-linejoin='round'/%3E%3Ccircle cx='23.5' cy='22.5' r='2.4' fill='%2322d3ee' stroke='%23fff' stroke-width='1'/%3E%3C/svg%3E") 4 3;
}
@keyframes flux-spin { to { --flux-angle:360deg; } }
@keyframes flux-flow { to { background-position:300% 50%; } }
@keyframes flux-drift {
  0%   { transform:translate3d(0,0,0) rotate(0deg) scale(1); }
  50%  { transform:translate3d(-4%,3%,0) rotate(8deg) scale(1.08); }
  100% { transform:translate3d(3%,-2%,0) rotate(-6deg) scale(1.02); }
}
@keyframes flux-rise { from { opacity:0; transform:translateY(16px) scale(.985); filter:blur(6px); } }
@keyframes flux-sheen { from { transform:translateX(-120%) skewX(-20deg); } to { transform:translateX(220%) skewX(-20deg); } }

/* ---------- Living backdrop: drifting aurora mesh + film grain ---------- */
html[data-theme="flux"][data-mode] body { background:var(--bg); }
html[data-theme="flux"][data-mode] body::before,
html[data-theme="flux"][data-mode] body::after { display:block !important; }
html[data-theme="flux"][data-mode] body::before {
  inset:-15vmax; mix-blend-mode:normal; opacity:.6;
  background:
    radial-gradient(38vmax 34vmax at 18% 22%,color-mix(in srgb,#8b5cf6 55%,transparent),transparent 62%),
    radial-gradient(32vmax 30vmax at 82% 16%,color-mix(in srgb,#22d3ee 40%,transparent),transparent 62%),
    radial-gradient(44vmax 36vmax at 62% 88%,color-mix(in srgb,#f472b6 34%,transparent),transparent 62%),
    radial-gradient(30vmax 26vmax at 8% 90%,color-mix(in srgb,#4338ca 45%,transparent),transparent 62%);
  animation:flux-drift 26s ease-in-out infinite alternate; will-change:transform;
}
html[data-theme="flux"][data-mode="light"] body::before { opacity:.32; }
html[data-theme="flux"][data-mode] body::after {
  mix-blend-mode:normal; opacity:.07;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="flux"][data-mode="light"] body::after { opacity:.05; filter:invert(1); }
html[data-theme="flux"] :is(#app-view,#login-view) { position:relative; z-index:1; }

/* ---------- Type ---------- */
html[data-theme="flux"][data-mode] body { letter-spacing:-.005em; scrollbar-color:color-mix(in srgb,var(--accent) 45%,transparent) transparent; }
html[data-theme="flux"][data-mode] :is(h1,h2,h3,h4) { font-family:"Sora","Plus Jakarta Sans",sans-serif; font-weight:700; letter-spacing:-.035em; }
html[data-theme="flux"][data-mode] .section-head h2 { font-size:clamp(28px,3vw,40px); }
html[data-theme="flux"][data-mode] .brand {
  font-family:"Sora",sans-serif; font-weight:800; letter-spacing:-.03em;
  background:var(--grad-brand); background-size:300% 100%; -webkit-background-clip:text; background-clip:text; color:transparent;
  animation:flux-flow 9s linear infinite;
}
html[data-theme="flux"] ::selection { background:color-mix(in srgb,var(--accent) 45%,transparent); color:var(--text); }

/* ---------- Layout: floating capsule header ---------- */
html[data-theme="flux"][data-mode][data-style] .topbar {
  position:sticky; top:14px; z-index:6;
  width:calc(min(100%,1600px) - 2 * var(--gutter)); margin:14px auto 0; box-sizing:border-box;
  padding:8px 10px 8px 22px; border-radius:999px; border:1px solid var(--flux-hair);
  background:color-mix(in srgb,var(--panel) 62%,transparent);
  -webkit-backdrop-filter:blur(20px) saturate(1.7); backdrop-filter:blur(20px) saturate(1.7);
  box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 10%,transparent),0 18px 40px -22px #000a;
}
html[data-theme="flux"][data-mode][data-style] .topbar::before {
  content:""; position:absolute; inset:-1px; border-radius:inherit; padding:1px; pointer-events:none;
  background:conic-gradient(from var(--flux-angle),transparent 0 18%,var(--accent) 32%,var(--accent-2) 46%,var(--accent-3) 60%,transparent 74%);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0); -webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);
  animation:flux-spin 7s linear infinite;
}
html[data-theme="flux"][data-mode][data-style] .topbar .btn.ghost {
  min-width:40px; height:40px; padding:0 14px; border-radius:999px; border:1px solid transparent;
  transition:transform .5s var(--flux-spring),background .25s,border-color .25s;
}
html[data-theme="flux"][data-mode][data-style] .topbar .btn.ghost:hover { background:color-mix(in srgb,var(--accent) 16%,transparent); border-color:var(--flux-hair); transform:translateY(-2px); }
html[data-theme="flux"][data-mode] .topbar .chip { border-radius:999px; background:color-mix(in srgb,var(--panel-2) 70%,transparent); border:1px solid var(--flux-hair); }
html[data-theme="flux"][data-mode] #content { max-width:1600px; width:auto; margin-inline:auto; padding:32px var(--gutter); }

/* ---------- Layout: station page becomes dock + stat strip + full-width canvas ---------- */
html[data-theme="flux"][data-mode] .station-layout,
html[data-theme="flux"][data-mode] .station-layout:not(.has-right) { grid-template-columns:minmax(0,1fr); gap:14px; }
html[data-theme="flux"][data-mode] .station-rail-left { order:-2; }
html[data-theme="flux"][data-mode] .station-rail-right { order:-1; }
html[data-theme="flux"][data-mode][data-style] .station-rail-left {
  position:sticky; top:84px; z-index:5; padding:6px; border-radius:999px !important;
  overflow-x:auto; scrollbar-width:none; overscroll-behavior-x:contain;
}
html[data-theme="flux"][data-mode] .station-rail-left::-webkit-scrollbar { display:none; }
html[data-theme="flux"][data-mode] .tabs.station-tabs-v { flex-direction:row; flex-wrap:nowrap; align-items:center; gap:4px; width:max-content; min-width:100%; }
html[data-theme="flux"][data-mode][data-style] .tabs.station-tabs-v .tab {
  width:auto; white-space:nowrap; padding:9px 16px; border-radius:999px; border:1px solid transparent;
  transition:transform .55s var(--flux-spring),background .25s,color .25s,box-shadow .35s;
}
html[data-theme="flux"][data-mode][data-style] .tabs.station-tabs-v .tab:hover:not(.active) { transform:translateY(-2px); background:color-mix(in srgb,var(--accent) 12%,transparent); }
html[data-theme="flux"][data-mode] .station-tabs-v .station-submenu {
  flex-direction:row; flex-basis:auto; align-items:center; gap:2px; margin:0 6px; padding:3px;
  border-radius:999px; background:color-mix(in srgb,var(--accent) 10%,transparent);
}
html[data-theme="flux"][data-mode][data-style] .station-tabs-v .station-submenu .tab { padding:6px 12px; font-size:.92em; }
html[data-theme="flux"][data-mode][data-style] .station-rail-right { padding:6px; border-radius:24px !important; }
html[data-theme="flux"][data-mode] .stats.station-stats-side { flex-direction:row; flex-wrap:wrap; gap:6px; }
html[data-theme="flux"][data-mode][data-style] .stats.station-stats-side .stat {
  flex:1 1 150px; width:auto; padding:12px 16px; border:0 !important; border-radius:18px !important;
  background:color-mix(in srgb,var(--panel-2) 55%,transparent) !important; box-shadow:none !important;
  -webkit-backdrop-filter:none; backdrop-filter:none;
}
html[data-theme="flux"][data-mode] .stats.station-stats-side .stat + .stat { border-top:0; }
html[data-theme="flux"][data-mode] .station-main { padding:4px 2px 24px; }
html[data-theme="flux"][data-mode] .month-bar { flex-wrap:wrap; row-gap:10px; }
html[data-theme="flux"][data-mode] .month-bar select { max-width:100%; }
html[data-theme="flux"][data-mode] .stat .value { font-family:"Sora",sans-serif; font-weight:700; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }

/* ---------- Surfaces: living glass with a pointer spotlight ---------- */
html[data-theme="flux"][data-mode][data-style] :is(.card,.stat,.station-rail-left,.station-rail-right,.modal,.login-card,.status-strip) {
  background:
    radial-gradient(420px circle at var(--mx,50%) var(--my,-30%),color-mix(in srgb,var(--accent) var(--flux-spot),transparent),transparent 60%),
    var(--flux-glass) !important;
  -webkit-backdrop-filter:blur(18px) saturate(1.5); backdrop-filter:blur(18px) saturate(1.5);
  border:1px solid var(--flux-hair) !important; border-radius:var(--radius);
  box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 9%,transparent),var(--shadow) !important;
  transition:transform .6s var(--flux-spring),box-shadow .4s var(--flux-ease),border-color .3s,--flux-spot .45s var(--flux-ease);
}
html[data-theme="flux"][data-mode][data-style] :is(.card,.stat):hover {
  --flux-spot:22%; transform:translateY(-4px);
  border-color:color-mix(in srgb,var(--accent) 45%,transparent) !important;
  box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 12%,transparent),0 30px 60px -30px color-mix(in srgb,var(--accent) 70%,#000) !important;
}
html[data-theme="flux"][data-mode] .card::before {
  height:2px; opacity:.9; background:linear-gradient(90deg,transparent,var(--accent),var(--accent-2),var(--accent-3),transparent);
  background-size:300% 100%; animation:flux-flow 6s linear infinite;
}
html[data-theme="flux"][data-mode][data-style] .station-card { border-radius:28px; padding:28px; }
html[data-theme="flux"][data-mode] .station-card h3 { font-size:25px; }
html[data-theme="flux"][data-mode] .station-card .sc-bal-num { font-family:"Sora",sans-serif; font-weight:700; letter-spacing:-.04em; }
html[data-theme="flux"][data-mode] .add-card { background:transparent !important; border-style:dashed !important; }

/* ---------- Controls ---------- */
html[data-theme="flux"][data-mode][data-style] .btn {
  border-radius:999px; transition:transform .5s var(--flux-spring),background .25s,box-shadow .35s,border-color .25s;
}
html[data-theme="flux"][data-mode][data-style] .btn:not(:disabled):active { transform:scale(.96); }
html[data-theme="flux"][data-mode][data-style] .btn:not(.primary):not(.info):not(.danger) {
  background:color-mix(in srgb,var(--panel) 55%,transparent); border:1px solid var(--flux-hair); box-shadow:none;
}
html[data-theme="flux"][data-mode][data-style] .btn:not(.primary):not(.info):not(.danger):hover { background:color-mix(in srgb,var(--accent) 14%,transparent); border-color:color-mix(in srgb,var(--accent) 35%,transparent); }
html[data-theme="flux"][data-mode][data-style] :is(.btn.primary,.btn.info,.tabs .tab.active,.seg button.active) {
  position:relative; overflow:hidden; color:#fff !important; border-color:transparent !important;
  background:var(--grad-primary) !important; background-size:300% 100% !important;
  animation:flux-flow 8s linear infinite; box-shadow:var(--shadow-glow);
}
html[data-theme="flux"][data-mode][data-style] :is(.btn.primary,.btn.info)::after {
  content:""; position:absolute; inset:0; width:40%; pointer-events:none;
  background:linear-gradient(90deg,transparent,#ffffff59,transparent); transform:translateX(-120%) skewX(-20deg);
}
html[data-theme="flux"][data-mode][data-style] :is(.btn.primary,.btn.info):hover::after { animation:flux-sheen .9s var(--flux-ease); }
html[data-theme="flux"][data-mode][data-style] :is(.btn.primary,.btn.info):hover { transform:translateY(-2px); box-shadow:0 16px 34px -14px #7c3aedcc; }
html[data-theme="flux"][data-mode][data-style] :is(input,select,textarea) {
  border-radius:var(--radius-input); border:1px solid var(--flux-hair); background:color-mix(in srgb,var(--input-bg) 80%,transparent);
  transition:border-color .25s,box-shadow .35s var(--flux-ease);
}
html[data-theme="flux"][data-mode][data-style] :is(input,select,textarea):focus {
  outline:none; border-color:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 28%,transparent);
}
html[data-theme="flux"][data-mode] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),textarea,[contenteditable="true"]) { cursor:text !important; }
html[data-theme="flux"][data-mode] :disabled { cursor:not-allowed !important; }
html[data-theme="flux"][data-mode] :is(input[type="checkbox"],input[type="radio"]) { accent-color:var(--accent); }
/* Flux surfaces are flat glass: drop the shared light-mode "pressed key" inset edge. */
html[data-theme="flux"][data-mode][data-style] :is(.btn:not(.primary):not(.info),.tab:not(.active),.seg button:not(.active)) { box-shadow:none !important; }
html[data-theme="flux"][data-mode][data-style] .cal .day:not(.empty) {
  border-radius:18px !important; box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 8%,transparent) !important;
  background:color-mix(in srgb,var(--panel) 72%,transparent) !important; border:1px solid var(--flux-hair) !important;
  transition:transform .5s var(--flux-spring),box-shadow .3s;
}
html[data-theme="flux"][data-mode][data-style] .cal .day:not(.empty):hover { transform:translateY(-3px); box-shadow:0 16px 30px -18px color-mix(in srgb,var(--accent) 80%,#000) !important; }
html[data-theme="flux"][data-mode][data-style] .cal .day.today { background:color-mix(in srgb,var(--accent) 16%,var(--panel)) !important; }
html[data-theme="flux"][data-mode] .cal .day.today { outline:2px solid var(--accent-2); outline-offset:2px; }

/* ---------- Choreography: content flows in, cards cascade ---------- */
html[data-theme="flux"][data-mode] #content > * { animation:flux-rise .75s var(--flux-ease) backwards; }
html[data-theme="flux"][data-mode] #content > :nth-child(2) { animation-delay:.07s; }
html[data-theme="flux"][data-mode] #content > :nth-child(3) { animation-delay:.14s; }
html[data-theme="flux"][data-mode] #content > :nth-child(n+4) { animation-delay:.2s; }
html[data-theme="flux"][data-mode] .station-grid > * { animation:flux-rise .8s var(--flux-ease) backwards; }
html[data-theme="flux"][data-mode] .station-grid > :nth-child(1) { animation-delay:.08s; }
html[data-theme="flux"][data-mode] .station-grid > :nth-child(2) { animation-delay:.16s; }
html[data-theme="flux"][data-mode] .station-grid > :nth-child(3) { animation-delay:.24s; }
html[data-theme="flux"][data-mode] .station-grid > :nth-child(n+4) { animation-delay:.32s; }
html[data-theme="flux"][data-mode] .modal { animation:flux-rise .5s var(--flux-ease) backwards; }

/* ---------- Gallery preview ---------- */
.theme-showcase[data-preset="flux"] .theme-showcase-art { background:radial-gradient(circle at 20% 20%,#8b5cf680,transparent 55%),radial-gradient(circle at 85% 30%,#22d3ee66,transparent 55%),radial-gradient(circle at 60% 95%,#f472b666,transparent 55%),#07080f; }
.theme-showcase[data-preset="flux"] .theme-showcase-orbit { border:0; background:conic-gradient(from var(--flux-angle),#8b5cf6,#22d3ee,#f472b6,#8b5cf6); border-radius:50%; opacity:.9; animation:flux-spin 6s linear infinite; }
.theme-showcase[data-preset="flux"] .theme-showcase-pane { background:linear-gradient(160deg,#ffffff1f,#ffffff08); border:1px solid #ffffff26; border-radius:18px; -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px); }
.theme-showcase[data-preset="flux"] .theme-showcase-type { font-family:"Sora",sans-serif; font-weight:800; background:linear-gradient(100deg,#c4b5fd,#67e8f9,#f9a8d4); -webkit-background-clip:text; background-clip:text; color:transparent; }
.theme-showcase[data-preset="flux"] .theme-showcase-caption { position:relative; z-index:2; color:#e9e6ff; }
.theme-showcase[data-preset="flux"] .theme-showcase-mini-button { background:linear-gradient(120deg,#6d28d9,#0e7490); border-radius:999px; }

/* ---------- Theme switch (all themes): colors cross-fade + a ripple from the click point ---------- */
html.gsp-theme-fade, html.gsp-theme-fade body, html.gsp-theme-fade body * {
  transition:background-color .5s ease,color .5s ease,border-color .5s ease,fill .5s ease !important;
}
.gsp-theme-ripple {
  position:fixed; width:24px; height:24px; margin:-12px 0 0 -12px; border-radius:50%;
  pointer-events:none; z-index:2147483646;
  background:radial-gradient(circle,color-mix(in srgb,var(--accent) 50%,transparent),color-mix(in srgb,var(--accent-2,var(--accent)) 22%,transparent) 45%,transparent 70%);
  animation:gsp-ripple .85s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes gsp-ripple { from { transform:scale(0); opacity:.85; } to { transform:scale(180); opacity:0; } }
@media (prefers-reduced-motion:reduce) { .gsp-theme-ripple { display:none; } }

/* ---------- Small screens + accessibility ---------- */
@media (max-width:700px) {
  html[data-theme="flux"][data-mode][data-style] .topbar { border-radius:26px; top:8px; margin-top:8px; padding-left:16px; }
  html[data-theme="flux"][data-mode][data-style] .station-rail-left { top:auto; position:relative; }
  html[data-theme="flux"][data-mode][data-style] .station-card { padding:24px; }
  html[data-theme="flux"][data-mode][data-style] .stats.station-stats-side .stat { flex:1 1 calc(50% - 6px); min-width:0; }
}
@media (prefers-reduced-motion:reduce) {
  html[data-theme="flux"] *, html[data-theme="flux"] *::before, html[data-theme="flux"] *::after { animation:none !important; transition-duration:.01ms !important; }
}

html[data-theme="flux"] { --gutter:clamp(20px,3vw,56px); }
