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

:root {
  --bg:       #0a0a0f;
  --surface:  #111118;
  --surface2: #16161f;
  --border:   #1e1e2e;
  --border2:  #2a2a3e;
  --indigo:   #6366f1;
  --violet:   #a78bfa;
  --rose:     #fb7185;
  --amber:    #fbbf24;
  --text:     #f4f4f8;
  --text2:    #9898b0;
  --text3:    #4a4a65;
  --success:  #34d399;
  --error:    #f87171;
  --glow:     rgba(99,102,241,0.15);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Canvas ───────────────────────────────────────────────────────── */
#bg-canvas {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Splash ───────────────────────────────────────────────────────── */
#splash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  animation: fadeOut 0.7s ease 2.5s forwards;
}

.splash-inner {
  text-align: center;
  animation: splashIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes splashIn {
  from { opacity: 0; transform: scale(0.8) translateY(24px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.splash-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-radius: 20px;
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.3), 0 20px 60px rgba(99,102,241,0.3);
  animation: logoGlow 2s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(99,102,241,0.3), 0 20px 60px rgba(99,102,241,0.3); }
  50%       { box-shadow: 0 0 0 1px rgba(99,102,241,0.5), 0 20px 80px rgba(99,102,241,0.5); }
}

.splash-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.splash-sub {
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.splash-title {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes fadeOut { to { opacity: 0; pointer-events: none; } }

/* ── App ──────────────────────────────────────────────────────────── */
#app { max-width: 780px; margin: 0 auto; min-height: 100vh; position: relative; z-index: 1; }

.hidden { display: none !important; }

.screen {
  display: none; flex-direction: column; min-height: 100vh;
  animation: screenIn 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active { display: flex; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Nav ──────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--text), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: 100px;
}

/* ── Welcome main ─────────────────────────────────────────────────── */
.welcome-main {
  padding: 64px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 52px;
  flex: 1;
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { max-width: 580px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--violet);
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 52px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--indigo), var(--violet), var(--rose));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200%;
  animation: gradShift 4s ease infinite;
}

@keyframes gradShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

.hero-desc {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text2);
  font-weight: 400;
  max-width: 480px;
}

/* ── Input wrap ───────────────────────────────────────────────────── */
.input-wrap { display: flex; flex-direction: column; gap: 16px; }

.input-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input-box:focus-within {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
}

.input-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.toolbar-dots {
  display: flex; gap: 6px;
}

.toolbar-dots span {
  width: 10px; height: 10px; border-radius: 50%;
}

.toolbar-dots span:nth-child(1) { background: #f87171; }
.toolbar-dots span:nth-child(2) { background: #fbbf24; }
.toolbar-dots span:nth-child(3) { background: #34d399; }

.toolbar-hint {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 1px;
  font-weight: 500;
}

textarea {
  width: 100%;
  height: 200px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 20px 22px;
  resize: none;
  outline: none;
  line-height: 1.75;
}

textarea::placeholder { color: var(--text3); line-height: 1.75; }

/* ── CTA ──────────────────────────────────────────────────────────── */
.cta-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 16px 32px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 8px 32px rgba(99,102,241,0.35);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.cta-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.cta-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(99,102,241,0.45); }
.cta-btn:active { transform: translateY(0); }
.cta-btn svg { transition: transform 0.2s; }
.cta-btn:hover svg { transform: translateX(3px); }

.cta-status {
  font-size: 14px;
  color: var(--text2);
  min-height: 20px;
  padding-left: 4px;
}

/* ── OR row ───────────────────────────────────────────────────────── */
.or-row { display: flex; align-items: center; gap: 16px; }
.or-line { flex: 1; height: 1px; background: var(--border); }
.or-text { font-size: 12px; color: var(--text3); letter-spacing: 1px; font-weight: 500; }

/* ── Upload btn ───────────────────────────────────────────────────── */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-btn:hover {
  border-color: var(--indigo);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(99,102,241,0.12);
  transform: translateY(-1px);
}

/* ── Quiz topbar ──────────────────────────────────────────────────── */
.quiz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px 16px;
}

.q-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.q-score-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--violet);
}

