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

:root {
  --bg:               #09090f;
  --surface:          #13131f;
  --surface-raised:   #1c1c2e;
  --border:           rgba(129, 140, 248, 0.18);
  --accent:           #818cf8;
  --accent-mid:       #6366f1;
  --accent-dark:      #4f46e5;
  --accent-glow:      rgba(99, 102, 241, 0.25);
  --text:             #f1f5f9;
  --text-muted:       #94a3b8;
  --text-faint:       #475569;
  --success:          #10b981;
  --success-glow:     rgba(16, 185, 129, 0.25);
  --danger:           #f43f5e;
  --radius:           16px;
  --radius-sm:        10px;
  --transition:       0.2s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 56px;
}

/* ── Header ── */
.header {
  width: 100%;
  max-width: 480px;
  text-align: center;
  padding: 40px 0 28px;
}

.session-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 14px;
}

.header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}

/* ── Welcome Back screen ── */
.welcome-back-name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.welcome-back-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.detail-list {
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.detail-label {
  color: var(--text-faint);
}

.detail-value {
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-mid), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 20px var(--success-glow);
  font-size: 18px;
  padding: 18px 20px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 500;
  padding: 10px;
  border: none;
}

.btn-danger-ghost:hover {
  color: var(--danger);
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Form ── */
.form-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 22px;
  color: var(--text);
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.field label .required {
  color: var(--accent);
  margin-left: 2px;
}

.field input,
.field textarea {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 13px 14px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  font-family: inherit;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Radio toggle ── */
.radio-group {
  display: flex;
  gap: 10px;
}

.radio-option {
  flex: 1;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-option label {
  display: block;
  text-align: center;
  padding: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: normal;
}

.radio-option input[type="radio"]:checked + label {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-mid);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-mid) inset;
}

/* ── Success screen ── */
.success-icon {
  width: 64px;
  height: 64px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
}

.success-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--text);
  text-align: center;
}

.success-sub {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

/* ── Error screen ── */
.error-icon {
  font-size: 40px;
  margin-bottom: 16px;
  text-align: center;
}

.error-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.error-sub {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Fade transition ── */
.screen-enter {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
