/* ================= Màn 1: giống verify_safe_template ================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-page: #f6f8fa;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-light: #eff6ff;
  --success-green: #10b981;
  --success-green-light: #ecfdf5;
  --border-color: #f1f5f9;
  --radius-card: 24px;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Outer Wrapper for responsive alignment */
.container {
  width: 100%;
  max-width: 390px;
  display: flex;
  justify-content: center;
}

/* Main White Card */
.card {
  position: relative;
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.03),
    0 12px 28px -4px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 40px 26px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Loading Stage Container */
.loading-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.loading-stage.hide {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* Circular Spinner matching user reference image */
.spinner-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  margin-bottom: 24px;
}

.spinner-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.spinner-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 6;
}

.spinner-bar {
  fill: none;
  stroke: var(--primary-blue);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 201;
  /* 2 * PI * 32 */
  stroke-dashoffset: 201;
  transition: stroke-dashoffset 0.08s linear;
}

/* Percentage in spinner center */
.spinner-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-blue);
  letter-spacing: -0.02em;
}

/* Main Title */
.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

/* Subtitle */
.card-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 290px;
  margin-bottom: 24px;
}

/* Step Checklist Box */
.steps-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.3s ease;
}

.step-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-icon-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-icon-wrap svg {
  width: 12px;
  height: 12px;
  display: none;
}

/* Step States */
.step-item.active {
  color: var(--text-main);
  background: var(--primary-blue-light);
  border-color: #bfdbfe;
}

.step-item.active .step-icon-wrap {
  background: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  animation: pulse 1.4s infinite;
}

.step-item.active .step-icon-wrap::after {
  content: '';
  width: 7px;
  height: 7px;
  background: #ffffff;
  border-radius: 50%;
}

.step-item.done {
  color: #065f46;
  background: var(--success-green-light);
  border-color: #a7f3d0;
}

.step-item.done .step-icon-wrap {
  background: var(--success-green);
}

.step-item.done .step-icon-wrap svg {
  display: block;
  stroke: #ffffff;
}

.step-status-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
}

.step-item.active .step-status-tag {
  color: var(--primary-blue);
  background: #dbeafe;
}

.step-item.done .step-status-tag {
  color: #047857;
  background: #d1fae5;
}

