/* ==========================================================================
   星星魔法 · Dual-Skin UI System (Warm Beige #f6f5f2 + Switchable Starlight)
   Visual & layout polish for New API v1.0.0-rc.49
   Zero functional modifications; respects native Light/Dark & theme presets.
   ========================================================================== */

/* ==========================================================================
   SKIN 1 (DEFAULT): 米黄暖纸 · Warm Beige (#f6f5f2, inspired by SnowAPI Poolside)
   ========================================================================== */
:root:not([data-theme-preset]):not([data-stella-skin="starlight"]) {
  --font-ui-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: var(--font-ui-sans);
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 0.9rem;
  --background: #f6f5f2;
  --foreground: #1b1916;
  --card: #fcfbf8;
  --card-foreground: #1b1916;
  --popover: rgba(252, 251, 248, 0.97);
  --popover-foreground: #1b1916;

  --primary: #c2623a;
  --primary-foreground: #fffdf9;
  --secondary: #ece9e0;
  --secondary-foreground: #2e2a24;
  --muted: #eeebe2;
  --muted-foreground: #6c675e;
  --accent: rgba(194, 98, 58, 0.10);
  --accent-foreground: #8f3f1e;

  --destructive: #c83232;
  --destructive-foreground: #ffffff;
  --success: #1a855a;
  --success-foreground: #ffffff;
  --warning: #c27814;
  --warning-foreground: #1b1916;
  --info: #2d6f9e;
  --info-foreground: #ffffff;

  --border: #e3dfd4;
  --input: #dad5c8;
  --ring: #c2623a;

  --sidebar: #f0eee8;
  --sidebar-foreground: #26231e;
  --sidebar-primary: #c2623a;
  --sidebar-primary-foreground: #fffdf9;
  --sidebar-accent: rgba(194, 98, 58, 0.11);
  --sidebar-accent-foreground: #9d4522;
  --sidebar-border: #e3dfd4;
  --sidebar-ring: #c2623a;

  --table-row: #fcfbf8;
  --table-header: #f1efe8;
  --table-header-hover: #e8e4da;

  --chart-1: #c2623a;
  --chart-2: #2f7d6d;
  --chart-3: #b08948;
  --chart-4: #4f6d8a;
  --chart-5: #9c5267;
  --overview-accent-1: #c2623a;
  --overview-accent-2: #2f7d6d;
  --overview-accent-3: #b08948;

  --stella-glow-1: rgba(214, 180, 130, 0.12);
  --stella-glow-2: rgba(194, 98, 58, 0.06);
  --stella-card-shadow: 0 1px 2px rgba(27, 25, 22, 0.04), 0 8px 22px -12px rgba(90, 74, 48, 0.10);
  --stella-card-hover-shadow: 0 4px 12px rgba(27, 25, 22, 0.05), 0 14px 30px -12px rgba(140, 95, 55, 0.16);
  --stella-header-bg: rgba(246, 245, 242, 0.86);
  --stella-btn-gradient: linear-gradient(135deg, #c96840 0%, #b3522c 100%);
  --stella-btn-shadow: 0 6px 18px -6px rgba(179, 82, 44, 0.40);
  --stella-sticky-shadow: -8px 0 16px -12px rgba(27, 25, 22, 0.14);
  --stella-selection: rgba(194, 98, 58, 0.18);
}

.dark:not([data-theme-preset]):not([data-stella-skin="starlight"]) {
  --background: #141412;
  --foreground: #f4f2ec;
  --card: #1d1c18;
  --card-foreground: #f4f2ec;
  --popover: rgba(29, 28, 24, 0.96);
  --popover-foreground: #f4f2ec;

  --primary: #df7c57;
  --primary-foreground: #141412;
  --secondary: #282620;
  --secondary-foreground: #ebe6dc;
  --muted: #24221d;
  --muted-foreground: #a7a297;
  --accent: rgba(223, 124, 87, 0.16);
  --accent-foreground: #ffd6c4;

  --destructive: #f87171;
  --destructive-foreground: #ffffff;
  --success: #4ade80;
  --success-foreground: #052e16;
  --warning: #fbbf24;
  --warning-foreground: #141412;
  --info: #60a5fa;
  --info-foreground: #0c192c;

  --border: #34322b;
  --input: #423f36;
  --ring: #df7c57;

  --sidebar: #181714;
  --sidebar-foreground: #e8e4da;
  --sidebar-primary: #df7c57;
  --sidebar-primary-foreground: #141412;
  --sidebar-accent: rgba(223, 124, 87, 0.18);
  --sidebar-accent-foreground: #ffd6c4;
  --sidebar-border: #302e27;
  --sidebar-ring: #df7c57;

  --table-row: #1d1c18;
  --table-header: #25231e;
  --table-header-hover: #2e2c26;

  --chart-1: #df7c57;
  --chart-2: #5eead4;
  --chart-3: #e9c46a;
  --chart-4: #7dd3fc;
  --chart-5: #f472b6;
  --overview-accent-1: #df7c57;
  --overview-accent-2: #5eead4;
  --overview-accent-3: #e9c46a;

  --stella-glow-1: rgba(223, 124, 87, 0.09);
  --stella-glow-2: rgba(233, 196, 106, 0.06);
  --stella-card-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 12px 28px -12px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 250, 240, 0.04);
  --stella-card-hover-shadow: 0 6px 16px rgba(0, 0, 0, 0.34), 0 16px 34px -12px rgba(223, 124, 87, 0.18), inset 0 1px 0 rgba(255, 250, 240, 0.06);
  --stella-header-bg: rgba(20, 20, 18, 0.84);
  --stella-btn-gradient: linear-gradient(135deg, #e58560 0%, #c96642 100%);
  --stella-btn-shadow: 0 6px 20px -6px rgba(223, 124, 87, 0.45);
  --stella-sticky-shadow: -10px 0 18px -10px rgba(0, 0, 0, 0.65);
  --stella-selection: rgba(223, 124, 87, 0.24);
}

/* ==========================================================================
   SKIN 2 (SWITCHABLE): 星空色 · Stella Starlight
   ========================================================================== */
:root[data-stella-skin="starlight"]:not([data-theme-preset]) {
  --font-ui-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: var(--font-ui-sans);
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 0.9rem;
  --background: #f5f7fd;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: rgba(255, 255, 255, 0.96);
  --popover-foreground: #0f172a;

  --primary: #5558e6;
  --primary-foreground: #ffffff;
  --secondary: #edf0fb;
  --secondary-foreground: #3730a3;
  --muted: #eef2fa;
  --muted-foreground: #5e6782;
  --accent: rgba(85, 88, 230, 0.10);
  --accent-foreground: #312e81;

  --destructive: #e11d48;
  --destructive-foreground: #ffffff;
  --success: #0d9f6e;
  --success-foreground: #ffffff;
  --warning: #d97706;
  --warning-foreground: #0f172a;
  --info: #0284c7;
  --info-foreground: #ffffff;

  --border: rgba(85, 88, 230, 0.12);
  --input: rgba(85, 88, 230, 0.18);
  --ring: #6366f1;

  --sidebar: #f0f3fc;
  --sidebar-foreground: #1e293b;
  --sidebar-primary: #5558e6;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(85, 88, 230, 0.12);
  --sidebar-accent-foreground: #4338ca;
  --sidebar-border: rgba(85, 88, 230, 0.10);
  --sidebar-ring: #6366f1;

  --table-row: #ffffff;
  --table-header: #f4f6fc;
  --table-header-hover: #eceffb;

  --chart-1: #5558e6;
  --chart-2: #0ea5e9;
  --chart-3: #8b5cf6;
  --chart-4: #10b981;
  --chart-5: #f59e0b;
  --overview-accent-1: #5558e6;
  --overview-accent-2: #0ea5e9;
  --overview-accent-3: #8b5cf6;

  --stella-glow-1: rgba(99, 102, 241, 0.11);
  --stella-glow-2: rgba(56, 189, 248, 0.08);
  --stella-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -12px rgba(79, 70, 229, 0.10);
  --stella-card-hover-shadow: 0 4px 12px rgba(15, 23, 42, 0.05), 0 16px 36px -14px rgba(85, 88, 230, 0.18);
  --stella-header-bg: rgba(245, 247, 253, 0.80);
  --stella-btn-gradient: linear-gradient(135deg, #5b5ce6 0%, #3b82f6 100%);
  --stella-btn-shadow: 0 6px 18px -6px rgba(85, 88, 230, 0.50);
  --stella-sticky-shadow: -8px 0 16px -12px rgba(15, 23, 42, 0.14);
  --stella-selection: rgba(99, 102, 241, 0.24);
}

.dark[data-stella-skin="starlight"]:not([data-theme-preset]) {
  --background: #080c16;
  --foreground: #f1f5f9;
  --card: #111728;
  --card-foreground: #f1f5f9;
  --popover: rgba(16, 22, 38, 0.94);
  --popover-foreground: #f1f5f9;

  --primary: #7276ff;
  --primary-foreground: #ffffff;
  --secondary: #192137;
  --secondary-foreground: #c7d2fe;
  --muted: #151c2f;
  --muted-foreground: #94a3b8;
  --accent: rgba(114, 118, 255, 0.16);
  --accent-foreground: #e0e7ff;

  --destructive: #fb7185;
  --destructive-foreground: #ffffff;
  --success: #34d399;
  --success-foreground: #052e16;
  --warning: #fbbf24;
  --warning-foreground: #0f172a;
  --info: #38bdf8;
  --info-foreground: #082f49;

  --border: rgba(148, 163, 255, 0.13);
  --input: rgba(148, 163, 255, 0.20);
  --ring: #818cf8;

  --sidebar: #0b101d;
  --sidebar-foreground: #e2e8f0;
  --sidebar-primary: #7276ff;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(114, 118, 255, 0.18);
  --sidebar-accent-foreground: #c7d2fe;
  --sidebar-border: rgba(148, 163, 255, 0.10);
  --sidebar-ring: #818cf8;

  --table-row: #111728;
  --table-header: #161e34;
  --table-header-hover: #1d2744;

  --chart-1: #818cf8;
  --chart-2: #38bdf8;
  --chart-3: #c084fc;
  --chart-4: #34d399;
  --chart-5: #fbbf24;
  --overview-accent-1: #818cf8;
  --overview-accent-2: #38bdf8;
  --overview-accent-3: #c084fc;

  --stella-glow-1: rgba(99, 102, 241, 0.18);
  --stella-glow-2: rgba(14, 165, 233, 0.10);
  --stella-card-shadow: 0 2px 6px rgba(0, 0, 0, 0.30), 0 14px 34px -14px rgba(0, 0, 0, 0.60), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --stella-card-hover-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 18px 40px -14px rgba(99, 102, 241, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --stella-header-bg: rgba(8, 12, 22, 0.78);
  --stella-btn-gradient: linear-gradient(135deg, #6d70ff 0%, #38bdf8 100%);
  --stella-btn-shadow: 0 6px 20px -6px rgba(114, 118, 255, 0.55);
  --stella-sticky-shadow: -10px 0 18px -10px rgba(0, 0, 0, 0.65);
  --stella-selection: rgba(99, 102, 241, 0.24);
}

/* ==========================================================================
   SHARED TYPOGRAPHY, LAYOUT, COMPONENTS & FLOATING SKIN SWITCHER
   ========================================================================== */

html, body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--stella-selection, rgba(194, 98, 58, 0.2));
  color: inherit;
}

code, pre, kbd, samp, .font-mono {
  font-family: var(--font-mono);
}

/* Ambient Backdrop */
:root:not([data-theme-preset]) body {
  background-color: var(--background);
  background-image:
    radial-gradient(ellipse 80% 42% at 15% -6%, var(--stella-glow-1), transparent 70%),
    radial-gradient(ellipse 70% 38% at 88% -4%, var(--stella-glow-2), transparent 68%);
  background-attachment: fixed;
}

:root:not([data-theme-preset]) main[data-slot="sidebar-inset"] {
  background:
    radial-gradient(ellipse 60% 30% at 85% 0%, var(--stella-glow-2), transparent 70%),
    var(--background);
}

@media (min-width: 768px) {
  :root:not([data-theme-preset]) main[data-slot="sidebar-inset"] {
    border: 1px solid var(--border);
  }
}

/* Sticky Frosted Header & Nav Collision Fix */
:root:not([data-theme-preset]) header {
  background: var(--stella-header-bg) !important;
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

header nav {
  flex-shrink: 0;
  white-space: nowrap;
}

header div:has(> nav) {
  margin-inline-end: 0.625rem !important;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  header button:is([aria-label="搜索"], [aria-label="Search"]) {
    width: 10.5rem !important;
    min-width: 10.5rem;
    overflow: hidden;
  }
}

@media (min-width: 1024px) {
  header button:is([aria-label="搜索"], [aria-label="Search"]) {
    width: 12.5rem !important;
    min-width: 12.5rem;
  }
}

@media (min-width: 1280px) {
  header button:is([aria-label="搜索"], [aria-label="Search"]) {
    width: 14rem !important;
    min-width: 14rem;
  }
}

:root:not([data-theme-preset]) header a[href="/"] img,
:root:not([data-theme-preset]) header a[href="/"] svg {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

:root:not([data-theme-preset]) header a[href="/"]:hover img,
:root:not([data-theme-preset]) header a[href="/"]:hover svg {
  transform: scale(1.06) rotate(-4deg);
}

/* Cards Elevation & Polish */
:root:not([data-theme-preset]) :is([data-slot="card"], main .rounded-2xl.border.bg-card) {
  border-color: var(--border) !important;
  box-shadow: var(--stella-card-shadow);
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
  font-variant-numeric: tabular-nums;
}

:root:not([data-theme-preset]) :is([data-slot="card"]:not([data-card-hover="false"]), main .rounded-2xl.border.bg-card):hover {
  border-color: color-mix(in oklch, var(--primary) 30%, var(--border)) !important;
  box-shadow: var(--stella-card-hover-shadow);
}

:root:not([data-theme-preset]) :is([data-slot="card"], main .rounded-2xl.border.bg-card) .rounded-lg.border,
:root:not([data-theme-preset]) :is([data-slot="card"], main .rounded-2xl.border.bg-card) .rounded-xl.border {
  border-color: var(--border);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

/* Overview Bento Layout Optimization */
body[data-stella-route="/dashboard/overview"] .rounded-2xl.border.bg-card :is(.h-72, .h-80) {
  height: auto !important;
  min-height: 6.5rem;
  max-height: 18rem;
}

@media (min-width: 1280px) {
  body[data-stella-route="/dashboard/overview"] main [class*="xl:grid-cols-[minmax(0,1fr)_22rem]"] {
    align-items: start;
  }

  body[data-stella-route="/dashboard/overview"] main [class*="lg:grid-cols-2"]:has(> .lg\:col-span-2) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body[data-stella-route="/dashboard/overview"] main [class*="lg:grid-cols-2"] > .lg\:col-span-2 {
    grid-column: 1 / -1 !important;
  }
}

/* Primary CTA Buttons */
:root:not([data-theme-preset]) :is(button, a).bg-primary {
  background-image: var(--stella-btn-gradient);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--stella-btn-shadow);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, filter 0.18s ease;
}

:root:not([data-theme-preset]) :is(button, a).bg-primary:not(:disabled):hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

:root:not([data-theme-preset]) :is(button, a).bg-primary:not(:disabled):active {
  transform: translateY(0);
}

/* Inputs & Focus */
:root:not([data-theme-preset]) input:not([type="checkbox"]):not([type="radio"]),
:root:not([data-theme-preset]) textarea,
:root:not([data-theme-preset]) [data-slot="select-trigger"] {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

:root:not([data-theme-preset]) input:not([type="checkbox"]):not([type="radio"]):focus-visible,
:root:not([data-theme-preset]) textarea:focus-visible,
:root:not([data-theme-preset]) [data-slot="select-trigger"]:focus-visible {
  border-color: var(--ring) !important;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 18%, transparent) !important;
}

/* Tables: Instant Render + Sticky Opaque Action Columns */
[data-slot="table"] tbody tr {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

:root:not([data-theme-preset]) :is([data-slot="table-container"], div:has(> [data-slot="table"])) {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.95);
  background: var(--card);
  box-shadow: var(--stella-card-shadow);
}

:root:not([data-theme-preset]) [data-slot="table"] thead tr {
  background: var(--table-header);
  border-bottom: 1px solid var(--border);
}

:root:not([data-theme-preset]) [data-slot="table"] th {
  color: var(--muted-foreground);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

:root:not([data-theme-preset]) [data-slot="table"] tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.14s ease;
}

:root:not([data-theme-preset]) [data-slot="table"] tbody tr:hover {
  background: color-mix(in oklch, var(--primary) 5%, var(--card));
}

:root:not([data-theme-preset]) [data-slot="table"] tbody tr:last-child {
  border-bottom: none;
}

:root:not([data-theme-preset]) [data-slot="table"] th.sticky {
  background: var(--table-header) !important;
  z-index: 3;
}

:root:not([data-theme-preset]) [data-slot="table"] td.sticky {
  background: var(--card) !important;
  z-index: 2;
}

:root:not([data-theme-preset]) [data-slot="table"] tbody tr:hover td.sticky {
  background: color-mix(in oklch, var(--primary) 5%, var(--card)) !important;
}

:root:not([data-theme-preset]) [data-slot="table"] :is(th, td).sticky.right-0 {
  box-shadow: var(--stella-sticky-shadow);
}

/* /keys /channels /usage-logs Toolbar Polish */
:root:not([data-theme-preset]) body:is(
  [data-stella-route="/keys"],
  [data-stella-route="/channels"],
  [data-stella-route^="/usage-logs"]
) main > main > div {
  gap: 0.875rem;
}

:root:not([data-theme-preset]) body[data-stella-route="/keys"] main .flex.flex-wrap.items-center:has(input[placeholder]) {
  background: color-mix(in oklch, var(--card) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.9);
  padding: 0.625rem 0.75rem;
}

:root:not([data-theme-preset]) body[data-stella-route="/keys"] [data-slot="table"] :is(th, td) {
  padding-inline: 0.75rem;
}

/* Dialogs, Popovers, Menus, Sidebar */
:root:not([data-theme-preset]) [data-slot="dialog-content"],
:root:not([data-theme-preset]) [data-slot="popover-content"],
:root:not([data-theme-preset]) [data-slot="dropdown-menu-content"],
:root:not([data-theme-preset]) [data-slot="select-content"] {
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.22);
}

.dark:not([data-theme-preset]) [data-slot="dialog-content"],
.dark:not([data-theme-preset]) [data-slot="popover-content"],
.dark:not([data-theme-preset]) [data-slot="dropdown-menu-content"],
.dark:not([data-theme-preset]) [data-slot="select-content"] {
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.70), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root:not([data-theme-preset]) [role="dialog"][aria-label="Sidebar"] {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
}

:root:not([data-theme-preset]) [data-slot="status-badge"],
:root:not([data-theme-preset]) [data-slot="provider-badge"] {
  font-variant-numeric: tabular-nums;
}

/* Homepage ("/") — Starlight gets fine grid; Beige gets warm editorial glow */
:root[data-stella-skin="starlight"]:not([data-theme-preset]) body[data-stella-route="/"] {
  background-image:
    radial-gradient(circle at 20% 10%, var(--stella-glow-1), transparent 45%),
    radial-gradient(circle at 82% 18%, var(--stella-glow-2), transparent 42%),
    linear-gradient(to right, rgba(99, 102, 241, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
  background-attachment: scroll;
}

:root:not([data-theme-preset]) body[data-stella-route="/"] main .rounded-2xl,
:root:not([data-theme-preset]) body[data-stella-route="/"] main .rounded-xl,
:root:not([data-theme-preset]) body[data-stella-route="/"] .rounded-2xl.border {
  box-shadow: var(--stella-card-shadow);
}

:root:not([data-theme-preset]) body[data-stella-route="/"] footer {
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 65%, transparent);
}

/* Auth Pages (/sign-in, /sign-up, /forgot-password, /reset, /otp) */
:root:not([data-theme-preset]) body:is(
  [data-stella-route="/sign-in"],
  [data-stella-route="/login"],
  [data-stella-route="/sign-up"],
  [data-stella-route="/register"],
  [data-stella-route="/forgot-password"],
  [data-stella-route="/reset"],
  [data-stella-route="/otp"]
) div.w-full:has(> div > h2):has(form):not(:has(a[href="/"])) {
  background: var(--card);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  padding: 2rem 1.75rem;
  box-shadow: var(--stella-card-hover-shadow);
}

/* ==========================================================================
   ULTRA-MINIMALIST HOMEPAGE (/) & FLOATING SKIN SWITCHER PILL
   ========================================================================== */
:root[data-stella-route="/"] #root {
  display: none !important;
}

:root:not([data-stella-route="/"]) #stella-home-stage {
  display: none !important;
}

#stella-home-stage {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-ui-sans);
}

#stella-home-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, var(--stella-glow-1), transparent 54%),
    radial-gradient(circle at 50% 58%, var(--stella-glow-2), transparent 62%);
}

