:root {
  color-scheme: dark;
  --page: #07111f;
  --page-glow: #132845;
  --surface: #101d2e;
  --surface-2: #15253a;
  --line: #2a3b52;
  --text: #f5f8fc;
  --muted: #a8b6c8;
  --green: #3ba557;
  --green-hover: #47b963;
  --green-soft: #172f25;
  --cyan: #6fc6db;
  --danger: #ff9f9f;
  --shadow: 0 28px 80px rgb(0 0 0 / 35%);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #e8edf3;
  --page-glow: #f9fbfd;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --line: #d6dee8;
  --text: #132036;
  --muted: #5d6c80;
  --green: #278344;
  --green-hover: #1f7139;
  --green-soft: #e8f4eb;
  --cyan: #176f86;
  --danger: #b42318;
  --shadow: 0 28px 80px rgb(20 35 55 / 14%);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -15%, var(--page-glow), transparent 46%),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
}

button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.gate-card {
  width: min(780px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.gate-header {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 20px;
  padding: 38px 42px 30px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  position: relative;
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 13px;
  background: var(--green);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 15%);
}

.brand-mark::before,
.brand-mark i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #07170c;
  content: "";
}

.brand-mark::before { top: 15px; left: 14px; box-shadow: 17px 0 #07170c; }
.brand-mark i:nth-child(1) { left: 20px; top: 25px; }
.brand-mark i:nth-child(2) { left: 14px; top: 31px; }
.brand-mark i:nth-child(3) { left: 31px; top: 31px; }

.eyebrow,
.step-count {
  margin: 0 0 6px;
  color: var(--green);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.75rem, 4vw, 2.45rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.02em; }
.intro, .step-heading > p:last-child { margin-bottom: 0; color: var(--muted); }

.gate-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.gate-progress li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
}

.gate-progress li::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.gate-progress span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .75rem;
}

.gate-progress [aria-current="step"] { color: var(--text); }
.gate-progress [aria-current="step"]::after { background: var(--green); }
.gate-progress [aria-current="step"] span,
.gate-progress .is-complete span { border-color: var(--green); background: var(--green); color: #fff; }

.gate-step { padding: 34px 42px 40px; }
.step-heading { margin-bottom: 24px; }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.theme-choice {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 15px;
  align-items: center;
  min-height: 126px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.theme-choice:hover { transform: translateY(-2px); border-color: var(--green); }
.theme-choice[aria-pressed="true"] { border-color: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 25%, transparent); }
.theme-choice strong, .theme-choice small { display: block; }
.theme-choice strong { margin-bottom: 3px; font-size: 1rem; }
.theme-choice small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.theme-choice b { grid-column: 2; color: var(--green); font-size: .78rem; }

.theme-preview {
  display: grid;
  width: 90px;
  height: 78px;
  padding: 10px;
  grid-template-columns: 17px 1fr;
  grid-template-rows: 13px 1fr;
  gap: 7px;
  overflow: hidden;
  border: 1px solid #aab5c3;
  border-radius: 9px;
}
.theme-preview::before { grid-column: 1 / -1; border-radius: 3px; content: ""; }
.theme-preview i { display: block; border-radius: 3px; }
.theme-preview i:nth-child(1) { grid-row: 2; }
.theme-preview i:nth-child(2) { grid-row: 2; }
.theme-preview i:nth-child(3) { display: none; }
.preview-light { background: #eef2f6; }
.preview-light::before { background: #13243d; }
.preview-light i:nth-child(1) { background: #2d914b; }
.preview-light i:nth-child(2) { background: #fff; }
.preview-dark { border-color: #3d4b60; background: #07111f; }
.preview-dark::before { background: #16253a; }
.preview-dark i:nth-child(1) { background: #3ba557; }
.preview-dark i:nth-child(2) { background: #15253a; }

form label { display: block; margin-bottom: 8px; font-size: .86rem; font-weight: 750; }
input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 15px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 20%, transparent); }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
.password-wrap button { position: absolute; top: 0; right: 5px; height: 52px; border: 0; background: transparent; color: var(--cyan); font-size: .8rem; font-weight: 800; cursor: pointer; }

.access-summary { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.access-summary span { padding: 12px 15px; }
.access-summary span + span { border-left: 1px solid var(--line); }
.access-summary small, .access-summary strong { display: block; }
.access-summary small { margin-bottom: 2px; color: var(--muted); font-size: .72rem; }
.access-summary strong { overflow: hidden; text-overflow: ellipsis; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.button { min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 9px; font-weight: 800; cursor: pointer; }
.button:disabled { opacity: .6; cursor: wait; }
.button-primary { background: var(--green); color: white; box-shadow: inset 0 -2px 0 rgb(0 0 0 / 16%); }
.button-primary:hover:not(:disabled) { background: var(--green-hover); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.button-quiet:hover { border-color: var(--muted); color: var(--text); }
.form-message { min-height: 22px; margin: 10px 0 -10px; color: var(--danger); font-size: .84rem; }
.form-message.success { color: var(--green); }

.gate-footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 20px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .76rem; }
.private-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

button:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan) 55%, transparent); outline-offset: 3px; }

@media (max-width: 650px) {
  .gate-shell { align-items: start; padding: 16px; }
  .gate-card { border-radius: 16px; }
  .gate-header { grid-template-columns: 42px 1fr; padding: 26px 22px 22px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 10px; transform: scale(.82); transform-origin: top left; }
  .gate-progress { padding: 0 15px; }
  .gate-progress li { font-size: 0; }
  .gate-progress span { font-size: .75rem; }
  .gate-step { padding: 26px 22px 30px; }
  .theme-grid { grid-template-columns: 1fr; }
  .theme-choice { min-height: 112px; }
  .form-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
