/* ============================================================
   Questifi — Design System
   Brand: Bright Ocean · Yellow Green · Coral Glow
   Style: Keith Haring-inspired — bold outlines, flat fills,
          kinetic energy, no gradients, no soft shadows
   Fonts: Clash Display 700 (headings) · Instrument Sans (body)
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Palette */
  --porcelain: #FAFFFD;
  --shadow:    #342E37;
  --ocean:     #3C91E6;
  --ocean-light: #EBF5FB;
  --ocean-dark:  #1a5fa8;
  --coral:      #FA824C;
  --coral-dark: #c55a28;
  --coral-light:#FFF0E8;
  --ygreen:      #9FD356;
  --ygreen-light:#F0FAE0;
  --ygreen-dark: #5a8a1e;
  --confirm:      #27ae60;
  --confirm-dark: #1e8449;
  --confirm-light:#EAFAF1;
  --danger:      #e74c3c;
  --danger-dark: #c0392b;
  --danger-light:#FDEDEC;
  --surface:   #FFFFFF;
  --border:    #E8EDE8;
  --border2:   #d0d8d0;
  --text:      #342E37;
  --text2:     #6b6575;
  --text3:     #9a94a3;
  --gray-light:#F5F5F5;

  /* Haring button shadow system */
  --shadow-sm:  2px 2px 0 var(--shadow);
  --shadow-md:  4px 4px 0 var(--shadow);
  --shadow-lg:  6px 6px 0 var(--shadow);

  /* Layout */
  --radius:    16px;
  --radius-sm: 10px;

  /* Typography */
  --font-display: 'Clash Display', sans-serif;
  --font-body:    'Instrument Sans', sans-serif;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }

/* ── BASE ────────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--porcelain);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.7;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.2;
}

/* ── SCREEN / VIEW SYSTEM ────────────────────────────────────── */
.screen { display: none; flex-direction: column; min-height: 100vh; }
.screen.active { display: flex; }
.view { display: none; flex: 1; flex-direction: column; }
.view.active { display: flex; }

/* ── NAV ─────────────────────────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 3px solid var(--shadow);
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  letter-spacing: -0.3px;
  text-decoration: none;
}
.nav-logo span { color: var(--coral); }
.nav-tabs { display: flex; gap: 2px; }
.nav-tab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  background: transparent;
  color: var(--text2);
  transition: all .15s;
  font-family: var(--font-body);
}
.nav-tab:hover { background: var(--coral-light); color: var(--coral-dark); border-color: var(--coral); }
.nav-tab.active { background: var(--coral-light); color: var(--coral); border-color: var(--coral); }
.nav-right { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; }
.nav-xp { color: var(--ocean); display: flex; align-items: center; gap: 5px; font-weight: 700; }
.nav-badge {
  background: var(--ygreen);
  color: var(--shadow);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--shadow);
}
.nav-badge.admin { background: var(--coral); color: #fff; }
.btn-out {
  background: none;
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-body);
  transition: all .15s;
}
.btn-out:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ── BUTTONS — Haring flat offset shadow system ──────────────── */
/* Primary: Coral Glow, 3px Shadow Grey border, 4px 4px 0 offset shadow */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  border: 3px solid var(--shadow);
  cursor: pointer;
  font-family: var(--font-body);
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: all .12s;
  text-decoration: none;
}
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-md); }

/* Secondary: transparent, 2px Coral border, no shadow */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  border: 2px solid var(--coral);
  cursor: pointer;
  font-family: var(--font-body);
  background: transparent;
  color: var(--coral);
  transition: all .12s;
  text-decoration: none;
}
.btn-secondary:hover { background: rgba(250,130,76,.08); transform: translateY(-2px); }

