@font-face {
  font-family: StarScript;
  src: url('/starapi/brand.ttf') format('truetype');
  font-display: swap;
}

:root {
  --primary: oklch(0.54 0.14 252);
  --primary-foreground: oklch(0.99 0.005 240);
  --ring: oklch(0.64 0.13 248);
  --sidebar-primary: var(--primary);
  --background: oklch(0.982 0.01 232);
  --card: oklch(0.996 0.004 232);
  --muted: oklch(0.952 0.018 238);
  --accent: oklch(0.932 0.035 238);
  --border: oklch(0.895 0.024 242);
  --radius: 0.9rem;
  --sidebar: oklch(0.968 0.018 235);
}

html.dark {
  --primary: oklch(0.75 0.11 242);
  --primary-foreground: oklch(0.18 0.04 252);
  --background: oklch(0.185 0.028 252);
  --card: oklch(0.225 0.03 252);
  --muted: oklch(0.27 0.035 252);
  --accent: oklch(0.32 0.05 252);
  --border: oklch(0.34 0.035 252);
  --sidebar: oklch(0.21 0.032 252);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

/* ---- Sidebar & Console Polish ---- */
[data-slot="sidebar-wrapper"] {
  background: radial-gradient(ellipse at 95% 0%, rgb(135 203 227 / 0.18), transparent 48%), var(--background);
}
[data-slot="sidebar"],
[data-slot="sidebar-inner"] {
  background: var(--sidebar) !important;
}
[data-slot="card"] {
  border-color: var(--border);
  box-shadow: 0 4px 24px rgb(42 82 142 / 0.04);
}
@media (prefers-reduced-motion: no-preference) {
  [data-slot="card"] {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease;
  }
  main [data-slot="card"]:hover {
    border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
    box-shadow: 0 10px 30px rgb(42 82 142 / 0.08);
  }
}
[data-slot="sidebar-menu-button"][data-active="true"] {
  background: var(--accent) !important;
  color: var(--primary) !important;
  border-radius: 10px;
}

/* ---- Top Navigation Bar (Scoped strictly to header.fixed) ---- */
header.fixed {
  z-index: 60 !important;
  background: transparent !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  padding-top: 12px;
}

header.fixed > div {
  max-width: 1320px !important;
}

header.fixed > div > nav {
  height: 52px !important;
  padding: 0 18px !important;
  border-radius: 999px;
  background: rgb(250 253 255 / 0.68);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgb(255 255 255 / 0.85);
  box-shadow: 0 4px 24px rgb(31 74 135 / 0.05), inset 0 1px 0 rgb(255 255 255 / 0.9);
}

html.dark header.fixed > div > nav {
  background: rgb(13 27 48 / 0.72);
  border-color: rgb(140 195 245 / 0.16);
  box-shadow: 0 8px 30px rgb(4 12 26 / 0.36), inset 0 1px 0 rgb(255 255 255 / 0.08);
}

/* Brand Lockup in Header */
header.fixed a[href="/"] > div:first-child {
  width: 30px !important;
  height: 30px !important;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid rgb(255 255 255 / 0.92);
  box-shadow: 0 2px 8px rgb(46 104 178 / 0.18);
}

html.dark header.fixed a[href="/"] > div:first-child {
  border-color: rgb(145 198 248 / 0.35);
}

header.fixed [title="StarAPI"],
header.fixed a:has(img[alt="logo"]) span,
header.fixed a[href="/"] span {
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  background: linear-gradient(135deg, #1d4982 0%, #3879d1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  max-width: none !important;
  overflow: visible !important;
}

html.dark header.fixed [title="StarAPI"],
html.dark header.fixed a:has(img[alt="logo"]) span,
html.dark header.fixed a[href="/"] span {
  background: linear-gradient(135deg, #e6f3ff 0%, #8ac5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

header.fixed a[href="/rankings"],
header.fixed a[href="/docs"] {
  display: none !important;
}

[data-slot="avatar"]:has([data-slot="avatar-fallback"]) {
  background: url('/starapi/avatar.jpg') center / cover !important;
}
[data-slot="avatar"] [data-slot="avatar-fallback"] {
  opacity: 0;
}

/* ---- Homepage Route Isolation ---- */
html[data-star-route="home"] body {
  overflow-x: hidden;
}
html[data-star-route="home"] #root > div.min-h-svh {
  min-height: 0 !important;
  height: 0 !important;
  overflow: visible !important;
}
html[data-star-route="home"] #root > div.min-h-svh > *:not(header.fixed):not(.fixed) {
  display: none !important;
}
html:not([data-star-route="home"]) .star-hero {
  display: none !important;
}

/* ---- Homepage Hero Stage ---- */
.star-hero {
  position: relative;
  z-index: 20;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 88px clamp(20px, 5vw, 64px) 22px;
  background-color: #e9f5fb;
  background-image:
    linear-gradient(180deg, rgb(244 251 255 / 0.72) 0%, rgb(244 251 255 / 0.16) 80px, transparent 160px),
    linear-gradient(90deg, rgb(238 249 255 / 0.65) 0%, rgb(238 249 255 / 0.28) 36%, transparent 60%),
    linear-gradient(180deg, transparent 82%, rgb(228 243 252 / 0.68) 100%),
    url('/starapi/wallpaper.webp');
  background-position: right center;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
}

html.dark .star-hero {
  background-color: #0b192e;
  background-image:
    linear-gradient(180deg, rgb(8 20 38 / 0.68) 0%, rgb(8 20 38 / 0.18) 84px, transparent 160px),
    linear-gradient(90deg, rgb(8 20 38 / 0.84) 0%, rgb(10 26 48 / 0.58) 38%, rgb(12 31 58 / 0.14) 65%, transparent 100%),
    linear-gradient(180deg, transparent 80%, rgb(8 20 38 / 0.78) 100%),
    url('/starapi/wallpaper.webp');
}

.star-hero-main {
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* ---- Frosted Card on Left ---- */
.star-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 42px 40px 36px;
  border-radius: 28px;
  background: linear-gradient(140deg, rgb(255 255 255 / 0.66) 0%, rgb(242 250 255 / 0.42) 100%);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgb(255 255 255 / 0.82);
  box-shadow:
    0 20px 52px -12px rgb(28 68 122 / 0.08),
    0 4px 14px -2px rgb(28 68 122 / 0.04),
    inset 0 1px 0 rgb(255 255 255 / 0.92);
  color: #1a3356;
}

html.dark .star-card {
  background: linear-gradient(145deg, rgb(13 28 52 / 0.72) 0%, rgb(9 21 40 / 0.56) 100%);
  border-color: rgb(145 198 248 / 0.16);
  box-shadow:
    0 28px 64px -12px rgb(3 10 22 / 0.52),
    inset 0 1px 0 rgb(255 255 255 / 0.09);
  color: #e8f3ff;
}

/* Eyebrow Pill */
.star-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.68);
  border: 1px solid rgb(168 206 238 / 0.52);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #366295;
  margin-bottom: 22px;
  white-space: nowrap;
}

