:root {
  --ink: #202545;
  --muted: #7d829c;
  --paper: #eef1f7;
  --line: #edf0f7;
  --purple: #7565e8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Nunito", "Segoe UI", sans-serif; font-weight: 600; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 max(5vw, 22px); display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: -.5px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; color: white; background: linear-gradient(140deg,#7565e8,#9c70ed); font-size: 15px; box-shadow: 0 6px 15px #7565e833; }
.brand-mark span { color: #d8ff91; }
.brand-name { font-size: 21px; }
.brand-name span { color: var(--purple); }
.topbar-right { display: flex; align-items: center; gap: 17px; }
.student-chip { color: #747b96; font-size: 13px; font-weight: 800; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #53c89a; }
.avatar { width: 37px; height: 37px; border: 0; border-radius: 50%; background: #eeeaff; color: #6858d7; font: 900 15px inherit; font-family: inherit; font-weight: 900; cursor: pointer; }
.main-content { width: min(1120px, 90%); margin: 0 auto; padding: 48px 0 24px; }
.welcome-section { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 50px; }
.eyebrow { margin: 0 0 8px; color: #9993d8; font-size: 10px; font-weight: 900; letter-spacing: 2px; }
h1 { margin: 0; font-size: clamp(27px,4vw,39px); line-height: 1.2; letter-spacing: -1.3px; }
h1 span:first-child { color: var(--purple); }
.wave { color: #ffbd59; font-size: 24px; vertical-align: top; }
.welcome-copy { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.grade-pill { display: flex; align-items: center; gap: 11px; padding: 12px 17px; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 7px 22px #292e5510; }
.grade-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #6f61dd; background: #f0edff; font-size: 20px; }
.grade-pill small,.grade-pill strong { display: block; }
.grade-pill small { color: #9a9db0; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.grade-pill strong { margin-top: 2px; font-size: 14px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 19px; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.5px; }
.section-note { color: #969bb0; font-size: 12px; font-weight: 800; }
.subject-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.subject-card { min-height: 150px; position: relative; display: flex; align-items: center; gap: 18px; padding: 25px; overflow: hidden; background: #fff; border: 1px solid #e3e7f0; border-radius: 21px; box-shadow: 0 5px 18px #252b4d0a; transition: transform .2s ease, box-shadow .2s ease; }
.subject-card:hover,.results-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px #30345b14; }
.card-icon { flex: 0 0 61px; width: 61px; height: 61px; display: grid; place-items: center; border-radius: 19px; }
.card-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.card-content { display: flex; flex-direction: column; gap: 6px; padding-right: 16px; }
.card-content strong { font-size: 22px; font-weight: 600; letter-spacing: 0; }
.card-content small { max-width: 270px; color: #777e99; font-size: 12px; line-height: 1.5; font-weight: 700; }
.card-arrow { position: absolute; top: 20px; right: 21px; color: #9ba0b4; font-size: 19px; }
.listening { background: #fff; border-color: #dce8fa; border-left: 4px solid #548ce9; }
.listening .card-icon { background: #dceaff; color: #548ce9; }
.grammar { background: #fff; border-color: #e7defb; border-left: 4px solid #896be4; }
.grammar .card-icon { background: #e5dcff; color: #896be4; }
.reading { background: #fff; border-color: #d8eee5; border-left: 4px solid #39a982; }
.reading .card-icon { background: #d5f2e4; color: #39a982; }
.writing { background: #fff; border-color: #f6e4d2; border-left: 4px solid #e99a4e; }
.writing .card-icon { background: #ffe6cb; color: #e99a4e; }
.exams { grid-column: 1 / -1; min-height: 175px; padding: 29px 31px; color: white; background: linear-gradient(112deg,#6559d9 0%,#8870ed 58%,#a17bea 100%); box-shadow: 0 12px 24px #7868df2b; }
.exams .card-icon { background: #ffffff25; color: white; }
.exams .card-content strong { font-size: 24px; font-weight: 600; letter-spacing: 0; }
.exams .card-content small { color: #e9e5ff; max-width: 390px; }
.exams .card-arrow { color: #e6e0ff; }
.exam-badge { position: absolute; top: 20px; right: 54px; padding: 6px 10px; border: 1px solid #ffffff4a; border-radius: 30px; color: #f2efff; font-size: 9px; font-weight: 900; letter-spacing: 1.2px; }
.exam-cta { position: absolute; right: 30px; bottom: 27px; color: white; font-size: 12px; font-weight: 900; }
.exam-cta span { margin-left: 6px; font-size: 17px; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 17px; margin-top: 22px; }
.results-card,.encouragement-card { min-height: 91px; display: flex; align-items: center; gap: 14px; padding: 18px 21px; border: 1px solid var(--line); border-radius: 17px; background: white; transition: transform .2s ease,box-shadow .2s ease; }
.results-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #6f61dd; background: #f0edff; font-size: 21px; font-weight: 900; }
.results-card strong,.results-card small,.encouragement-card strong,.encouragement-card small { display: block; }
.results-card strong,.encouragement-card strong { font-size: 14px; font-weight: 900; }
.results-card small,.encouragement-card small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.results-card .card-arrow { position: static; margin-left: auto; }
.encouragement-card { background: #fffdf5; border-color: #f7efd7; }
.sparkle { color: #e8b74f; font-size: 25px; }
.footer { display: flex; justify-content: space-between; margin-top: 37px; padding-top: 17px; border-top: 1px solid #e9ebf2; color: #a2a6b7; font-size: 10px; font-weight: 700; }
@media (max-width: 650px) {
  .topbar { height: 65px; padding: 0 18px; }
  .brand-name { font-size: 19px; }
  .main-content { width: calc(100% - 34px); padding-top: 32px; }
  .welcome-section { align-items: flex-start; flex-direction: column; margin-bottom: 36px; }
  .grade-pill { padding: 9px 13px; }
  .subject-grid { grid-template-columns: 1fr; gap: 12px; }
  .subject-card { min-height: 126px; padding: 20px; gap: 14px; }
  .card-icon { flex-basis: 54px; width: 54px; height: 54px; border-radius: 16px; }
  .card-content strong { font-size: 20px; font-weight: 600; letter-spacing: 0; }
  .exams { grid-column: auto; min-height: 170px; padding: 23px 20px; }
  .exams .card-content strong { font-size: 22px; font-weight: 600; letter-spacing: 0; }
  .exam-badge { top: 14px; right: 15px; font-size: 8px; }
  .exam-cta { right: 20px; bottom: 18px; }
  .bottom-grid { grid-template-columns: 1fr; gap: 12px; }
  .section-note { font-size: 10px; }
  .footer { gap: 10px; font-size: 9px; }
}

/* Listening navigation */
[hidden] { display: none !important; }
.content-view { min-height: 55vh; padding: 8px 0 30px; }
.back-link { display: inline-block; margin: 0 0 28px; padding: 9px 14px; border: 1px solid #dfe4ef; border-radius: 10px; background: #fff; color: #5f6682; font: 600 13px inherit; font-family: inherit; cursor: pointer; }
.view-title { margin: 0; font-size: clamp(27px, 4vw, 34px); font-weight: 800; letter-spacing: 0; }
.view-description { margin: 10px 0 24px; color: #39415e; font-size: 16px; line-height: 1.6; font-weight: 700; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.type-card,.exercise-row { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; padding: 22px; border: 1px solid #dce8fa; border-radius: 17px; background: #fff; color: var(--ink); text-align: left; font-family: inherit; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.type-card:hover,.exercise-row:hover { transform: translateY(-2px); box-shadow: 0 10px 22px #30345b12; }
.type-number,.exercise-number { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 14px; background: #e5efff; color: #548ce9; font-size: 17px; font-weight: 700; }
.type-card strong,.type-card small { display: block; }
.type-card strong { font-size: 20px; font-weight: 600; }
.type-card small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.exercise-list { display: grid; gap: 12px; max-width: 700px; }
.exercise-row { padding: 15px 18px; border-color: #e3e7f0; }
.exercise-number { flex-basis: 40px; width: 40px; height: 40px; font-size: 15px; }
.exercise-row strong { font-size: 16px; font-weight: 600; }
.exercise-arrow { margin-left: auto; color: #8b92aa; font-size: 20px; }
.empty-exercise { max-width: 700px; margin-top: 20px; padding: 42px 24px; border: 1px dashed #ccd5e5; border-radius: 18px; background: #fff; text-align: center; }
.empty-icon { color: #548ce9; font-size: 30px; }
.empty-exercise h3 { margin: 12px 0 7px; font-size: 18px; font-weight: 600; }
.empty-exercise p { margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 650px) { .type-grid { grid-template-columns: 1fr; } .type-card { padding: 18px; } }

/* Exercise selection cards */
.exercise-list {
  max-width: 820px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.exercise-row {
  min-height: 150px;
  padding: 22px 16px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border: 1px solid #dce5f3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 16px #252b4d0a;
  text-align: center;
}
.exercise-number {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #e5efff;
  color: #548ce9;
  font-size: 18px;
}
.exercise-row strong { font-size: 17px; font-weight: 600; }
.exercise-arrow {
  position: absolute;
  top: 13px;
  right: 16px;
  margin: 0;
  color: #9aa4b8;
}
@media (max-width: 650px) {
  .exercise-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .exercise-row { min-height: 130px; padding: 18px 10px; }
}
@media (max-width: 380px) {
  .exercise-list { grid-template-columns: 1fr; }
}


/* Grade 11 listening exercise preview */
.audio-placeholder {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 820px;
  margin: 22px 0;
  padding: 16px 19px;
  border: 1px solid #dce8fa;
  border-radius: 14px;
  background: #f7faff;
  color: var(--ink);
}
.audio-placeholder > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #e5efff;
  color: #548ce9;
  font-size: 22px;
}
.audio-placeholder strong, .audio-placeholder small { display: block; }
.audio-placeholder strong { font-size: 14px; font-weight: 700; }
.audio-placeholder small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.listening-questions {
  display: grid;
  gap: 15px;
  max-width: 820px;
  text-align: left;
  direction: ltr;
}
.question-card {
  padding: 20px 22px;
  border: 1px solid #e1e7f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 14px #252b4d08;
  direction: ltr;
  text-align: left;
}
.question-card h3 {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  color: #202545;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 700;
}
.question-card h3 > span { color: #548ce9; flex: 0 0 auto; }
.answer-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.answer-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #dfe5ef;
  border-radius: 10px;
  background: #fbfcfe;
  color: #39415e;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.answer-option:hover { border-color: #9bb9ee; background: #f5f8ff; }
.answer-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.custom-radio {
  display: inline-block;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  border: 1.7px solid #9aa5b8;
  border-radius: 50%;
  background: #fff;
}
.answer-option:has(input:checked) {
  border-color: #548ce9;
  background: #eef5ff;
  color: #254f91;
}
.answer-option input:checked + .custom-radio {
  border: 5px solid #548ce9;
}
.answer-option input:focus-visible + .custom-radio {
  outline: 3px solid #b8d0fa;
  outline-offset: 2px;
}
@media (max-width: 650px) {
  .question-card { padding: 17px 15px; }
  .answer-options { grid-template-columns: 1fr; gap: 8px; }
  .answer-option { min-height: 43px; }
}


/* Teacher login interface */
.teacher-login-link { padding: 10px 16px; border: 1px solid #dcd8fb; border-radius: 11px; background: #f3f0ff; color: #6254cb; font: 800 13px "Nunito", sans-serif; cursor: pointer; }
.teacher-login-link:hover { background: #e9e4ff; }
.teacher-login-wrap { display: grid; place-items: start center; padding: 12px 0 35px; }
.teacher-login-card { width: min(100%, 470px); padding: 32px; border: 1px solid #e1e5f0; border-radius: 22px; background: #fff; box-shadow: 0 12px 34px #252b4d12; }
.teacher-login-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 22px; border-radius: 16px; background: linear-gradient(140deg,#7565e8,#9c70ed); color: white; font-size: 17px; font-weight: 900; }
.teacher-login-card .view-description { margin-bottom: 24px; font-size: 14px; }
.teacher-login-form { display: grid; gap: 9px; }
.teacher-login-form label { margin-top: 8px; color: #303754; font-size: 13px; font-weight: 900; }
.teacher-login-form input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid #dfe4ef; border-radius: 11px; background: #fbfcff; color: var(--ink); font: 700 14px "Nunito", sans-serif; }
.teacher-login-form input:focus { outline: 3px solid #e6e1ff; border-color: #8979e8; }
.teacher-submit { min-height: 49px; margin-top: 15px; border: 0; border-radius: 11px; background: #7565e8; color: white; font: 900 15px "Nunito", sans-serif; opacity: .55; cursor: not-allowed; }
.login-setup-note { margin: 17px 0 0; color: #858ba1; font-size: 11px; line-height: 1.5; text-align: center; }
@media (max-width: 650px) { .topbar-right { gap: 9px; } .teacher-login-link { padding: 9px 11px; font-size: 12px; } .student-chip { display: none; } .teacher-login-card { padding: 25px 20px; } }


/* Teacher login and panel */
.teacher-login-wrap { display: grid; place-items: center; padding: 24px 0 40px; }
.teacher-login-card { width: min(100%, 460px); padding: 34px; border: 1px solid #e1e7f0; border-radius: 22px; background: #fff; box-shadow: 0 12px 32px #252b4d10; }
.teacher-login-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 20px; border-radius: 16px; color: #fff; background: linear-gradient(140deg,#7565e8,#9c70ed); font-weight: 900; }
.teacher-login-form { display: grid; gap: 10px; margin-top: 22px; }
.teacher-login-form label { margin-top: 8px; color: #39415e; font-size: 13px; font-weight: 800; }
.teacher-login-form input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #dce2ee; border-radius: 11px; background: #fbfcff; color: var(--ink); font: 600 14px inherit; font-family: inherit; outline: none; }
.teacher-login-form input:focus { border-color: #8b7bea; box-shadow: 0 0 0 3px #8b7bea20; }
.teacher-submit { min-height: 48px; margin-top: 12px; padding: 0 20px; border: 0; border-radius: 11px; background: #7565e8; color: #fff; font: 800 14px inherit; font-family: inherit; cursor: pointer; }
.teacher-submit:disabled { opacity: .65; cursor: wait; }
.login-setup-note { color: #858ba2; font-size: 12px; line-height: 1.6; }
.teacher-login-error { min-height: 18px; margin: 2px 0 0; color: #c43e52; font-size: 12px; }
.teacher-panel { max-width: 760px; margin: 0 auto; padding: 24px 0; }
.teacher-panel-card { margin-top: 24px; padding: 26px; border: 1px solid #dce8fa; border-radius: 18px; background: #fff; }
.teacher-panel-card h3 { margin: 0 0 10px; font-size: 19px; }
.teacher-panel-card p { color: #69718c; line-height: 1.6; }
@media (max-width: 520px) { .teacher-login-card { padding: 25px 20px; } }


/* Teacher exercise management */
.teacher-tools-heading { display:flex; align-items:center; justify-content:space-between; gap:18px; margin:28px 0 16px; }
.teacher-tools-heading h3 { margin:0; font-size:20px; }
.teacher-tools-heading p { margin:6px 0 0; color:#737b96; font-size:13px; line-height:1.5; }
.add-exercise-button,.add-question-button { flex:0 0 auto; min-height:44px; padding:0 16px; border:0; border-radius:11px; background:#7565e8; color:#fff; font:800 13px "Nunito",sans-serif; cursor:pointer; }
.teacher-exercise-list { display:grid; gap:11px; }
.teacher-exercise-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:17px 19px; border:1px solid #e1e7f0; border-radius:14px; background:#fff; }
.teacher-exercise-row strong,.teacher-exercise-row small { display:block; }
.teacher-exercise-row strong { font-size:15px; }
.teacher-exercise-row small { margin-top:4px; color:#77809a; font-size:12px; }
.exercise-status { display:inline-block; margin-top:8px; padding:4px 8px; border-radius:20px; background:#f1f2f6; color:#6d748b; font-size:10px; font-weight:800; }
.exercise-status.published { background:#e4f7ed; color:#23845a; }
.edit-exercise-button { min-width:70px; min-height:38px; border:1px solid #dcd8fb; border-radius:9px; background:#f3f0ff; color:#6254cb; font:800 12px "Nunito",sans-serif; cursor:pointer; }
.editor-empty,.editor-error { padding:20px; border:1px dashed #d6ddeb; border-radius:13px; background:#fff; color:#737b96; font-size:13px; }
.editor-error { color:#b83e52; }
.teacher-logout { margin-top:25px; }
.exercise-editor-form { display:grid; gap:16px; max-width:850px; margin-top:22px; padding:24px; border:1px solid #e1e7f0; border-radius:18px; background:#fff; }
.exercise-editor-form > label,.editor-meta-grid label,.editor-question > label { display:grid; gap:7px; color:#39415e; font-size:12px; font-weight:900; }
.exercise-editor-form input:not([type="checkbox"]),.exercise-editor-form select,.exercise-editor-form textarea,.editor-question input,.editor-question select { width:100%; min-height:43px; padding:10px 12px; border:1px solid #dce2ee; border-radius:9px; background:#fbfcff; color:var(--ink); font:600 13px "Nunito",sans-serif; }
.exercise-editor-form textarea { resize:vertical; line-height:1.5; }
.exercise-editor-form input:focus,.exercise-editor-form select:focus,.exercise-editor-form textarea:focus { outline:3px solid #e9e5ff; border-color:#8979e8; }
.editor-meta-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.editor-questions-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:7px; }
.editor-questions-heading h3 { margin:0; font-size:18px; }
.add-question-button { min-height:38px; }
#editorQuestions { display:grid; gap:14px; }
.editor-question { display:grid; gap:12px; padding:17px; border:1px solid #e1e7f0; border-radius:13px; background:#fbfcff; }
.editor-question-heading { display:flex; align-items:center; justify-content:space-between; }
.editor-question-heading strong { color:#303754; font-size:14px; }
.remove-question { border:0; background:transparent; color:#b64b5b; font:800 11px "Nunito",sans-serif; cursor:pointer; }
.editor-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.editor-options label { display:grid; gap:6px; color:#68718c; font-size:11px; font-weight:800; }
.publish-toggle { display:flex !important; align-items:center; gap:9px !important; color:#39415e; font-size:13px !important; }
.publish-toggle input { width:17px; height:17px; accent-color:#7565e8; }
.editor-actions { display:flex; align-items:center; gap:15px; flex-wrap:wrap; }
.editor-actions .teacher-submit { min-width:160px; margin:0; }
#exerciseSaveMessage { margin:0; color:#23845a; font-size:12px; }
@media (max-width:650px) {
  .teacher-tools-heading { align-items:flex-start; flex-direction:column; }
  .teacher-exercise-row { align-items:flex-start; }
  .editor-meta-grid,.editor-options { grid-template-columns:1fr; }
  .exercise-editor-form { padding:17px; }
  .editor-questions-heading { align-items:flex-start; }
}


/* Separate teacher add/edit actions */
.teacher-management-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.teacher-management-actions .edit-exercise-button { min-height:44px; padding:0 16px; font-size:13px; }
@media (max-width:650px) { .teacher-management-actions { width:100%; } .teacher-management-actions button { flex:1 1 auto; } }
