:root {
  --bg-0: #0c0d11;
  --bg-1: #13161d;
  --panel: #161a23;
  --panel-soft: #1e2330;
  --line: #2d3446;
  --line-strong: #46506b;
  --text: #f2f5ff;
  --text-soft: #a9b0c4;
  --brand-red: #ff2a2a;
  --brand-red-dark: #d71f1f;
  --ok: #52d273;
  --err: #ff6767;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg-0);
  font-family: "Manrope", sans-serif;
}

.track-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1300px 700px at -10% -15%, rgba(255, 42, 42, 0.2), transparent 58%),
    radial-gradient(900px 500px at 105% 110%, rgba(74, 98, 174, 0.24), transparent 62%),
    linear-gradient(155deg, #0b0d11, #111420 45%, #0d1018);
}

.track-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -28deg,
      rgba(255, 255, 255, 0.02) 0 10px,
      rgba(255, 255, 255, 0.005) 10px 24px
    );
  opacity: 0.7;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 42, 42, 0.14), rgba(0, 0, 0, 0.74) 60%);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.splash-card {
  width: min(520px, 94vw);
  background: linear-gradient(180deg, rgba(24, 30, 43, 0.95), rgba(15, 19, 29, 0.97));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 30px 26px;
  text-align: center;
  animation: splash-in 0.65s ease;
}

.splash-lang-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

html[dir="rtl"] .splash-lang-wrap {
  justify-content: flex-start;
}

.splash-logo {
  width: min(320px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto 16px;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45));
  animation: logo-float 2.3s ease-in-out infinite;
}

.splash-title {
  margin: 0 0 20px;
  font-family: "Saira Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f5f6fc;
}