/* Small utility buttons */
.btn-sm {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid;
  transition: all .12s;
}
.btn-sm.edit { border-color: var(--ocean); color: var(--ocean-dark); background: var(--ocean-light); }
.btn-sm.edit:hover { background: var(--ocean); color: #fff; box-shadow: 3px 3px 0 var(--ocean-dark); }
.btn-sm.del { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.btn-sm.del:hover { background: var(--danger); color: #fff; box-shadow: 3px 3px 0 var(--danger-dark); }

/* ── CARDS — Haring bold border + offset shadow ──────────────── */
.card {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}
.card-hover {
  transition: all .2s;
  cursor: pointer;
}
.card-hover:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }

/* ── FORMS ───────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.field input,
.field-g input,
.ef-ta,
.pl-inp {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 400;
  outline: none;
  color: var(--text);
  transition: border-color .15s, background .15s;
  background: var(--surface);
}
.field input:focus,
.field-g input:focus,
.ef-ta:focus,
.pl-inp:focus {
  border-color: var(--coral);
  background: var(--coral-light);
}
.ef-sel {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  background: var(--surface);
  flex: 1;
}
.ef-sel:focus { border-color: var(--coral); }

/* ── LANDING ─────────────────────────────────────────────────── */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--porcelain);
}
.landing-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ocean);
  margin-bottom: 16px;
}
.landing-logo {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -1px;
}
.landing-logo span { color: var(--coral); }
.landing-tag { font-size: 18px; color: var(--text2); font-weight: 400; margin-bottom: 52px; text-align: center; }
.entry-cards { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.entry-card {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: 20px;
  padding: 36px 32px;
  width: 240px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-md);
}
.entry-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.entry-icon { font-size: 44px; margin-bottom: 16px; }
.entry-card h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 8px; color: var(--text); }
.entry-card p { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ── AUTH ────────────────────────────────────────────────────── */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--porcelain);
}
.auth-card {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.auth-logo { font-family: var(--font-display); font-size: 24px; color: var(--text); margin-bottom: 4px; }
.auth-logo span { color: var(--coral); }
.auth-sub { font-size: 13px; color: var(--text2); margin-bottom: 28px; }
.auth-tabs {
  display: flex;
  margin-bottom: 22px;
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-body);
  transition: all .15s;
}
.auth-tab.active { background: var(--coral); color: #fff; }
.auth-err {
  background: var(--danger-light);
  color: var(--danger-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  display: none;
  border: 2px solid var(--danger);
}
.btn-auth {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  border: 3px solid var(--shadow);
  cursor: pointer;
  font-family: var(--font-body);
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: all .12s;
  margin-top: 4px;
}
.btn-auth:disabled { opacity: .6; cursor: not-allowed; }
.btn-auth:not(:disabled):hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.btn-auth:not(:disabled):active { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.btn-auth.adm { background: var(--shadow); color: #fff; box-shadow: 4px 4px 0 var(--coral); border-color: var(--coral); }
.btn-auth.adm:not(:disabled):hover { box-shadow: 6px 6px 0 var(--coral); }
.auth-back { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: var(--text2); cursor: pointer; }
.auth-back:hover { color: var(--coral); }

/* ── JOURNEY / QUEST PATH ────────────────────────────────────── */
.journey-wrap { max-width: 520px; margin: 0 auto; padding: 32px 24px 80px; width: 100%; }
.journey-hdr { text-align: center; margin-bottom: 32px; }
.journey-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--ocean); margin-bottom: 8px; }
.journey-title { font-family: var(--font-display); font-size: 28px; color: var(--text); margin-bottom: 20px; }
.journey-prog-wrap {
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
  border: 2px solid var(--shadow);
}
.journey-prog-fill { height: 100%; background: var(--coral); border-radius: 99px; transition: width .6s; }
.journey-prog-lbl { font-size: 12px; color: var(--text3); font-weight: 600; }

.path { position: relative; }
.path-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--shadow);
  transform: translateX(-50%);
  z-index: 0;
  opacity: .15;
}
.node { position: relative; z-index: 1; margin-bottom: 24px; display: flex; }
.node.left { justify-content: flex-start; padding-right: 54%; }
.node.right { justify-content: flex-end; padding-left: 54%; }
.ncard {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 14px 16px;
  width: 100%;
  cursor: pointer;
  transition: all .18s;
  position: relative;
  box-shadow: 3px 3px 0 var(--shadow);
}
.ncard:hover:not(.locked) { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--shadow); }
.ncard.done { border-color: var(--ygreen); background: var(--ygreen-light); box-shadow: 3px 3px 0 var(--ygreen-dark); }
.ncard.active { border-color: var(--coral); background: var(--coral-light); box-shadow: 3px 3px 0 var(--coral-dark); }
.ncard.locked { opacity: .45; cursor: default; box-shadow: none; }
.nicon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 8px; flex-shrink: 0; border: 2px solid var(--shadow); }
.ni-done { background: var(--ygreen); }
.ni-active { background: var(--coral-light); }
.ni-lock { background: var(--gray-light); }
.ni-def { background: var(--ocean-light); }
.nname { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.nmeta { font-size: 12px; color: var(--text2); }
.nscore { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700; }
.nscore.done { color: var(--ygreen-dark); }
.nscore.active { color: var(--coral); }
.nbadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  border: 1.5px solid var(--shadow);
}
.nb-done { background: var(--ygreen); color: var(--shadow); }
.nb-active { background: var(--coral); color: #fff; }
.nb-lock { background: var(--gray-light); color: var(--text3); }
.ndot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--shadow);
  top: 50%;
  z-index: 2;
}
.node.left .ndot { right: -7px; transform: translateY(-50%); background: var(--coral); }
.node.right .ndot { left: -7px; transform: translateY(-50%); background: var(--coral); }
.ndot.done { background: var(--ygreen) !important; }
.ndot.lock { background: var(--border2) !important; }
.path-end { text-align: center; padding: 24px 0 0; position: relative; z-index: 1; }
.path-end-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid var(--shadow);
  box-shadow: var(--shadow-md);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.path-end-txt { font-family: var(--font-display); font-size: 16px; color: var(--text2); }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty { text-align: center; padding: 56px 20px; color: var(--text2); }
