:root {
  --navy-900: #050d16;
  --navy-800: #071018;
  --navy-700: #0c1a28;
  --panel: rgba(10, 21, 33, 0.72);
  --panel-border: rgba(120, 190, 220, 0.16);
  --ink: #e7f0f4;
  --ink-dim: #8fa6b3;
  --amber: #f5b638;
  --cyan: #3fd0e0;
  --danger: #ff6b6b;
  --ok: #4fd48a;
  --radius: 14px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--navy-900);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Background ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg__image {
  position: absolute;
  inset: -12px;
  background: url("/aero-chart-bg.png") center / cover no-repeat;
  filter: saturate(0.9) brightness(0.5) blur(4px);
}

.bg__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(63, 208, 224, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 208, 224, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 40%, transparent 85%);
}

.bg__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 35%,
    rgba(5, 13, 22, 0.1) 0%,
    rgba(5, 13, 22, 0.75) 65%,
    rgba(5, 13, 22, 0.96) 100%
  );
}

/* ---------- Stage ---------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------- Panel ---------- */
.panel {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel__head {
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  flex-wrap: wrap;
}

.brand__logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(120, 200, 255, 0.25));
}

.brand__divider {
  width: 1px;
  height: 30px;
  background: var(--panel-border);
}

.brand__text h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
}

.brand__text p {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.brand__version {
  font-family: var(--mono);
  font-size: 10px !important;
  letter-spacing: 0.16em !important;
  color: var(--amber) !important;
  opacity: 0.9;
}

/* ---------- Steps ---------- */
.steps {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
}

.steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.steps__item.is-active {
  opacity: 1;
}

.steps__num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
  border: 1px solid rgba(63, 208, 224, 0.4);
  border-radius: 6px;
  padding: 3px 6px;
}

.steps__item.is-active .steps__num {
  background: rgba(63, 208, 224, 0.14);
  box-shadow: 0 0 12px rgba(63, 208, 224, 0.25);
}

.steps__label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.steps__item.is-active .steps__label {
  color: var(--ink);
}

.steps__line {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--panel-border) 0 6px, transparent 6px 12px);
}

/* ---------- Step panels ---------- */
.step {
  display: none;
  animation: fade 0.4s ease both;
}

.step.is-active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.step__intro {
  margin-bottom: 20px;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--amber);
}

.step__intro h2 {
  margin: 8px 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.step__intro p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}

.callsign {
  color: var(--cyan);
  font-family: var(--mono);
}

/* ---------- Field ---------- */
.field {
  display: block;
  margin-bottom: 22px;
}

.field__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: rgba(5, 13, 22, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  font-family: var(--mono);
  padding: 14px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder {
  color: rgba(143, 166, 179, 0.5);
}

.field input:focus {
  border-color: rgba(63, 208, 224, 0.6);
  box-shadow: 0 0 0 3px rgba(63, 208, 224, 0.14);
}

.field__hint {
  display: block;
  min-height: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.12s ease, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  width: 100%;
  color: var(--navy-900);
  background: linear-gradient(180deg, #ffce5c, var(--amber));
  box-shadow: 0 10px 30px -12px rgba(245, 182, 56, 0.6);
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--ghost {
  color: var(--ink);
  background: rgba(63, 208, 224, 0.08);
  border-color: rgba(63, 208, 224, 0.3);
}

.btn--ghost:hover {
  background: rgba(63, 208, 224, 0.16);
}

.btn--link {
  background: none;
  color: var(--ink-dim);
  padding: 14px 8px;
}

.btn--link:hover {
  color: var(--ink);
}

/* ---------- Scanner ---------- */
.scanner {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #04090f;
  border: 1px solid var(--panel-border);
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

.scanner__hud {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.reticle {
  position: relative;
  width: 58%;
  aspect-ratio: 3 / 4;
}

.reticle__c {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid var(--cyan);
  filter: drop-shadow(0 0 6px rgba(63, 208, 224, 0.6));
  transition: border-color 0.3s;
}

.reticle__c--tl {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}
.reticle__c--tr {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}
.reticle__c--bl {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}
.reticle__c--br {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

.reticle__scan {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
  animation: scan 2.4s ease-in-out infinite;
  opacity: 0;
}

.crosshair {
  position: absolute;
  width: 1px;
  height: 100%;
  background: rgba(63, 208, 224, 0.15);
}
.crosshair::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -50vw;
  right: -50vw;
  height: 1px;
  background: rgba(63, 208, 224, 0.15);
}

@keyframes scan {
  0% {
    top: 2%;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    top: 98%;
    opacity: 0;
  }
}

/* Scanning state */
.scanner[data-state="scanning"] .reticle__scan {
  opacity: 1;
}

/* Detected state */
.scanner[data-state="detected"] .reticle__c {
  border-color: var(--ok);
  filter: drop-shadow(0 0 8px rgba(79, 212, 138, 0.8));
}

/* Error state */
.scanner[data-state="error"] .reticle__c {
  border-color: var(--danger);
}

.scanner__readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(4, 9, 15, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 10px;
  backdrop-filter: blur(4px);
}

.scanner__readout .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.4s ease-in-out infinite;
  flex: none;
}

.scanner[data-state="detected"] .dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: none;
}

.scanner[data-state="error"] .dot {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: none;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* ---------- Face actions ---------- */
.face-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.face-actions .btn--link {
  margin-left: auto;
}

.auth-message {
  margin: 14px 0 0;
  min-height: 18px;
  font-size: 13px;
  font-family: var(--mono);
}

.auth-message.is-error {
  color: var(--danger);
}
.auth-message.is-ok {
  color: var(--ok);
}
.auth-message.is-busy {
  color: var(--cyan);
}

/* ---------- Footer ---------- */
.panel__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.mono {
  font-family: var(--mono);
}

/* ---------- Powered By ---------- */
.powered-by {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(4, 9, 15, 0.55);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.powered-by span {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.powered-by img {
  height: 26px;
  width: auto;
  object-fit: contain;
  opacity: 0.95;
}

.powered-by__name {
  font-size: 12px !important;
  letter-spacing: 0.05em !important;
  text-transform: none !important;
  color: var(--ink) !important;
  font-weight: 600;
}

@media (max-width: 480px) {
  .panel {
    padding: 22px 18px;
  }
  .brand__text h1 {
    font-size: 15px;
  }
  .powered-by {
    right: 12px;
    bottom: 12px;
  }
}
