/* ssp-deploy portal theme - light + dark, purple accent.
   #7c3aed / #2e1065 are replaced by install.sh (BRAND_COLOR / HEADER_COLOR).
   The theme follows <html data-bs-theme="light|dark"> (Bootstrap 5.3). */
:root, [data-bs-theme=light] {
  --brand: #7c3aed;
  --brand-ink: color-mix(in srgb, var(--brand) 80%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --header: #2e1065;
  --ink: #1d1530;
  --muted: #6b6480;
  --line: #e7e2f1;
  --ground: #f5f3fa;
  --ground-glow: color-mix(in srgb, var(--brand) 10%, transparent);
  --card: #ffffff;
  --field: #ffffff;
  --field-line: #d9d2e9;
  --tab-bg: #f0edf7;
  --tab-active: #ffffff;
  --shadow: 0 1px 2px rgba(29, 21, 48, .05), 0 12px 32px rgba(76, 29, 149, .10);
  --radius: 14px;
}
/* dark: calm graphite with only a hint of violet, so text stays crisp and the
   purple accent is the one thing that glows (not purple everywhere) */
[data-bs-theme=dark] {
  --brand-ink: #c4b5fd;                 /* links, active tab: soft lavender, easy to read */
  --brand-soft: rgba(139, 92, 246, .22);
  --ink: #ebe9f3;                       /* main text: off-white, not pure white (less glare) */
  --muted: #9a97ad;
  --line: #262433;
  --ground: #0c0b12;
  --ground-glow: rgba(124, 58, 237, .16);
  --card: #15141d;
  --field: #0f0e16;
  --field-line: #2e2c3d;
  --tab-bg: #0f0e16;
  --tab-active: #24222f;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 50px rgba(0, 0, 0, .55);
  --bs-body-bg: var(--ground);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--field-line);
  --bs-secondary-color: var(--muted);
}
/* ---- dark mode galaxy (pure CSS, no images: CSP-safe, tiny) ----
   html  = deep space + nebula clouds (slow drift)
   body::before = small + medium stars, body::after = bright stars that twinkle
   The layers are fixed behind the page; the card is slightly see-through. */
