/* ════════════════════════════════════════════════
   IDIOMASOFÍA® · IELTS BAND ESTIMATOR
   styles.css
   Brand: #1AACCF sky-blue · #FF7A2F orange · #0D0D1A dark
════════════════════════════════════════════════ */

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

:root {
  --blue:    #1AACCF;
  --blue2:   #29B6D8;
  --orange:  #FF7A2F;
  --dark:    #0D0D1A;
  --surface: #14142B;
  --card:    #1C1C35;
  --border:  #2A2A4A;
  --text:    #E2E8F0;
  --muted:   #7B8CB4;
  --green:   #22C55E;
  --red:     #EF4444;
  --radius:  14px;
  --font-display: 'Fredoka One', sans-serif;
  --font-body:    'Nunito', sans-serif;
}

html, body {
  height: 100%;
  background: var(--dark);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ─────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Global button ───────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px 24px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Brand logo ──────────────────────────────── */
.brand-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--blue);
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 8px;
}
.brand-logo.small { font-size: 1.1rem; margin-bottom: 12px; }

/* ═══════════════════════════════════════════════
   SCREEN 1 · WELCOME
═══════════════════════════════════════════════ */
.welcome-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 24px 40px;
  text-align: center;
}
.brand-tagline { color: var(--muted); font-size: 0.85rem; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 36px; }

.ielts-hero { margin-bottom: 32px; }
.ielts-badge {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 3px;
  padding: 5px 18px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 3rem;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 12px;
}
.hero-sub { color: var(--muted); font-size: 0.95rem; line-height: 1.6; }

.test-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}
.meta-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.meta-icon { font-size: 1.3rem; }
.meta-val { font-family: var(--font-display); font-size: 1.15rem; color: var(--blue); }
.meta-lbl { font-size: 0.7rem; color: var(--muted); }

.welcome-note { margin-top: 16px; font-size: 0.78rem; color: var(--muted); }

/* ═══════════════════════════════════════════════
   SCREEN 2 · REGISTRATION
═══════════════════════════════════════════════ */
.form-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 24px;
}
.form-header { text-align: center; margin-bottom: 28px; }
.form-header h2 { font-family: var(--font-display); font-size: 1.8rem; color: #fff; margin-bottom: 6px; }
.form-header p { color: var(--muted); font-size: 0.9rem; }

.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 0.83rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.field-group input,
.field-group select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.97rem;
  padding: 12px 16px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}
.field-group input:focus,
.field-group select:focus { border-color: var(--blue); }
.field-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237B8CB4' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }

.field-error { background: rgba(239,68,68,0.1); border: 1px solid var(--red); color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; margin-bottom: 14px; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════
   SCREEN 3 · INSTRUCTIONS
═══════════════════════════════════════════════ */
.instructions-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}
.instructions-shell h2 { font-family: var(--font-display); font-size: 1.8rem; color: #fff; margin-bottom: 24px; }

.sections-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.section-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
}
.sc-icon { font-size: 1.4rem; flex-shrink: 0; }
.sc-title { font-weight: 800; font-size: 0.97rem; color: #fff; }
.sc-detail { font-size: 0.8rem; color: var(--muted); }

.instr-rules { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; text-align: left; }
.rule { font-size: 0.88rem; color: var(--muted); padding: 5px 0; border-bottom: 1px solid var(--border); }
.rule:last-child { border-bottom: none; }
.rule strong { color: var(--orange); }

/* ═══════════════════════════════════════════════
   SCREEN 4 · PASSAGE INTERSTITIAL
═══════════════════════════════════════════════ */
.passage-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px;
}
.passage-intro-header { text-align: center; margin-bottom: 24px; }
.section-eyebrow {
  display: inline-block;
  background: rgba(255,122,47,0.15);
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.passage-intro-header h2 { font-family: var(--font-display); font-size: 1.7rem; color: #fff; margin-bottom: 8px; }
.passage-intro-header p { color: var(--muted); font-size: 0.9rem; }

.passage-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text);
  max-height: 50vh;
  overflow-y: auto;
}
.passage-body p { margin-bottom: 14px; }
.passage-body p:last-child { margin-bottom: 0; }
.passage-body em { color: var(--blue); font-style: italic; }

/* ═══════════════════════════════════════════════
   SCREEN 5 · TEST
═══════════════════════════════════════════════ */
.test-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.test-id-pill {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--muted);
  background: var(--card);
  padding: 4px 10px;
  border-radius: 20px;
}
.timer-pill {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--blue);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 4px 14px;
  border-radius: 20px;
  transition: color 0.3s;
}
.timer-pill.warning { color: var(--orange); border-color: var(--orange); }
.timer-pill.urgent  { color: var(--red);    border-color: var(--red); }

.progress-track {
  height: 4px;
  background: var(--border);
  width: 100%;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--orange));
  transition: width 0.4s ease;
}

/* Passage panel (collapsible) */
.passage-panel {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.35s ease;
  max-height: 340px;
}
.passage-panel.collapsed { max-height: 44px; }
.passage-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 0.83rem;
  font-weight: 800;
  color: var(--blue);
  cursor: pointer;
}
.btn-passage-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
.btn-passage-toggle:hover { border-color: var(--blue); color: var(--blue); }
.passage-panel-body {
  padding: 0 16px 16px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text);
  max-height: 280px;
  overflow-y: auto;
}
.passage-panel-body p { margin-bottom: 12px; }
.passage-panel-body em { color: var(--blue); font-style: italic; }

