:root {
  color-scheme: light;
  --red: #ef4444;
  --red-dark: #dc2626;
  --ink: #172033;
  --muted: #78839a;
  --line: #e9edf4;
  --paper: #fff;
  --wash: #f5f7fb;
  --green: #159466;
  font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--wash); padding-bottom: 94px; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100% - 1120px) / 2)); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 800 17px Manrope, sans-serif; letter-spacing: -.5px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--red); border-radius: 10px; color: #fff; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.live-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.live-status i { width: 7px; height: 7px; background: #20b981; border-radius: 50%; box-shadow: 0 0 0 4px #e6f8f1; }
.profile-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: linear-gradient(135deg, var(--red), #fb7185); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
main { max-width: 1000px; padding: 0 24px; margin: auto; }
.eyebrow { margin: 0 0 10px; color: var(--red); font-size: 10px; letter-spacing: 1.35px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 8px 0 19px; }
.section-heading h2 { font: 800 25px Manrope, sans-serif; letter-spacing: -.7px; margin: 0; }
.section-copy { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.quiet-button { border: 1px solid var(--line); background: #fff; border-radius: 9px; color: #59657b; padding: 9px 14px; cursor: pointer; font-size: 12px; font-weight: 700; }
.profile-card { display: flex; align-items: center; gap: 17px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(27,39,65,.04); }
.profile-avatar { width: 70px; height: 70px; flex: 0 0 70px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, #ef4444, #fb7185); color: #fff; font: 800 24px Manrope, sans-serif; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-identity { flex: 1; min-width: 0; }
.profile-identity h3 { margin: 0 0 4px; font: 800 18px Manrope, sans-serif; overflow-wrap: anywhere; }
.profile-identity p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.profile-identity .profile-id { margin-top: 6px; color: #9aa3b3; font-size: 11px; }
.copy-id-button { flex: 0 0 auto; }
.profile-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 15px 0 28px; }
.profile-stat { display: grid; gap: 8px; padding: 17px 19px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.profile-stat span { color: var(--muted); font-size: 11px; font-weight: 700; }
.profile-stat strong { color: var(--ink); font: 800 21px Manrope, sans-serif; }
.profile-section { margin: 0 0 23px; }
.profile-action, .profile-language { min-height: 67px; display: flex; align-items: center; gap: 13px; padding: 12px 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.profile-action + .profile-action { margin-top: 8px; }
.profile-action:hover { border-color: #f2b4b4; background: #fffafa; }
.action-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 10px; background: #fff0f0; color: var(--red-dark); font-size: 17px; }
.profile-action > span:nth-child(2), .profile-language > span { flex: 1; display: grid; gap: 3px; }
.profile-action strong, .profile-language strong { font-size: 13px; font-weight: 800; }
.profile-action small, .profile-language small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.profile-action b { color: #a3acbb; font-size: 16px; }
.profile-language select { max-width: 135px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; }
.profile-footer { padding: 6px 0 18px; }
.profile-auth-button { justify-content: center; }
.profile-auth-button[hidden] { display: none; }
.logout-button { width: 100%; padding: 12px; border: 1px solid #f1c2c2; border-radius: 10px; background: #fff; color: var(--red-dark); font-size: 13px; font-weight: 800; cursor: pointer; }
.logout-button:hover { background: #fff5f5; }
.view { display: none; animation: appear .24s ease; }
.view.active { display: block; }
.view[hidden] { display: none !important; }
@keyframes appear { from { opacity: .4; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.feed { display: flex; flex-direction: column; gap: 18px; }
.feed-card { width: 100%; max-width: 760px; margin: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 28px rgba(27,39,65,.045); scroll-snap-align: start; }
.feed-image { display: block; width: 100%; max-height: 410px; aspect-ratio: 16/8.4; object-fit: cover; background: #edf0f5; }
.feed-body { padding: 22px 24px 24px; }
.feed-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.feed-badge { border-radius: 20px; background: #fff0f0; color: var(--red-dark); padding: 4px 9px; font-size: 10px; font-weight: 800; letter-spacing: .3px; }
.feed-title { font: 800 20px/1.35 Manrope, sans-serif; letter-spacing: -.4px; margin: 0 0 9px; }
.feed-description { color: #58647a; line-height: 1.7; font-size: 14px; white-space: pre-line; margin: 0; }
.read-more { display: inline-flex; margin-top: 16px; color: var(--red-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.quiz-block { border-top: 1px solid var(--line); margin-top: 19px; padding-top: 17px; }
.quiz-prompt { font-size: 15px; font-weight: 800; line-height: 1.55; margin: 0 0 12px; white-space: pre-line; }
.options { display: grid; gap: 8px; }
.option-button { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #424e64; padding: 11px 13px; font-size: 13px; line-height: 1.45; cursor: pointer; }
.option-button:hover:not(:disabled) { border-color: #f4a1a1; background: #fffafa; }
.option-button:disabled { cursor: default; }
.option-button.correct { color: #08794f; border-color: #94dec1; background: #f0fbf6; }
.option-button.incorrect { color: #bd3232; border-color: #f2b1b1; background: #fff6f6; }
.answer-note { margin: 10px 0 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
.answer-note.correct { color: var(--green); font-weight: 700; }
.answer-note.incorrect { color: var(--red-dark); font-weight: 700; }
.state-card, .feed-end { max-width: 760px; margin: 8px auto; width: 100%; text-align: center; padding: 28px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; }
.feed-end { padding: 20px; background: transparent; border: 0; }
.institute-promo {
  position: fixed;
  z-index: 4;
  right: max(18px, calc((100vw - 1060px) / 2));
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: min(320px, calc(100vw - 36px));
  padding: 17px 18px 16px;
  border: 1px solid #f1dede;
  border-radius: 16px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 12px 36px rgba(27,39,65,.14);
}
.institute-promo[hidden] { display: none; }
.institute-promo-close {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #f5f7fb;
  color: #78839a;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.institute-promo-close:hover { background: #fff0f0; color: var(--red-dark); }
.institute-promo-label {
  margin: 0 28px 7px 0;
  color: var(--red-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.institute-promo-message {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}
.institute-promo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}
.institute-promo-link:hover { text-decoration: underline; }
.practice-setup { max-width: 560px; margin: 22px auto 0; }
.topic-panel, .question-area { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 8px 28px rgba(27,39,65,.04); }
.topic-panel { padding: 26px; }
.topic-panel label { display: block; margin: 0 0 7px; color: #59657b; font-size: 11px; font-weight: 800; }
.topic-panel select { width: 100%; padding: 11px 12px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; outline: none; font-size: 12px; }
.topic-panel select:focus { border-color: #f18e8e; }
.retry-topics { margin: -8px 0 14px; }
.quiz-page { max-width: 860px; margin: 0 auto; padding-bottom: 24px; }
.quiz-session-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 8px 0 22px; }
.quiz-session-heading h2 { margin: 0; font: 800 25px Manrope, sans-serif; letter-spacing: -.7px; }
.quiz-session-heading .section-copy { margin: 7px 0 0; }
.change-topic-button { flex: 0 0 auto; }
.quiz-page .question-area { min-height: 420px; padding: clamp(22px, 4vw, 38px); }
.practice-question { max-width: 700px; margin: 0 auto; }
.quiz-page .practice-options .option-button { padding: 15px 16px; font-size: 14px; }
.optional { color: #a4adbb; font-weight: 500; }
.primary-button, .next-button { width: 100%; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 10px; background: var(--red); color: #fff; cursor: pointer; font-size: 13px; font-weight: 800; }
.primary-button:hover:not(:disabled), .next-button:hover { background: var(--red-dark); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.topic-note { color: #9aa3b3; font-size: 11px; line-height: 1.5; margin: 12px 0 0; }
.question-area { min-height: 380px; }
.empty-question { min-height: 340px; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--red); background: #fff0f0; border-radius: 15px; font-size: 24px; margin-bottom: 14px; }
.empty-question h3 { color: var(--ink); font: 800 18px Manrope, sans-serif; margin: 0 0 8px; }
.empty-question p { max-width: 280px; margin: 0; font-size: 12px; line-height: 1.6; }
.question-progress { color: var(--red); font-size: 10px; letter-spacing: 1px; font-weight: 800; margin: 0 0 11px; text-transform: uppercase; }
.question-text { font: 700 18px/1.55 Manrope, sans-serif; white-space: pre-line; margin: 0 0 17px; }
.practice-options { display: grid; gap: 9px; }
.practice-options .option-button { padding: 13px 14px; font-size: 13px; }
.practice-explanation { margin-top: 14px; padding: 12px 13px; background: #f6f8fb; border-radius: 10px; color: #657187; font-size: 12px; line-height: 1.6; white-space: pre-line; }
.practice-explanation strong { color: var(--ink); display: block; margin-bottom: 3px; }
.next-button { margin-top: 16px; }
.next-button[hidden] { display: none; }
.toast { position: fixed; z-index: 8; left: 50%; bottom: 90px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 10px; background: #20283a; color: #fff; font-size: 12px; box-shadow: 0 8px 25px #10172a33; transition: .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.bottom-nav { position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; min-height: 70px; padding: 7px max(16px, calc((100% - 620px) / 2)) max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }
.nav-item { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 50px; border: 0; background: transparent; text-decoration: none; color: #929bad; cursor: pointer; font-size: 10px; font-weight: 700; }
.nav-item.active { color: var(--red); }
.nav-icon { height: 22px; font-size: 20px; line-height: 22px; font-weight: 500; }
@media (max-width: 680px) {
  body { padding-bottom: 84px; }
  .topbar { height: 58px; padding: 0 17px; }
  .live-status { display: none; }
  main { padding: 0 16px; }
  .section-heading h2 { font-size: 22px; }
  .profile-card { align-items: flex-start; flex-wrap: wrap; padding: 17px; }
  .profile-avatar { width: 58px; height: 58px; flex-basis: 58px; font-size: 20px; }
  .profile-identity { padding-top: 3px; }
  .profile-identity h3 { font-size: 15px; }
  .copy-id-button { margin-left: 75px; }
  .profile-stats { gap: 9px; }
  .profile-stat { padding: 14px; }
  .profile-stat strong { font-size: 18px; }
  .feed { gap: 13px; }
  .feed-card { border-radius: 14px; }
  .feed-image { aspect-ratio: 16/10; }
  .feed-body { padding: 17px; }
  .feed-title { font-size: 18px; }
  .practice-setup { margin-top: 16px; }
  .topic-panel { padding: 20px; }
  .quiz-session-heading { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .quiz-session-heading h2 { font-size: 22px; }
  .quiz-page .question-area { min-height: 310px; padding: 17px; }
  .quiz-page .practice-options .option-button { padding: 13px 14px; font-size: 13px; }
  .question-area { min-height: 310px; padding: 17px; }
  .empty-question { min-height: 250px; }
  .bottom-nav { min-height: 64px; }
  .institute-promo {
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: min(300px, calc(100vw - 24px));
    padding: 14px 15px 13px;
  }
}
@media (max-width: 420px) {
  .profile-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
  }
  .copy-id-button {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
