:root {
  --navy: #303841;
  --navy-deep: #1c2127;
  --steel: #2e9bd1;
  --steel-glow: #5fc0f0;
  --white: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at 50% 38%, #37424e 0%, var(--navy) 45%, var(--navy-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 5vh, 40px);
  padding: 24px;
}

/* ---------- Badge wrapper: shared origin for mark + sonar rings ---------- */
.badge-wrap {
  position: relative;
  z-index: 1;
  width: clamp(170px, 44vw, 250px);
  height: clamp(170px, 44vw, 250px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Sonar rings behind mark (centered on the badge-wrap, i.e. the
   same point as the mark-plate's own center, not the viewport center) ---------- */
.sonar-field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.sonar-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(220px, 58vw, 340px);
  height: clamp(220px, 58vw, 340px);
  margin-left: calc(clamp(220px, 58vw, 340px) / -2);
  margin-top: calc(clamp(220px, 58vw, 340px) / -2);
  border-radius: 50%;
  border: 1.5px solid var(--steel);
  opacity: 0;
  animation: sonar-pulse 3.2s ease-out infinite;
}

.sonar-ring.r2 { animation-delay: 1.05s; }
.sonar-ring.r3 { animation-delay: 2.1s; }

@keyframes sonar-pulse {
  0%   { transform: scale(0.35); opacity: 0.9; }
  75%  { opacity: 0.12; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ---------- Badge / mark ---------- */
.mark-plate {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #ffffff, #f3f0e6 70%, #ece7d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 3px rgba(46, 155, 209, 0.55),
    0 0 40px 6px rgba(46, 155, 209, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.45);
}

.mark-svg {
  width: 88%;
  height: 88%;
  display: block;
}

.brand-name {
  position: relative;
  z-index: 1;
  text-align: center;
}

.brand-name h1 {
  margin: 0;
  font-size: clamp(22px, 5.6vw, 32px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--white);
}

.brand-name p {
  margin: 6px 0 0;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel-glow);
}

/* ---------- CTA ---------- */
.cta {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--steel);
  color: var(--navy-deep);
  font-size: clamp(16px, 4.4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: clamp(15px, 3.4vw, 19px) clamp(38px, 9.5vw, 60px);
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(46, 155, 209, 0.6), 0 14px 30px rgba(0, 0, 0, 0.4);
  animation: cta-breathe 2.4s ease-in-out infinite;
  transition: transform 0.15s ease, background 0.15s ease;
}

@keyframes cta-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 155, 209, 0.55), 0 14px 30px rgba(0, 0, 0, 0.4); }
  50%      { box-shadow: 0 0 0 14px rgba(46, 155, 209, 0), 0 14px 30px rgba(0, 0, 0, 0.4); }
}

.cta:hover { background: var(--steel-glow); }
.cta:active { transform: scale(0.97); }

.cta:disabled {
  cursor: default;
  animation: none;
}

.cta:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

/* ---------- Error message ---------- */
.error-message {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 320px;
  text-align: center;
  font-size: clamp(13px, 3.4vw, 15px);
  font-weight: 600;
  color: #ff9d9d;
}

body.leaving .stage {
  animation: stage-fade 0.35s ease forwards;
}

@keyframes stage-fade {
  to { opacity: 0; transform: scale(0.96); }
}

@media (max-width: 380px) {
  .stage { gap: 16px; }
}

/* ---------- Burst transition overlay ---------- */
.burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.burst-ring {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--steel);
  opacity: 0;
}

.burst-ring.go {
  animation: burst-expand 1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.burst-ring.b2.go { animation-delay: 0.12s; }
.burst-ring.b3.go { animation-delay: 0.24s; }

@keyframes burst-expand {
  0%   { transform: scale(1); opacity: 1; border-width: 3px; }
  100% { transform: scale(60); opacity: 0; border-width: 0.5px; }
}

.burst-fill {
  position: absolute;
  inset: 0;
  background: var(--navy-deep);
  opacity: 0;
}

.burst-fill.go {
  animation: burst-fill-in 0.9s ease-in forwards;
  animation-delay: 0.5s;
}

@keyframes burst-fill-in {
  to { opacity: 1; }
}

.burst-mark {
  position: absolute;
  width: clamp(90px, 22vw, 150px);
  height: clamp(90px, 22vw, 150px);
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #ffffff, #f3f0e6 70%, #ece7d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
}

.burst-mark svg {
  width: 88%;
  height: 88%;
}

.burst-mark.go {
  animation: burst-mark-in 0.7s ease-out forwards;
  animation-delay: 0.85s;
}

@keyframes burst-mark-in {
  0%   { opacity: 0; transform: scale(0.5); }
  60%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
