:root {
  color-scheme: light;
  font-family: "Poppins", sans-serif;
  color: #1c2640;
  background: #f5f7fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f5f7fc;
}

button {
  font: inherit;
}

dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  padding: 28px;
  border: 1px solid #e9ebf3;
  border-radius: 10px;
  color: #1c2640;
  background: #fff;
  box-shadow: 0 16px 48px rgb(35 46 82 / 16%);
}

dialog::backdrop { background: rgb(28 38 64 / 35%); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-header .eyebrow { margin: 0; }
.close-dialog { border: 0; background: #eeefff; color: #505bd0; border-radius: 50%; width: 36px; height: 36px; font-size: 24px; cursor: pointer; flex-shrink: 0; }
dialog h2 { font-size: 23px; letter-spacing: -0.4px; }
dialog p, dialog li { font-size: 13px; line-height: 1.7; color: #737d98; }
.lesson-concept { margin: 0 0 16px; }
.lesson-media { margin-bottom: 20px; }
.lesson-media audio { display: block; width: 100%; max-width: 100%; }
.lesson-youtube { width: 100%; aspect-ratio: 16 / 9; }
.lesson-youtube iframe { display: block; width: 100%; height: 100%; border: 0; }
.lesson-actions { margin-top: 24px; border-top: 1px solid #e9ebf3; padding-top: 12px; }
.lesson-actions p:empty { display: none; }
.answer-list { display: grid; gap: 10px; margin: 20px 0; }
.answer, .dialog-action { width: 100%; padding: 12px 15px; border-radius: 11px; font-size: 13px; cursor: pointer; }
.answer { text-align: left; border: 1px solid #e9ebf3; background: #f5f7fc; color: #1c2640; }
.answer:hover:not(:disabled) { border-color: #5964dc; background: #eeefff; }
.answer.correct { border-color: #239a6b; background: #e7f8f1; }
.answer.incorrect { border-color: #b34b4b; background: #fff0f0; }
.answer:disabled { cursor: default; color: #1c2640; opacity: 1; }
.dialog-action { border: 0; background: #5964dc; color: #fff; margin-top: 12px; }
.dialog-action:hover { background: #4652ca; }
dialog button:focus-visible { outline: 3px solid #b8befb; outline-offset: 3px; }
dialog .feedback { color: #1c2640; min-height: 24px; }
.explanation-help { margin: -4px 0 4px; }
.explain-button { border: 0; border-radius: 4px; padding: 6px 0; background: transparent; color: #505bd0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.explain-button:hover { color: #3945b5; }
.explain-button:disabled { cursor: wait; }
dialog .explanation-detail { margin: 8px 0 12px; padding: 12px 14px; border-left: 2px solid #d9dcfb; border-radius: 0 8px 8px 0; background: #f5f7fc; color: #58627b; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.stat { padding: 16px; border-radius: 14px; background: #f5f7fc; font-size: 12px; color: #737d98; }
.stat strong { display: block; font-size: 26px; color: #505bd0; }
.history-day { margin-top: 24px; }
.history-day h4 { margin: 0 0 10px; color: #737d98; font-size: 12px; font-weight: 500; }
.history-list { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.history-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) 14px; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid #e9ebf3; border-radius: 11px; background: #f5f7fc; color: #1c2640; text-align: left; cursor: pointer; }
.history-item:hover { background: #eeefff; border-color: #b8befb; }
.history-details { min-width: 0; }
.history-item strong { display: block; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.history-meta { display: block; margin-top: 4px; font-size: 11px; color: #737d98; }
.history-icon { width: 20px; height: 20px; color: #737d98; }
.history-chevron { width: 14px; height: 14px; color: #a1a9bb; }
.dialog-header { position: sticky; top: -28px; z-index: 1; background: #fff; padding: 8px 0; }

.dashboard {
  width: min(1120px, 100% - 48px);
  margin: 0 auto;
  padding: 32px 0 64px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 28px;
  border-bottom: 1px solid #e7eaf2;
}

.brand-mark,
.profile {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-weight: 700;
}

.brand-mark {
  background: #5b67e8;
  color: #fff;
  font-size: 21px;
}

.page-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.profile {
  width: 38px;
  height: 38px;
  margin-left: auto;
  border-radius: 50%;
  background: #e9eaff;
  color: #505bd0;
  font-size: 13px;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.account-control { position: relative; flex: 0 0 auto; margin-left: auto; }
.profile:hover, .profile[aria-expanded="true"] { background: #dfe2fc; }
.account-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 10; min-width: 160px; padding: 6px; border: 1px solid #e9ebf3; border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgb(35 46 82 / 12%); }
.account-menu button { display: block; width: 100%; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: #1c2640; text-align: left; font-size: 13px; cursor: pointer; }
.account-menu button:hover { background: #eeefff; color: #505bd0; }
.account-menu button:disabled { opacity: .45; cursor: wait; }
.account-menu p { margin: 6px 10px; font-size: 12px; color: #737d98; }

.welcome {
  max-width: 680px;
  padding: 48px 0 34px;
}

.eyebrow,
.card-label {
  margin: 0 0 10px;
  color: #737d98;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
}

.welcome h2 {
  margin: 0 0 10px;
  font-size: clamp(27px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -1.2px;
}

.welcome > p:last-child {
  margin: 0;
  color: #737d98;
  font-size: 15px;
  line-height: 1.7;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.learning-card {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  align-items: flex-start;
  padding: 26px;
  border: 1px solid #e9ebf3;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(35 46 82 / 4%);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: #eeefff;
  color: #5964dc;
  font-size: 23px;
}

.progress-card .card-icon {
  background: #e7f8f1;
  color: #239a6b;
}

.next-card { border-color: #d9dcfb; }
.next-topic { margin: 4px 0 8px; font-size: 16px; font-weight: 500; }
.streak { margin: 0 0 20px; color: #737d98; font-size: 14px; }
.streak strong { color: #239a6b; font-size: 36px; font-weight: 600; }
.learning-card.progress-card button { background: #eeefff; color: #505bd0; }
.learning-card.progress-card button:hover { background: #e0e3fc; }

.learning-card .card-label {
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: 1px;
}

.learning-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.card-description {
  margin: 0 0 22px;
  color: #737d98;
  font-size: 13px;
  line-height: 1.7;
}

.learning-card button {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  background: #5964dc;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}

.learning-card button:hover {
  transform: translateY(-1px);
  background: #4652ca;
}

.learning-card button:focus-visible {
  outline: 3px solid #b8befb;
  outline-offset: 3px;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  margin: -5px 0 8px;
  border-radius: 99px;
  background: #e9edf4;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #39b887;
}

.progress-caption {
  margin: 0 0 18px;
  color: #737d98;
  font-size: 11px;
}

@media (max-width: 800px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .dashboard {
    width: min(100% - 32px, 420px);
    padding: 20px 0 40px;
  }

  .page-header {
    padding-bottom: 20px;
  }

  .welcome {
    padding: 34px 0 25px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .learning-card {
    min-height: 0;
    padding: 22px;
  }

  .card-icon {
    margin-bottom: 18px;
  }

  .learning-card button {
    margin-top: 4px;
  }
}

/* Onboarding shares the dashboard's palette, rounded cards and spacing. */
[hidden] { display: none !important; }
.page-header .profile { margin-left: 0; }
.onboarding { max-width: 760px; margin: 40px auto 0; }
.auth-screen { max-width: 600px; margin: 40px auto 0; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.setup-progress { display: flex; align-items: center; gap: 20px; margin: 18px 0; color: #737d98; font-size: 12px; }
.setup-progress progress { flex: 1; width: 100%; height: 7px; border: 0; border-radius: 99px; overflow: hidden; background: #e7eaf2; accent-color: #5964dc; }
.setup-progress progress::-webkit-progress-bar { background: #e7eaf2; }
.setup-progress progress::-webkit-progress-value { background: #5964dc; border-radius: 99px; }
.setup-progress progress::-moz-progress-bar { background: #5964dc; }
#step-label { white-space: nowrap; }
.setup-card { padding: 32px; border: 1px solid #e9ebf3; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgb(35 46 82 / 4%); }
.setup-card h2 { margin: 0 0 12px; font-size: clamp(23px, 3.5vw, 30px); line-height: 1.4; letter-spacing: -.7px; font-weight: 600; }
.step-description { color: #737d98; font-size: 14px; line-height: 1.7; margin: 0 0 24px; }
.step-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.setup-option { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 14px; border: 1px solid #e2e5ef; border-radius: 12px; background: #fff; color: #1c2640; font-size: 13px; text-align: left; cursor: pointer; }
.setup-option::before { content: ''; width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid #bcc3d5; border-radius: 50%; }
.step-options.multiple .setup-option::before { border-radius: 5px; }
.setup-option:hover { background: #f5f7fc; border-color: #5964dc; }
.setup-option[aria-pressed="true"] { border-color: #5964dc; background: #eeefff; color: #424cb5; }
.setup-option[aria-pressed="true"]::before { content: '✓'; display: grid; place-items: center; background: #5964dc; color: #fff; border-color: #5964dc; font-size: 12px; }
.selection-count { min-height: 22px; margin: 16px 0 0; color: #505bd0; font-size: 12px; }
.setup-navigation { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #e9ebf3; margin-top: 24px; padding-top: 22px; }
.setup-primary, .setup-back, .google-button { min-height: 46px; border: 0; border-radius: 11px; padding: 12px 22px; font: inherit; font-size: 13px; cursor: pointer;}
.setup-primary { background: #5964dc; color: #fff; margin-top:20px;}
.setup-primary:hover:not(:disabled) { background: #4652ca; }
.setup-back { background: #eeefff; color: #505bd0; }
.setup-card button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 3px solid #b8befb; outline-offset: 3px; }
#account-form, #login-form { max-width: 440px; margin: 0 auto; }
#account-form label, #login-form label { display: block; margin: 16px 0 6px; font-size: 12px; }
#account-form input, #login-form input { width: 100%; min-height: 48px; border: 1px solid #d9deeb; border-radius: 11px; padding: 12px; font: inherit; font-size: 16px; color: #1c2640; background: #f5f7fc; }
#account-form .setup-primary, #login-form .setup-primary { width: 100%; margin-top: 24px; }
.google-button { width: 100%; background: #fff; color: #1c2640; border: 1px solid #d9deeb; }
.account-divider, .prototype-note, #account-status, #login-status, #startup-status { font-size: 12px; line-height: 1.7; color: #737d98; text-align: center; }

@media (max-width: 560px) {
  .onboarding, .auth-screen { margin-top: 28px; }
  .setup-card { padding: 22px 18px; }
  .step-options { grid-template-columns: 1fr; }
  .page-header { gap: 8px; }
  .page-header .profile { display: grid; }
}





#placement .step-options { display: grid; gap: 12px; margin: 24px 0; }
.placement-recommended { display: block; font-size: .8em; color: #505bd0; margin-top: 4px; }
.placement-question audio { max-width: 100%; }

#level-completion-actions .certificate-button { background: transparent; color: #505bd0; margin-top: 10px; border: 1px solid #d9dcfb; }
#level-completion-status { font-size: 13px; line-height: 1.6; }
#level-completion-actions { margin-top: auto; }
.next-card button:disabled { opacity: .6; cursor: wait; }

.account-menu a { display:block; padding:10px 14px; color:#1c2640; text-decoration:none; font-size:13px; border-radius:8px; }
.account-menu a[hidden] { display:none; }
.account-menu a:hover { background:#eeefff; }
.language-options { display:flex; gap:4px; }
.language-options button { text-align:center; }
.language-options button[aria-pressed="true"] { background:#e9eaff; color:#505bd0; font-weight:600; }
.account-menu { max-width:calc(100vw - 40px); }

