:root {
  --ink: #14272f;
  --muted: #667780;
  --paper: #f4f7f8;
  --card: #ffffff;
  --line: #dce5e8;
  --navy: #0c2834;
  --navy-2: #153e4c;
  --teal: #19a7a0;
  --teal-dark: #087a77;
  --amber: #f0a33a;
  --red: #c64256;
  --green: #2f8651;
  --shadow: 0 14px 38px rgba(12, 40, 52, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(25, 167, 160, .32);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 26px 18px; color: #fff;
  background:
    radial-gradient(circle at 15% 5%, rgba(25,167,160,.28), transparent 28%),
    linear-gradient(165deg, var(--navy-2), var(--navy) 62%);
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 30px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px;
  color: var(--navy); background: #7de1d9; font-weight: 900; letter-spacing: -.04em;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1.06rem; letter-spacing: .01em; }
.brand span { color: #a9c4cb; font-size: .78rem; }
.nav-label { margin: 22px 12px 8px; color: #86a6ae; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.nav-link {
  width: 100%; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 11px;
  padding: 11px 12px; margin: 3px 0; color: #c9d8dc; background: transparent; text-align: left;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: rgba(125,225,217,.15); box-shadow: inset 3px 0 #7de1d9; }
.nav-icon { width: 25px; text-align: center; font-size: 1.05rem; }
.course-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--dot); }
.nav-link small { margin-left: auto; color: #86a6ae; font-size: .72rem; }
.sidebar-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 26px; padding: 14px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.05);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #71df9a; margin-top: 7px; box-shadow: 0 0 0 4px rgba(113,223,154,.12); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: .82rem; }
.sidebar-note small { color: #96b3ba; font-size: .72rem; margin-top: 2px; }

.workspace { min-width: 0; }
.topbar {
  height: 76px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line);
  background: rgba(244,247,248,.92); backdrop-filter: blur(14px);
}
.search-wrap {
  position: relative; width: min(520px, 55vw); display: flex; align-items: center; gap: 9px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.search-wrap input { width: 100%; height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #f8fafb; font-size: .7rem; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.streak-chip { padding: 7px 11px; border: 1px solid #f2d5a9; border-radius: 999px; color: #7b4b0d; background: #fff5e7; font-size: .78rem; font-weight: 750; }
.avatar-button, .icon-button {
  width: 40px; height: 40px; border: 0; border-radius: 11px; color: #fff; background: var(--navy); font-weight: 800;
}
.mobile-only { display: none; }

#app { max-width: 1440px; margin: 0 auto; padding: 34px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.eyebrow { margin: 0 0 7px; color: var(--teal-dark); font-size: .74rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.03; letter-spacing: -.045em; }
h2 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: 1.02rem; }
.page-head h1 {
  color: transparent;
  background: linear-gradient(100deg, var(--navy), #167c82 72%);
  background-clip: text;
  -webkit-background-clip: text;
}
.lede { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 1.02rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 17px; border: 1px solid transparent; border-radius: 11px; font-weight: 800;
}
.btn-primary { color: #fff; background: var(--navy); }
.btn-primary:hover { background: #174555; }
.btn-teal { color: #fff; background: var(--teal-dark); }
.btn-secondary { color: var(--ink); border-color: var(--line); background: #fff; }
.btn-danger { color: #9d2337; border-color: #efc4ca; background: #fff6f7; }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.text-button { border: 0; padding: 0; color: var(--teal-dark); background: transparent; font-weight: 800; }

.hero-panel {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.35fr .65fr; gap: 30px;
  padding: 34px; margin-bottom: 24px; border-radius: 24px; color: #fff;
  background: linear-gradient(125deg, #0d3442, #125b65);
  box-shadow: var(--shadow);
}
.hero-panel::after {
  content: ""; position: absolute; width: 360px; height: 360px; right: -110px; top: -160px;
  border: 55px solid rgba(125,225,217,.12); border-radius: 50%;
}
.hero-panel h1 { max-width: 720px; }
.hero-panel .lede { color: #c4d9de; }
.hero-kicker { color: #7de1d9; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; }
.today-meter { align-self: center; position: relative; z-index: 1; padding: 23px; border: 1px solid rgba(255,255,255,.13); border-radius: 18px; background: rgba(255,255,255,.08); }
.today-meter strong { display: block; font-size: 2.5rem; line-height: 1; }
.today-meter span { color: #c5dadd; font-size: .83rem; }
.meter-track { height: 8px; margin-top: 16px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: #7de1d9; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 24px; }
.stat-card, .card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 5px 17px rgba(12,40,52,.04); }
.stat-card { padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: .77rem; font-weight: 750; }
.stat-value { display: block; margin-top: 4px; font-size: 1.85rem; font-weight: 900; letter-spacing: -.035em; }
.stat-foot { color: var(--muted); font-size: .75rem; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(290px, .7fr); gap: 20px; }
.card { padding: 23px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.card-head h2, .card-head p { margin-bottom: 0; }

.plan-list { display: grid; gap: 2px; }
.plan-item { display: grid; grid-template-columns: 54px 38px 1fr auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid #edf1f2; }
.plan-item:last-child { border: 0; }
.plan-time { color: var(--muted); font-size: .75rem; font-weight: 750; }
.plan-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--navy); background: #eaf5f4; }
.plan-item strong, .plan-item small { display: block; }
.plan-item small { color: var(--muted); font-size: .76rem; }
.course-progress-list { display: grid; gap: 16px; }
.course-progress-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.course-progress-row small { color: var(--muted); }
.mini-track { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: #edf1f2; overflow: hidden; }
.mini-fill { height: 100%; border-radius: inherit; background: var(--course, var(--teal)); }

.course-banner { padding: 27px; margin-bottom: 20px; border-left: 7px solid var(--course); }
.course-banner-top { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; }
.course-banner h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.course-banner h1 { color: var(--course); }
.meta-row { display: flex; flex-wrap: wrap; gap: 9px 18px; color: var(--muted); font-size: .82rem; }
.mcq-section-head { margin: 28px 0 17px; }
.mcq-section-head h2 { margin-bottom: 7px; font-size: clamp(1.4rem, 2.6vw, 2rem); }
.topic-mcq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.topic-mcq-card { position: relative; display: flex; flex-direction: column; gap: 15px; min-height: 310px; border-top: 5px solid var(--course); }
.topic-mcq-card.highlighted { box-shadow: 0 0 0 3px color-mix(in srgb, var(--course) 20%, transparent), var(--shadow); }
.topic-mcq-number { position: absolute; right: 18px; top: 13px; color: color-mix(in srgb, var(--course) 24%, white); font-size: 3.2rem; font-weight: 950; line-height: 1; }
.topic-mcq-card h3 { position: relative; max-width: 82%; margin-bottom: 9px; color: var(--course); font-size: 1.22rem; }
.topic-mcq-card p:not(.eyebrow) { color: var(--muted); }
.topic-mcq-progress { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; color: var(--muted); font-size: .76rem; font-weight: 750; }
.topic-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 20px; }
.topic-menu { align-self: start; position: sticky; top: 100px; padding: 12px; }
.topic-button { width: 100%; display: flex; gap: 10px; padding: 11px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
.topic-button:hover { background: #f2f7f7; }
.topic-button.active { color: #fff; background: var(--navy); }
.topic-number { font-weight: 900; opacity: .65; }
.topic-main-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 17px; }
.topic-main-head h2 { color: var(--course); font-size: clamp(1.45rem, 2.3vw, 2rem); }
.concept-list { display: grid; gap: 10px; }
.concept-card { border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.concept-card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; cursor: pointer; font-weight: 850; }
.concept-card summary span { color: var(--course); }
.concept-card summary::-webkit-details-marker { display: none; }
.concept-card summary::after { content: "+"; color: var(--teal-dark); font-size: 1.3rem; }
.concept-card[open] summary::after { content: "−"; }
.concept-body { padding: 0 17px 17px; color: var(--muted); }
.concept-body p { margin: 9px 0 0; }
.concept-body strong { color: var(--ink); }

.quiz-shell { max-width: 940px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 15px; }
.quiz-progress { flex: 1; }
.quiz-progress p { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.question-card { padding: clamp(20px, 4vw, 38px); }
.question-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 17px; }
.tag { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #36545c; background: #edf4f5; font-size: .72rem; font-weight: 800; }
.tag-kind { color: #70490e; background: #fff1dc; }
.question-card h2 { font-size: clamp(1.25rem, 2.3vw, 1.75rem); line-height: 1.42; }
.option-list { display: grid; gap: 11px; margin: 24px 0; }
.option {
  width: 100%; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 11px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; text-align: left;
}
.option:hover:not(:disabled) { border-color: #8bc8c5; background: #f5fbfb; }
.option-letter { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: #47636a; background: #eef3f4; font-weight: 900; }
.option:nth-child(1) .option-letter { color: #1e6570; background: #dff3f3; }
.option:nth-child(2) .option-letter { color: #66449a; background: #eee7f8; }
.option:nth-child(3) .option-letter { color: #945515; background: #fff0dc; }
.option:nth-child(4) .option-letter { color: #9a3550; background: #fae7ed; }
.option.selected { border-color: var(--navy); background: #eef6f7; }
.option.correct { border-color: #82c99b; background: #edf9f1; }
.option.incorrect { border-color: #e4a3ad; background: #fff2f4; }
.option.correct .option-letter { color: #fff; background: var(--green); }
.option.incorrect .option-letter { color: #fff; background: var(--red); }
.option.correct { color: #195a34; box-shadow: inset 4px 0 var(--green); }
.option.incorrect { color: #8f2436; box-shadow: inset 4px 0 var(--red); }
.explanation { margin-top: 20px; padding: 18px; border-left: 5px solid var(--green); border-radius: 10px; background: #f0faf3; }
.explanation.wrong { border-color: var(--red); background: #fff3f5; }
.explanation h3 { margin-bottom: 6px; }
.explanation p { margin-bottom: 0; color: #405c47; }
.answer-verdict { margin-bottom: 15px; padding-bottom: 13px; border-bottom: 1px solid rgba(34,91,57,.15); }
.answer-verdict span { color: var(--green); font-size: .74rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.explanation.wrong .answer-verdict span { color: var(--red); }
.answer-verdict h3 { margin: 3px 0 0; font-size: 1.18rem; }
.explanation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.explain-block { padding: 14px; border: 1px solid rgba(24,70,59,.1); border-radius: 10px; background: rgba(255,255,255,.72); }
.explain-block span { display: block; margin-bottom: 5px; font-size: .75rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.explain-block p { color: var(--ink); }
.explain-reason { border-top: 4px solid #2366c2; }
.explain-reason span { color: #2366c2; }
.explain-definition { border-top: 4px solid #6d4db2; }
.explain-definition span { color: #6d4db2; }
.explain-importance { border-top: 4px solid #b66b10; }
.explain-importance span { color: #8a5008; }
.explain-example { border-top: 4px solid #0f827e; }
.explain-example span { color: #0f706d; }
.question-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 21px; }
.star-button { border: 0; background: transparent; color: var(--muted); font-weight: 800; }
.star-button.active { color: #b56e00; }

.exam-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 17px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 800; }
.form-group select { width: 100%; height: 47px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.exam-rules { margin: 0; padding-left: 20px; color: var(--muted); }
.exam-rules li { margin: 8px 0; }
.exam-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 18px; }
.exam-nav { align-self: start; position: sticky; top: 96px; }
.exam-clock { padding: 13px; margin-bottom: 13px; border-radius: 11px; color: #fff; background: var(--navy); text-align: center; font-size: 1.45rem; font-weight: 900; letter-spacing: .04em; }
.question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.q-jump { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .75rem; font-weight: 800; }
.q-jump.answered { color: #fff; border-color: var(--teal-dark); background: var(--teal-dark); }
.q-jump.current { box-shadow: 0 0 0 3px rgba(25,167,160,.25); }
.exam-option-selected { border-color: var(--navy); background: #e8f3f5; }

.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.score-ring { width: 130px; height: 130px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) var(--score), #e7eef0 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #fff; }
.score-ring strong { position: relative; z-index: 1; font-size: 1.75rem; }
.result-list { display: grid; gap: 11px; margin-top: 20px; }
.result-item { padding: 16px; border: 1px solid var(--line); border-left: 5px solid var(--status); border-radius: 11px; background: #fff; }
.result-item p { margin-bottom: 8px; }
.result-item small { color: var(--muted); }
.exam-review-explanation { display: grid; gap: 6px; margin-top: 13px; padding: 13px; border-radius: 10px; background: #f5f8f9; }
.exam-review-explanation p { margin: 0; color: var(--muted); }
.exam-review-explanation strong { color: var(--ink); }

.flashcard-stage { max-width: 780px; margin: 20px auto; perspective: 1200px; }
.flashcard { min-height: 380px; position: relative; transition: transform .55s; transform-style: preserve-3d; cursor: pointer; }
.flashcard.flipped { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 45px; border: 1px solid var(--line); border-radius: 22px; background: #fff; backface-visibility: hidden; box-shadow: var(--shadow); text-align: center; }
.flash-back { transform: rotateY(180deg); background: #0f3b48; color: #fff; }
.flash-back p { color: #c8dde1; }
.flash-count { text-align: center; color: var(--muted); font-weight: 750; }

.review-grid { display: grid; gap: 12px; }
.review-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.review-row p { margin-bottom: 2px; font-weight: 800; }
.review-row small { color: var(--muted); }
.empty-state { padding: 50px 25px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 2.4rem; }

.search-panel { position: fixed; z-index: 60; top: 68px; left: 310px; width: min(650px, calc(100vw - 340px)); max-height: 70vh; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.search-result { width: 100%; display: block; padding: 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
.search-result:hover { background: #f1f7f7; }
.search-result strong, .search-result small { display: block; }
.search-result small { color: var(--muted); }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--navy); box-shadow: var(--shadow); }
.fine-print { color: var(--muted); font-size: .78rem; }

@media (max-width: 1060px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .hero-panel, .exam-setup { grid-template-columns: 1fr; }
  .today-meter { max-width: 360px; }
  .topic-mcq-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 80; width: 280px; transform: translateX(-105%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(5,25,33,.46); }
  .mobile-only { display: grid; place-items: center; }
  .topbar { padding: 0 17px; gap: 10px; }
  .search-wrap { width: auto; flex: 1; }
  .search-wrap kbd, .streak-chip { display: none; }
  #app { padding: 23px 17px; }
  .topic-layout, .exam-layout { grid-template-columns: 1fr; }
  .topic-menu, .exam-nav { position: static; }
  .topic-menu { display: flex; overflow-x: auto; padding: 8px; }
  .topic-button { min-width: 210px; }
  .search-panel { left: 17px; width: calc(100vw - 34px); }
}

@media (max-width: 560px) {
  h1 { font-size: 2rem; }
  .page-head, .course-banner-top, .topic-main-head, .quiz-top { align-items: stretch; flex-direction: column; }
  .hero-panel, .card, .course-banner, .question-card { padding: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.45rem; }
  .plan-item { grid-template-columns: 45px 34px 1fr; }
  .plan-item .text-button { grid-column: 3; justify-self: start; }
  .option { grid-template-columns: 34px 1fr; padding: 11px; }
  .option-list { gap: 9px; }
  .option span:last-child { overflow-wrap: anywhere; }
  .explanation-grid { grid-template-columns: 1fr; }
  .topic-mcq-card { min-height: 0; }
  .question-footer { align-items: stretch; flex-direction: column-reverse; }
  .question-footer .btn { width: 100%; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .flash-face { padding: 26px; }
}

@media print {
  .sidebar, .topbar, .button-row, .question-footer { display: none !important; }
  .app-shell { display: block; }
  #app { max-width: none; padding: 0; }
  .card { box-shadow: none; }
}