.progress-track {
  height: 3px;
  background: var(--border);
  margin: 0 40px;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(99,102,241,0.5);
}

/* ── Quiz main ────────────────────────────────────────────────────── */
.quiz-main {
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.q-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 32px 36px;
  margin-bottom: 4px;
}

.q-card p {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  line-height: 1.6;
  color: var(--text);
  font-weight: 700;
}

/* ── Options ──────────────────────────────────────────────────────── */
#options-wrap { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 18px 22px;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.option-btn::before {
  content: attr(data-letter);
  min-width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}

.option-btn:hover:not(:disabled) {
  border-color: rgba(99,102,241,0.4);
  background: #13131e;
  transform: translateX(4px);
}

.option-btn:hover:not(:disabled)::before {
  background: rgba(99,102,241,0.15);
  border-color: var(--indigo);
  color: var(--violet);
}

.option-btn.correct {
  border-color: var(--success);
  background: rgba(52,211,153,0.06);
  color: #6ee7b7;
}

.option-btn.correct::before {
  background: rgba(52,211,153,0.15);
  border-color: var(--success);
  color: var(--success);
}

.option-btn.wrong {
  border-color: var(--error);
  background: rgba(248,113,113,0.06);
  color: #fca5a5;
}

.option-btn.wrong::before {
  background: rgba(248,113,113,0.15);
  border-color: var(--error);
  color: var(--error);
}

.option-btn:disabled { cursor: default; transform: none; }

@keyframes flashPulse {
  0%, 100% { background: var(--surface); }
  50% { background: #1a1a2e; border-color: var(--indigo); }
}

.option-btn.flash { animation: flashPulse 0.25s ease; }

/* ── Yes/No ───────────────────────────────────────────────────────── */
.yesno-btn {
  font-size: 17px;
  font-weight: 600;
  padding: 28px;
  text-align: center;
  justify-content: center;
  letter-spacing: 1px;
}

.yesno-btn::before { display: none; }

#options-wrap:has(.yesno-btn) { flex-direction: row; gap: 12px; }
#options-wrap:has(.yesno-btn) .yesno-btn { flex: 1; }

/* ── Quiz footer ──────────────────────────────────────────────────── */
.quiz-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.feedback {
  font-size: 15px;
  font-weight: 600;
  min-height: 22px;
  text-align: center;
}

.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text2);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 32px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.next-btn:hover {
  border-color: var(--indigo);
  color: var(--violet);
  box-shadow: 0 4px 20px rgba(99,102,241,0.15);
  transform: translateY(-2px);
}

.next-btn span { transition: transform 0.2s; }
.next-btn:hover span { transform: translateX(3px); }

/* ── Results ──────────────────────────────────────────────────────── */
.results-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 44px;
  flex: 1;
  padding: 60px 40px;
  text-align: center;
}

.results-top { display: flex; flex-direction: column; align-items: center; gap: 20px; }

.grade-label {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-style: italic;
  color: var(--text2);
}

.score-circle {
  position: relative;
  width: 180px; height: 180px;
}

.score-ring-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

#score-arc {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

#score-display {
  font-family: 'Playfair Display', serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.score-pct {
  font-size: 13px;
  color: var(--text3);
  font-weight: 500;
  margin-top: 4px;
}

.results-btns {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.credit {
  font-size: 13px;
  color: var(--text3);
  letter-spacing: 1px;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  text-align: right;
  padding: 16px 40px;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 2px;
  opacity: 0.5;
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav, .welcome-main, .quiz-main { padding-left: 20px; padding-right: 20px; }
  .quiz-topbar { padding: 20px 20px 12px; }
  .progress-track { margin: 0 20px; }
  .hero-title { font-size: 36px; }
  .cta-btn, .upload-btn { width: 100%; justify-content: center; }
}
