/* ==========================================================================
   Dark Precision Pro (样板一：深空精密运维版) — Public Portal & Storefront Skin
   Applies to: / (redeem.html), /buy (shop.html), /agent-api-docs
   Fixes:
     1. Emerald-Obsidian Dark Precision palette across / & /buy
     2. Narrow/mobile Light-Mode 50%/50% split-background bug fixed
     3. Mobile vertical priority: Interactive redeem card FIRST above steps
     4. Top unified portal bar (/ <-> /buy + Session Tutorial Modal)
   ========================================================================== */

/* 1. Public Storefront (/buy), API Docs & Pool Public Pages */
html[data-theme="dark"] body:is(.sneat-shop, .sneat-api-docs, .sneat-pool, .sneat-verify) {
  --sn-primary: #34d399;
  --sn-primary-solid: #10b981;
  --sn-primary-soft: rgba(16, 185, 129, 0.14);
  --sn-page: #080c14;
  --sn-surface: #11192a;
  --sn-soft: #162036;
  --sn-field: #0a101d;
  --sn-ink: #eef4fc;
  --sn-text: #d7e3f4;
  --sn-muted: #8b9bb4;
  --sn-border: rgba(148, 163, 184, 0.16);
  --sn-shadow: 0 18px 46px rgba(2, 6, 16, 0.45);
  --sn-green: #34d399;
  --sn-green-bg: rgba(16, 185, 129, 0.14);
  --sn-green-line: rgba(16, 185, 129, 0.34);
  --sn-red: #fb7185;
  --sn-red-bg: rgba(244, 63, 94, 0.15);
  --sn-red-line: rgba(244, 63, 94, 0.34);
  --sn-amber: #fbbf24;
  --sn-amber-bg: rgba(245, 158, 11, 0.15);
  --sn-amber-line: rgba(245, 158, 11, 0.34);
  --sn-blue: #22d3ee;
  --sn-blue-bg: rgba(6, 182, 212, 0.14);
  background:
    radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.10), transparent 38%),
    radial-gradient(circle at 84% 16%, rgba(6, 182, 212, 0.09), transparent 36%),
    #080c14 !important;
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .sneat-shop .backdrop {
  background: transparent !important;
}
html[data-theme="dark"] .sneat-shop .brand-icon {
  background: linear-gradient(135deg, #10b981, #0ea5e9) !important;
  color: #031d15 !important;
  font-weight: 900 !important;
}
html[data-theme="dark"] .sneat-shop .primary:not(:disabled) {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #10b981 !important;
  color: #031d15 !important;
  font-weight: 800 !important;
}
html[data-theme="dark"] .sneat-shop :is(.plan:hover:not(:disabled), .plan.selected, .shop-network-option.selected) {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
}

/* 2. Public Redemption Page (/) — Dark Precision Pro */
html[data-theme="dark"] body.redeem-body,
html[data-theme="dark"] body.redeem-body[data-template][data-theme] {
  --page-bg: #080c14;
  --surface: #11192a;
  --surface-soft: #152036;
  --field-bg: #0a101d;
  --ink: #eef4fc;
  --muted-ink: #8b9bb4;
  --line-ui: rgba(148, 163, 184, 0.16);
  --action: #10b981;
  --button-bg: #10b981;
  --preset-bg: #080c14;
  --preset-surface: #11192a;
  --preset-soft: #152036;
  --preset-field: #0a101d;
  --preset-ink: #eef4fc;
  --preset-muted: #8b9bb4;
  --preset-line: rgba(148, 163, 184, 0.16);
  --preset-action: #10b981;
  --preset-button: #10b981;
  --design-accent: #10b981;
  --preset-backdrop:
    radial-gradient(circle at 16% 14%, rgba(16, 185, 129, 0.12), transparent 40%),
    radial-gradient(circle at 86% 18%, rgba(6, 182, 212, 0.10), transparent 38%),
    #080c14;
  background:
    radial-gradient(circle at 16% 14%, rgba(16, 185, 129, 0.12), transparent 40%),
    radial-gradient(circle at 86% 18%, rgba(6, 182, 212, 0.10), transparent 38%),
    #080c14 !important;
  color: #e6edf7 !important;
  font-variant-numeric: tabular-nums;
}

/* Fix Light-Theme Narrow/Mobile 50%/50% Split-Background Bug! */
html[data-theme="light"] body.redeem-body,
html[data-theme="light"] body.redeem-body[data-template][data-theme] {
  --preset-backdrop:
    radial-gradient(ellipse at 50% 0%, rgba(16, 185, 129, 0.09), transparent 58%),
    #f4f7fb;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(16, 185, 129, 0.09), transparent 58%),
    #f4f7fb !important;
}
html[data-theme="light"] .redeem-body::before,
html[data-theme="light"] .redeem-body::after,
html[data-theme="dark"] .redeem-body::before,
html[data-theme="dark"] .redeem-body::after {
  background-image: none !important;
}

/* Align Left Intro Divider Cleanly */
.redeem-body .intro-divider {
  width: 100% !important;
  max-width: none !important;
  opacity: 0.65;
}

/* Precision Card & Emerald Accents on / */
html[data-theme="dark"] .redeem-body .brand-symbol {
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%) !important;
  color: #031d15 !important;
  border: 1px solid rgba(110, 231, 183, 0.45) !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.25) !important;
  font-weight: 900 !important;
}