[data-bs-theme=dark], [data-bs-theme=dark] body { background-color: #07060d !important; }
[data-bs-theme=dark] {
  background-image:
    radial-gradient(38rem 24rem at 12% 8%,  rgba(124, 58, 237, .30), transparent 70%),
    radial-gradient(34rem 22rem at 92% 30%, rgba(59, 130, 246, .16), transparent 70%),
    radial-gradient(42rem 26rem at 70% 105%, rgba(192, 38, 211, .20), transparent 70%),
    radial-gradient(26rem 14rem at 35% 60%, rgba(99, 102, 241, .10), transparent 70%),
    linear-gradient(160deg, #0b0718 0%, #07060d 45%, #0a0614 100%) !important;
  background-size: 140% 140%, 140% 140%, 140% 140%, 140% 140%, 100% 100% !important;
  background-attachment: fixed !important;
  animation: ssp-nebula 60s ease-in-out infinite alternate;
}
[data-bs-theme=dark] body { background: transparent !important; }
[data-bs-theme=dark] body::before,
[data-bs-theme=dark] body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
[data-bs-theme=dark] body::before {
  background-image:
    radial-gradient(1px 1px at 23px 41px,  rgba(255,255,255,.75), transparent),
    radial-gradient(1px 1px at 131px 97px, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 77px 173px, rgba(220,210,255,.65), transparent),
    radial-gradient(1px 1px at 191px 19px, rgba(255,255,255,.45), transparent),
    radial-gradient(1px 1px at 211px 151px,rgba(255,255,255,.6),  transparent),
    radial-gradient(1.5px 1.5px at 59px 113px,  rgba(200,190,255,.8), transparent),
    radial-gradient(1.5px 1.5px at 283px 211px, rgba(255,255,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 157px 263px, rgba(190,215,255,.7), transparent),
    radial-gradient(1px 1px at 311px 67px,  rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 17px 293px,  rgba(255,255,255,.55), transparent);
  background-size: 233px 233px, 233px 233px, 233px 233px, 233px 233px, 233px 233px,
                   347px 347px, 347px 347px, 347px 347px, 347px 347px, 347px 347px;
  opacity: .9;
}
[data-bs-theme=dark] body::after {
  background-image:
    radial-gradient(2px 2px at 101px 79px,  #fff, transparent),
    radial-gradient(2px 2px at 389px 311px, #e9e0ff, transparent),
    radial-gradient(2.5px 2.5px at 263px 457px, #fff, transparent),
    radial-gradient(2px 2px at 457px 131px, #dbe7ff, transparent),
    radial-gradient(1.5px 1.5px at 37px 397px, #fff, transparent);
  background-size: 521px 521px;
  filter: drop-shadow(0 0 2px rgba(196, 181, 253, .9));
  animation: ssp-twinkle 4.5s ease-in-out infinite alternate;
}
@keyframes ssp-twinkle { from { opacity: .25; } to { opacity: 1; } }
@keyframes ssp-nebula  { from { background-position: 0% 0%, 100% 0%, 50% 100%, 30% 50%, 0 0; }
                         to   { background-position: 12% 8%, 88% 10%, 40% 90%, 40% 60%, 0 0; } }
[data-bs-theme=dark] .ssp-card {
  background: rgba(19, 17, 30, .80) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, .06), 0 20px 60px rgba(0, 0, 0, .6), 0 0 80px rgba(124, 58, 237, .12);
}
/* ---- light mode: soft pastel aurora (pure CSS, CSP-safe) ----
   body::before = large lavender / sky / pink / peach glows that slowly drift and turn
   body::after  = very faint dot texture, fading out towards the bottom */
:root:not([data-bs-theme=dark]) { background: #f7f6fc !important; }
:root:not([data-bs-theme=dark]) body { background: transparent !important; }
:root:not([data-bs-theme=dark]) body::before,
:root:not([data-bs-theme=dark]) body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
}
:root:not([data-bs-theme=dark]) body::before {
  inset: -20%;
  background:
    radial-gradient(34rem 28rem at 22% 22%, rgba(167, 139, 250, .42), transparent 70%),
    radial-gradient(30rem 24rem at 82% 18%, rgba(125, 211, 252, .38), transparent 70%),
    radial-gradient(32rem 26rem at 74% 82%, rgba(244, 164, 206, .32), transparent 70%),
    radial-gradient(28rem 22rem at 20% 84%, rgba(253, 210, 160, .30), transparent 70%);
  animation: ssp-aurora 36s ease-in-out infinite alternate;
}
:root:not([data-bs-theme=dark]) body::after {
  inset: 0;
  background-image: radial-gradient(rgba(76, 29, 149, .10) 1px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
          mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
}
@keyframes ssp-aurora {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate(3%, -2%) rotate(6deg) scale(1.06); }
  100% { transform: translate(-2%, 3%) rotate(-5deg) scale(1.03); }
}
:root:not([data-bs-theme=dark]) .ssp-card {
  background: rgba(255, 255, 255, .86) !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
[data-bs-theme=dark] .ssp-card { border-color: var(--line); }
[data-bs-theme=dark] .ssp-top {
  background: linear-gradient(120deg, #1b1430 0%, #2a1a52 55%, #3b1f73 100%);
  border-bottom: 1px solid rgba(196, 181, 253, .12);
}
[data-bs-theme=dark] .ssp-card .btn-success {
  background: linear-gradient(135deg, #7c3aed, #9b5cf6); border-color: transparent;
  box-shadow: 0 6px 18px rgba(124, 58, 237, .35);
}
[data-bs-theme=dark] .ssp-card .btn-success:hover,
[data-bs-theme=dark] .ssp-card .btn-success:focus { background: linear-gradient(135deg, #8b4cf0, #a96ff7); filter: none; }
[data-bs-theme=dark] .ssp-card .form-control:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .28); }
[data-bs-theme=dark] .ssp-tabs .nav-link.active { box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 8px rgba(0, 0, 0, .35); }
[data-bs-theme=dark] .ssp-captcha-img { box-shadow: 0 6px 20px rgba(124, 58, 237, .30); }
[data-bs-theme=dark] .ssp-card .ppolicy.alert-warning { background: rgba(139, 92, 246, .09); border-color: rgba(139, 92, 246, .28); color: #d6d0ea; }
[data-bs-theme=dark] .text-success, [data-bs-theme=dark] .fa-check { color: #6ee7a8 !important; }
[data-bs-theme=dark] .text-danger,  [data-bs-theme=dark] .fa-times { color: #ff9b94 !important; }

html:not([data-bs-theme=dark]), body {
  background: var(--ground) !important;
  color: var(--ink);
  font-size: 15px;
  padding-top: 0;
  transition: background-color .2s ease, color .2s ease;
}
body {
  min-height: 100vh;
  background-image: radial-gradient(60rem 30rem at 50% -10rem, var(--ground-glow), transparent 70%) !important;
  background-repeat: no-repeat !important;
}
body > .container { max-width: 560px; padding: 32px 16px 48px; }

.ssp-wrap { width: 100%; }
.ssp-card {
  background: var(--card) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  overflow: hidden;
}
.ssp-card > .card-body { padding: 28px 28px 24px; }

/* header band (white logo) - deep purple in both themes */
.ssp-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -28px -28px 22px; padding: 18px 24px;
  background: linear-gradient(120deg, var(--header), color-mix(in srgb, var(--header) 70%, var(--brand)));
}
.ssp-brand { display: inline-flex; min-height: 32px; align-items: center; }
.ssp-logo { height: 34px; width: auto; max-width: 60vw; }
/* animated logo (install.sh splits logo.png into rocket + wordmark), pure CSS (strict CSP).
   Rocket loop, 8s: rises from below the header band (full thrust) -> settles ->
   floats -> ignition -> launches out at the top-right -> rises from below again.
   .ssp-top overflow:hidden makes it appear/vanish at the band's edges.
   Wordmark is revealed once; a light sweep runs over the letters.
   Everything stops for users with prefers-reduced-motion (see bottom). */
.ssp-top { overflow: hidden; }
.ssp-logo-anim { display: inline-flex; align-items: center; line-height: 0; }
.ssp-rocket { position: relative; display: inline-block; z-index: 1; animation: ssp-rocket 8s linear infinite; }
.ssp-flame {                  /* flame size follows the flight (same 8s cycle) */
  position: absolute; left: 2%; bottom: 0; width: 36%; height: 32%; z-index: -1;
  transform-origin: 75% 25%; animation: ssp-flame-cycle 8s linear infinite;
}
.ssp-flame::before {          /* fast flicker inside */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 214, 150, .98), rgba(249, 115, 22, .6) 45%, rgba(168, 85, 247, 0) 100%);
  filter: blur(3px); animation: ssp-flicker .16s ease-in-out infinite alternate;
}
.ssp-word { position: relative; display: inline-block; overflow: hidden;
  animation: ssp-reveal .8s cubic-bezier(.3, .7, .2, 1) .9s both; }
.ssp-word::after {            /* light sweep, masked to the letters only */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .95) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; background-position: 150% 0;
  -webkit-mask: url("logo-word.png") center / 100% 100% no-repeat;
          mask: url("logo-word.png") center / 100% 100% no-repeat;
  animation: ssp-shine 8s ease-in-out 2s infinite;
}
@keyframes ssp-rocket {
  0%     { transform: translate(-26px, 64px); opacity: 0; animation-timing-function: ease-out; }
  2%     { opacity: 1; animation-timing-function: cubic-bezier(.15, .7, .3, 1); }
  14%    { transform: translate(0, -3px); animation-timing-function: ease-in-out; }  /* arrives, small overshoot */
  18%    { transform: translate(0, 2px); }
  22%    { transform: translate(0, 0); animation-timing-function: ease-in-out; }
  34%    { transform: translate(1px, -3px); animation-timing-function: ease-in-out; }  /* float */
  46%    { transform: translate(0, 0); animation-timing-function: ease-in-out; }
  58%    { transform: translate(1px, -3px); animation-timing-function: ease-in-out; }
  68%    { transform: translate(0, 0); }
  73%    { transform: translate(-1px, 2px); animation-timing-function: cubic-bezier(.55, 0, .9, .4); } /* ignition */
  86%    { transform: translate(50px, -80px); opacity: 1; }                              /* gone, top-right */
  87%, 100% { transform: translate(-26px, 64px); opacity: 0; }                           /* back below */
}
@keyframes ssp-flame-cycle {
  0%, 12%  { transform: scale(1.45); opacity: 1; }    /* full thrust while rising */
  22%      { transform: scale(.75); opacity: .75; }   /* landed: idle flame */
  68%      { transform: scale(.75); opacity: .75; }
  73%      { transform: scale(1.4); opacity: 1; }     /* ignition */
  86%      { transform: scale(1.7); opacity: 1; }
  87%, 100% { transform: scale(1.35); opacity: 1; }
}
@keyframes ssp-flicker { from { opacity: .6; transform: scale(.88); } to { opacity: 1; transform: scale(1.1); } }
@keyframes ssp-reveal  { from { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateX(-6px); }
                         to   { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes ssp-shine   { 0% { background-position: 150% 0; } 25%, 100% { background-position: -60% 0; } }

.ssp-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.ssp-theme {
  width: 32px; height: 32px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28);
  background: transparent; color: rgba(255, 255, 255, .85); display: inline-flex;
  align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.ssp-theme:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.ssp-theme:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ssp-ico-light { display: none; }
[data-bs-theme=dark] .ssp-ico-dark { display: none; }
[data-bs-theme=dark] .ssp-ico-light { display: inline-block; }

.ssp-lang { display: flex; gap: 2px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: 2px; }
.ssp-lang a {
  font-size: 12px; font-weight: 600; letter-spacing: .04em; color: rgba(255, 255, 255, .78);
  padding: 3px 10px; border-radius: 999px;
}
.ssp-lang a:hover { color: #fff; }
.ssp-lang a.active { background: #fff; color: var(--header); }

.ssp-title { font-size: 1.45rem; font-weight: 650; margin: 0 0 4px; text-align: center; color: var(--ink); }
.ssp-subtitle { color: var(--muted); text-align: center; margin-bottom: 20px; }

/* tabs */
.ssp-tabs { background: var(--tab-bg); border-radius: 10px; padding: 4px; margin-bottom: 20px; gap: 4px; }
.ssp-tabs .nav-link { color: var(--muted); border-radius: 8px; font-weight: 600; padding: 8px 10px; }
.ssp-tabs .nav-link:hover { color: var(--ink); }
.ssp-tabs .nav-link.active { background: var(--tab-active); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }

/* messages */
.ssp-card .alert { border-radius: 10px; box-shadow: none !important; font-size: 14px; }
.ssp-card .alert.shadow { box-shadow: none !important; }
.ssp-card .alert-warning { background: #fffaeb; border-color: #fde9b0; color: #6b4e00; }
.ssp-card .alert-success { background: #ecfdf3; border-color: #b7ebc9; color: #05603a; }
.ssp-card .alert-danger  { background: #fef3f2; border-color: #fecdca; color: #912018; }
[data-bs-theme=dark] .ssp-card .alert-warning { background: #2a2111; border-color: #4d3a12; color: #f5cf73; }
[data-bs-theme=dark] .ssp-card .alert-success { background: #0e2a1c; border-color: #174a31; color: #7ee2a8; }
[data-bs-theme=dark] .ssp-card .alert-danger  { background: #2d1416; border-color: #55242a; color: #ffa7a0; }
.ssp-card .ppolicy ul { margin-bottom: 0; }
/* password rules box: soft purple panel instead of a yellow warning */
.ssp-card .ppolicy.alert-warning { background: #f6f2ff; border-color: #e3d7fd; color: #3b2d5c; }

/* form: no coloured panel, stacked labels */
.ssp-card form { margin: 0; }
.ssp-card .alert-info { background: transparent; border: 0; padding: 0; color: inherit; }
.ssp-card form .row { margin-left: 0; margin-right: 0; }
.ssp-card form .col-sm-4, .ssp-card form .col-sm-8,
.ssp-card form [class*="offset-sm-"] { flex: 0 0 100%; max-width: 100%; margin-left: 0; padding-left: 0; padding-right: 0; }
.ssp-card form .col-form-label { text-align: left !important; font-weight: 600; font-size: 14px; padding-bottom: 4px; color: var(--ink); }
.ssp-card .form-control { padding: 9px 12px; background: var(--field); border-color: var(--field-line); color: var(--ink); }
.ssp-card .form-control::placeholder { color: var(--muted); opacity: .8; }
.ssp-card .input-group-text { background: var(--tab-bg); border-color: var(--field-line); color: var(--muted); }
.ssp-card .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* classic captcha (CAPTCHA_STYLE=classic) */
.ssp-card .captcha { padding-top: 0 !important; display: flex; align-items: center; gap: 8px; }
.ssp-card .captcha img { border-radius: 8px; border: 1px solid var(--field-line); }
.ssp-card #captcha-refresh.fa { cursor: pointer; color: var(--brand-ink); margin-left: 0; }

/* captcha: purple card + refresh + short answer box on one line */
.ssp-captcha-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ssp-captcha-img { width: 200px; height: 64px; border-radius: 12px; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent); }
.ssp-captcha-refresh {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--field-line);
  background: var(--field); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center;
}
.ssp-captcha-refresh:hover { background: var(--brand-soft); }
.ssp-captcha-refresh.spin i { animation: ssp-spin .4s linear; }
@keyframes ssp-spin { to { transform: rotate(360deg); } }
.ssp-captcha-input.form-control { flex: 1 1 90px; min-width: 90px; font-size: 1.15rem; font-weight: 700; text-align: center; letter-spacing: .15em; text-transform: uppercase; }

/* primary button */
.ssp-card .btn-success {
  width: 100%; background: var(--brand); border-color: var(--brand); color: #fff;
  font-weight: 600; padding: 10px 16px; border-radius: 10px;
}
.ssp-card .btn-success:hover, .ssp-card .btn-success:focus { filter: brightness(1.08); background: var(--brand); border-color: var(--brand); }

a { color: var(--brand-ink); }
a:hover { color: var(--brand); }

.ssp-note { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.ssp-copy { font-size: 12px; opacity: .8; margin-top: 18px; }

@media (max-width: 480px) {
  body > .container { padding-top: 16px; }
  .ssp-card > .card-body { padding: 20px 16px; }
  .ssp-top { margin: -20px -16px 18px; padding: 14px 16px; }
  .ssp-logo { height: 24px; }
  .ssp-captcha-img { width: 170px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
/* theme switch: slow dissolve day <-> night (View Transitions API, started in portal.js) */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 1.4s; animation-timing-function: cubic-bezier(.45, 0, .55, 1);
}
