:root {
  --deep: #0f3640;
  --deep2: #125e52;
  --ink: #1b2226;
  --muted: #68757d;
  --line: #dfe5e1;
  --brand: #137667;
  --brand-soft: #e6f3ee;
  --blue: #1665c0;
  --red: #c92a20;
  --paper: #fcfcfa;
  --gold-bg: #fff5d8;
  --gold-bd: #dfa700;
  --gold-ink: #6a4900;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0a2026; color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; }

.stage {
  position: absolute; width: 1600px; height: 900px; transform-origin: 0 0;
  background: linear-gradient(135deg, var(--deep), var(--deep2) 72%, #188a6c);
  overflow: hidden;
}
.brand {
  position: absolute; left: 44px; top: 17px;
  color: #fff; font-weight: 700; font-size: 23px; letter-spacing: .3px;
}
.ep {
  position: absolute; right: 44px; top: 19px;
  color: #cbe6df; font-size: 20px; display: flex; gap: 16px;
}
.ep span { opacity: .55; }
.ep span.done { opacity: .82; }
.ep span.now { opacity: 1; color: #fff; font-weight: 700; border-bottom: 3px solid #ffe082; padding-bottom: 2px; }

.board {
  position: absolute; left: 44px; right: 44px; top: 62px; bottom: 54px;
  background: var(--paper); border-radius: 14px; padding: 22px 38px;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  overflow: hidden;
  display: flex; flex-direction: column;
}
#ink { position: absolute; inset: 0; width: 1600px; height: 900px; z-index: 5; pointer-events: none; }
.stage.mode-pen #ink { pointer-events: auto; cursor: crosshair; }
.stage.mode-eraser #ink { pointer-events: auto; cursor: cell; }
.stage.mode-text #ink { pointer-events: auto; cursor: text; }

.notes { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; z-index: 5; pointer-events: none; }
.nt {
  position: absolute; color: #d9281e; font-size: 28px; font-weight: 700; line-height: 1.25;
  background: rgba(255,255,255,.94); border-radius: 6px; padding: 3px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); white-space: pre-wrap; word-break: break-word;
}
.nt .tx { outline: none; display: inline-block; min-width: 1ch; }
.nt .h {
  display: none; position: absolute; left: -28px; top: 2px; width: 24px; text-align: center;
  color: #fff; background: #d9281e; border-radius: 5px; font-size: 20px; cursor: move; user-select: none;
}
.stage.mode-pen .notes .nt { pointer-events: none !important; }
.stage.mode-eraser .notes .nt { cursor: cell; }

.pagenum { position: absolute; right: 48px; bottom: 10px; color: #cbe6df; font-size: 18px; }
.playing {
  position: absolute; left: 48px; bottom: 10px; color: #ffe082;
  font-size: 20px; font-weight: 700; z-index: 6;
}
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.15); }
.prog i { display: block; height: 100%; background: #ffe082; transition: width .25s ease; }

/* Slide typography */
.headrow { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
h1 { margin: 0; color: var(--deep2); font-size: 33px; line-height: 1.2; font-weight: 700; }
.pill {
  display: inline-block; background: var(--brand); color: #fff;
  border-radius: 999px; padding: 4px 16px; font-size: 18px; font-weight: 600;
}
.src-badge {
  display: inline-block; background: var(--brand-soft); color: var(--deep2);
  border: 1px solid #b9dfd2; border-radius: 999px; padding: 3px 12px;
  font-size: 16px; font-weight: 600;
}
.hide { visibility: hidden; }
.ghost { opacity: .28; outline: 2px dashed #9aa6a8; outline-offset: 3px; border-radius: 6px; }

.act { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; flex-wrap: wrap; flex: none; z-index: 3; }
.tb {
  background: var(--brand); color: #fff; border: 0; border-radius: 9px;
  padding: 7px 15px; font-size: 18px; font-weight: 600;
}
.tb.alt { background: #fff; color: var(--deep2); border: 2px solid var(--brand); }
.tb.warn { background: var(--red); }

.play {
  border: 2px solid var(--brand); color: var(--brand); background: #fff;
  border-radius: 999px; padding: 4px 16px; font-size: 20px; font-weight: 600; white-space: nowrap;
}
.play.sm { font-size: 17px; padding: 2px 12px; }
.play.lg { font-size: 24px; padding: 8px 26px; }

.goal {
  border-left: 5px solid var(--brand); padding: 6px 0 6px 20px;
  font-size: 30px; line-height: 1.45; font-weight: 600; margin: 12px 0 18px;
}
.big { font-size: 46px; line-height: 1.3; font-weight: 700; margin: 0; color: var(--deep); }
.sub { font-size: 23px; color: var(--deep2); font-weight: 700; margin: 14px 0 6px; }
.muted { color: var(--muted); }

/* Teacher-only notes */
.tn {
  font-size: 19px; line-height: 1.4; color: var(--gold-ink);
  background: var(--gold-bg); border-left: 4px solid var(--gold-bd);
  border-radius: 5px; padding: 6px 12px; margin: 8px 0;
}
.tn b { color: #4a3100; }
.tn.hide { display: none; }

.g { position: relative; white-space: nowrap; }
.g.u { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.g i {
  position: absolute; left: 0; top: calc(100% - 2px); font-style: normal;
  font-weight: 500; font-size: 16px; line-height: 1.15; white-space: nowrap;
  color: var(--gold-ink); background: #fff1c7; border-radius: 3px; padding: 1px 6px; z-index: 2;
}

/* Cards & grids */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 14px; }
.card-grid.two { grid-template-columns: 1fr 1fr; }
.mcard {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 16px 20px; font-size: 24px; line-height: 1.45;
}
.mcard h3 { margin: 0 0 8px; font-size: 24px; color: var(--deep2); }
.mcard p { margin: 4px 0; font-size: 21px; }

/* IELTS Official Table */
table.ielts-tbl {
  width: 100%; border-collapse: collapse; font-size: 23px; background: #fff;
  border: 1.5px solid #b9c7c4; border-radius: 8px; overflow: hidden;
}
table.ielts-tbl th {
  background: #dfece8; color: #16443d; padding: 10px 14px;
  text-align: left; font-size: 20px; border-bottom: 1.5px solid #b9c7c4;
}
table.ielts-tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line); vertical-align: top; line-height: 1.5;
}
table.ielts-tbl td:last-child { border-right: 0; }
.qnum {
  display: inline-block; min-width: 26px; height: 26px; line-height: 24px;
  text-align: center; border-radius: 6px; background: var(--deep2); color: #fff;
  font-size: 16px; font-weight: 700; margin-right: 5px; vertical-align: 2px;
}

input.ans-in {
  font: inherit; font-size: 24px; width: 175px; border: 0;
  border-bottom: 2.5px solid #5f7176; background: #f4f8f7;
  padding: 2px 8px; color: var(--blue); outline: none; text-align: center;
  border-radius: 4px 4px 0 0; font-weight: 600;
}
input.ans-in:focus { border-color: var(--brand); background: #e6f4ef; }
input.ans-in.wide { width: 100%; text-align: left; font-size: 26px; padding: 6px 12px; }
textarea.ans-area {
  font: inherit; font-size: 25px; width: 100%; min-height: 110px;
  border: 2px solid #b9c7c4; border-radius: 10px; padding: 12px 16px;
  color: var(--blue); background: #fff; outline: none; resize: none; line-height: 1.45;
}
textarea.ans-area:focus { border-color: var(--brand); background: #f7fcf9; }

.mk { display: inline-block; margin-left: 6px; font-size: 20px; font-weight: 700; }
.mk.ok { color: var(--brand); }
.mk.no { color: var(--red); }

/* Reading Split View */
.read-split {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 22px;
  flex: 1; min-height: 0; margin-top: 6px;
}
.passage-box {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 18px 22px; overflow-y: auto; font-size: 21px; line-height: 1.65;
}
.passage-box h2 { margin: 0 0 10px; font-size: 26px; color: var(--deep); }
.passage-box p { margin: 0 0 14px; text-align: left; }
.p-tag {
  display: inline-block; font-size: 14px; font-weight: 700; color: var(--deep2);
  background: var(--brand-soft); border-radius: 4px; padding: 1px 7px; margin-right: 8px;
  vertical-align: 2px;
}
mark.ev-hi {
  background: #ffe98a; color: #1b2226; padding: 2px 4px; border-radius: 4px;
  box-shadow: 0 0 0 2px #f2b705;
}
.q-box {
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 4px;
}
.q-card {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px 18px; font-size: 22px; line-height: 1.5;
}
.q-card.active-ev { border-color: #e0a800; background: #fffdf4; }
.q-card .inst { font-size: 18px; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  border: 2px solid #bdc6c8; background: #fff; border-radius: 8px;
  padding: 6px 18px; font-size: 20px; font-weight: 600; color: var(--ink);
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:disabled { opacity: 1; cursor: default; }

/* Speaking & Writing frames */
.skel { display: grid; gap: 8px; margin: 10px 0; }
.skel > div {
  display: flex; align-items: baseline; gap: 16px; font-size: 26px;
  padding: 10px 14px; background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
}
.skel b { width: 130px; flex: none; color: var(--deep2); font-size: 22px; }
.skel span { color: var(--blue); font-weight: 600; }

/* Audio & review cards */
.review-row {
  display: grid; grid-template-columns: 70px 1fr 1.1fr; gap: 14px; align-items: start;
  padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 21px; line-height: 1.4;
}
.review-row:last-child { border-bottom: 0; }

/* Anki banner */
.anki-box {
  background: #fff; border: 2px solid var(--brand); border-radius: 14px;
  padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-top: 14px;
}
.anki-btn {
  display: inline-block; background: var(--brand); color: #fff; text-decoration: none;
  border-radius: 10px; padding: 14px 28px; font-size: 24px; font-weight: 700; white-space: nowrap;
}
.anki-btn.sec {
  background: #fff; color: var(--deep2); border: 2px solid var(--brand); font-size: 20px; padding: 10px 20px;
}

/* Student shell */
body.stu {
  background: linear-gradient(135deg, var(--deep), var(--deep2) 72%, #188a6c);
  position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden;
}
body.stu .stage { background: none; }
.gate {
  position: fixed; inset: 0; background: linear-gradient(135deg, var(--deep), var(--deep2));
  color: #fff; display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; text-align: center;
}
.gcard h1 { color: #fff; font-size: 42px; margin: 0 0 24px; }
.gate button {
  background: #fff; color: var(--deep2); border: 0; border-radius: 10px;
  padding: 14px 38px; font-size: 22px; font-weight: 700;
}
.netbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15;
  background: var(--red); color: #fff; text-align: center; padding: 6px; font-size: 14px; font-weight: 600;
}
.status {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 8px;
  background: #fff; border-radius: 999px; padding: 4px 14px; font-size: 13px;
  color: var(--muted); box-shadow: 0 2px 8px rgba(20,25,30,.2); z-index: 8;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; transition: opacity .3s;
}
.status.quiet { opacity: .55; padding: 4px 10px; }
.status.quiet #st { display: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c28a1e; }
.dot.live { background: #23a26d; }
.dot.off { background: var(--red); }
.fsbtn {
  margin-left: 6px; background: #eef3f2; color: var(--deep2);
  border: 0; border-radius: 999px; padding: 2px 10px; font-size: 13px; text-decoration: none;
}
.audiobar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 44px; z-index: 10; }
.audiobar button {
  background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 26px; font-size: 18px; font-weight: 600; box-shadow: 0 3px 12px rgba(20,25,30,.3);
}
.count { font-size: 110px; font-weight: 700; text-align: center; color: var(--deep2); font-variant-numeric: tabular-nums; }
.count.end { color: var(--red); }
