/* Havolith — Customer Portal auth (matches /panel/ design) */
:root {
  --bg: #070709;
  --bg-2: #0c0c10;
  --surface: rgba(20, 20, 26, 0.72);
  --surface-2: rgba(255, 255, 255, 0.03);
  --input-bg: rgba(18, 18, 24, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(200, 194, 232, 0.35);
  --text: #eef0f4;
  --text-2: #a0a0ab;
  --text-muted: #65656e;
  --accent: #c8c2e8;
  --accent-strong: #a29dc4;
  --brand: #8a7dff;
  --brand-soft: rgba(138, 125, 255, 0.18);
  --success: #7ab696;
  --success-soft: rgba(122, 182, 150, 0.12);
  --danger: #c88585;
  --danger-soft: rgba(200, 133, 133, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.bg-base { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: var(--bg); }
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(200, 194, 232, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 194, 232, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 80%);
  opacity: 0.85;
}
.bg-particles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(200, 194, 232, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 40%, rgba(170, 160, 210, 0.035) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 60%, rgba(150, 140, 195, 0.03) 0%, transparent 60%);
}

::selection { background: rgba(184, 180, 212, 0.3); color: #fff; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(200, 194, 232, 0.22), rgba(200, 194, 232, 0.12));
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgba(200, 194, 232, 0.35), rgba(200, 194, 232, 0.2)); }

.top-left-button { position: fixed; top: 22px; left: 24px; z-index: 999; }
.top-left-button a {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.top-left-button a:hover { color: var(--text-2); background: rgba(200, 194, 232, 0.05); border-color: var(--border-strong); }
.top-left-button i { font-size: 0.7rem; opacity: 0.7; }

.top-heading { text-align: center; margin: 44px 0 24px; z-index: 1; position: relative; }
.top-heading h1 {
  font-family: 'Orbitron', 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  background: linear-gradient(90deg,
    var(--accent) 0%,
    #ffffff 25%,
    var(--brand) 50%,
    #ffffff 75%,
    var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: headingShine 4s linear infinite;
}
@keyframes headingShine {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}
@media (prefers-reduced-motion: reduce) {
  .top-heading h1 {
    animation: none;
    background: linear-gradient(90deg, var(--accent), #ffffff, var(--brand));
    background-size: 100% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.top-heading p {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.top-heading::after {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, rgba(200, 194, 232, 0.4), transparent);
}

.container { width: 100%; max-width: 440px; margin: 0 auto; padding: 0 24px 80px; z-index: 1; position: relative; }
.panel-wrap { width: 100%; }
.panel {
  width: 100%;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 90% 60% at 50% -10%, rgba(200, 194, 232, 0.06) 0%, transparent 55%);
  pointer-events: none;
}
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(200, 194, 232, 0.18), transparent 40%, transparent 60%, rgba(200, 194, 232, 0.08));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.panel .panel-inner { padding: 32px 32px 28px; position: relative; z-index: 1; }
.panel .form-well { margin-top: 0; }

.key-entry .card-logo { margin: 0 auto 14px; text-align: center; }
.key-entry .card-logo img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: none;
}
.panel .key-entry .form-heading { margin-bottom: 26px; text-align: center; }
.panel .key-entry .form-heading h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
}
.panel .key-entry .form-heading p {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 400;
}

.input-group { margin-bottom: 14px; text-align: left; }
.input-group label {
  display: block;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.input-row {
  display: block;
  background: var(--input-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(200, 194, 232, 0.1);
}
.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  outline: none;
}
.input-group input::placeholder { color: var(--text-muted); letter-spacing: 0.06em; }

.form-extra-link {
  text-align: right;
  margin: -4px 0 10px;
}
.form-extra-link a {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.form-extra-link a:hover { color: var(--accent); }

.step-hint {
  margin-bottom: 18px;
  font-size: 0.82rem;
  color: var(--text-2);
  text-align: center;
  line-height: 1.5;
}
.step-hidden { display: none !important; }

.btn-continue {
  width: 100%;
  padding: 14px 18px;
  margin-top: 10px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(26, 24, 36, 0.9), rgba(16, 14, 24, 0.95));
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.btn-continue:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(200, 194, 232, 0.35);
  background: linear-gradient(180deg, rgba(32, 30, 44, 0.95), rgba(20, 18, 28, 0.98));
}
.btn-continue:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-continue i { font-size: 0.8rem; opacity: 0.85; }

#result {
  margin-top: 14px;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  width: 100%;
  border: 1px solid transparent;
  display: none;
}
#result:not(:empty) { display: block; }
#result.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(122, 182, 150, 0.3);
}
#result.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(200, 133, 133, 0.3);
}

.card-footer-links {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.card-footer-links .buy-cta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.4;
}
.card-footer-links .buy-cta a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(200, 194, 232, 0.06);
  border: 1px solid var(--border-strong);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.card-footer-links .buy-cta a:hover {
  background: rgba(200, 194, 232, 0.1);
  border-color: rgba(200, 194, 232, 0.35);
  color: var(--text);
}
.card-footer-links .buy-cta a i { font-size: 0.78rem; }
.card-footer-links .or-divider {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  color: var(--text-muted);
  margin: 14px 0 10px;
  opacity: 0.75;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-footer-links .or-divider::before,
.card-footer-links .or-divider::after {
  content: '';
  width: 32px; height: 1px;
  background: rgba(200, 194, 232, 0.15);
}
.card-footer-links .back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  transition: color 0.2s ease;
}
.card-footer-links .back-link:hover { color: var(--text-2); }
.card-footer-links .secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}
.card-footer-links .secure-badge::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(122, 182, 150, 0.55);
}

footer {
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  text-align: center;
  background: rgba(8, 8, 12, 0.85);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid var(--border);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 999;
}
footer p { margin: 0; }

@media (max-width: 768px) {
  .panel .panel-inner { padding: 26px 22px 24px; }
  .container { padding-left: 20px; padding-right: 20px; padding-bottom: 80px; }
  .top-left-button { top: 16px; left: 14px; }
  .top-heading { margin-top: 56px; }
}

#page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#page-loader.hidden { opacity: 0; visibility: hidden; }
.page-loader-spinner {
  width: 54px;
  height: 54px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loaderSpin 0.9s linear infinite;
}
@keyframes loaderSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .page-loader-spinner { animation-duration: 1.4s; }
}