.empty .ei { font-size: 52px; margin-bottom: 14px; }
.empty p { font-size: 15px; }

/* ── LEADERBOARD ─────────────────────────────────────────────── */
.lb-wrap { max-width: 520px; margin: 0 auto; padding: 32px 24px; width: 100%; }
.lb-card { background: var(--surface); border: 3px solid var(--shadow); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.lb-item { display: flex; align-items: center; padding: 12px 18px; gap: 10px; border-bottom: 2px solid var(--border); }
.lb-item:last-child { border-bottom: none; }
.lb-item.me { background: var(--coral-light); }
.lb-rank { font-weight: 700; font-size: 15px; width: 22px; text-align: center; color: var(--text2); }
.lb-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ygreen);
  color: var(--shadow);
  border: 2px solid var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.lb-xp { font-weight: 700; font-size: 13px; color: var(--coral); }

/* ── QUIZ ────────────────────────────────────────────────────── */
.quiz-hdr {
  background: var(--surface);
  border-bottom: 3px solid var(--shadow);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-x { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text3); padding: 4px; }
.btn-x:hover { color: var(--text); }
.qprog-bar {
  flex: 1;
  height: 12px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  border: 2px solid var(--shadow);
}
.qprog-fill { height: 100%; background: var(--coral); border-radius: 99px; transition: width .4s; }
.q-hearts { color: var(--danger); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.quiz-body { flex: 1; display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; padding: 32px 24px 100px; width: 100%; }
.q-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ocean); margin-bottom: 10px; }
.q-text { font-family: var(--font-display); font-size: 24px; color: var(--text); margin-bottom: 28px; line-height: 1.4; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  background: var(--surface);
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.choice-btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--shadow); }
.choice-btn.selected { border-color: var(--coral); background: var(--coral-light); }
.choice-btn.correct { border-color: var(--ygreen); background: var(--ygreen-light); box-shadow: 3px 3px 0 var(--ygreen-dark); }
.choice-btn.wrong { border-color: var(--danger); background: var(--danger-light); box-shadow: 3px 3px 0 var(--danger-dark); }
.c-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gray-light);
  border: 2px solid var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.choice-btn.selected .c-letter { background: var(--coral); border-color: var(--coral-dark); color: #fff; }
.choice-btn.correct .c-letter { background: var(--ygreen); border-color: var(--ygreen-dark); color: #fff; }
.choice-btn.wrong .c-letter { background: var(--danger); border-color: var(--danger-dark); color: #fff; }
.word-area {
  min-height: 52px;
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
  background: var(--surface);
}
.word-pool { display: flex; flex-wrap: wrap; gap: 7px; }
.wblock {
  background: var(--surface);
  border: 2px solid var(--shadow);
  border-radius: 9px;
  padding: 7px 13px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .1s;
  font-family: var(--font-body);
  box-shadow: 2px 2px 0 var(--shadow);
}
.wblock:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow); }
.wblock.used { opacity: .2; pointer-events: none; }
.wblock.in-ans { background: var(--coral-light); border-color: var(--coral); }
.pairs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pair-btn {
  background: var(--surface);
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 13px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  font-family: var(--font-body);
  box-shadow: 2px 2px 0 var(--shadow);
}
.pair-btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--shadow); }
.pair-btn.selected { border-color: var(--coral); background: var(--coral-light); }
.pair-btn.matched { border-color: var(--ygreen); background: var(--ygreen-light); opacity: .75; pointer-events: none; }
.pair-btn.wflash { border-color: var(--danger); background: var(--danger-light); animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.btn-check {
  background: var(--coral);
  color: #fff;
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--font-body);
  margin-top: 18px;
  box-shadow: var(--shadow-md);
  transition: all .1s;
}
.btn-check:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.btn-check:active { transform: translate(2px,2px); box-shadow: var(--shadow-sm); }

