/* ══════════════════════════════════════════════
       RESET & BASE
    ══════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html { scroll-behavior: smooth; height: 100%; }

    body {
      font-family: 'Inter', sans-serif;
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 24px 16px;
      -webkit-font-smoothing: antialiased;
      background:
        radial-gradient(ellipse at 50% 0%, rgba(123,47,255,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(55,217,184,0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 100% 100%, rgba(123,47,255,0.2) 0%, transparent 40%),
        #03030d;
      background-attachment: fixed;
    }

    /* ══════════════════════════════════════════════
       STAR FIELD — 3 LAYERS
    ══════════════════════════════════════════════ */
    .stars-1, .stars-2, .stars-3 {
      position: fixed; top: 0; left: 0;
      width: 1px; height: 1px;
      border-radius: 50%;
      pointer-events: none; z-index: 0;
    }
    .stars-1 {
      box-shadow:
        12vw 8vh #fff, 95vw 15vh #fff, 37vw 92vh #fff, 68vw 3vh #fff,
        4vw 44vh #fff, 81vw 67vh #fff, 23vw 29vh #fff, 56vw 81vh #fff,
        90vw 41vh #fff, 15vw 73vh #fff, 42vw 12vh #fff, 77vw 55vh #fff,
        8vw 88vh #fff, 61vw 22vh #fff, 33vw 65vh #fff, 50vw 7vh #fff,
        87vw 93vh #fff, 19vw 50vh #fff, 72vw 36vh #fff, 3vw 17vh #fff,
        45vw 78vh #fff, 94vw 60vh #fff, 28vw 5vh #fff, 63vw 45vh #fff,
        11vw 97vh #fff, 80vw 28vh #fff, 39vw 70vh #fff, 54vw 14vh #fff,
        97vw 85vh #fff, 25vw 38vh #fff, 66vw 91vh #fff, 7vw 52vh #fff,
        48vw 33vh #fff, 83vw 9vh #fff, 16vw 62vh #fff, 59vw 76vh #fff,
        35vw 19vh #fff, 92vw 48vh #fff, 1vw 83vh #fff, 70vw 11vh #fff;
      animation: starsTwinkle1 3s ease-in-out infinite alternate;
    }
    .stars-2 {
      width: 2px; height: 2px;
      box-shadow:
        22vw 18vh #fff, 85vw 5vh #fff, 47vw 82vh #fff, 58vw 33vh #fff,
        14vw 54vh #fff, 71vw 77vh #fff, 33vw 9vh #fff, 46vw 61vh #fff,
        80vw 91vh #fff, 5vw 23vh #fff, 52vw 42vh #fff, 67vw 15vh #fff,
        28vw 98vh #fff, 91vw 37vh #fff, 13vw 66vh #fff, 40vw 28vh #fff,
        77vw 84vh #fff, 9vw 49vh #fff, 62vw 6vh #fff, 34vw 73vh #fff,
        55vw 52vh #fff, 84vw 20vh #fff, 19vw 90vh #fff, 73vw 44vh #fff,
        1vw 35vh #fff, 60vw 68vh #fff, 26vw 11vh #fff, 88vw 58vh #fff,
        43vw 87vh #fff, 7vw 76vh #fff, 70vw 30vh #fff, 36vw 55vh #fff;
      animation: starsTwinkle2 6s ease-in-out infinite alternate;
    }
    .stars-3 {
      width: 3px; height: 3px;
      box-shadow:
        32vw 28vh #fff, 75vw 95vh #fff, 57vw 43vh #fff, 88vw 12vh #fff,
        4vw 64vh #fff, 41vw 77vh #fff, 63vw 8vh #fff, 19vw 51vh #fff,
        96vw 71vh #fff, 50vw 35vh #fff, 8vw 92vh #fff, 72vw 19vh #fff,
        27vw 58vh #fff, 84vw 84vh #fff, 46vw 3vh #fff, 13vw 39vh #fff,
        65vw 66vh #fff, 38vw 20vh #fff, 81vw 53vh #fff, 55vw 97vh #fff;
      animation: starsTwinkle3 9s ease-in-out infinite alternate;
    }
    @keyframes starsTwinkle1 { from { opacity: 0.3; } to { opacity: 1; } }
    @keyframes starsTwinkle2 { from { opacity: 0.5; } to { opacity: 0.9; } }
    @keyframes starsTwinkle3 { from { opacity: 0.2; } to { opacity: 0.8; } }

    /* ══════════════════════════════════════════════
       NEBULA CLOUDS
    ══════════════════════════════════════════════ */
    .nebula { position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; }
    .nebula-1 {
      width: 600px; height: 600px; top: -15%; left: -10%;
      background: rgba(123,47,255,0.15); filter: blur(80px);
      animation: nebulaDrift1 15s ease-in-out infinite alternate;
    }
    .nebula-2 {
      width: 500px; height: 500px; bottom: -10%; right: -8%;
      background: rgba(55,217,184,0.1); filter: blur(80px);
      animation: nebulaDrift2 18s ease-in-out infinite alternate;
    }
    .nebula-3 {
      width: 400px; height: 400px; top: 40%; left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(123,47,255,0.08); filter: blur(100px);
      animation: nebulaDrift3 20s ease-in-out infinite alternate;
    }
    @keyframes nebulaDrift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(30px,20px) scale(1.1); } }
    @keyframes nebulaDrift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(-25px,-15px) scale(1.15); } }
    @keyframes nebulaDrift3 { from { transform: translate(-50%,-50%) scale(1); } to { transform: translate(calc(-50% + 20px),calc(-50% - 10px)) scale(1.2); } }

    /* ══════════════════════════════════════════════
       GRID FLOOR
    ══════════════════════════════════════════════ */
    .grid-floor {
      position: fixed; bottom: -50%; left: 50%;
      transform: translateX(-50%) perspective(500px) rotateX(60deg);
      width: 200%; height: 200%;
      background-image:
        linear-gradient(rgba(55,217,184,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(55,217,184,0.08) 1px, transparent 1px);
      background-size: 60px 60px;
      animation: gridScroll 8s linear infinite;
      pointer-events: none; z-index: 0;
    }
    @keyframes gridScroll { 0% { background-position: 0 0; } 100% { background-position: 0 60px; } }

    /* ══════════════════════════════════════════════
       WORMHOLE
    ══════════════════════════════════════════════ */
    .wormhole {
      position: fixed; top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      width: 600px; height: 600px; border-radius: 50%;
      background: conic-gradient(from 0deg, transparent 0deg, rgba(55,217,184,0.05) 60deg, rgba(123,47,255,0.08) 180deg, transparent 360deg);
      animation: wormholeRotate 20s linear infinite;
      filter: blur(2px); pointer-events: none; z-index: 0;
    }
    .wormhole::before {
      content: ''; position: absolute; inset: 60px; border-radius: 50%;
      background: conic-gradient(from 180deg, transparent 0deg, rgba(55,217,184,0.04) 90deg, rgba(123,47,255,0.06) 270deg, transparent 360deg);
      animation: wormholeRotate 14s linear infinite reverse; filter: blur(1px);
    }
    .wormhole::after {
      content: ''; position: absolute; inset: 140px; border-radius: 50%;
      border: 1px solid rgba(55,217,184,0.06);
      animation: wormholePulse 4s ease-in-out infinite;
    }
    @keyframes wormholeRotate {
      0% { transform: translate(-50%,-50%) rotate(0deg); }
      100% { transform: translate(-50%,-50%) rotate(360deg); }
    }
    @keyframes wormholePulse { 0%,100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.05); } }

    /* ══════════════════════════════════════════════
       REGISTER CARD
    ══════════════════════════════════════════════ */
    .portal-wrapper {
      position: relative; z-index: 10;
      perspective: 1000px; width: 100%;
      display: flex; justify-content: center;
    }

    .register-portal {
      position: relative;
      width: 480px;
      max-width: 100%;
      background: rgba(3,5,25,0.7);
      backdrop-filter: blur(40px) saturate(200%);
      -webkit-backdrop-filter: blur(40px) saturate(200%);
      border-radius: 28px;
      border: 1px solid rgba(55,217,184,0.2);
      box-shadow:
        0 0 0 1px rgba(123,47,255,0.1),
        0 20px 60px rgba(0,0,0,0.8),
        0 0 80px rgba(55,217,184,0.08),
        inset 0 1px 0 rgba(255,255,255,0.05);
      padding: 44px 40px 40px;
      animation: cardFloat 6s ease-in-out infinite;
    }
    @media (max-width: 520px) { .register-portal { padding: 32px 24px 28px; } }

    @keyframes cardFloat {
      0%, 100% { transform: translateY(0px); }
      50%       { transform: translateY(-6px); }
    }

    /* Animated top border beam */
    .register-portal::before {
      content: '';
      position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
      background: linear-gradient(90deg, transparent, #37d9b8, #7b2fff, #37d9b8, transparent);
      border-radius: 1px;
      animation: beamScan 3s ease-in-out infinite;
      box-shadow: 0 0 20px rgba(55,217,184,0.8);
    }
    @keyframes beamScan {
      0%,100% { opacity: 0.3; left: 20%; right: 20%; }
      50%      { opacity: 1;   left: 5%;  right: 5%;  }
    }

    /* Scanning line */
    .register-portal::after {
      content: '';
      position: absolute; top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, rgba(55,217,184,0.6), transparent);
      border-radius: 28px 28px 0 0;
      animation: scanLine 4s ease-in-out infinite; opacity: 0.6;
      pointer-events: none;
    }
    @keyframes scanLine { 0% { top: 0; opacity: 0.6; } 100% { top: 100%; opacity: 0; } }

    /* ══════════════════════════════════════════════
       SYSTEM STATUS
    ══════════════════════════════════════════════ */
    .system-status {
      display: flex; align-items: center; gap: 8px;
      font-family: 'Fira Code', monospace; font-size: 10px;
      color: rgba(113,211,91,0.7); letter-spacing: 2px;
      text-transform: uppercase; margin-bottom: 24px;
    }
    .status-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: #71d35b; box-shadow: 0 0 8px #71d35b;
      animation: statusPulse 1.5s ease-in-out infinite; flex-shrink: 0;
    }
    .status-ping { margin-left: auto; color: rgba(55,217,184,0.5); animation: statusPulse 2s ease-in-out infinite; font-size: 8px; }
    @keyframes statusPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }

    /* ══════════════════════════════════════════════
       LOGO
    ══════════════════════════════════════════════ */
    .portal-logo { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
    .logo-icon-wrap {
      width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
      background: linear-gradient(135deg, rgba(55,217,184,0.2), rgba(123,47,255,0.2));
      border: 1px solid rgba(55,217,184,0.3);
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 0 20px rgba(55,217,184,0.2);
    }
    .logo-code { font-family: 'Fira Code', monospace; font-size: 1.4rem; color: #37d9b8; text-shadow: 0 0 10px rgba(55,217,184,0.8); }
    .logo-text-wrap { display: flex; flex-direction: column; }
    .logo-main { font-family: 'Orbitron', sans-serif; font-size: 1.5rem; font-weight: 900; color: white; letter-spacing: 3px; line-height: 1.2; }
    .logo-vex { background: linear-gradient(135deg, #37d9b8, #7b2fff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    .logo-sub { font-family: 'Fira Code', monospace; font-size: 9px; color: rgba(55,217,184,0.5); letter-spacing: 3px; display: block; margin-top: 2px; }

    /* ══════════════════════════════════════════════
       TITLE & DESC
    ══════════════════════════════════════════════ */
    .portal-title { font-family: 'Orbitron', sans-serif; font-size: 1.4rem; font-weight: 700; color: #fff; margin: 20px 0 6px; }
    .portal-desc { font-size: 13px; color: rgba(160,174,192,0.6); margin-bottom: 28px; }

    /* Step progress */
    .step-dots { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
    .step-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.1); transition: all 0.3s; }
    .step-dot.active { width: 24px; border-radius: 4px; background: linear-gradient(90deg, #37d9b8, #7b2fff); }
    .step-dot.done { background: rgba(113,211,91,0.5); }
    .step-label { font-family: 'Fira Code', monospace; font-size: 9px; color: rgba(255,255,255,0.3); letter-spacing: 2px; text-transform: uppercase; margin-left: 8px; }

    /* ══════════════════════════════════════════════
       FORM FIELDS — TERMINAL STYLE
    ══════════════════════════════════════════════ */
    .field-group { position: relative; margin-bottom: 18px; }
    .field-label {
      font-family: 'Fira Code', monospace; font-size: 10px; font-weight: 700;
      color: rgba(55,217,184,0.6); letter-spacing: 2px; text-transform: uppercase;
      margin-bottom: 8px; display: block;
    }
    .field-label::before { content: attr(data-index) ' > '; color: rgba(123,47,255,0.6); }
    .field-input {
      width: 100%; background: rgba(0,0,0,0.4);
      border: 1px solid rgba(55,217,184,0.15); border-radius: 12px;
      color: #e2e8f0; padding: 14px 44px 14px 16px;
      font-family: 'Fira Code', monospace; font-size: 14px;
      outline: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      caret-color: #37d9b8;
    }
    .field-input::placeholder { color: rgba(255,255,255,0.2); font-size: 13px; }
    .field-input:focus {
      border-color: rgba(55,217,184,0.6); background: rgba(55,217,184,0.05);
      box-shadow: 0 0 0 3px rgba(55,217,184,0.08), 0 0 20px rgba(55,217,184,0.1), inset 0 0 20px rgba(55,217,184,0.03);
    }
    .field-icon { position: absolute; right: 14px; top: 38px; color: rgba(55,217,184,0.4); font-size: 16px; transition: color 0.3s; pointer-events: none; }
    .field-input:focus ~ .field-icon { color: #37d9b8; text-shadow: 0 0 8px rgba(55,217,184,0.5); }
    .field-toggle { position: absolute; right: 14px; top: 38px; color: rgba(55,217,184,0.4); font-size: 16px; cursor: pointer; background: none; border: none; padding: 0; line-height: 1; transition: color 0.3s; }
    .field-toggle:hover { color: #37d9b8; }
    .typing-indicator { position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; border-radius: 0 0 12px 12px; background: linear-gradient(90deg, #37d9b8, #7b2fff); transform: scaleX(0); transform-origin: left; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
    .field-input:focus ~ .typing-indicator { transform: scaleX(1); }

    /* 2-col grid for name row */
    .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    @media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

    /* Select styled */
    .field-select {
      width: 100%; background: rgba(0,0,0,0.4);
      border: 1px solid rgba(55,217,184,0.15); border-radius: 12px;
      color: #e2e8f0; padding: 14px 44px 14px 16px;
      font-family: 'Fira Code', monospace; font-size: 13px;
      outline: none; appearance: none; -webkit-appearance: none;
      cursor: pointer; transition: all 0.3s;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
    }
    .field-select:focus { border-color: rgba(55,217,184,0.6); background-color: rgba(55,217,184,0.05); box-shadow: 0 0 0 3px rgba(55,217,184,0.08); }
    .field-select option { background: #050514; color: white; }

    /* Password strength */
    .strength-bar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-top: 8px; overflow: hidden; }
    .strength-fill { height: 100%; border-radius: 2px; width: 0; transition: width 0.4s ease, background 0.3s; }
    .strength-label { font-size: 10px; font-family: 'Fira Code', monospace; margin-top: 5px; color: rgba(255,255,255,0.3); letter-spacing: 1px; }

    /* Terms checkbox */
    .terms-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 4px; margin-bottom: 20px; }
    .terms-check {
      appearance: none; -webkit-appearance: none;
      width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px;
      border: 1px solid rgba(55,217,184,0.3); border-radius: 5px;
      background: rgba(0,0,0,0.3); cursor: pointer; position: relative; transition: all 0.2s;
    }
    .terms-check:checked { background: linear-gradient(135deg, #37d9b8, #7b2fff); border-color: transparent; }
    .terms-check:checked::after { content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
    .terms-text { font-family: 'Fira Code', monospace; font-size: 11px; color: rgba(255,255,255,0.4); letter-spacing: 0.3px; line-height: 1.6; }
    .terms-text a { color: rgba(55,217,184,0.7); text-decoration: none; transition: color 0.2s; }
    .terms-text a:hover { color: #37d9b8; }

    /* ══════════════════════════════════════════════
       SUBMIT BUTTON
    ══════════════════════════════════════════════ */
    .portal-btn {
      width: 100%; height: 56px; border: none; border-radius: 14px; cursor: pointer;
      font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 3px;
      text-transform: uppercase; color: white; position: relative; overflow: hidden;
      background: linear-gradient(135deg, #00a3cc, #7b2fff);
      transition: all 0.3s ease; margin-top: 4px;
      box-shadow: 0 4px 30px rgba(55,217,184,0.3); z-index: 1;
    }
    .portal-btn::before {
      content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
      transition: left 0.5s ease;
    }
    .portal-btn:hover::before { left: 100%; }
    .portal-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 40px rgba(55,217,184,0.4); }
    .portal-btn:active { transform: translateY(0); }
    .portal-btn.loading .btn-text { display: none; }
    .portal-btn .btn-loading { display: none; position: relative; z-index: 1; }
    .portal-btn.loading .btn-loading { display: inline-flex; align-items: center; gap: 4px; }
    .loading-dots span { width: 5px; height: 5px; border-radius: 50%; background: white; display: inline-block; animation: loadDot 1.4s ease-in-out infinite both; }
    .loading-dots span:nth-child(2) { animation-delay: 0.16s; }
    .loading-dots span:nth-child(3) { animation-delay: 0.32s; }
    @keyframes loadDot { 0%,80%,100% { transform: scale(0); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

    /* ══════════════════════════════════════════════
       MESSAGES
    ══════════════════════════════════════════════ */
    .portal-msg {
      margin-top: 16px; padding: 12px 16px; border-radius: 10px;
      font-family: 'Fira Code', monospace; font-size: 11px; letter-spacing: 0.5px;
      display: none; align-items: center; gap: 8px;
    }
    .portal-msg.msg-error { background: rgba(255,51,102,0.08); border: 1px solid rgba(255,51,102,0.3); color: #ff3366; }
    .portal-msg.msg-success { background: rgba(113,211,91,0.08); border: 1px solid rgba(113,211,91,0.3); color: #71d35b; }
    .portal-msg.visible { display: flex; }

    /* ══════════════════════════════════════════════
       TRUST BADGES
    ══════════════════════════════════════════════ */
    .trust-row { display: flex; gap: 16px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
    .trust-item { display: flex; align-items: center; gap: 6px; font-family: 'Fira Code', monospace; font-size: 10px; color: rgba(255,255,255,0.25); letter-spacing: 1px; }
    .trust-item i { font-size: 12px; color: rgba(55,217,184,0.4); }

    /* ══════════════════════════════════════════════
       DIVIDER & SIGN IN LINK
    ══════════════════════════════════════════════ */
    .access-divider { display: flex; align-items: center; gap: 16px; margin: 24px 0 18px; }
    .divider-line { flex: 1; height: 1px; background: rgba(255,255,255,0.06); }
    .divider-text { font-family: 'Fira Code', monospace; font-size: 9px; letter-spacing: 3px; color: rgba(255,255,255,0.2); text-transform: uppercase; white-space: nowrap; }
    .sign-in-link { display: block; text-align: center; font-family: 'Fira Code', monospace; font-size: 12px; color: rgba(255,255,255,0.35); letter-spacing: 0.5px; }
    .sign-in-link a { color: rgba(55,217,184,0.7); text-decoration: none; transition: color 0.2s; font-weight: 700; }
    .sign-in-link a:hover { color: #37d9b8; }

    /* ══════════════════════════════════════════════
       SOCIAL PROOF MINI STRIP
    ══════════════════════════════════════════════ */
    .social-proof { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 12px 16px; background: rgba(55,217,184,0.04); border: 1px solid rgba(55,217,184,0.08); border-radius: 12px; }
    .sp-avatars { display: flex; }
    .sp-avatar { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(3,5,25,0.9); margin-left: -8px; font-family: 'Orbitron', sans-serif; font-size: 10px; font-weight: 700; color: white; display: flex; align-items: center; justify-content: center; }
    .sp-avatar:first-child { margin-left: 0; }
    .sp-text { font-size: 12px; color: rgba(160,174,192,0.6); }
    .sp-text strong { color: #37d9b8; font-weight: 600; }

    /* Field error message */
    .field-err { font-family: 'Fira Code', monospace; font-size: 10px; color: #ff3366; margin-top: 5px; letter-spacing: 0.5px; display: none; }
    .field-err.show { display: block; }
    .field-input.invalid { border-color: rgba(255,51,102,0.5); }
    .field-input.invalid:focus { box-shadow: 0 0 0 3px rgba(255,51,102,0.08); }
    .field-input.valid { border-color: rgba(113,211,91,0.3); }