/* Result Stage (After 8s) */
.result-stage {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.result-stage.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Success Icon */
.success-icon-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 25px -4px rgba(16, 185, 129, 0.4),
    0 0 0 6px rgba(16, 185, 129, 0.12);
  margin-bottom: 20px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon-wrap svg {
  width: 38px;
  height: 38px;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.badge-success {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #047857;
  background: #d1fae5;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}

.result-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.result-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 290px;
  margin-bottom: 28px;
}

/* CTA Button: ĐĂNG KÝ NGAY */
.btn-submit {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 10px 20px -3px rgba(37, 99, 235, 0.4),
    0 4px 6px -2px rgba(37, 99, 235, 0.2);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 26px -3px rgba(37, 99, 235, 0.5),
    0 6px 10px -2px rgba(37, 99, 235, 0.25);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow:
    0 6px 14px -2px rgba(37, 99, 235, 0.35);
}

.btn-submit svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn-submit:hover svg {
  transform: translateX(3px);
}

/* Keyframe Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.75;
    transform: scale(1.06);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }

  70% {
    transform: scale(1.08);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile fine-tuning */
@media (max-width: 380px) {
  .card {
    padding: 32px 18px 28px;
  }

  .card-title {
    font-size: 18px;
  }

  .result-title {
    font-size: 20px;
  }
}

.scene { transition: opacity 0.3s ease, transform 0.3s ease; }
.is-l2 .scene { opacity: 0; transform: scale(0.96); pointer-events: none; }
button.btn-submit { border: 0; font: inherit; cursor: pointer; }

/* ================= Màn 2: "Truy cập cổng quốc tế" ================= */
      .l2 {
        position: fixed;
        inset: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        container-type: size;
        overflow: hidden;
        background: #021630;
        /* ảnh nền 744x1448 nhúng 1 lần, dùng cho 2 lớp: nền mờ phủ kín + nền nét khớp chiều cao */
        --bgimg: url("../img/bg.webp");
      }
      .l2::before,
      .l2::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
      }
      .l2::before {
        inset: -40px;
        background: var(--bgimg) center / cover no-repeat;
        filter: blur(18px) brightness(0.45);
      }
      .l2::after {
        background:
          linear-gradient(180deg, rgba(3, 12, 30, 0.92) 0%, rgba(3, 12, 30, 0.6) 20%, rgba(3, 12, 30, 0) 42%),
          var(--bgimg) center / auto 100% no-repeat;
        /* màn ngang/desktop: ảnh nét chỉ rộng bằng ảnh, mờ dần 2 mép sang nền mờ */
        -webkit-mask: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%)
          center / calc(100vh * 744 / 1448) 100% no-repeat;
        mask: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%)
          center / calc(100vh * 744 / 1448) 100% no-repeat;
      }
      .l2[hidden] {
        display: none;
      }
      .l2 .stage {
        --u: min(100cqw / 390, 100cqh / 880);
        position: relative;
        z-index: 1;
        width: calc(var(--u) * 390);
        height: calc(var(--u) * 880);
        text-align: center;
      }

      /* Heading 1 theo Figma: Roboto 900 24/32, letter-spacing 1.2px, khung 362x32 */
      .hd {
        position: absolute;
        left: calc(var(--u) * 14);
        top: calc(var(--u) * 26);
        width: calc(var(--u) * 362);
        height: calc(var(--u) * 32);
        display: flex;
        align-items: center;
        justify-content: center;
        filter: drop-shadow(0 calc(var(--u) * 2) calc(var(--u) * 16) rgba(234, 179, 8, 0.5));
      }
      .hd span {
        font-size: calc(var(--u) * 24);
        font-weight: 900;
        line-height: calc(var(--u) * 32);
        letter-spacing: calc(var(--u) * 1.2);
        text-transform: uppercase;
        white-space: nowrap;
        background: linear-gradient(180deg, #ffe873 0%, #f5b014 45%, #d48806 70%, #ffd666 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
      }
      .tag {
        position: absolute;
        left: calc(var(--u) * 22.5);
        right: calc(var(--u) * 22.5);
        top: calc(var(--u) * 66);
        height: calc(var(--u) * 31);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px dashed rgba(35, 121, 164, 0.9);
        border-radius: calc(var(--u) * 6);
        background: rgba(6, 30, 56, 0.45);
        font-size: calc(var(--u) * 13.5);
        font-weight: 700;
        white-space: nowrap;
        color: #67e8f9;
      }
      .proto {
        position: absolute;
        left: 0;
        right: 0;
        top: calc(var(--u) * 111);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: calc(var(--u) * 14);
        font-size: calc(var(--u) * 13);
        font-weight: 500;
        line-height: 1;
        letter-spacing: 0.16em;
        color: #a5f3fc;
      }
      .proto b {
        width: calc(var(--u) * 3.5);
        height: calc(var(--u) * 3.5);
        border-radius: 50%;
        background: #0891b2;
      }
      .proto i {
        width: calc(var(--u) * 9);
        height: calc(var(--u) * 9);
        border: calc(var(--u) * 1.5) solid var(--gold);
        transform: rotate(45deg);
        background: radial-gradient(var(--gold) 0 32%, transparent 34%);
      }
      .proto i:first-child {
        margin-right: calc(var(--u) * 6);
      }
      .proto i:last-child {
        margin-left: calc(var(--u) * 2);
      }

      .grid {
        position: absolute;
        left: calc(var(--u) * 15);
        top: calc(var(--u) * 148.5);
        display: grid;
        grid-template-columns: repeat(2, calc(var(--u) * 172));
        gap: calc(var(--u) * 16);
      }
      .gate {
        --tone: rgba(13, 120, 118, 0.75);
        --bar: #34d399;
        position: relative;
        height: calc(var(--u) * 329);
        border: 1px solid var(--tone);
        border-radius: calc(var(--u) * 13);
        background:
          radial-gradient(
            90% 45% at 50% 42%,
            rgba(20, 110, 140, 0.32) 0%,
            rgba(20, 110, 140, 0) 100%
          ),
          linear-gradient(180deg, rgba(7, 26, 48, 0.74) 0%, rgba(7, 36, 60, 0.62) 55%, rgba(5, 26, 50, 0.8) 100%);
        box-shadow: 0 0 calc(var(--u) * 14) rgba(0, 10, 30, 0.45);
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
      }
      .gate.r {
        --tone: rgba(110, 72, 112, 0.8);
        --bar: #ef4444;
      }
      .flag {
        position: absolute;
        left: calc(var(--u) * 38);
        top: calc(var(--u) * 8);
        width: calc(var(--u) * 96) !important; /* globes.js đặt cứng 240px */
        height: calc(var(--u) * 96) !important;
        filter: drop-shadow(0 calc(var(--u) * 6) calc(var(--u) * 10) rgba(0, 0, 0, 0.5));
        pointer-events: none;
        user-select: none;
      }
      .region {
        position: absolute;
        left: 0;
        right: 0;
        top: calc(var(--u) * 110.5);
        font-size: calc(var(--u) * 13.5);
        font-weight: 500;
        line-height: calc(var(--u) * 21);
        letter-spacing: 0.08em;
      }
      .country {
        position: absolute;
        left: 0;
        right: 0;
        top: calc(var(--u) * 162.5);
        font-size: calc(var(--u) * 17.5);
        font-weight: 700;
        line-height: 1;
        letter-spacing: 0.05em;
        color: var(--gold);
      }
      .gate hr {
        position: absolute;
        left: calc(var(--u) * 12.5);
        right: calc(var(--u) * 12.5);
        top: calc(var(--u) * 199);
        border: 0;
        border-top: 1px solid rgba(64, 120, 150, 0.35);
      }
      .spec {
        position: absolute;
        left: calc(var(--u) * 13);
        right: calc(var(--u) * 8);
        top: calc(var(--u) * 208.3);
        display: grid;
        grid-template-columns: calc(var(--u) * 54) calc(var(--u) * 46) 1fr;
        row-gap: calc(var(--u) * 7);
        align-items: center;
        text-align: left;
        font-size: calc(var(--u) * 10.5);
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
      }
      .spec span:nth-child(3) {
        text-align: right;
      }
      .spec .aes {
        font-size: calc(var(--u) * 12);
        color: #fde68a;
      }
      .spec .bars {
        width: calc(var(--u) * 37.5);
        height: calc(var(--u) * 11);
        background: repeating-linear-gradient(
          90deg,
          var(--bar) 0 calc(var(--u) * 5.5),
          transparent 0 calc(var(--u) * 8)
        );
      }
      .spec .stars {
        justify-self: end;
        width: calc(var(--u) * 51);
        height: calc(var(--u) * 9.5);
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 23'%3E%3Cpath fill='%23fbbf24' d='M12 0l3.1 8h8.6l-7 5.2 2.7 8.3L12 16.4l-7.4 5.1 2.7-8.3-7-5.2h8.6z'/%3E%3C/svg%3E")
          0 0 / calc(var(--u) * 10.2) 100% repeat-x;
      }
      .go {
        position: absolute;
        left: calc(var(--u) * 12);
        right: calc(var(--u) * 12.5);
        bottom: calc(var(--u) * 12);
        height: calc(var(--u) * 36.5);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: calc(var(--u) * 9);
        background: #fff;
        box-shadow:
          0 0 calc(var(--u) * 12) rgba(140, 220, 255, 0.35),
          inset 0 calc(var(--u) * -2) 0 rgba(15, 40, 70, 0.12);
        font-size: calc(var(--u) * 12);
        font-weight: 700;
        letter-spacing: 0.04em;
        white-space: nowrap;
        color: #050b14;
        text-decoration: none;
        transition: transform 0.15s ease;
      }
      .go:active {
        transform: scale(0.96);
      }

      /* xuất hiện lớp 2 */
      .l2.on .hd,
      .l2.on .tag,
      .l2.on .proto {
        animation: drop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
      }
      .l2.on .tag {
        animation-delay: 0.06s;
      }
      .l2.on .proto {
        animation-delay: 0.12s;
      }
      .l2.on .gate {
        animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
      }
      .l2.on .gate:nth-child(1) { animation-delay: 0.15s; }
      .l2.on .gate:nth-child(2) { animation-delay: 0.23s; }
      .l2.on .gate:nth-child(3) { animation-delay: 0.31s; }
      .l2.on .gate:nth-child(4) { animation-delay: 0.39s; }
      .l2.on .go {
        animation: glow 1.8s 1s ease-in-out infinite;
      }

      @keyframes drop {
        from {
          opacity: 0;
          transform: translateY(calc(var(--u) * -10));
        }
      }
      @keyframes rise {
        from {
          opacity: 0;
          transform: translateY(calc(var(--u) * 18)) scale(0.97);
        }
      }
      @keyframes glow {
        0%,
        100% {
          box-shadow:
            0 0 calc(var(--u) * 12) rgba(140, 220, 255, 0.35),
            inset 0 calc(var(--u) * -2) 0 rgba(15, 40, 70, 0.12);
        }
        50% {
          box-shadow:
            0 0 calc(var(--u) * 20) rgba(140, 220, 255, 0.7),
            inset 0 calc(var(--u) * -2) 0 rgba(15, 40, 70, 0.12);
        }
      }
.l2 { font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; color: #fff; --gold: #fbbf24; }

@media (prefers-reduced-motion: reduce) {
  .card, .l2.on *, .l2.on .gate { animation: none !important; }
}

/* ---------- Hover cổng: quầng sáng tím/xanh + mạng nút sáng ---------- */
.gate { overflow: hidden; transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s; }
.gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 46%, rgba(20, 184, 196, 0.75) 0%, rgba(126, 58, 190, 0.6) 30%, rgba(60, 20, 110, 0.25) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.gate > * { position: absolute; z-index: 1; }
.net {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.net path { fill: none; stroke: #2dd4bf; stroke-width: 0.8; stroke-opacity: 0.7; stroke-dasharray: 400; stroke-dashoffset: 400; }
.net circle { fill: #2dd4bf; filter: drop-shadow(0 0 3px #2dd4bf); }
.net circle.dim { fill: #a855f7; filter: drop-shadow(0 0 3px #a855f7); }

.gate:hover, .gate:focus-within {
  border-color: rgba(45, 212, 191, 0.85);
  transform: translateY(calc(var(--u) * -3));
  box-shadow: 0 0 calc(var(--u) * 26) rgba(126, 58, 190, 0.55), 0 0 calc(var(--u) * 10) rgba(45, 212, 191, 0.35);
}
.gate:hover::before, .gate:focus-within::before, .gate:hover .net, .gate:focus-within .net { opacity: 1; }
.gate:hover .net path, .gate:focus-within .net path { animation: net-draw 0.9s ease forwards; }

@keyframes net-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .gate:hover .net path { animation: none; stroke-dashoffset: 0; }
}