/* ── FEEDBACK BAR ────────────────────────────────────────────── */
.fb-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 24px 26px;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  gap: 14px;
}
.fb-bar.correct { background: var(--ygreen-light); border-top: 3px solid var(--shadow); }
.fb-bar.wrong { background: var(--danger-light); border-top: 3px solid var(--shadow); }
.fb-icon { font-size: 26px; flex-shrink: 0; }
.fb-text { flex: 1; }
.fb-text h3 { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.fb-text p { font-size: 13px; color: var(--text2); }
.fb-bar.correct .fb-text h3 { color: var(--ygreen-dark); }
.fb-bar.wrong .fb-text h3 { color: var(--danger-dark); }
.btn-cont {
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 13px 26px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--font-body);
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  transition: all .1s;
}
.fb-bar.correct .btn-cont { background: var(--ygreen); }
.fb-bar.wrong .btn-cont { background: var(--danger); }
.btn-cont:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }

/* ── RESULT ──────────────────────────────────────────────────── */
.result-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; }
.result-emoji { font-size: 72px; margin-bottom: 16px; animation: popIn .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes popIn { from{transform:scale(0)} to{transform:scale(1)} }
.result-title { font-family: var(--font-display); font-size: 32px; color: var(--text); margin-bottom: 10px; }
.result-pct { font-size: 64px; font-weight: 700; color: var(--coral); line-height: 1; margin-bottom: 6px; }
.result-pct.fail { color: var(--text2); }
.result-sub { color: var(--text2); font-size: 15px; margin-bottom: 28px; }
.result-stats { display: flex; gap: 16px; margin-bottom: 36px; flex-wrap: wrap; justify-content: center; }
.rstat {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.rstat .rnum { font-size: 28px; font-weight: 700; }
.rstat .rlbl { font-size: 12px; color: var(--text2); margin-top: 3px; }
.rstat.good .rnum { color: var(--ygreen-dark); }
.rstat.bad .rnum { color: var(--danger); }
.rstat.xp .rnum { color: var(--coral); }
.result-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-done {
  background: var(--coral);
  color: #fff;
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 15px 40px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  transition: all .12s;
}
.btn-done:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.btn-retry {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--shadow);
  border-radius: var(--radius);
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .12s;
}
.btn-retry:hover { background: var(--gray-light); }

/* ── ADMIN ───────────────────────────────────────────────────── */
.admin-layout { max-width: 760px; margin: 0 auto; padding: 36px 24px 80px; width: 100%; }
.sec-title { font-family: var(--font-display); font-size: 26px; color: var(--text); margin-bottom: 6px; }
.sec-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.admin-c-card {
  background: var(--surface);
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-md);
}
.admin-c-info { flex: 1; }
.admin-c-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.admin-c-meta { font-size: 13px; color: var(--text2); }
.admin-c-acts { display: flex; gap: 8px; }

/* Upload zone */
.upload-zone {
  border: 3px dashed var(--shadow);
  border-radius: var(--radius);
  padding: 44px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.drag { border-style: solid; border-color: var(--coral); background: var(--coral-light); }
.uz-icon { font-size: 44px; margin-bottom: 12px; }
.upload-zone h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 7px; color: var(--text); }
.upload-zone p { color: var(--text2); font-size: 13px; }
#pdf-input { display: none; }
.sel-file {
  background: var(--confirm-light);
  border: 2px solid var(--confirm);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--confirm-dark);
}
.field-g { margin-bottom: 18px; }
.field-g label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 7px; }
.btn-gen {
  background: var(--coral);
  color: #fff;
  border: 3px solid var(--shadow);
  border-radius: var(--radius);
  padding: 15px 28px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .1s;
}
.btn-gen:disabled { background: var(--text3); box-shadow: none; border-color: var(--text3); cursor: not-allowed; }
.btn-gen:not(:disabled):hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.gen-state { text-align: center; padding: 40px; display: none; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to{transform:rotate(360deg)} }
.gen-txt { font-weight: 600; color: var(--text2); font-size: 14px; }