html[data-theme="dark"] .redeem-body .eyebrow,
html[data-theme="dark"] .redeem-body .intro-accent {
  color: #34d399 !important;
}

html[data-theme="dark"] .redeem-body .redeem-form-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)), #11192a !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
  border-bottom-width: 1px !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 60px rgba(2, 6, 16, 0.5) !important;
}

html[data-theme="dark"] .redeem-body .mode-switch {
  background: #0d1320 !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  border-radius: 12px !important;
  padding: 4px !important;
}
html[data-theme="dark"] .redeem-body .mode-tab[aria-current="page"] {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #031d15 !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28) !important;
}

html[data-theme="dark"] .redeem-body .button-primary:not(:disabled) {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #10b981 !important;
  color: #031d15 !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.24) !important;
}
html[data-theme="dark"] .redeem-body .button-primary:not(:disabled):hover {
  filter: brightness(1.07);
}

html[data-theme="dark"] .redeem-body :is(input, textarea, select):not([type="file"]) {
  background: #0a101d !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  color: #eef4fc !important;
}
html[data-theme="dark"] .redeem-body :is(input, textarea, select):focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16) !important;
}

html[data-theme="dark"] .redeem-body :is(.step-line > span, .redeem-progress li span) {
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] .redeem-body .privacy-note {
  background: rgba(16, 185, 129, 0.06) !important;
  border: 1px solid rgba(16, 185, 129, 0.22) !important;
  border-radius: 12px !important;
}

/* 3. Unified Top Portal Bar on / (Links / <-> /buy + Session Tutorial Modal) */
.dp-pub-portal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: rgba(13, 19, 32, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  flex-wrap: wrap;
}
html[data-theme="light"] .dp-pub-portal-bar {
  background: rgba(255, 255, 255, 0.88);
  border-color: #cbd5e1;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}
.dp-pub-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}
.dp-pub-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
}
html[data-theme="light"] .dp-pub-status-pill {
  color: #047857;
}
.dp-pub-bar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dp-pub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: #d7e3f4;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: all 0.15s;
}
html[data-theme="light"] .dp-pub-nav-link {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}
.dp-pub-nav-link:hover {
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}
html[data-theme="light"] .dp-pub-nav-link:hover {
  border-color: #10b981;
  color: #047857;
}
.dp-pub-nav-link.is-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: #031d15 !important;
  font-weight: 800;
}

/* Session Guide Dialog */
dialog.dp-guide-dialog {
  padding: 0;
  border: 1px solid rgba(16, 185, 129, 0.36);
  border-radius: 16px;
  width: min(520px, calc(100vw - 28px));
  background: #11192a;
  color: #eef4fc;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
}
html[data-theme="light"] dialog.dp-guide-dialog {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
dialog.dp-guide-dialog::backdrop {
  background: rgba(3, 7, 15, 0.7);
  backdrop-filter: blur(4px);
}
.dp-guide-body {
  padding: 24px;
}
.dp-guide-steps {
  margin: 14px 0 18px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.dp-guide-steps a {
  color: #34d399;
  text-decoration: underline;
}
html[data-theme="light"] .dp-guide-steps a { color: #059669; }

/* 4. Mobile Vertical Priority Fix: Interactive Form FIRST above Onboarding Copy! */
@media (max-width: 900px) {
  .redeem-body #redeemLayout.redeem-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 22px !important;
  }
  .redeem-body #redeem.layout-form {
    order: -1 !important;
    width: 100% !important;
  }
  .redeem-body section.layout-steps {
    order: 1 !important;
    width: 100% !important;
  }
}
