:root {
  color-scheme: dark;
  --bg: #100a1f;
  --bg-2: #170f2c;
  --panel: rgba(29, 20, 52, 0.74);
  --panel-2: rgba(255, 255, 255, 0.055);
  --text: #f7f2ff;
  --muted: #b7aeca;
  --border: rgba(255, 255, 255, 0.14);
  --purple: #7b3cff;
  --purple-2: #a476ff;
  --cyan: #27e0c1;
  --gold: #ffd86f;
  --error: #ff7b8d;
  --success: #27e0c1;
  --focus: #a476ff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 78% 10%, rgba(123, 60, 255, 0.34), transparent 30%),
    radial-gradient(circle at 16% 76%, rgba(39, 224, 193, 0.12), transparent 28%),
    linear-gradient(145deg, #0c0717, var(--bg) 55%, #211044);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 72%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px 16px;
  position: relative;
}

.login-shell::before {
  content: "SECURE";
  position: fixed;
  left: clamp(16px, 5vw, 80px);
  top: clamp(80px, 12vw, 140px);
  font-size: clamp(84px, 17vw, 250px);
  font-weight: 1000;
  line-height: .8;
  letter-spacing: -.08em;
  color: rgba(255, 255, 255, .045);
  pointer-events: none;
}

.auth-home {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 20;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(27, 18, 50, .72);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .26);
  backdrop-filter: blur(22px);
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 950;
}

.auth-logo {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .18), transparent 28%), linear-gradient(145deg, #070511, #1f123e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13), 0 0 26px rgba(123, 60, 255, .42);
  overflow: hidden;
}

.auth-logo::before {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 0deg, transparent, rgba(39, 224, 193, .45), transparent, rgba(255, 216, 111, .4), transparent);
  animation: logo-orbit 5.5s linear infinite;
}

.auth-logo::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 12px;
  background: #080511;
}

.auth-logo svg {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(39, 224, 193, .28));
}

.shield-core { fill: url(#authShield); animation: shield-pulse 2.8s ease-in-out infinite; }
.shield-line { fill: none; stroke: rgba(255,255,255,.72); stroke-width: 1.4; }
.dollar { fill: none; stroke: url(#authGold); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 120; animation: dollar-draw 4s ease-in-out infinite; }
.crypto-node { fill: var(--cyan); filter: drop-shadow(0 0 6px rgba(39,224,193,.8)); }
.crypto-link { fill: none; stroke: rgba(39,224,193,.55); stroke-width: 1.3; stroke-dasharray: 4 4; animation: crypto-flow 2.4s linear infinite; }
.node-a { animation: node-ping 2.8s ease-in-out infinite; }
.node-b { animation: node-ping 2.8s ease-in-out .35s infinite; }
.node-c { animation: node-ping 2.8s ease-in-out .7s infinite; }
.logo-sweep { fill: none; stroke: rgba(255,244,184,.9); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 20 80; animation: logo-sweep 2.6s ease-in-out infinite; }

.pro-gold {
  position: relative;
  display: inline-block;
  margin-left: 1px;
  background: linear-gradient(105deg, #8b5d0c 0%, #ffd86f 26%, #fff8c9 44%, #d8a127 62%, #7b5107 82%, #ffe587 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(255, 203, 82, .34);
  animation: gold-reflect 3.8s ease-in-out infinite;
}

.pro-gold::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 8px;
  background: linear-gradient(180deg, rgba(255,216,111,.3), transparent);
  transform: scaleY(-1);
  filter: blur(2px);
  opacity: .65;
}

.login-panel {
  width: min(100%, 470px);
  margin-top: 68px;
  background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  border-radius: 34px;
  padding: 32px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
  backdrop-filter: blur(18px);
}

.brand-block {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--purple-2);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: .96;
  letter-spacing: -.06em;
}

.lede {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 900;
}

label span {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  background: rgba(0, 0, 0, .22);
}

input:focus,
button:focus-visible {
  outline: 4px solid rgba(164, 118, 255, .18);
  outline-offset: 2px;
  border-color: var(--focus);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.register-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.primary-action {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(123,60,255,.36);
}

.primary-action:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.message {
  min-height: 24px;
  margin-top: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.message.error { color: var(--error); }
.message.success { color: var(--success); }

.auth-links {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: center;
  color: var(--muted);
  line-height: 1.45;
}

.auth-links.compact {
  margin-top: 10px;
  padding-top: 0;
  border-top: 0;
}

.auth-links a {
  color: var(--purple-2);
  font-weight: 950;
  text-decoration: none;
}

.auth-links a:hover {
  color: #fff;
}

.deriv-risk-note {
  margin: 18px 0 0;
  color: rgba(247, 242, 255, .62);
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.terms-shell {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.terms-panel {
  max-width: 760px;
}

.terms-box {
  border: 1px solid rgba(255, 216, 77, .26);
  background: rgba(255, 216, 77, .06);
  border-radius: 18px;
  padding: 18px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

.terms-box h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.terms-box p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  color: var(--text);
}

@keyframes logo-orbit { to { transform: rotate(360deg); } }
@keyframes shield-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
@keyframes dollar-draw { 0% { stroke-dashoffset: 120; } 38%,70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -120; } }
@keyframes crypto-flow { to { stroke-dashoffset: -16; } }
@keyframes node-ping { 0%,100% { opacity:.75; transform: scale(1); transform-origin:center; } 50% { opacity:1; transform: scale(1.25); } }
@keyframes logo-sweep { 0% { stroke-dashoffset:100; opacity:0; } 25%,65% { opacity:1; } 100% { stroke-dashoffset:-70; opacity:0; } }
@keyframes gold-reflect { 0%,100% { background-position:0% 50%; filter:saturate(1); } 46%,54% { background-position:100% 50%; filter:saturate(1.35) brightness(1.18); } }

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

@media (max-width: 520px) {
  .login-shell {
    padding: 28px 14px;
    place-items: start center;
  }

  .auth-home {
    position: static;
    transform: none;
    width: 100%;
    margin-bottom: 18px;
  }

  .auth-logo {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .auth-logo svg {
    width: 28px;
    height: 28px;
  }

  .login-panel {
    margin-top: 0;
    padding: 24px;
    border-radius: 26px;
  }

  h1 {
    font-size: 2.15rem;
  }

  .auth-links {
    align-items: center;
    flex-direction: column;
    gap: 2px;
  }
}
