/* ─────────────────────────────────────────────────────
   BTL Design Tokens
   ───────────────────────────────────────────────────── */
:root {
  --bg: #e8f7f8;
  --surface: #ffffff;
  --surface-soft: #f4fbfc;
  --border: #cce8ea;
  --border-soft: #e4f1f2;
  --text: #475766;
  --text-mid: #435868;
  --text-dim: #8aabb0;
  --accent: #2d8289;
  --accent-light: #e0f4f5;
  --accent-dark: #1f6168;
  --grad-start: #43b2ea;
  --grad-end: #3fb284;
  --success: #3fb284;
  --danger: #e57373;
  --danger-bg: #fdecea;
  --neutral: #e6ecef;
  --neutral-hover: #d5dee2;
  --radius: 10px;
  --radius-lg: 14px;
  --sans: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-card: 0 12px 40px rgba(69, 96, 104, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

/* ─────────────────────────────────────────────────────
   Card – fixed height, three-row grid: header | body | footer
   ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 620px;
  height: 620px;                 /* fixed height for consistency across screens */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-content {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 40px 48px 32px;
  min-height: 0;                 /* allow inner scroll boxes to shrink */
}

.card-content.active {
  display: flex;
}

/* ─────────────────────────────────────────────────────
   Landing (index.html)
   ───────────────────────────────────────────────────── */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
  padding: 48px;
}

.landing-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.landing-logo img {
  height: 60px;
  width: auto;
  max-width: 100%;
}

.landing-title {
  color: var(--accent);
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
  max-width: 440px;
}

.landing-subtitle {
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  max-width: 440px;
  margin: 0;
}

.landing-cta {
  margin-top: 16px;
}

/* ─────────────────────────────────────────────────────
   Wizard structure
   ───────────────────────────────────────────────────── */
.wizard-header {
  text-align: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.step-indicator {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 16px;
}

.step-indicator strong {
  font-weight: 700;
}

.wizard-title {
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.wizard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  justify-content: center;       /* vertical center for short bodies */
}

.wizard-body--top {
  justify-content: flex-start;   /* form etc. anchored at top */
}

/* Footer sits at bottom of card */
.wizard-footer {
  flex-shrink: 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wizard-footer .footer-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0;
}

.wizard-footer .footer-hint a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wizard-footer-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ─────────────────────────────────────────────────────
   Age Pills (Screen 2)
   ───────────────────────────────────────────────────── */
.age-pills {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.age-pill {
  background: var(--neutral);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  padding: 12px 26px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, color 0.15s;
  min-width: 92px;
}

.age-pill:hover { background: var(--neutral-hover); }
.age-pill:active { transform: scale(0.98); }

.age-pill.selected {
  background: var(--success);
  color: white;
}

.age-pill.blocked {
  background: var(--danger);
  color: white;
}

.age-warning {
  text-align: center;
  margin-top: 28px;
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
}

/* ─────────────────────────────────────────────────────
   Rules List (Screen 3) – scrollable with 10 rules
   ───────────────────────────────────────────────────── */
.rules-box {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 8px 4px 8px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Custom scrollbar for the rules box */
.rules-box::-webkit-scrollbar { width: 8px; }
.rules-box::-webkit-scrollbar-track { background: transparent; }
.rules-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
.rules-box::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

.rules-list {
  margin: 0;
  padding: 0 16px 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.rule {
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
}

.rule:last-child { border-bottom: none; }

.rule-num {
  font-size: 18px;
  line-height: 1.2;
  padding-top: 1px;
  user-select: none;
}

.rule-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-title {
  font-weight: 600;
  color: var(--text-mid);
  font-size: 15px;
  line-height: 1.35;
}

.rule-desc {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.rule-desc .rule-emoji {
  margin-left: 2px;
}

/* ─────────────────────────────────────────────────────
   Form (Screen 4)
   ───────────────────────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form input {
  font-family: var(--sans);
  font-size: 15px;
  padding: 13px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

.form input::placeholder { color: var(--text-dim); }

.form input:focus {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.form input.invalid { border-color: var(--danger); }
.form input.valid { border-color: var(--success); }

.field-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 4px;
  min-height: 16px;
}

.field-hint.error { color: var(--danger); }
.field-hint.success { color: var(--success); }

.field-note {
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 4px;
  line-height: 1.4;
}

.pw-requirements {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.pw-req {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}

.pw-req::before {
  content: "○";
  font-size: 12px;
  line-height: 1;
  width: 12px;
  text-align: center;
}

.pw-req.met {
  color: var(--success);
}

.pw-req.met::before {
  content: "✓";
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────
   Success Screen
   ───────────────────────────────────────────────────── */
.card-content.success {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
}

.success-emoji {
  font-size: 56px;
  margin: 0;
  line-height: 1;
}

.success-title {
  color: var(--accent);
  font-size: 24px;
  font-weight: 600;
  margin: 4px 0 0;
}

.success-text {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  max-width: 420px;
  margin: 0;
}

.username-badge {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  margin-top: 4px;
}

.username-badge-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.success-cta {
  margin-top: 16px;
}

/* ─────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────── */
button {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.05s, opacity 0.15s, background 0.15s;
}

button:active:not(:disabled) { transform: scale(0.98); }

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

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.btn-secondary:hover:not(:disabled) { background: #cae9ea; }

.btn-gradient {
  background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
  color: white;
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.btn-gradient:hover:not(:disabled) { opacity: 0.92; }

/* ─────────────────────────────────────────────────────
   Toast
   ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  font-size: 15px;
  z-index: 100;
  animation: slideDown 0.25s ease-out;
  max-width: 90%;
}

@keyframes slideDown {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ─────────────────────────────────────────────────────
   Utility
   ───────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────────────────
   Mobile
   ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: 0; align-items: stretch; }
  .card {
    height: 100vh;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .card-content, .landing { padding: 32px 24px 24px; }
  .wizard-footer-buttons { flex-direction: column-reverse; }
  .wizard-footer-buttons button { width: 100%; }
  .age-pill {
    flex: 1 1 calc(50% - 10px);
    min-width: 0;
    padding: 14px 8px;
    white-space: nowrap;
  }
  .age-pills { gap: 10px; }
}
