:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #4361ee;
  --brand-dark: #3b4fd8;
  --brand-soft: #eef1ff;
  --green: #12b76a;
  --green-soft: #e7f8f0;
  --red: #f04438;
  --red-soft: #feeceb;
  --amber: #f79009;
  --amber-soft: #fff4e5;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

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

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:disabled { background: #b9c3ea; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn-round {
  width: 40px; height: 40px; padding: 0; font-size: 18px; border-radius: 50%;
  background: var(--bg); border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.btn-round:hover { background: var(--brand-soft); transform: scale(1.05); }
.btn-round.muted { opacity: .45; filter: grayscale(1); }

.answer-fx {
  animation: pop .28s ease;
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.fx-correct { animation: fadeGreen .6s ease; }
.fx-wrong { animation: shake .4s ease; }
@keyframes fadeGreen {
  0% { background-color: rgba(18,183,106,.25); }
  100% { background-color: transparent; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===== NAMTEACHER CHAT ===== */
.nav-teacher { background: var(--brand-soft); color: var(--brand); border-radius: 100px; padding: 7px 14px; }
.nav-teacher:hover { background: var(--brand); color: #fff; }
.teacher-screen { min-height: 100vh; display: flex; flex-direction: column; }
.teacher-main { max-width: 780px; margin: 0 auto; padding: 20px 24px 30px; width: 100%; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.teacher-chat { flex: 1; max-height: 54vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg { max-width: 85%; padding: 12px 15px; border-radius: 16px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.ai .msg-name { font-weight: 800; font-size: 12px; color: var(--brand); display: block; margin-bottom: 4px; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-top-right-radius: 4px; }
.msg .m-example { background: var(--brand-soft); border-left: 3px solid var(--brand); padding: 8px 10px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.msg .m-tip { background: var(--amber-soft); border-left: 3px solid var(--amber); padding: 8px 10px; border-radius: 8px; margin: 8px 0; font-size: 14px; color: #7a4a00; }
.msg .m-topic { font-size: 14px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 2px; }
.msg .m-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; display: block; }
.msg ul { margin: 6px 0 0 18px; }
.teacher-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: inherit; font-size: 13px; font-weight: 600; background: var(--brand-soft); color: var(--brand); border: none; border-radius: 100px; padding: 7px 13px; cursor: pointer; transition: all .14s ease; }
.chip:hover { background: var(--brand); color: #fff; }
.teacher-inputbar { display: flex; gap: 10px; }
.teacher-inputbar input { flex: 1; font-family: inherit; font-size: 15px; padding: 12px 15px; border: 2px solid var(--line); border-radius: 12px; outline: none; }
.teacher-inputbar input:focus { border-color: var(--brand); }
.teacher-inputbar .btn { border-radius: 12px; padding: 0 20px; font-size: 18px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .4; animation: blink 1s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
@media (max-width: 700px) { .nav-teacher { display: none; } }

.s-progress {
  display: inline-block; font-size: 12px; font-weight: 700; margin-top: 8px;
  padding: 3px 9px; border-radius: 100px; color: #fff;
}
.s-progress.prog-100 { background: #12b76a; }
.s-progress.prog-high { background: #4361ee; }
.s-progress.prog-mid { background: #f79009; }
.s-progress.prog-low { background: #98a2b3; }

.tops-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.top-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: all .15s ease;
}
.top-chip:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.top-chip .s-emoji { font-size: 22px; }
.top-chip .c-meta { flex: 1; }
.top-chip .c-name { font-weight: 700; font-size: 14px; }
.top-chip .c-pct { font-size: 12px; color: var(--muted); }
.top-chip .c-num { font-size: 16px; font-weight: 900; color: var(--brand); }
@media (max-width: 760px) { .tops-list { grid-template-columns: 1fr; } }
.btn-back { font-size: 14px; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #4361ee 0%, #6a4ff0 45%, #8e54d9 100%);
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 24px;
  padding: 36px 34px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-avatar {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(67, 97, 238, .4); border: 3px solid #fff;
}
.login-brand { font-size: 15px; font-weight: 800; color: var(--brand); letter-spacing: .02em; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #4361ee, #8e54d9);
  color: #fff; font-weight: 800; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark.small { width: 34px; height: 34px; font-size: 18px; border-radius: 9px; }
.login-title { font-size: 22px; font-weight: 800; }
.login-title span { background: linear-gradient(135deg,#4361ee,#8e54d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { color: var(--muted); font-size: 14px; margin: 14px 0 20px; }
.login-questions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.login-q {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 12px; padding: 12px 14px;
}
.login-q-label { font-weight: 600; font-size: 16px; width: 150px; }
.login-q input {
  flex: 1; font-family: inherit; font-size: 16px; padding: 8px 10px;
  border: 2px solid var(--line); border-radius: 10px; outline: none;
}
.login-q input:focus { border-color: var(--brand); }
.login-q .q-mark { font-size: 18px; font-weight: 700; color: var(--brand); }
.login-error {
  background: var(--red-soft); color: var(--red); padding: 10px 14px;
  border-radius: 10px; font-size: 14px; font-weight: 600; margin-top: 12px;
}

/* ===== HEADER / MAIN ===== */
.main-screen { min-height: 100vh; }
.app-header {
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(67, 97, 238, .35); border: 2px solid #fff;
}
.brand-text-col { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text { font-size: 18px; font-weight: 800; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.header-avatar { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.avatar-img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 2px 8px rgba(67, 97, 238, .35);
  border: 2px solid #fff; flex-shrink: 0;
}
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #4361ee, #8e54d9);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(67, 97, 238, .35);
  border: 2px solid #fff; flex-shrink: 0;
}
.avatar-name { font-size: 14px; font-weight: 700; color: var(--ink); }
@media (max-width: 640px) { .avatar-name { display: none; } }
.header-nav { display: flex; gap: 8px; }
.nav-link { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.nav-link:hover { background: var(--brand-soft); color: var(--brand); }

.container { max-width: 1180px; margin: 0 auto; padding: 30px 24px 80px; }

/* ===== HERO ===== */
.hero {
  display: grid; grid-template-columns: 1fr 320px; gap: 40px;
  align-items: center; padding: 34px 0 10px;
}
.hero-badge {
  display: inline-block; background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 100px;
  margin-bottom: 18px;
}
.hero-title { font-size: 44px; line-height: 1.15; font-weight: 900; letter-spacing: -.02em; }
.hero-title span { background: linear-gradient(135deg,#4361ee,#8e54d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-text { color: var(--muted); font-size: 17px; margin-top: 14px; max-width: 480px; }
.hero-card {
  background: linear-gradient(140deg,#4361ee,#8e54d9); color: #fff;
  border-radius: var(--radius); padding: 28px; text-align: center;
  box-shadow: var(--shadow);
}
.big-num { font-size: 52px; font-weight: 900; line-height: 1; }
.hero-card p { font-size: 14px; opacity: .9; margin: 6px 0 16px; }
.hero-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tag { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); padding: 5px 12px; border-radius: 100px; font-size: 13px; font-weight: 600; }

/* ===== SECTIONS ===== */
.exam-section, .grade-section { margin-top: 44px; }
.section-head { margin-bottom: 20px; }
.section-title { font-size: 26px; font-weight: 800; }
.section-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ===== EXAM CARDS ===== */
.exam-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.exam-card {
  position: relative; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: all .18s ease; color: var(--ink);
}
.exam-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); }
.exam-badge {
  position: absolute; top: 18px; right: 18px;
  width: 44px; height: 44px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff;
}
.exam-card.vpr .exam-badge { background: #12b76a; }
.exam-card.oge .exam-badge { background: #f79009; }
.exam-card.ege .exam-badge { background: #f04438; }
.exam-card h3 { font-size: 24px; font-weight: 800; margin-top: 20px; }
.exam-card p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.exam-arrow {
  display: inline-block; margin-top: 16px; color: var(--brand); font-weight: 700;
  transition: transform .15s ease;
}
.exam-card:hover .exam-arrow { transform: translateX(6px); }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .exam-grid { grid-template-columns: 1fr; }
}

/* ===== GRADE GRID ===== */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.grade-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 12px; text-align: center; cursor: pointer;
  transition: all .16s ease;
}
.grade-card:hover { transform: translateY(-4px); border-color: var(--brand); box-shadow: var(--shadow); }
.grade-card .g-num { font-size: 30px; font-weight: 900; color: var(--brand); }
.grade-card .g-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }

/* ===== SUBJECT SCREENS ===== */
.sub-header {
  background: #fff; border-bottom: 1px solid var(--line); padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 40;
}
.sub-header > *:nth-child(2) { flex: 1; text-align: center; }
.sub-title { font-size: 22px; font-weight: 800; }
.sub-sub { font-size: 13px; color: var(--muted); }
.sub-spacer { width: 90px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 26px; }
.subject-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; cursor: pointer; transition: all .16s ease; position: relative; overflow: hidden;
}
.subject-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--sc, var(--brand));
}
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--sc, var(--brand)); }
.subject-card .s-emoji { font-size: 30px; }
.subject-card h3 { font-size: 18px; font-weight: 700; margin-top: 10px; }
.subject-card p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.subject-card .s-quest { font-size: 12px; font-weight: 700; color: var(--sc, var(--brand)); margin-top: 12px; display: inline-block; }

/* ===== QUIZ ===== */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 26px; }
.topic-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: all .16s ease; text-align: left;
  display: flex; flex-direction: column; gap: 6px;
}
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--sc, var(--brand)); }
.topic-card .t-icon { font-size: 26px; }
.topic-card h3 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.topic-card .t-grades { font-size: 12px; color: var(--muted); font-weight: 700; }
.topic-card .t-arrow { color: var(--sc, var(--brand)); font-weight: 700; margin-top: 4px; }

.rule-view { display: flex; justify-content: center; padding-top: 40px; }
.rule-card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--line); max-width: 760px; width: 100%; overflow: hidden;
}
.rule-head { padding: 26px 30px; color: #fff; }
.rule-head h3 { font-size: 24px; font-weight: 800; }
.rule-head .r-grade { font-size: 13px; opacity: .9; }
.rule-body { padding: 26px 30px; }
.rule-body p { font-size: 16px; line-height: 1.65; color: var(--ink); }
.rule-body .r-rule { margin-bottom: 14px; }
.rule-body .r-example {
  background: var(--brand-soft); border-left: 4px solid var(--brand);
  padding: 12px 16px; border-radius: 10px; margin: 14px 0; font-size: 15px;
}
.rule-body .r-tip {
  background: var(--amber-soft); border-left: 4px solid var(--amber);
  padding: 12px 16px; border-radius: 10px; font-size: 14px; color: #7a4a00;
}
.rule-body .r-hint { font-size: 13px; color: var(--muted); }
.rule-actions { padding: 0 30px 30px; }
.quiz-screen { min-height: 100vh; display: flex; flex-direction: column; }
.quiz-header {
  background: #fff; border-bottom: 1px solid var(--line); padding: 16px 24px;
  position: sticky; top: 0; z-index: 40;
}
.quiz-top { max-width: 820px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.quiz-top-info h3 { font-size: 18px; font-weight: 800; }
.quiz-top-info p { font-size: 13px; color: var(--muted); }
.quiz-score {
  font-size: 15px; font-weight: 800; color: var(--brand);
  background: var(--brand-soft); padding: 8px 14px; border-radius: 10px;
}
.progress-track { max-width: 820px; margin: 12px auto 0; height: 8px; background: var(--line); border-radius: 100px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg,#4361ee,#8e54d9); border-radius: 100px; transition: width .3s ease; }

.quiz-main { max-width: 820px; margin: 0 auto; padding: 34px 24px; width: 100%; flex: 1; }
.quiz-question { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.quiz-answers { display: flex; flex-direction: column; gap: 12px; }
.answer-opt {
  font-family: inherit; text-align: left; font-size: 17px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 18px; cursor: pointer; transition: all .13s ease; color: var(--ink);
}
.answer-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.answer-opt:disabled { cursor: default; }
.answer-opt.correct { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.answer-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.answer-opt.locked { opacity: .55; }
.quiz-input-row { display: flex; gap: 12px; }
.quiz-input {
  flex: 1; font-family: inherit; font-size: 18px; padding: 13px 16px;
  border: 2px solid var(--line); border-radius: 12px; outline: none;
}
.quiz-input:focus { border-color: var(--brand); }
.quiz-controls { display: flex; gap: 12px; margin-top: 26px; }

/* ===== RESULT ===== */
.result-main { display: flex; justify-content: center; padding-top: 60px; }
.result-card {
  background: var(--card); border-radius: 20px; padding: 40px;
  text-align: center; max-width: 460px; width: 100%; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.result-emblem {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.result-emblem .res-big { font-weight: 900; font-size: 34px; color: #fff; }
.result-card h3 { font-size: 24px; font-weight: 800; }
.result-card p { color: var(--muted); margin: 10px 0 24px; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd3e1; border-radius: 100px; }
::-webkit-scrollbar-track { background: transparent; }