/* Question zone */
.question-zone {
  padding: 20px 16px 0;
  max-width: 680px;
  margin: 0 auto;
}
.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-pill {
  background: rgba(26,172,207,0.15);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}
.q-counter { font-size: 0.8rem; color: var(--muted); }

/* Per-question timer */
.q-timer-pill {
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  transition: color 0.3s, border-color 0.3s;
  white-space: nowrap;
  margin-left: auto;
}
.q-timer-pill.qt-warning { color: var(--orange); border-color: var(--orange); }
.q-timer-pill.qt-slow    { color: var(--red);    border-color: var(--red); }

.q-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.55;
  margin-bottom: 20px;
  white-space: pre-line;
}

.options-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 100px; }
.option-btn {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.4;
}
.option-btn .opt-label {
  width: 26px;
  height: 26px;
  background: var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background 0.18s;
}
.option-btn:hover:not(.selected) { border-color: var(--blue2); }
.option-btn.selected {
  background: rgba(26,172,207,0.12);
  border-color: var(--blue);
  color: #fff;
}
.option-btn.selected .opt-label { background: var(--blue); color: #fff; }

/* TFNG pills */
.option-btn.tfng-true:hover:not(.selected)   { border-color: var(--green); }
.option-btn.tfng-false:hover:not(.selected)  { border-color: var(--red); }
.option-btn.tfng-ng:hover:not(.selected)     { border-color: var(--muted); }
.option-btn.tfng-true.selected  { background: rgba(34,197,94,0.12); border-color: var(--green); }
.option-btn.tfng-false.selected { background: rgba(239,68,68,0.12);  border-color: var(--red); }

.test-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}
.answered-badge { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.answered-badge span:first-child { color: var(--blue); font-weight: 800; font-size: 1rem; }
.test-footer .btn-primary { width: auto; min-width: 130px; padding: 12px 22px; font-size: 0.95rem; }

/* ═══════════════════════════════════════════════
   SCREEN 6 · SUBMITTING
═══════════════════════════════════════════════ */
.submit-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 18px;
  padding: 24px;
}
.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.submit-msg { font-family: var(--font-display); font-size: 1.4rem; color: #fff; }
.submit-sub { font-size: 0.85rem; color: var(--muted); }

/* ═══════════════════════════════════════════════
   SCREEN 7 · RESULTS
═══════════════════════════════════════════════ */
.results-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 36px 20px 48px;
}
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.result-test-id { font-size: 0.72rem; font-family: monospace; color: var(--muted); background: var(--card); padding: 4px 10px; border-radius: 20px; }

.band-hero { text-align: center; margin-bottom: 24px; }
.band-label-top { font-size: 0.78rem; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; }
.band-big {
  font-family: var(--font-display);
  font-size: 6rem;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 10px;
}
.band-cefr-pill {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 6px 22px;
  border-radius: 24px;
  margin-bottom: 8px;
}
.band-user-label { color: var(--muted); font-size: 0.95rem; }

/* Band meter */
.band-meter-wrap { margin-bottom: 24px; padding: 0 4px; }
.band-meter { position: relative; }
.bm-track {
  height: 12px;
  background: var(--card);
  border-radius: 6px;
  overflow: visible;
  position: relative;
  border: 1px solid var(--border);
}
.bm-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444, #F97316, #EAB308, #22C55E, #1AACCF, #9333EA);
  border-radius: 6px;
  transition: width 1.2s cubic-bezier(0.22,1,0.36,1);
}
.bm-marker {
  position: absolute;
  top: -5px;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--blue);
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 1.2s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 2px 8px rgba(26,172,207,0.5);
}
.bm-labels {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

/* Breakdown */
.breakdown-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.breakdown-title { font-weight: 800; font-size: 0.85rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 14px; }
.breakdown-row {
  display: grid;
  grid-template-columns: 24px 1fr 1fr 52px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.breakdown-row:last-of-type { border-bottom: none; }
.br-icon { font-size: 1rem; }
.br-name { font-size: 0.83rem; font-weight: 700; color: var(--text); }
.br-bar-wrap { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.br-bar { height: 100%; background: var(--blue); border-radius: 4px; width: 0; transition: width 1.4s cubic-bezier(0.22,1,0.36,1); }
.br-score { font-size: 0.8rem; font-weight: 800; color: var(--blue); text-align: right; }
.breakdown-total { margin-top: 14px; text-align: right; font-size: 0.85rem; color: var(--muted); }
.breakdown-total strong { color: var(--blue); font-size: 1rem; }

/* Next steps */
.next-steps-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  margin-bottom: 20px;
}
.ns-message { font-size: 0.92rem; color: var(--text); margin-bottom: 18px; line-height: 1.6; }
.btn-whatsapp {
  display: inline-block;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  padding: 13px 28px;
  border-radius: 30px;
  margin-bottom: 12px;
  transition: opacity 0.2s;
}
.btn-whatsapp:hover { opacity: 0.88; }
.ns-note { font-size: 0.78rem; color: var(--muted); }

.results-footer { text-align: center; font-size: 0.72rem; color: var(--muted); margin-top: 8px; }

/* ── Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 420px) {
  .test-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 2.4rem; }
  .band-big { font-size: 5rem; }
  .breakdown-row { grid-template-columns: 20px 1fr 1fr 46px; }
  .br-name { font-size: 0.75rem; }
}
