/* ==========================================
   zhay.piupiu.kz — Design System
   ========================================== */

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

/* ── Variables ───────────────────────────────────────── */
:root {
  --bg:         #0a0b10;
  --surface:    rgba(17, 19, 24, 0.6);
  --surface2:   rgba(26, 29, 38, 0.8);
  --border:     rgba(255, 255, 255, 0.08);
  --accent:     #6c63ff;
  --accent2:    #a78bfa;
  --green:      #22c55e;
  --red:        #ef4444;
  --yellow:     #eab308;
  --text:       #f8fafc;
  --muted:      #94a3b8;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 4px 32px rgba(0,0,0,0.5);
  --glow:       0 0 40px rgba(108,99,255,0.15);
}

:root[data-theme="light"] {
  --bg:         #f8fafc;
  --surface:    rgba(255, 255, 255, 0.7);
  --surface2:   rgba(255, 255, 255, 0.9);
  --border:     rgba(0, 0, 0, 0.08);
  --text:       #0f172a;
  --muted:      #64748b;
  --glow:       0 0 20px rgba(108,99,255,0.15);
  --shadow:     0 4px 20px rgba(0,0,0,0.05);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(circle at top left, rgba(108, 99, 255, 0.08) 0%, transparent 40%),
                    radial-gradient(circle at bottom right, rgba(167, 139, 250, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--text); }
img { max-width: 100%; }

/* ── Layout ──────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container--sm { max-width: 560px; margin: 0 auto; padding: 0 20px; }

/* ── Nav ─────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s, border-color 0.3s;
}
.nav-logo {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-actions { display: flex; gap: 12px; align-items: center; }
.nav-user {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(108,99,255,0.35);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108,99,255,0.5);
  color: #fff;
}
.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--outline:hover { background: var(--surface2); color: var(--text); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid transparent; }
.btn--ghost:hover { color: var(--text); background: var(--surface2); border-color: var(--border); }
.btn--danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }
.btn--lg { padding: 16px 36px; font-size: 1.05rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover { 
  border-color: rgba(108,99,255,0.4); 
  box-shadow: var(--glow), var(--shadow); 
  transform: translateY(-4px);
}
.card--active { border-color: var(--accent); box-shadow: var(--glow); }

/* ── Hero ────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 80px 20px 60px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  color: var(--accent2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 36px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Section titles ──────────────────────────────────── */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

/* ── Form elements ───────────────────────────────────── */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.input--code {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
}

/* ── Quiz interface ──────────────────────────────────── */
.quiz-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.quiz-progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 0.4s ease;
}
.quiz-counter {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.quiz-timer {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.question-block {
  margin-bottom: 32px;
}
.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 24px;
}
.question-image {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.question-code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: pre;
}

/* ── Options ─────────────────────────────────────────── */
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  width: 100%;
}
.option:hover { border-color: rgba(108,99,255,0.4); background: rgba(108,99,255,0.08); }
.option.selected {
  border-color: var(--accent);
  background: rgba(108,99,255,0.15);
}
.option.correct { border-color: var(--green); background: rgba(34,197,94,0.1); }
.option.incorrect { border-color: var(--red); background: rgba(239,68,68,0.1); }
.option.correct-answer { border-color: var(--green); background: rgba(34,197,94,0.07); }
.option-letter {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.option.selected .option-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.option.correct .option-letter { background: var(--green); border-color: var(--green); color: #fff; }
.option.incorrect .option-letter { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Results ─────────────────────────────────────────── */
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--pct), var(--surface2) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto 24px;
}
.score-circle::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--bg);
}
.score-circle-num {
  position: relative;
  z-index: 1;
  font-size: 1.8rem;
  font-weight: 800;
}
.explanation-box {
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}
.explanation-box strong { color: var(--accent2); }

/* ── Tags / Badges ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge--free { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.badge--paid { background: rgba(108,99,255,0.15); color: var(--accent2); border: 1px solid rgba(108,99,255,0.3); }
.badge--locked { background: rgba(100,116,139,0.15); color: var(--muted); border: 1px solid var(--border); }
.badge--demo { background: rgba(234,179,8,0.15); color: var(--yellow); border: 1px solid rgba(234,179,8,0.3); }

/* ── Variant grid ────────────────────────────────────── */
.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.variant-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.variant-card:hover:not(.locked) {
  border-color: var(--accent);
  box-shadow: var(--glow), 0 12px 24px rgba(0,0,0,0.1);
  transform: translateY(-6px);
  color: var(--text);
}
.variant-card.locked { opacity: 0.5; cursor: not-allowed; }
.variant-num {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.variant-info { font-size: 0.8rem; color: var(--muted); }

/* ── Alert / Toast ───────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.alert--error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert--success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert--info { background: rgba(108,99,255,0.1); border: 1px solid rgba(108,99,255,0.3); color: var(--accent2); }

/* ── Nav dots ────────────────────────────────────────── */
.q-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.q-dot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
}
.q-dot.current { border-color: var(--accent); color: var(--accent2); }
.q-dot.answered { background: rgba(108,99,255,0.2); border-color: var(--accent); color: var(--text); }

/* ── Report button ───────────────────────────────────── */
.report-btn {
  font-size: 0.78rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-family: inherit;
}
.report-btn:hover { color: var(--yellow); }

/* ── Loading ─────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ──────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 80px;
}

/* ── Animations ──────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive helpers ────────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 { font-size: 2.2rem; }
  .auth-card { padding: 30px 20px; border-radius: 20px; }
  .result-card h1 { font-size: 3rem; }
  .compare-grid { grid-template-columns: 1fr; }
}

/* ── Auth Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-box {
  transform: translateY(0);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .nav { padding: 14px 16px; }
  .hero { padding: 48px 16px 40px; }
  .card { padding: 20px; }
  .variant-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
