:root {
  --bg: #07080c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f5f8;
  --text-muted: #8f94a6;
  --text-dim: #585d70;
  --accent: #5b8cff;
  --accent-2: #9b5cff;
  --accent-gradient: linear-gradient(135deg, #5b8cff 0%, #9b5cff 100%);
  --danger: #ff5c7a;
  --success: #5fd39a;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(900px 600px at 15% -10%, #171a2c 0%, var(--bg) 60%) no-repeat, var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px calc(40px + env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(91, 140, 255, 0.35);
}

h1 {
  margin: 0 0 10px;
  font-size: 29px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1:focus {
  outline: none;
}

.lead {
  margin: 0 0 26px;
  color: var(--text-muted);
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

input,
textarea {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

textarea {
  min-height: 100px;
  resize: vertical;
  overflow-wrap: anywhere;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.25);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

.code-input {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.invalid,
.invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.2);
}

.field-error {
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.hint.ok {
  color: var(--success);
}

.hint.warn {
  color: #ffc46b;
}

.divider {
  display: flex;
  align-items: center;
  margin: 28px 0 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.divider span {
  padding: 0 12px;
}

.password-row {
  position: relative;
}

.password-row input {
  padding-right: 96px;
}

.toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  min-width: 80px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-error {
  margin: 6px 0 16px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 92, 122, 0.35);
  border-radius: 12px;
  background: rgba(255, 92, 122, 0.12);
  color: #ffd3dc;
  font-size: 15px;
}

.primary,
.secondary {
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), opacity 0.15s var(--ease);
}

.primary {
  margin-top: 8px;
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(91, 140, 255, 0.28);
}

.secondary {
  background: var(--surface-strong);
  color: var(--text);
}

.primary:active,
.secondary:active {
  transform: scale(0.985);
}

.primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.primary:focus-visible,
.secondary:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.privacy {
  margin: 22px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.done {
  padding-top: 36px;
  text-align: center;
}

.done .lead {
  margin-bottom: 32px;
}

.done-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  margin: 0 auto 26px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: 0 14px 40px rgba(91, 140, 255, 0.4);
}