html.dark .star-badge {
  background: rgb(22 45 78 / 0.62);
  border-color: rgb(130 186 240 / 0.22);
  color: #9ecbff;
}

.star-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3a82d6;
  box-shadow: 0 0 0 3px rgb(58 130 214 / 0.2);
  flex-shrink: 0;
}

html.dark .star-badge-dot {
  background: #67b2ff;
  box-shadow: 0 0 0 3px rgb(103 178 255 / 0.25);
}

/* Brand Lockup */
.star-brand-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.star-title {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.05;
}

.star-title-script {
  font-family: StarScript, "Georgia", serif;
  font-size: clamp(54px, 5vw, 70px);
  font-weight: 400;
  color: #1c4477;
  letter-spacing: 0.01em;
  padding-right: 4px;
}

.star-title-api {
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(32px, 3.2vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #245596 0%, #4489de 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html.dark .star-title-script {
  color: #eef7ff;
}

html.dark .star-title-api {
  background: linear-gradient(135deg, #b8deff 0%, #6cb4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Poetic Subtitle & Verse */
.star-slogan {
  font-family: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", serif;
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #1c3b68;
  margin: 6px 0 12px;
  line-height: 1.4;
}

html.dark .star-slogan {
  color: #e4f1ff;
}

.star-desc {
  font-size: 14px;
  line-height: 1.8;
  color: #46678f;
  margin: 0 0 32px;
  letter-spacing: 0.03em;
}

html.dark .star-desc {
  color: #a9c7e6;
}

/* Action Buttons */
.star-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease;
}

.star-btn-primary {
  background: linear-gradient(135deg, #265491 0%, #3b77c2 100%);
  color: #ffffff !important;
  box-shadow: 0 10px 22px -4px rgb(38 84 145 / 0.34), inset 0 1px 0 rgb(255 255 255 / 0.25);
}

.star-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -4px rgb(38 84 145 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.3);
}

.star-btn-secondary {
  background: rgb(255 255 255 / 0.72);
  color: #254a7a !important;
  border: 1px solid rgb(180 212 240 / 0.78);
  box-shadow: 0 4px 12px rgb(38 84 145 / 0.05);
}

.star-btn-secondary:hover {
  transform: translateY(-2px);
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 8px 18px rgb(38 84 145 / 0.1);
}

html.dark .star-btn-primary {
  background: linear-gradient(135deg, #3b7dd0 0%, #5ca0f2 100%);
  color: #ffffff !important;
  box-shadow: 0 10px 26px -4px rgb(22 65 128 / 0.55);
}

html.dark .star-btn-secondary {
  background: rgb(24 46 78 / 0.72);
  color: #d8ecff !important;
  border-color: rgb(135 190 245 / 0.25);
}

html.dark .star-btn-secondary:hover {
  background: rgb(32 58 96 / 0.88);
}

.star-poem-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: #5579a0;
  padding-top: 6px;
}

.star-poem-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

html.dark .star-poem-foot {
  color: #96bce0;
}

/* ---- Bottom Legal & Attribution Bar inside Hero ---- */
.star-hero-bottom {
  width: 100%;
  max-width: 1280px;
  margin: 18px auto 0;
  padding: 9px 20px;
  border-radius: 999px;
  background: rgb(250 253 255 / 0.56);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgb(255 255 255 / 0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: #496c94;
}

html.dark .star-hero-bottom {
  background: rgb(12 26 46 / 0.58);
  border-color: rgb(140 195 248 / 0.14);
  color: #9ec0e2;
}

.star-hero-bottom-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.star-hero-bottom-links a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.star-hero-bottom-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---- Inner Pages Polish ---- */
[aria-label="价格显示模式"],
[data-slot="collapsible"]:has(button[title="按量计费"]),
[data-slot="status-badge"][title="按量计费"] {
  display: none !important;
}

/* Sign-in & Sign-up Auth Pages Polish */
.grid.h-svh {
  background: radial-gradient(ellipse at 50% 20%, rgb(180 220 248 / 0.28), transparent 70%), var(--background);
}
html.dark .grid.h-svh {
  background: radial-gradient(ellipse at 50% 20%, rgb(20 46 80 / 0.35), transparent 70%), var(--background);
}

.grid.h-svh a[href="/"] {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.grid.h-svh a[href="/"] img {
  border-radius: 10px !important;
  border: 1.5px solid rgb(255 255 255 / 0.9);
  box-shadow: 0 2px 10px rgb(42 82 142 / 0.16);
}
.grid.h-svh a[href="/"] h1 {
  font-family: "Plus Jakarta Sans", "Inter", sans-serif !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  background: linear-gradient(135deg, #1d4982 0%, #3879d1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}
html.dark .grid.h-svh a[href="/"] h1 {
  background: linear-gradient(135deg, #e6f3ff 0%, #8ac5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.grid.h-svh .container > div {
  border-radius: 24px;
  background: rgb(255 255 255 / 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgb(255 255 255 / 0.88);
  box-shadow:
    0 20px 48px -12px rgb(28 68 122 / 0.08),
    inset 0 1px 0 rgb(255 255 255 / 0.9);
}
html.dark .grid.h-svh .container > div {
  background: rgb(14 30 54 / 0.76);
  border-color: rgb(145 198 248 / 0.16);
  box-shadow:
    0 24px 54px -12px rgb(3 10 22 / 0.5),
    inset 0 1px 0 rgb(255 255 255 / 0.08);
}

main.container > .max-w-4xl {
  padding-top: 28px !important;
  padding-bottom: 48px !important;
}
main.container > .max-w-4xl > .space-y-2:has(> h1) {
  display: none;
}
main.container > .max-w-4xl > .prose {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 44px;
  box-shadow: 0 12px 36px rgb(34 72 128 / 0.05);
}

/* ---- Mobile Polish (<= 768px) ---- */
@media (max-width: 768px) {
  header.fixed {
    padding-top: 8px;
  }
  header.fixed > div > nav {
    height: 46px !important;
    padding: 0 14px !important;
  }

  .star-hero {
    padding: 60px 14px 14px;
    background-position: 78% 12%;
    background-size: 210% auto;
    background-image:
      linear-gradient(180deg, rgb(238 249 255 / 0.35) 0%, rgb(235 247 254 / 0.04) 30%, rgb(232 246 253 / 0.86) 52%, #eaf5fc 100%),
      url('/starapi/wallpaper.webp');
  }

  html.dark .star-hero {
    background-position: 78% 12%;
    background-size: 210% auto;
    background-image:
      linear-gradient(180deg, rgb(8 20 38 / 0.38) 0%, rgb(8 20 38 / 0.08) 30%, rgb(9 22 42 / 0.88) 52%, #0b192e 100%),
      url('/starapi/wallpaper.webp');
  }

  .star-hero-main {
    align-items: flex-end;
    padding-top: 27svh;
  }

  .star-card {
    max-width: 100%;
    padding: 28px 20px 24px;
    border-radius: 24px;
    text-align: center;
    background: linear-gradient(145deg, rgb(255 255 255 / 0.82) 0%, rgb(242 250 255 / 0.68) 100%);
  }

  html.dark .star-card {
    background: linear-gradient(145deg, rgb(13 28 52 / 0.84) 0%, rgb(9 21 40 / 0.74) 100%);
  }

  .star-badge {
    font-size: 9.5px;
    letter-spacing: 0.09em;
    padding: 4px 11px;
    margin-bottom: 16px;
  }

  .star-brand-head {
    justify-content: center;
  }

  .star-title-script {
    font-size: 48px;
  }
  .star-title-api {
    font-size: 30px;
  }

  .star-slogan {
    font-size: 20px;
    letter-spacing: 0.08em;
  }

  .star-desc {
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 22px;
  }

  .star-actions {
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
  }

  .star-btn {
    flex: 1;
    min-width: 130px;
    padding: 11px 18px;
    font-size: 14px;
  }

  .star-poem-foot {
    justify-content: center;
    font-size: 11.5px;
  }

  .star-hero-bottom {
    flex-direction: column;
    gap: 4px;
    border-radius: 16px;
    padding: 8px 12px;
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
  }

  main.container > .max-w-4xl > .prose {
    padding: 24px 20px;
    border-radius: 16px;
  }
}

/* ---- Hide payment/wallet UI ---- */
main .mx-auto.max-w-7xl > .group\/card.bg-muted\/20 {
  display: none !important;
}
/* Redemption code entry stays visible on the wallet page; only the paid top-up
   amount/payment selector inside the card is suppressed. */
#wallet-add-funds [data-slot=card-header],
#wallet-add-funds form,
#wallet-add-funds > div > div:not(:last-child) {
  display: none !important;
}

/* ---- Global Footer Legal Links ---- */
footer:has(> .star-legal-links) > div:not([class*="fixed"]) {
  display: none !important;
}
.star-legal-links {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 18px 16px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.star-legal-links a {
  padding: 2px 6px;
  text-decoration: none;
}
.star-legal-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}
footer .text-muted-foreground\/45,
footer span:has(> a[href*="new-api"]),
footer a[href*="QuantumNous"] {
  display: none !important;
}