:root[data-stella-skin="starlight"] #stella-home-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.72;
  background-image:
    radial-gradient(1.5px 1.5px at 16% 24%, rgba(255, 255, 255, 0.70), transparent),
    radial-gradient(1px 1px at 28% 66%, rgba(165, 180, 252, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 42% 18%, rgba(255, 255, 255, 0.60), transparent),
    radial-gradient(1px 1px at 64% 28%, rgba(125, 211, 252, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 78% 58%, rgba(255, 255, 255, 0.70), transparent),
    radial-gradient(1px 1px at 84% 20%, rgba(196, 181, 253, 0.60), transparent),
    radial-gradient(1px 1px at 12% 82%, rgba(147, 197, 253, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 54% 80%, rgba(255, 255, 255, 0.50), transparent);
}

.stella-home-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
}

.stella-home-emblem {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--stella-card-shadow);
  color: var(--primary);
}

.stella-home-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, var(--font-ui-sans), serif;
  font-size: clamp(2.35rem, 5.2vw, 3.6rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--foreground);
}

.stella-home-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 28px;
  border-radius: 9999px;
  background: var(--stella-btn-gradient);
  color: var(--primary-foreground) !important;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  box-shadow: var(--stella-btn-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.stella-home-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.stella-home-cta:active {
  transform: translateY(0);
}

.stella-home-cta .stella-cta-arrow {
  transition: transform 0.18s ease;
}

.stella-home-cta:hover .stella-cta-arrow {
  transform: translateX(3px);
}

/* Pin skin switcher neatly in top-right on homepage (/) without overlapping */
:root[data-stella-route="/"] #stella-skin-switcher,
body[data-stella-route="/"] #stella-skin-switcher {
  top: 20px;
  left: auto;
  right: 24px;
  bottom: auto;
}

