:root {
  --bg: #0e141b;
  --panel: #17212b;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f7f5ef;
  --muted: #acb4bc;
  --green: #35d07f;
  --red: #f45b69;
  --yellow: #f8c84a;
  --blue: #73b8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(115, 184, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #111923 0%, #0c1117 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
}

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

.brand-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #29394c, #1d6d53);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-subtitle,
.signed-in,
.footer,
.step-status,
.gender-hint,
.debug-log {
  color: var(--muted);
}

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

.status-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.status-card {
  width: min(1120px, 100%);
  min-height: min(78vh, 820px);
  border-radius: 32px;
  padding: 36px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.status-card::before {
  content: "";
  position: absolute;
  inset: -20% auto auto 55%;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  filter: blur(60px);
  pointer-events: none;
}

.status-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
}

.status-title {
  margin: 10px 0 10px;
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.status-message {
  margin: 0;
  max-width: 760px;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.88);
}

.status-title.is-pulsing::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  animation: status-dots 1.1s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: baseline;
}

.detail-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.detail-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.detail-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.62);
}

.detail-value {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 700;
}

.app-ready .status-card {
  box-shadow: 0 22px 80px rgba(24, 93, 70, 0.14);
}

.app-success .status-card {
  background:
    linear-gradient(180deg, rgba(53, 208, 127, 0.18), rgba(53, 208, 127, 0.06)),
    #14251d;
}

.app-reject .status-card {
  background:
    linear-gradient(180deg, rgba(244, 91, 105, 0.22), rgba(244, 91, 105, 0.06)),
    #261318;
}

.app-warning .status-card {
  background:
    linear-gradient(180deg, rgba(248, 200, 74, 0.22), rgba(248, 200, 74, 0.06)),
    #2b2412;
}

.app-busy .status-card {
  background:
    linear-gradient(180deg, rgba(115, 184, 255, 0.18), rgba(115, 184, 255, 0.06)),
    #14202a;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #f7f5ef, #b8d4ff);
  color: #091019;
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

.setup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.setup-card,
.modal-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 24px;
  background: #141c25;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow);
  padding: 24px;
}

.setup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.setup-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--blue);
}

.setup-progress {
  margin: 18px 0 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.setup-form {
  display: grid;
  gap: 22px;
}

.setup-step {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.setup-step h3 {
  margin-top: 0;
}

.setup-step input,
.setup-step select,
.gender-prompt input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  margin: 10px 0 0;
}

.field-row {
  margin-top: 12px;
}

.inline-toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.header-preview {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.header-chip {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(115, 184, 255, 0.12);
  color: #cfe5ff;
  font-size: 0.92rem;
}

.gender-prompt {
  margin-top: 28px;
  max-width: 360px;
}

.gender-prompt label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
}

.test-panel {
  margin-top: 30px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-heading {
  font-weight: 800;
}

.test-buttons,
.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.option-button {
  min-width: 220px;
}

.debug-log {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(460px, calc(100vw - 32px));
  max-height: 40vh;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 40;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

@keyframes status-dots {
  0% {
    width: 0;
  }

  100% {
    width: 0.9em;
  }
}

.debug-raw {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: min(400px, calc(100vw - 32px));
  max-height: 50vh;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 40;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

.debug-raw-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.debug-raw pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--blue);
}

@media (max-width: 860px) {
  .topbar,
  .footer {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-card {
    min-height: auto;
    padding: 28px;
  }
}

@media (max-width: 560px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
