/* ==========================================================================
   MULTILEV — Design System
   Signature: "Daraja narvoni" (Level Staircase) — A1'dan C2'gacha yuksalish
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* --- Ranglar (palette) — yorqin, zamonaviy --- */
  --bg: #F7F7FC;               /* deyarli oq, biroz binafsha ottenkali */
  --surface: #FFFFFF;
  --surface-2: #EFEFFB;
  --ink: #17172B;              /* chuqur to'q ko'k-qora */
  --ink-soft: #5A5B77;
  --border: #E6E6F4;

  --brand: #5B4FE9;            /* jonli indigo/binafsha — energiya, zamonaviylik */
  --brand-dark: #4338CA;
  --brand-light: #EEECFE;

  --gold: #FFB238;             /* issiq amber — yutuq, C1 belgisi */
  --gold-bg: #FFF3E0;

  --skill-listening: #2F80ED;
  --skill-listening-bg: #E8F1FE;
  --skill-reading: #12B76A;
  --skill-reading-bg: #E7FAF1;
  --skill-writing: #FF6B57;
  --skill-writing-bg: #FFEEEA;
  --skill-speaking: #D6409F;
  --skill-speaking-bg: #FDEAF5;

  --success: #12B76A;
  --error: #E5484D;
  --error-bg: #FDECEC;

  /* --- Tipografika --- */
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* --- Radius / soya --- */
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23,23,43,0.05), 0 8px 24px rgba(91,79,233,0.08);
  --shadow-lift: 0 6px 12px rgba(23,23,43,0.06), 0 20px 44px rgba(91,79,233,0.16);
}

html, body { overflow-x: hidden; max-width: 100%; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; font-weight: 700; }

.gradient-text {
  background: linear-gradient(100deg, var(--brand), var(--skill-speaking) 70%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p { margin: 0 0 1em 0; color: var(--ink-soft); }

a { color: var(--brand); text-decoration: none; }

.mono { font-family: var(--font-mono); }

/* --- Layout --- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-body {
  padding: 40px 0 80px 0;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 247, 245, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo .dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--skill-speaking));
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 0.9rem;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-links a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.94rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links a.active { background: var(--brand); color: white; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle svg { width: 24px; height: 24px; stroke: var(--ink); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.96rem;
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #7B6EF6);
  color: white;
  box-shadow: 0 6px 16px rgba(91,79,233,0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); box-shadow: 0 8px 20px rgba(91,79,233,0.45); }

.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

.btn-ghost { background: transparent; color: var(--ink-soft); padding: 10px 16px; }
.btn-ghost:hover { color: var(--ink); }

.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.skill-card {
  border-radius: var(--radius);
  padding: 26px;
  border: 1.5px solid var(--border);
  border-top: 4px solid var(--border);
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.skill-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); }

.skill-icon {
  width: 52px; height: 52px;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
}
.skill-icon svg { width: 26px; height: 26px; }

.skill-card.listening { border-top-color: var(--skill-listening); }
.skill-card.listening .skill-icon { background: var(--skill-listening); color: white; box-shadow: 0 6px 14px rgba(47,128,237,0.3); }
.skill-card.reading { border-top-color: var(--skill-reading); }
.skill-card.reading .skill-icon { background: var(--skill-reading); color: white; box-shadow: 0 6px 14px rgba(18,183,106,0.3); }
.skill-card.writing { border-top-color: var(--skill-writing); }
.skill-card.writing .skill-icon { background: var(--skill-writing); color: white; box-shadow: 0 6px 14px rgba(255,107,87,0.3); }
.skill-card.speaking { border-top-color: var(--skill-speaking); }
.skill-card.speaking .skill-icon { background: var(--skill-speaking); color: white; box-shadow: 0 6px 14px rgba(214,64,159,0.3); }

.tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* --- Level ladder (signature element) --- */
.ladder-wrap {
  width: 100%;
  overflow-x: auto;
}
.ladder-svg { width: 100%; height: auto; min-width: 480px; }
.ladder-step-label {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
}

/* --- Progress bar --- */
.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--gold));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* --- Exam UI --- */
.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.timer {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  background: var(--surface-2);
  padding: 8px 16px;
  border-radius: 999px;
}
.timer.warning { background: var(--error-bg); color: var(--error); }

.question-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}

.question-block .qnum {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand);
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: block;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.option:hover { border-color: var(--brand); }
.option.selected { border-color: var(--brand); background: var(--brand-light); }
.option.correct { border-color: var(--success); background: #E6F2EB; }
.option.incorrect { border-color: var(--error); background: var(--error-bg); }
.option input { accent-color: var(--brand); width: 18px; height: 18px; }

textarea, input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
}
textarea:focus, input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.word-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: right;
  margin-top: 6px;
}
.word-count.ok { color: var(--success); }

/* --- Feedback / AI result --- */
.feedback-box {
  border-left: 4px solid var(--brand);
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 20px;
}
.feedback-box h4 { margin-bottom: 10px; font-family: var(--font-body); font-weight: 800; }

.score-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--ink);
  color: white;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 1.1rem;
}
.score-pill small { font-size: 0.7rem; opacity: 0.7; font-weight: 500; }

/* --- Loading spinner --- */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(22,33,28,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lift);
}

/* --- Hero decoration (yorqin fon effektlari) --- */
.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
}
header.page-body { position: relative; overflow: hidden; }
.tag {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 800;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* --- Mobile nav --- */
@media (max-width: 820px) {
  .nav-links {
    position: fixed;
    top: 68px; left: 0; right: 0;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-150%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; }
  .nav-links a { text-align: center; padding: 12px; }
  .nav-toggle { display: block; }
}