#stella-skin-switcher {
  position: fixed;
  z-index: 45;
  top: 8px;
  left: 292px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  height: 32px;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--card) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.12);
  font-family: var(--font-ui-sans);
  user-select: none;
}

@media (max-width: 1023px) {
  #stella-skin-switcher {
    top: auto;
    bottom: 12px;
    left: 12px;
  }
}

body:is(
  [data-stella-route="/sign-in"],
  [data-stella-route="/login"],
  [data-stella-route="/sign-up"],
  [data-stella-route="/register"],
  [data-stella-route="/forgot-password"],
  [data-stella-route="/reset"],
  [data-stella-route="/otp"]
) #stella-skin-switcher {
  top: 16px;
  left: auto;
  right: 20px;
  bottom: auto;
}

#stella-skin-switcher button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

#stella-skin-switcher button:hover {
  color: var(--foreground);
}

#stella-skin-switcher button.is-active {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 2px 8px -2px color-mix(in oklch, var(--primary) 55%, transparent);
}

#stella-skin-switcher .stella-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  display: inline-block;
  border: 1px solid rgba(128, 128, 128, 0.35);
}

#stella-skin-switcher .stella-dot-beige {
  background: #f6f5f2;
}

#stella-skin-switcher .stella-dot-starlight {
  background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(120, 113, 102, 0.25);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklch, var(--primary) 55%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