.splash-start {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 13px 28px;
  min-width: 210px;
  font-family: "Saira Condensed", sans-serif;
  font-size: 21px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark));
  cursor: pointer;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.splash-actions {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.splash-start.ghost {
  background: #1a2233;
  border-color: #3a4664;
  color: #dce5ff;
}

.splash-start:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.splash-loading {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.splash-loading[hidden] {
  display: none !important;
}

.splash.is-starting .splash-start {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.splash.is-starting .splash-card {
  background: linear-gradient(180deg, rgba(12, 14, 19, 0.98), rgba(8, 10, 14, 0.98));
  border-color: #262d3d;
}

.splash.is-starting {
  background: radial-gradient(circle at 50% 30%, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.92) 65%);
}

.splash.is-starting .splash-logo,
.splash.is-starting .splash-title {
  opacity: 0.22;
  transition: opacity 0.35s ease;
}

.splash .spinner {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

.splash.is-starting .spinner {
  width: 30px;
  height: 30px;
  border-width: 4px;
}

.splash.is-starting .splash-loading {
  margin-top: 8px;
}

.splash-loading span + span {
  display: none;
}

.splash-loading {
  align-items: center;
  color: var(--text-soft);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.splash-error {
  display: block;
  margin-top: 10px;
  min-height: 18px;
  color: var(--err);
  font-size: 13px;
}

.splash.is-done {
  opacity: 0;
  visibility: hidden;
}

.app-shell {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.app-shell.is-hidden {
  display: none;
}

.app-shell.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  backdrop-filter: blur(8px);
  background: rgba(7, 9, 14, 0.68);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-logo {
  display: block;
  width: 156px;
  max-width: 45vw;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
}

.lang-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[dir="rtl"] .lang-wrap {
  direction: rtl;
}

.lang-select {
  border: 1px solid #46516d;
  border-radius: 8px;
  background: #121829;
  color: #eef3ff;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  padding: 6px 8px;
}

.shell {
  max-width: 1080px;
  margin: 22px auto 84px;
  padding: 0 20px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), #121722);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #ff8b8b;
  font-family: "Saira Condensed", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

h1 {
  margin: 0 0 8px;
  color: #fff;
  font-family: "Saira Condensed", sans-serif;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 0.95;
  text-transform: uppercase;
}

.lede {
  margin: 0;
  color: var(--text-soft);
  font-size: 17px;
}

.form-panel {
  padding: 22px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.step {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  border-radius: 9px;
  background: #252c3d;
  border: 1px solid #313b52;
  color: #7f8cac;
  font-family: "Saira Condensed", sans-serif;
  font-weight: 800;
}

.step.active {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

.step.done {
  background: #1d2434;
  color: #c4cce0;
}

.step.hidden {
  display: none;
}

.step-panel {
  display: none;
}

.step-panel.hidden {
  display: none !important;
}

.step-panel.active {
  display: block;
  animation: panel-in 0.22s ease;
}

h2 {
  margin: 0 0 14px;
  font-family: "Saira Condensed", sans-serif;
  font-size: 30px;
  color: #fff;
  text-transform: uppercase;
}

.step-note {
  margin: -4px 0 14px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.4;
}

.guardian-note {
  background: rgba(255, 42, 42, 0.09);
  border: 1px solid rgba(255, 42, 42, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  color: #dce2f2;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #0f1420;
  color: #eff3ff;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  padding: 12px;
  outline: none;
}

.field input::placeholder {
  color: #8f98ae;
  opacity: 0.55;
}

.birth-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.field input:focus,
.field select:focus {
  border-color: #7d8ab1;
  box-shadow: 0 0 0 2px rgba(117, 133, 176, 0.25);
}

.field.invalid input,
.field.invalid select {
  border-color: var(--err);
  background: rgba(255, 72, 72, 0.08);
}

.field-error {
  min-height: 16px;
  font-size: 13px;
  color: #ff9b9b;
}

.field-error.global {
  display: block;
  margin-top: 8px;
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #141a27;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: #e8edfb;
  font-family: "Manrope", sans-serif;
  font-weight: 600;
}

.helper-toggle {
  margin-bottom: 12px;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.toggle.invalid {
  border-color: var(--err);
  background: rgba(255, 85, 85, 0.09);
}

.signature-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #131928;
  padding: 14px;
}

.signature-box.invalid {
  border-color: var(--err);
  background: rgba(255, 85, 85, 0.09);
}

.signature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signature-head h3 {
  margin: 0;
  font-family: "Saira Condensed", sans-serif;
  font-size: 21px;
  text-transform: uppercase;
}

.signature-box p {
  margin: 8px 0 10px;
  color: var(--text-soft);
  font-size: 14px;
}

.photo-box {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #131928;
  padding: 14px;
}

.photo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-head h3 {
  margin: 0;
  font-family: "Saira Condensed", sans-serif;
  font-size: 21px;
  text-transform: uppercase;
}

.photo-box p {
  margin: 8px 0 10px;
  color: var(--text-soft);
  font-size: 14px;
}

.photo-disclaimer {
  color: #9fb0d8;
  margin-top: -2px;
}

.photo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.photo-upload-btn {
  border: 1px solid #47516d;
  border-radius: 8px;
  background: #1c2333;
  color: #e6ecfb;
  padding: 8px 10px;
  font-family: "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.photo-preview-wrap {
  margin-top: 12px;
}

#photo-preview {
  width: min(240px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #323a4f;
  background: #0c1019;
  display: block;
}

#signature-canvas {
  width: 100%;
  height: 220px;
  background: #0c1019;
  border: 2px solid #323a4f;
  border-radius: 9px;
  touch-action: none;
  display: block;
}

.signature-clear {
  border: 1px solid #47516d;
  border-radius: 8px;
  background: #1c2333;
  color: #e6ecfb;
  padding: 8px 10px;
  font-family: "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.doc-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.doc-link-btn {
  border: none;
  background: transparent;
  color: #5da7ff;
  text-decoration: underline;
  text-decoration-color: #5da7ff;
  text-underline-offset: 2px;
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.doc-link-btn:hover {
  color: #8cc1ff;
  text-decoration-color: #8cc1ff;
}

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 14, 0.76);
  padding: 18px;
}

.legal-modal[hidden] {
  display: none !important;
}

.legal-dialog {
  width: min(920px, 96vw);
  max-height: min(88vh, 900px);
  border: 1px solid #394666;
  border-radius: 12px;
  background: linear-gradient(180deg, #151b2b, #101622);
  box-shadow: 0 28px 48px rgba(0, 0, 0, 0.56);
  display: grid;
  grid-template-rows: auto 1fr;
}

.legal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #2e3a56;
  padding: 10px 14px;
}

.legal-head h3 {
  margin: 0;
  font-family: "Saira Condensed", sans-serif;
  font-size: 24px;
  text-transform: uppercase;
}

.legal-body {
  overflow: auto;
  padding: 14px;
  color: #d8e0f6;
  line-height: 1.6;
  font-size: 15px;
}

.legal-body h4 {
  margin: 18px 0 8px;
  color: #ffffff;
  font-family: "Saira Condensed", sans-serif;
  font-size: 22px;
  text-transform: uppercase;
}

.legal-body p {
  margin: 0 0 10px;
  color: #d8e0f6;
}

.actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 22px;
  min-width: 140px;
  font-family: "Saira Condensed", sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark));
  color: #fff;
}

button.ghost {
  background: #1d2434;
  color: #e4ebff;
  border-color: #44506e;
}

.form-status {
  display: block;
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
}

.form-status.ok {
  color: var(--ok);
}

.form-status.error {
  color: var(--err);
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 920px) {
  .field-row,
  .toggle-row {
    grid-template-columns: 1fr;
  }

  .top-logo {
    width: 130px;
  }

  .topbar-inner {
    flex-wrap: wrap;
  }

  button {
    min-width: 120px;
  }
}
