/* Aura Nocturne. Opt-in skin: light palette, layouts and portrait assets stay intact. */
/* Eclipse: a 44px touch target with a compact, inset 3D track.
   State follows the root, so a saved night preference paints correctly even
   before the header's JavaScript has synchronised its accessible state. */
.app-header .header-theme {
  --theme-travel:30px; position:relative; width:64px; height:44px;
  flex:none; padding:0; border:0; border-radius:22px; background:transparent;
  color:var(--muted); isolation:isolate;
}
.app-header .header-theme:not(:disabled) { cursor:pointer; }
.app-header .header-theme:not(:disabled):hover { background:transparent; }
.header-theme > span { pointer-events:none; }
.theme-track {
  position:absolute; inset:5px 0; border-radius:20px; opacity:1;
  background:linear-gradient(155deg,#d0c5b4,#f8f2e7);
  box-shadow:inset 0 2px 4px #5c4b3742,inset 0 -1px 1px #ffffffb8,0 1px 0 #ffffffa3;
}
.theme-track-night {
  position:absolute; inset:5px 0; opacity:0;
}
.theme-track-night svg { display:block; width:100%; height:100%; overflow:visible; }
.theme-sphere {
  position:absolute; top:8px; left:3px; width:28px; height:28px;
  transform:translate3d(0,0,0);
}
/* Static silhouettes crossfade while their small compositor layers move.
   No animated masks, filters or shadow rasterisation on the moving moon. */
.theme-sphere::before {
  content:""; position:absolute; inset:4px; border-radius:50%; opacity:1;
  transform:scale(1);
  background:radial-gradient(circle at 30% 23%,#fff7cc,#efb163 43%,#bd622a 78%,#8a3a19);
  box-shadow:0 3px 5px #4d301952,inset 0 1px 1px #ffffffdb,inset -2px -2px 3px #9b461439;
}
.theme-moon {
  position:absolute; inset:5px; opacity:0;
  transform:rotate(-18deg) scale(.88);
}
.theme-moon svg { display:block; width:100%; height:100%; overflow:visible; }
.theme-symbol { position:absolute; top:15px; display:grid; place-items:center; width:14px; height:14px; }
.theme-symbol svg { width:14px; height:14px; stroke-width:1.5; }
.theme-symbol-sun { left:8px; color:#adc28e; opacity:0; }
.theme-symbol-moon { right:8px; color:#786958; opacity:1; }
:root[data-theme="dark"] .app-header .header-theme { background:transparent; }
:root[data-theme="dark"] .theme-track-night,
:root[data-theme="dark"] .theme-moon,
:root[data-theme="dark"] .theme-symbol-sun { opacity:1; }
:root[data-theme="dark"] .theme-symbol-moon,
:root[data-theme="dark"] .theme-track,
:root[data-theme="dark"] .theme-sphere::before { opacity:0; }
:root[data-theme="dark"] .theme-sphere { transform:translate3d(var(--theme-travel),0,0); }
:root[data-theme="dark"] .theme-sphere::before { transform:scale(.86); }
:root[data-theme="dark"] .theme-moon { transform:rotate(0) scale(1); }
@media(max-width:359px) {
  .app-header .header-theme { width:56px; --theme-travel:22px; }
  .theme-symbol-sun { left:6px; }
  .theme-symbol-moon { right:6px; }
}

:root[data-theme="dark"] {
  color-scheme:dark;
  --paper:#0c0e0b;
  --surface:#191d17;
  --panel:#252c20;
  --ink:#f2f5ec;
  --muted:#adb5a4;
  --line:#3d4735;
  --accent:#c1f46b;
  --accent-soft:#2c3b1d;
  --shadow:0 10px 30px #00000040,0 1px 0 #ffffff08 inset;
  --night-glass:#1b2118f5;
  --night-edge:#ffffff15;
  --night-on-accent:#17200d;
  --night-ease:cubic-bezier(.2,.75,.2,1);
  background:var(--paper);
}

/* Static, bounded gradients give ambient light without animating large blurs.
   One isolated background layer stays behind every clickable surface. */
body { isolation:isolate; }
:root[data-theme="dark"] body { background:var(--paper); }
body::before {
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(ellipse 72% 44% at 105% -4%,#b6ef5630,transparent 75%),
    radial-gradient(ellipse 85% 48% at -14% 100%,#a0d13b38,transparent 74%),
    linear-gradient(145deg,#ffffff03,transparent 48%);
  opacity:0;
}
:root[data-theme="dark"] body::before { opacity:1; }
:root[data-theme="dark"] .app-shell { background:transparent; box-shadow:none; }
:root[data-theme="dark"] .app-header {
  --balance-surface:#252e1d; --menu-surface:var(--night-glass);
  background:#11150ff5; border-color:var(--night-edge);
  box-shadow:0 8px 28px #00000066,0 1px 0 #ffffff06 inset;
}
:root[data-theme="dark"] .brand-logo {
  filter:grayscale(1) contrast(10) invert(1); mix-blend-mode:screen;
}
:root[data-theme="dark"] .editor-placeholder img {
  filter:url('#aura-black-mark') invert(1); mix-blend-mode:normal;
}
:root[data-theme="dark"] .brand { color:var(--ink); }
:root[data-theme="dark"] .header-control { color:#c0c7b8; }
:root[data-theme="dark"] .header-balance > span {
  color:var(--accent); border:1px solid #c1f46b24;
  box-shadow:0 1px 0 #ffffff0a inset;
}
:root[data-theme="dark"] .header-control[aria-expanded="true"] { color:var(--accent); }
:root[data-theme="dark"] .avatar { background:var(--surface); border-color:var(--line); color:var(--ink); }
:root[data-theme="dark"] .header-panel,
:root[data-theme="dark"] .composer-popover,
:root[data-theme="dark"] .generation-confirm {
  background:var(--night-glass); border-color:#6a7e5059;
  box-shadow:0 24px 60px #00000080,0 5px 16px #0000004d,inset 0 1px 0 #e8ffbe18;
  backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
}
:root[data-theme="dark"] .header-navigation a[aria-current="page"] { background:var(--accent-soft); }
:root[data-theme="dark"] .profile-person,
:root[data-theme="dark"] .profile-topup {
  background:#ffffff04; border-color:var(--night-edge);
  box-shadow:0 1px 0 #ffffff08 inset,0 5px 14px #0000001f;
}
:root[data-theme="dark"] .profile-person .avatar { box-shadow:0 0 0 3px #c1f46b0a; }
:root[data-theme="dark"] .profile-funds {
  background:linear-gradient(115deg,#c1f46b10,#ffffff03);
  border-color:#c1f46b29; box-shadow:0 1px 0 #ffffff08 inset;
}
:root[data-theme="dark"] .profile-funds strong { color:var(--accent); }
:root[data-theme="dark"] .receipt-preferences { border-color:var(--line); }
:root[data-theme="dark"] input::placeholder { color:var(--muted); opacity:1; }

/* Quiet gallery; no tint/filter is applied to any portrait. */
:root[data-theme="dark"] .catalogue-heading { padding-bottom:15px; border-bottom:1px solid var(--night-edge); }
:root[data-theme="dark"] .look-image { background:#171b14; box-shadow:0 6px 18px #00000030; }
:root[data-theme="dark"] .look-image::after { border-color:#ffffff14; }
:root[data-theme="dark"] .look-tile > .favorite::before {
  background:#151a12e8; border-color:#ffffff2b; box-shadow:0 2px 8px #00000040;
}
:root[data-theme="dark"] .favorite[aria-pressed="true"],
:root[data-theme="dark"] .look-tile > .favorite[aria-pressed="true"]::before { border-color:#c1f46b80; }
:root[data-theme="dark"] .placeholder .look-image {
  background:linear-gradient(145deg,#1c2217,#11150f); border-color:#313a28;
  color:#9ea994;
}
:root[data-theme="dark"] .primary,
:root[data-theme="dark"] .composer-popover .upload-choice {
  color:var(--night-on-accent); border-color:#c1f46b;
  background:linear-gradient(120deg,#d0fa8b,#b2e85b);
  box-shadow:0 1px 0 #f3ffdd80 inset,0 5px 18px #96c84b17;
}
:root[data-theme="dark"] .secondary,
:root[data-theme="dark"] .choice,
:root[data-theme="dark"] .header-packages { background:#ffffff05; border-color:var(--line); }
:root[data-theme="dark"] .choice[aria-pressed="true"] {
  color:var(--accent); background:var(--accent-soft); border-color:var(--accent);
}
:root[data-theme="dark"] .upload { border-color:#63744e; }
:root[data-theme="dark"] .reference button { background:#191d17eb; }
:root[data-theme="dark"] .editor-workspace .reference button { background:transparent; }
:root[data-theme="dark"] .editor-workspace .reference button::before { box-shadow:0 1px 4px #00000070; }
:root[data-theme="dark"] .empty-symbol {
  background:radial-gradient(ellipse at 25% 0,#3a4d27,#191e15 75%);
  border-color:#c1f46b30; box-shadow:0 6px 24px #00000030,0 1px 0 #ffffff0a inset;
}
:root[data-theme="dark"] .error {
  color:#ffb7a8; background:#331d19; border-color:#985f50;
}
:root[data-theme="dark"] .receipt-preferences [data-error="true"] { color:#ffb7a8; }
:root[data-theme="dark"] .toast { background:#28331f; color:var(--ink); border-color:#c1f46b40; }
:root[data-theme="dark"] .guide-badge--do { background:#24351b; color:#c1f46b; }
:root[data-theme="dark"] .guide-badge--dont { background:#39231d; color:#ffb7a8; }
:root[data-theme="dark"] .guide-col--do .guide-list li::before { color:var(--accent); }
:root[data-theme="dark"] .guide-col--dont .guide-list li::before { color:#ffb7a8; }

/* Raised controls, clean dividing edges, no luminous halo around every card. */
:root[data-theme="dark"] .flow-actions,
:root[data-theme="dark"] .editor-dock {
  background:linear-gradient(135deg,#20271bf5,#141811fa);
  border-color:#59654a; box-shadow:0 -8px 28px #00000030,0 10px 26px #00000050,inset 0 1px 0 #ffffff0b;
}
:root[data-theme="dark"] .editor-look { background:#1a2016; border-color:#46523b; }
:root[data-theme="dark"] .editor-placeholder { background:transparent; }
:root[data-theme="dark"] .dock-control { background:#0f130d; border-color:#627151; }
:root[data-theme="dark"] .dock-control[aria-expanded="true"] { color:var(--accent); background:var(--accent-soft); border-color:#8faa67; }
:root[data-theme="dark"] .editor-dock .consent input { accent-color:var(--accent); }
:root[data-theme="dark"] .menu-option[aria-pressed="true"] { color:var(--accent); }
:root[data-theme="dark"] .generation-cost strong { color:var(--accent); }
:root[data-theme="dark"] .generation-confirm::backdrop,
:root[data-theme="dark"] .checkout-dialog::backdrop { background:#030602b8; }
:root[data-theme="dark"] .photo-viewer { background:#10130e; color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] .photo-viewer::backdrop { background:#030502ed; }
:root[data-theme="dark"] .viewer-ios-hint { color:var(--muted); }

/* All four tiers share the night palette; intensity replaces warm/gold fills. */
:root[data-theme="dark"] .plan-slide .plan-card-inner {
  color:var(--ink); background:linear-gradient(160deg,#222a1b,#141811 64%);
  border:1px solid #4a593a; box-shadow:0 12px 32px #00000055,0 1px 0 #ffffff0c inset;
}
:root[data-theme="dark"] .plan-slide-studio .plan-card-inner { border-color:#8dae60; }
:root[data-theme="dark"] .plan-slide-portfolio .plan-card-inner { background:linear-gradient(160deg,#28351b,#11150e 64%); }
:root[data-theme="dark"] .plan-slide-collection .plan-card-inner {
  background:radial-gradient(ellipse at 100% 0,#4a62254a,transparent 60%),#10150c;
  border-color:#c1f46b; box-shadow:0 12px 32px #00000055,0 0 22px #a6d8590a;
}
:root[data-theme="dark"] .plan-slide .plan-label,
:root[data-theme="dark"] .plan-slide .plan-description,
:root[data-theme="dark"] .plan-slide .plan-value,
:root[data-theme="dark"] .plan-slide .plan-legal-note { color:var(--muted); }
:root[data-theme="dark"] .plan-slide .plan-legal-note a { color:#c6cebc; }
:root[data-theme="dark"] .plan-slide .plan-features li { color:#dce3d3; }
:root[data-theme="dark"] .plan-slide .plan-features svg { color:var(--accent); }
:root[data-theme="dark"] .plan-slide .plan-tag { color:var(--accent); background:var(--accent-soft); border-color:#c1f46b38; }
:root[data-theme="dark"] .plan-slide .plan-price-pill {
  border-color:#718856; color:var(--ink); box-shadow:0 4px 0 #050803,0 8px 18px #00000033;
}
:root[data-theme="dark"] .plan-slide .plan-pill-rubles { background:linear-gradient(145deg,#2b3422,#191f14); color:var(--ink); }
:root[data-theme="dark"] .plan-slide .plan-pill-aur {
  background:linear-gradient(120deg,#d0fa8b,#a8d95c); color:var(--night-on-accent); text-shadow:none;
}
:root[data-theme="dark"] .plan-slide .plan-select { background:#ffffff03; color:var(--ink); border-color:#879d6c; }
:root[data-theme="dark"] .plan-slide .plan-select[aria-pressed="true"] {
  color:var(--night-on-accent); background:var(--accent); border-color:var(--accent);
  box-shadow:0 4px 18px #a6d85912;
}
:root[data-theme="dark"] .plan-brand-mark { filter:invert(1); opacity:.82; }
:root[data-theme="dark"] .plan-slide .plan-brand-disc { fill:transparent; }
:root[data-theme="dark"] .checkout-dialog,
:root[data-theme="dark"] .checkout-panel { background:var(--surface); color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] .checkout-panel input { background:var(--paper); color:var(--ink); border-color:#657654; }
:root[data-theme="dark"] .checkout-panel :focus-visible { outline-color:var(--accent); }
:root[data-theme="dark"] .generation-progress { background:#0c0f0a; }
:root[data-theme="dark"] .waiting-screen::before { background:radial-gradient(circle,#a6dc5152 0%,#789d2824 39%,transparent 72%); }
:root[data-theme="dark"] .aura-glow { background:radial-gradient(circle,#bff36b69 0%,#bff36b19 42%,transparent 72%); }
:root[data-theme="dark"] .aura-ring { border-color:#c1f46b71; box-shadow:0 0 0 13px #baf36c0b,inset 0 0 0 18px #eaffca08; }
:root[data-theme="dark"] .aura-ring::before,:root[data-theme="dark"] .aura-ring::after { box-shadow:0 0 0 5px #c1f46b19,0 0 16px #c1f46b73; }
:root[data-theme="dark"] .aura-core { background:linear-gradient(145deg,#364b23,#1e2818 65%,#0e140b); border-color:#8cab60; box-shadow:0 18px 40px #0000007a,inset 0 2px 2px #eaffca2c,inset 0 -7px 14px #00000061; }
:root[data-theme="dark"] .aura-core::before { border-color:#edffcb29; }
:root[data-theme="dark"] .aura-core img { filter:url('#aura-black-mark') invert(1); mix-blend-mode:normal; }

@media(min-width:700px) {
  :root[data-theme="dark"] .app-shell { border-inline:1px solid #ffffff07; }
}
@media(hover:hover) and (pointer:fine) {
  :root[data-theme="dark"] .primary:not(:disabled):hover,
  :root[data-theme="dark"] .composer-popover .upload-choice:hover { background:#d5ff91; border-color:#d5ff91; box-shadow:0 6px 24px #b6ef5626; }
  :root[data-theme="dark"] .secondary:hover,
  :root[data-theme="dark"] .template-summary:hover,
  :root[data-theme="dark"] .job-card:hover,
  :root[data-theme="dark"] .upload:not(.busy):hover,
  :root[data-theme="dark"] .choice:not([aria-pressed="true"]):hover,
  :root[data-theme="dark"] .plan-slide .plan-select:not([aria-pressed="true"]):hover { background:#2a3521; border-color:#8fab6c; }
  :root[data-theme="dark"] .icon-button:not(:disabled):hover { background:var(--accent-soft); }
  :root[data-theme="dark"] .look-tile > .favorite:hover { background:transparent; }
  :root[data-theme="dark"] .look-card:hover .look-image { box-shadow:0 12px 28px #00000070,0 0 0 1px #c1f46b40; }
}
@media(prefers-reduced-motion:no-preference) {
  .theme-sphere { will-change:transform; transition:transform 380ms cubic-bezier(.4,0,.2,1); }
  .theme-sphere::before,.theme-moon {
    will-change:transform,opacity;
    transition:transform 380ms cubic-bezier(.4,0,.2,1),opacity 300ms ease;
  }
  .theme-track,.theme-track-night,.theme-symbol { transition:opacity 300ms ease; }
  .app-header .header-theme { transition:transform 120ms ease; }
  .app-header .header-theme:not(:disabled):active { transform:scale(.96); }
  /* No snapshot overlay or page-wide blur: only the shell and a small set of
     surfaces fade, leaving navigation / carousel transform transitions alone. */
  :root,body,.app-shell,.app-header,.header-balance > span,.avatar,
  .editor-dock,.flow-actions,.profile-person,.profile-funds,.profile-topup,
  .generation-confirm,.photo-viewer {
    transition:background-color 380ms ease,color 380ms ease,border-color 380ms ease,box-shadow 380ms ease;
  }
  body::before { transition:opacity 420ms ease; }
  :root[data-theme="dark"] .header-panel { transition:opacity 220ms ease,transform 280ms var(--night-ease),visibility 280ms; }
  :root[data-theme="dark"] .composer-popover { transition:opacity 220ms ease,transform 280ms var(--night-ease),visibility 280ms; }
  :root[data-theme="dark"] .plan-slide.is-active .plan-pill-aur::after { animation:aur-plaque-sheen 2.4s ease-out 1; }
}
@media(prefers-reduced-motion:reduce) {
  .header-theme,.header-theme *,.header-theme *::before,.header-theme *::after,body::before {
    animation:none !important; transition:none !important;
  }
  :root[data-theme="dark"] *, :root[data-theme="dark"] *::before, :root[data-theme="dark"] *::after {
    animation:none !important; transition:none !important; scroll-behavior:auto !important;
  }
}