/* Review section */
.review-sec { display: none; }
.review-sec.active { display: block; }
.review-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--shadow);
  flex-wrap: wrap;
  gap: 12px;
}
.review-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-publish {
  background: var(--coral);
  color: #fff;
  border: 3px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  transition: all .1s;
}
.btn-publish:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.btn-pdf-exp {
  background: var(--surface);
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-back {
  background: var(--surface);
  color: var(--text2);
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
}

/* Question cards */
.q-card { background: var(--surface); border: 3px solid var(--shadow); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-md); }
.q-card-hd {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  background: var(--gray-light);
  border-bottom: 2px solid var(--shadow);
  cursor: pointer;
  user-select: none;
}
.q-num { width: 24px; height: 24px; border-radius: 50%; background: var(--shadow); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.tp { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 3px 8px; border-radius: 99px; border: 1.5px solid var(--shadow); }
.tp-s { background: var(--ocean-light); color: var(--ocean-dark); }
.tp-m { background: #F5EEF8; color: #7D3C98; }
.tp-p { background: var(--coral-light); color: var(--coral-dark); }
.tp-w { background: var(--ygreen-light); color: var(--ygreen-dark); }
.q-prev { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.qha { display: flex; gap: 5px; }
.ib { width: 28px; height: 28px; border: none; background: none; border-radius: 7px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background .1s; }
.ib:hover { background: var(--border); }
.ib.del:hover { background: var(--danger-light); }
.carr { color: var(--text3); font-size: 12px; transition: transform .2s; }
.q-card.collapsed .carr { transform: rotate(-90deg); }
.q-card-bd { padding: 16px; }
.q-card.collapsed .q-card-bd { display: none; }
.ef-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text2); margin-bottom: 5px; display: block; }
.ef-ta {
  width: 100%;
  border: 2px solid var(--shadow);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color .15s;
  background: var(--surface);
  min-height: 44px;
}
.ef-ta:focus { border-color: var(--coral); background: var(--coral-light); }
.ef-ta.expl { background: #FFFDE0; border-color: #e0c800; font-size: 13px; }
.ef-mr { display: flex; gap: 8px; margin-bottom: 12px; }
.ef-f { margin-bottom: 12px; }
.cl-list { display: flex; flex-direction: column; gap: 7px; }
.cl-row { display: flex; align-items: center; gap: 7px; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--surface); }
.cl-row.iscorr { border-color: var(--ygreen); background: var(--ygreen-light); }
.ct { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.cl-row.iscorr .ct { border-color: var(--ygreen); background: var(--ygreen); color: #fff; }
.ci-inp { flex: 1; border: none; background: transparent; font-family: var(--font-body); font-size: 14px; color: var(--text); outline: none; }
.btn-add-r { margin-top: 7px; background: none; border: 2px dashed var(--shadow); border-radius: var(--radius-sm); padding: 7px 14px; font-family: var(--font-body); font-size: 13px; color: var(--text2); cursor: pointer; width: 100%; }
.btn-add-r:hover { border-color: var(--coral); color: var(--coral); background: var(--coral-light); }
.pl-list { display: flex; flex-direction: column; gap: 7px; }
.pl-row { display: flex; align-items: center; gap: 7px; }
.pl-arr { color: var(--text3); font-size: 14px; }
.ww { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.wchip { display: flex; align-items: center; gap: 4px; background: var(--ygreen-light); border: 2px solid var(--ygreen-dark); border-radius: 8px; padding: 4px 9px; font-size: 13px; font-weight: 700; }
.wchip.extra { background: var(--danger-light); border-color: var(--danger); }
.wchip input { border: none; background: transparent; font-family: var(--font-body); font-size: 13px; font-weight: 700; width: 70px; outline: none; color: var(--text); }
.cdel { cursor: pointer; opacity: .5; font-size: 13px; }
.cdel:hover { opacity: 1; }
.btn-aw { background: none; border: 2px dashed var(--shadow); border-radius: 8px; padding: 4px 11px; font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--text2); cursor: pointer; }
.btn-aw:hover { border-color: var(--ygreen); color: var(--ygreen-dark); background: var(--ygreen-light); }
.btn-aw.extra:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.add-q-bar { border: 2px dashed var(--shadow); border-radius: var(--radius); padding: 16px; text-align: center; margin-top: 8px; }
.add-q-bar p { font-size: 13px; color: var(--text2); margin-bottom: 10px; }
.type-btns { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.bat { font-family: var(--font-body); font-weight: 700; font-size: 12px; padding: 6px 13px; border-radius: 7px; cursor: pointer; border: 2px solid var(--shadow); transition: all .12s; }
.bat-s { background: var(--ocean-light); color: var(--ocean-dark); }
.bat-m { background: #F5EEF8; color: #7D3C98; }
.bat-p { background: var(--coral-light); color: var(--coral-dark); }
.bat-w { background: var(--ygreen-light); color: var(--ygreen-dark); }
.bat:hover { transform: translate(-1px,-1px); box-shadow: 2px 2px 0 var(--shadow); }
.drag-handle { cursor: grab; color: var(--text3); font-size: 14px; }
.q-card.drag-over { border-color: var(--coral); border-style: dashed; }

/* ── PANEL HEADER ────────────────────────────────────────────── */
.panel-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-title { font-family: var(--font-display); font-size: 24px; color: var(--text); }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--shadow);
  color: #fff;
  padding: 10px 22px;
  border-radius: 99px;
  border: 2px solid var(--shadow);
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transition: all .3s;
  z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MOBILE ──────────────────────────────────────────────────── */
@media(max-width:600px) {
  .nav { padding: 0 16px; height: 56px; }
  .nav-logo { font-size: 19px; }
  .nav-tabs { gap: 1px; }
  .nav-tab { padding: 6px 11px; font-size: 13px; }
  .nav-right { gap: 10px; font-size: 13px; }
  .nav-badge { display: none; }
  .btn-out { padding: 5px 10px; font-size: 12px; }
  .landing { padding: 36px 16px; }
  .landing-logo { font-size: 42px; }
  .landing-tag { font-size: 15px; margin-bottom: 36px; }
  .entry-cards { flex-direction: column; align-items: center; gap: 14px; }
  .entry-card { width: 100%; max-width: 320px; padding: 28px 24px; }
  .entry-icon { font-size: 36px; margin-bottom: 12px; }
  .auth-card { padding: 28px 20px; }
  .auth-logo { font-size: 20px; }
  .journey-wrap { padding: 24px 16px 80px; }
  .journey-title { font-size: 22px; }
  .node.left { padding-right: 48%; }
  .node.right { padding-left: 48%; }
  .nname { font-size: 13px; }
  .nicon { width: 28px; height: 28px; font-size: 14px; }
  .quiz-hdr { padding: 12px 16px; }
  .quiz-body { padding: 24px 16px 100px; }
  .q-text { font-size: 19px; margin-bottom: 20px; }
  .choice-btn { padding: 12px 14px; font-size: 14px; }
  .c-letter { width: 26px; height: 26px; font-size: 12px; }
  .pairs-grid { grid-template-columns: 1fr; gap: 7px; }
  .fb-bar { padding: 14px 16px 20px; flex-wrap: wrap; }
  .btn-cont { width: 100%; text-align: center; }
  .result-pct { font-size: 52px; }
  .result-title { font-size: 26px; }
  .result-stats { flex-direction: column; gap: 10px; }
  .result-btns { flex-direction: column; width: 100%; max-width: 280px; }
  .btn-done, .btn-retry { width: 100%; text-align: center; }
  .admin-layout { padding: 24px 16px 80px; }
  .sec-title { font-size: 22px; }
  .review-hdr { flex-direction: column; align-items: flex-start; }
  .review-acts { width: 100%; justify-content: flex-start; }
  .ef-mr { flex-wrap: wrap; }
  .ef-sel { flex: 1 1 100%; }
  .admin-c-card { flex-wrap: wrap; gap: 10px; }
  .admin-c-acts { width: 100%; }
  .lb-wrap { padding: 24px 16px; }
}

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  .nav, .review-hdr, .qha, .drag-handle, .btn-add-r, .btn-aw, .cdel, .add-q-bar, .ef-mr { display: none !important; }
  .q-card { border: 2px solid var(--shadow); page-break-inside: avoid; box-shadow: none; }
  .q-card.collapsed .q-card-bd { display: block !important; }
  body { background: #fff; }
  .admin-layout { max-width: 100%; padding: 0; }
}
