:root {
  --crimson: #DC143C;
  --blue: #003893;
  --cyan: #25F4EE;
  --pink: #FE2C55;
  --ink: #15181d;
  --muted: #8a8f98;
  --text-2: #4b5560;
  --bg: #f4f5f8;
  --card: #ffffff;
  --line: #e7e9ee;
  --ok: #16a34a;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* Lock the outer page: only #views scrolls. Without this, hard scrolls
 * rubber-band the whole shell on iOS and the tab bar rides out of view. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  font-size: 15px;
  line-height: 1.4;
  background: #d9dce3;
  color: var(--ink);
}

.phone {
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
@media (min-width: 500px) {
  .phone { box-shadow: 0 0 40px rgba(0,0,0,.25); }
}

/* ---------- app bar ---------- */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px;
  /* iPhone notch / rounded corners: env() is 0 wherever there is no inset */
  padding-top: calc(7px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

/* iOS-PWA-only back button (shown by app.js when installed on iPhone) */
#te-back-btn {
  flex: none; width: 34px; height: 34px; margin-right: 10px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg); color: var(--ink);
  font-size: 24px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; padding-bottom: 3px;
}
#te-back-btn[hidden] { display: none; }
#te-back-btn:active { transform: scale(0.94); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 26px; width: auto; flex: none; }
.brand-name { font-weight: 800; font-size: 17px; }
.brand-name small { color: var(--muted); font-weight: 600; }
.icon-btn {
  position: relative; border: none; background: none; color: var(--ink);
  width: 36px; height: 36px; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--pink); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: grid; place-items: center;
}

/* ---------- views ---------- */
#views { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.view { display: none; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

.greet { font-size: 15px; margin-bottom: 12px; }
.greet-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* destination focus pill + picker sheet */
.dest-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 14px; margin-bottom: 12px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.dest-pill.focused { border-color: var(--blue); color: var(--blue); background: rgba(10, 79, 192, .06); }
.dest-caret { font-size: 11px; opacity: .65; }
.focus-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.focus-row {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 12px 14px;
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: left;
}
.focus-row:active { border-color: var(--blue); background: rgba(10, 79, 192, .06); }
.focus-row[hidden] { display: none !important; } /* our flex display would defeat [hidden] */

/* ---------- live online classes ---------- */
.class-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card, #fff); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px; cursor: pointer;
}
.class-card .cls-main { flex: 1; min-width: 0; }
.class-card h4 { font-size: 15px; margin: 0 0 2px; }
.class-card .muted { font-size: 12.5px; }
.cls-next { font-size: 12.5px; margin-top: 6px; }
.cls-until { color: var(--blue, #0a4fc0); font-weight: 700; }
.cls-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cls-price { font-size: 12px; font-weight: 800; color: var(--blue, #0a4fc0); }
.cls-session {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; margin-bottom: 8px;
}
.cls-session.past { opacity: .75; }
.cls-h4 { font-size: 13px; margin: 14px 0 8px; }
.cls-badge {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .3px;
  color: var(--blue, #0a4fc0); background: rgba(10, 79, 192, .08);
  border: 1px solid rgba(10, 79, 192, .25); border-radius: 999px;
  padding: 2px 8px; margin-bottom: 4px;
}
.my-sched {
  background: var(--card, #fff); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
}
.my-sched .cls-h4 { margin: 0 0 8px; }
.my-sched .cls-session:last-child { margin-bottom: 0; }
#class-sheet-body h3 { margin-bottom: 4px; }

/* ---------- voice doctor (missing Android TTS voice pack) ---------- */
.crs-voicedoc {
  background: rgba(192, 57, 43, .07); border: 1.5px solid rgba(192, 57, 43, .35);
  border-radius: 14px; padding: 14px; margin-bottom: 14px; font-size: 13.5px;
}
.crs-voicedoc p { margin: 8px 0; }
.crs-voicedoc-head { font-size: 15px; }
.crs-voicedoc-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.crs-voicedoc-btns a { text-decoration: none; display: inline-flex; align-items: center; }
.crs-voicedoc-steps { font-size: 12.5px; color: var(--muted, #8a8f98); }

/* ---------- document desk v2 ---------- */
.doc-hint { display: block; font-size: 11.5px; color: var(--muted, #8a8f98); margin: 1px 0 2px; }
.doc-due { color: #c0392b; font-weight: 700; }
.section-title { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.ok { color: var(--ok); font-weight: 700; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-note { font-size: 11px; color: var(--muted); text-align: center; margin: 18px 0 8px; }

/* ---------- hero ---------- */
.hero-card {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--blue), #0a4fc0);
  color: #fff; border-radius: var(--radius);
  padding: 18px 16px;
}
.hero-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  background: rgba(255,255,255,.18); border-radius: 6px; padding: 3px 8px;
  margin-bottom: 8px;
}
.hero-text h2 { font-size: 18px; margin-bottom: 6px; }
.hero-text p { font-size: 12.5px; opacity: .9; margin-bottom: 12px; }
.hero-flag { font-size: 44px; }

.btn-primary {
  border: none; cursor: pointer;
  background: var(--crimson); color: #fff;
  font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 10px;
}
.btn-primary.wide { width: 100%; margin-top: 14px; padding: 13px; }
.btn-ghost {
  display: block; width: 100%; margin-top: 16px;
  background: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px; color: var(--muted); font-weight: 600; cursor: pointer;
}

/* ---------- quick grid ---------- */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 14px;
}
.quick {
  border: none; cursor: pointer;
  background: var(--card); border-radius: 12px;
  padding: 12px 4px; font-size: 12px; font-weight: 600; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.quick span { font-size: 20px; }

/* ---------- visit-us ---------- */
.visit-strip {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 10px; padding: 12px 14px; text-align: left;
  background: var(--card); border: none; border-radius: var(--radius);
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.vs-ico { font-size: 22px; }
.vs-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.vs-text b { font-size: 14px; color: var(--ink); }
.vs-text small { font-size: 12px; color: var(--muted); }
.vs-caret { font-size: 20px; color: var(--muted); }
.visit-map { margin-bottom: 12px; }
.visit-map iframe {
  display: block; width: 100%; height: 230px;
  border: 0; border-radius: 12px; background: var(--bg);
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h4 { font-size: 15px; margin-bottom: 4px; }
.card p { font-size: 13.5px; color: var(--text-2); }
.card .meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.card .meta .seats { color: var(--ok); font-weight: 700; }
.card .tag {
  font-size: 10px; font-weight: 800; letter-spacing: .05em;
  color: var(--crimson); margin-bottom: 4px; display: inline-block;
}

/* ---------- explore ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--line);
}
.searchbar svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.searchbar input { border: none; outline: none; flex: 1; font-size: 14px; background: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- stepper ---------- */
.stepper { list-style: none; }
.stepper li {
  position: relative; padding: 0 0 18px 28px; font-size: 13.5px; font-weight: 600;
}
.stepper li small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.stepper li::before {
  content: ""; position: absolute; left: 6px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--line);
}
.stepper li::after {
  content: ""; position: absolute; left: 11px; top: 18px; bottom: 0;
  width: 2px; background: var(--line);
}
.stepper li:last-child::after { display: none; }
.stepper li.done::before { background: var(--ok); }
.stepper li.current::before {
  background: var(--crimson);
  box-shadow: 0 0 0 4px rgba(220,20,60,.18);
}
.stepper li.current { color: var(--crimson); }

/* ---------- social links (Me tab) ---------- */
.social-card {
  background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--radius, 14px);
  padding: 15px; margin-top: 14px;
}
.social-card h4 { margin: 0 0 10px; font-size: 14px; }
.social-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.social-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; font-size: 13px; font-weight: 800; text-decoration: none;
  border-radius: 999px; padding: 9px 15px;
}
.social-btn.fb { background: #1877F2; }
.social-btn.tt { background: #111; }
.social-btn.wa { background: #25D366; }
.social-btn:active { opacity: .85; }

/* ---------- notification center ---------- */
/* our display rules would defeat the [hidden] attribute — force it to win */
.notif-panel[hidden], .notif-backdrop[hidden], .icon-btn .badge[hidden] { display: none !important; }
.notif-backdrop { position: fixed; inset: 0; z-index: 48; background: rgba(15, 18, 25, .45); }
.notif-panel {
  position: fixed; top: calc(56px + env(safe-area-inset-top)); right: 10px; z-index: 49;
  width: min(370px, calc(100vw - 20px)); max-height: min(66vh, 520px);
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(15, 18, 25, .18);
  display: flex; flex-direction: column; overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px 11px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.notif-list { overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: none; background: none; padding: 12px 15px; border-bottom: 1px solid #f0f1f4;
  color: var(--ink); font: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:active { background: #fafbfd; }
.ni-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 6px; }
.notif-item.unread .ni-dot { background: var(--crimson); }
.notif-item.unread b { color: var(--ink); }
.ni-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ni-text b { font-size: 13.5px; }
.ni-body {
  font-size: 12.5px; color: var(--text-2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ni-text small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-empty { text-align: center; padding: 34px 24px; font-size: 30px; }
.notif-empty p { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ---------- document verification states ---------- */
.doc-ok { color: var(--ok); font-weight: 700; }
.doc-wait { color: #b9770a; font-weight: 700; }
.doc-bad { color: #c0392b; font-weight: 700; }
.doc-row.bad { border: 1.5px solid rgba(192, 57, 43, .35); border-radius: 10px; }

/* ---------- exam ticket (Track tab) ---------- */
.ticket {
  background: var(--card, #fff); border: 1.5px solid var(--line); border-radius: var(--radius, 14px);
  padding: 15px 15px 13px; margin-bottom: 12px;
}
.ticket.off { opacity: .65; }
.tk-head { display: flex; align-items: flex-start; gap: 10px; }
.tk-head h4 { font-size: 15px; margin: 0; }
.tk-head p { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.tk-level {
  margin-left: auto; flex: none; background: linear-gradient(135deg, var(--crimson), var(--blue));
  color: #fff; font-weight: 800; font-size: 13px; border-radius: 9px; padding: 6px 11px;
}
.tk-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin: 8px 0 12px; }
.tk-count { font-weight: 700; color: var(--blue); }
.tk-count.hot { color: var(--crimson); }
.tk-line { display: flex; align-items: flex-start; margin: 2px 0 10px; }
.tk-st {
  display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none;
  width: 58px; font-size: 12.5px; font-weight: 800; color: var(--muted);
}
.tk-st::first-line { line-height: 1; }
.tk-st small { font-size: 10px; font-weight: 600; text-align: center; }
.tk-st.done { color: var(--ok); }
.tk-join { flex: 1; height: 2px; background: var(--line); margin-top: 8px; }
.tk-next { font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.tk-cancel { font-size: 13px; color: var(--muted); margin: 0; }
.tk-prep { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.tk-prep-line { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.tk-prep-bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 9px; }
.tk-prep-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--crimson), var(--blue)); border-radius: 99px; }
.tk-fee { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; font-size: 13px; }
.tk-fee b { display: block; margin-bottom: 3px; font-size: 13.5px; }
.tk-fee p { color: var(--text-2); margin: 0 0 9px; line-height: 1.5; }
.tk-fee.ok { color: var(--ok); font-weight: 700; }
.tk-fee.wait { color: #b9770a; font-weight: 700; }
.tk-fee.bad b { color: #c0392b; }
.tk-pay-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-payline { cursor: pointer; }
.wa-line { display: block; text-align: center; margin-top: 12px; font-size: 13.5px; font-weight: 700; color: #128C7E; }
.jc-empty h4 { margin: 0 0 4px; }
.jc-empty p { font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
#journey-cta { margin-top: 4px; }
.noc-fold { margin-top: 16px; }
.noc-fold summary, .track-guide summary { list-style: none; cursor: pointer; }
.noc-fold summary::-webkit-details-marker, .track-guide summary::-webkit-details-marker { display: none; }
.noc-fold summary .section-title, .track-guide summary .section-title { display: inline-block; margin: 0 0 8px; }
.noc-fold summary .section-title::after, .track-guide summary .section-title::after { content: " ▸"; color: var(--muted); font-size: 12px; }
.noc-fold[open] summary .section-title::after, .track-guide[open] summary .section-title::after { content: " ▾"; }

/* the journey explainer on Track */
.track-guide { margin-bottom: 14px; }
.tg-body {
  background: var(--card, #fff); border: 1.5px solid var(--line); border-radius: var(--radius, 14px);
  padding: 15px 15px 11px; margin-top: 2px;
}
.tg-step { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.tg-step:last-of-type { border-bottom: none; }
.tg-step b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.tg-step p { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 0; }
.tg-note { font-size: 12.5px; font-weight: 700; text-align: center; margin: 10px 0 4px; }
.dest-pill[hidden] { display: none !important; }

/* ---------- checklist ---------- */
.checklist { list-style: none; }
.checklist li {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 6px; font-size: 13px;
  cursor: pointer; user-select: none;
}
.checklist li .box {
  width: 19px; height: 19px; border-radius: 6px;
  border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; color: #fff; font-size: 12px;
}
.checklist li.checked .box { background: var(--ok); border-color: var(--ok); }
.checklist li.checked { color: var(--muted); text-decoration: line-through; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--crimson), var(--blue));
  color: #fff; font-weight: 800; display: grid; place-items: center;
}
.list-card { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.list-card .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 14px; font-size: 13.5px; font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.list-card .row:last-child { border-bottom: none; }

/* ---------- TikTok-style tab bar ---------- */
.tabbar {
  display: flex; align-items: stretch;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px calc(4px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--ink); }
.tab.active span { font-weight: 800; }

/* center create/apply button — TikTok layered pill */
.tab-apply { justify-content: center; }
.plus-pill {
  position: relative; z-index: 0;
  width: 46px; height: 31px; border-radius: 9px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
}
.plus-pill svg { width: 17px; height: 17px; }
.plus-pill::before, .plus-pill::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 9px; z-index: -1;
}
.plus-pill::before { background: var(--cyan); transform: translateX(-4px); }
.plus-pill::after { background: var(--pink); transform: translateX(4px); }

/* ---------- sheet & toast ---------- */
.backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 8;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 9;
  background: var(--card); border-radius: 18px 18px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(40%); opacity: .4; } }
.sheet-grip {
  width: 42px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 2px auto 12px;
}
.sheet h3 { font-size: 16px; margin-bottom: 12px; }
.sheet label {
  display: block; font-size: 12px; font-weight: 700; color: var(--muted);
  margin-bottom: 10px;
}
.sheet select, .sheet input {
  display: block; width: 100%; margin-top: 4px;
  padding: 11px 12px; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  outline: none;
}
.toast {
  position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%);
  z-index: 10; max-width: 86%;
  background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  animation: fadein .2s ease;
  text-align: center;
}

.empty { padding: 10px 2px; }

/* ---------- v0.2: auth + booking ---------- */
.btn-sm { margin-top: 10px; padding: 8px 14px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; margin-top: 4px; }
.btn-row .btn-primary, .btn-row .btn-outline { flex: 1; padding: 11px; }
.btn-outline {
  border: 1.5px solid var(--ink); background: none; color: var(--ink);
  border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
}
#auth-card h4 { font-size: 15px; margin-bottom: 4px; }
#auth-card label {
  display: block; font-size: 12px; font-weight: 700; color: var(--muted);
  margin-bottom: 10px;
}
#auth-card input {
  display: block; width: 100%; margin-top: 4px;
  padding: 11px 12px; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  outline: none;
}
#profile-card .btn-primary.wide { margin-top: 14px; }

/* WhatsApp OTP login */
.btn-wa { background: #25D366; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-wa .wa-ic { font-size: 16px; }
.otp-sent { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.linkbtn { border: none; background: none; color: var(--blue); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline; }
.otp-input { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 10px; }
.otp-resend { margin-top: 12px; font-size: 13px; text-align: center; }
.otp-dev { margin-top: 12px; padding: 9px 12px; background: #fef3e2; color: #b9770a; border-radius: 8px; font-size: 12.5px; text-align: center; }

/* ---------- focused plan / 100% online counsellor ---------- */
.resume-banner {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--blue), #0a4fc0); color: #fff;
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px;
}
.resume-banner .rb-icon { font-size: 22px; }
.resume-banner h4 { font-size: 14px; margin: 0; }
.resume-banner p { font-size: 12px; opacity: .92; margin: 0; }
.resume-banner .rb-go { margin-left: auto; font-size: 22px; opacity: .9; }

.plan-screen {
  position: absolute; inset: 0; z-index: 7;
  background: var(--bg); display: flex; flex-direction: column;
}
.plan-screen[hidden] { display: none; }
.plan-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line);
}
.plan-back {
  border: none; background: none; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--ink); width: 30px;
}
.plan-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.plan-head-text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-head-text span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-change {
  border: 1px solid var(--line); background: none; cursor: pointer;
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.plan-progress { height: 6px; background: var(--line); }
.plan-progress-fill { height: 100%; background: var(--ok); width: 0; transition: width .3s ease; }
.plan-next {
  padding: 12px 16px; background: #eef4ff; color: var(--blue);
  font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line);
}
.plan-next small { display: block; color: var(--text-2); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.plan-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.plan-foot {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.plan-complete {
  text-align: center; padding: 18px; margin-bottom: 10px;
  background: #eafaf0; border-radius: 12px; color: var(--ok); font-weight: 700;
}

.pstep { background: var(--card); border-radius: 12px; margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line); }
.pstep-head { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; }
.pstep-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--line); color: var(--text-2);
}
.pstep.done .pstep-dot { background: var(--ok); color: #fff; }
.pstep.current .pstep-dot { background: var(--crimson); color: #fff; box-shadow: 0 0 0 4px rgba(220,20,60,.18); }
.pstep-ttl { flex: 1; font-size: 13.5px; font-weight: 600; }
.pstep.done .pstep-ttl { color: var(--text-2); }
.pstep.locked .pstep-head { opacity: .55; }
.pstep-chev { color: var(--muted); font-size: 11px; }
.pstep-body { padding: 0 14px 14px 52px; font-size: 13px; color: var(--text-2); }
.pstep-body .what { margin-bottom: 8px; line-height: 1.5; }
.pstep-body .do { color: var(--ink); font-weight: 600; margin-bottom: 10px; }
.pstep-body .checklist { margin: 4px 0 10px; }
.pstep-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pstep-cta { border: none; cursor: pointer; background: var(--crimson); color: #fff; font-weight: 700; font-size: 12.5px; padding: 8px 14px; border-radius: 9px; }
.pstep-done-btn { border: 1px solid var(--ok); cursor: pointer; background: none; color: var(--ok); font-weight: 700; font-size: 12.5px; padding: 8px 14px; border-radius: 9px; }

/* document upload list */
.doc-list { margin: 4px 0 12px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.doc-meta { display: block; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row.has .doc-meta { color: var(--ok); font-weight: 600; }
.doc-btn { flex: none; cursor: pointer; border: 1px solid var(--crimson); color: var(--crimson); font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 8px; }
.doc-row.has .doc-btn { border-color: var(--line); color: var(--text-2); }
.doc-login { font-size: 12.5px; color: var(--text-2); }
.doc-login .pstep-cta { margin-top: 8px; }

/* Visa Readiness Agent card */
.agent-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.agent-emoji { font-size: 18px; }
.agent-head strong { font-size: 14px; flex: 1; }
.agent-band { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.agent-band.ok { background: #eafaf0; color: var(--ok); }
.agent-band.warn { background: #fef3e2; color: #b9770a; }
.agent-band.risk { background: #fdecec; color: #c0392b; }
.agent-score { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.agent-pct { font-size: 30px; font-weight: 800; line-height: 1; }
.agent-pct span { font-size: 15px; font-weight: 700; color: var(--muted); }
.agent-bar { flex: 1; height: 9px; border-radius: 999px; background: var(--line); overflow: hidden; }
.agent-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.agent-fill.ok { background: var(--ok); }
.agent-fill.warn { background: #e8951b; }
.agent-fill.risk { background: #d8453c; }
.agent-sub { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.agent-factors { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.afactor { display: flex; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.afactor:last-child { border-bottom: none; }
.af-ic { font-size: 14px; flex: none; line-height: 1.3; }
.af-text { display: flex; flex-direction: column; }
.af-label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.afactor.ok .af-label { color: var(--text-2); font-weight: 500; }
.af-fix { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.agent-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.agent-note .pstep-cta { margin-top: 8px; }

/* File Coach (friendly student view of the readiness engine) */
.coach-count {
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  background: #eafaf0; color: var(--ok); white-space: nowrap;
}
.coach-todos { margin-top: 4px; }
.coach-next { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 6px; }
.coach-todo {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--bg); border-radius: 10px; padding: 9px 11px; margin-bottom: 6px;
}
.coach-todo b { font-size: 13px; display: block; }
.coach-todo small { font-size: 12px; color: var(--text-2); line-height: 1.4; display: block; margin-top: 1px; }

/* exam result step (the journey gate) */
.res-form { display: grid; gap: 8px; margin-top: 10px; }
.res-form label { font-size: 11px; font-weight: 700; color: var(--muted); display: block; }
.res-form input, .res-form select {
  width: 100%; margin-top: 3px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: var(--card); color: var(--ink); font-family: inherit;
}
.res-note { border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin-top: 8px; }
.res-note.ok { background: #eafaf0; }
.res-note.wait { background: #fef3e2; }
.res-note.support { background: #eef2fb; }
.res-note.bad { background: #fdecec; }
.pstep-cta.ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); margin-top: 8px; }

/* referral card (Me tab) */
.ref-card {
  background: linear-gradient(135deg, var(--crimson), var(--blue));
  border-radius: var(--radius); padding: 16px; margin: 14px 0;
  color: #fff;
}
.ref-head { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.ref-sub { font-size: 12.5px; line-height: 1.5; color: rgba(255,255,255,.88); margin-bottom: 12px; }
.ref-link {
  background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.4);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px;
  word-break: break-all; color: #fff;
}
.ref-btns { display: flex; gap: 8px; }
.ref-btn {
  flex: 1; border: 1px solid rgba(255,255,255,.5); border-radius: 10px;
  background: rgba(255,255,255,.14); color: #fff;
  padding: 10px 8px; font-size: 13px; font-weight: 800; cursor: pointer;
  font-family: inherit;
}
.ref-btn.solid { background: #fff; color: var(--crimson); border-color: #fff; }
.ref-btn:active { transform: scale(.97); }
.ref-count { font-size: 12.5px; font-weight: 700; margin-top: 10px; color: #FFD98E; }

/* document preview lightbox */
.doc-lightbox {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(10, 12, 18, .92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.doc-lightbox[hidden] { display: none; }
.doc-lightbox img {
  max-width: 100%; max-height: 90vh;
  border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
  object-fit: contain;
}
.dl-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  width: 38px; height: 38px; border-radius: 999px; border: none;
  background: rgba(255,255,255,.14); color: #fff; font-size: 17px; font-weight: 700;
  cursor: pointer;
}
.doc-view-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; margin-right: 6px; font-family: inherit;
}

/* course card buttons */
.card-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* home revision promo */
.rev-promo {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  background: linear-gradient(135deg, #6b21a8, #9333ea); color: #fff;
  border-radius: var(--radius); padding: 14px 16px;
}
.rev-promo-text { flex: 1; }
.rev-promo-text h3 { font-size: 15px; margin: 6px 0 4px; }
.rev-promo-text p { font-size: 12px; opacity: .92; }
.rev-promo-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.rev-promo-btns .btn-outline { border-color: #fff; color: #fff; }

/* revision study screen */
.rev-screen { position: absolute; inset: 0; z-index: 8; background: var(--bg); display: flex; flex-direction: column; }
.rev-screen[hidden] { display: none; }
.rev-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.rev-back { border: none; background: none; cursor: pointer; font-size: 26px; line-height: 1; color: var(--ink); width: 30px; }
.rev-head { display: flex; flex-direction: column; min-width: 0; }
.rev-head strong { font-size: 15px; }
.rev-head span { font-size: 11.5px; color: var(--text-2); }
.rev-controls { padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.rev-levels, .rev-cats, .rev-modes { display: flex; gap: 6px; }
.rev-controls button {
  flex: 1; border: 1px solid var(--line); background: var(--bg); cursor: pointer;
  border-radius: 8px; padding: 8px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.rev-controls .rev-levels button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.rev-controls .rev-cats button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.rev-controls .rev-modes button.active { background: #6b21a8; color: #fff; border-color: #6b21a8; }
.rev-cats button, .rev-modes button { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2; }
.rev-cats button small, .rev-modes button small { font-size: 10px; font-weight: 600; opacity: .8; }
.rev-lang { display: flex; gap: 6px; }
.rev-lang button { flex: 1; font-size: 12px; padding: 6px; }
.rev-lang button.active { background: #0f6e56; color: #fff; border-color: #0f6e56; }

.rev-audio { border: none; background: none; cursor: pointer; font-size: 18px; padding: 0 4px; line-height: 1; vertical-align: middle; }
.rev-front-audio { margin-top: 10px; }
.rev-front-audio .rev-audio { font-size: 26px; }

.rev-testbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.rev-timer { background: #6b21a8; color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.rev-timer-done { font-size: 18px; font-weight: 700; color: #6b21a8; margin-bottom: 8px; }

.rev-weakbar { width: 100%; }
.rev-weak-btn {
  width: 100%; border: 1px solid #e8951b; background: #fef3e2; color: #b9770a;
  cursor: pointer; border-radius: 8px; padding: 9px 10px; font-size: 12.5px; font-weight: 700;
}
.rev-weak-btn.active { background: #e8951b; color: #fff; border-color: #e8951b; }

.rev-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }
.rev-progress { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; text-align: center; }

.rev-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  min-height: 200px; padding: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.rev-card.flipped { border-color: var(--blue); }
.rev-front { font-size: 52px; font-weight: 700; line-height: 1.2; }
.rev-tap { font-size: 11px; color: var(--muted); margin-top: 14px; }
.rev-reading { font-size: 26px; font-weight: 700; }
.rev-romaji { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.rev-mean { font-size: 18px; font-weight: 600; margin-top: 10px; color: var(--blue); }
.rev-ex { font-size: 18px; margin-top: 12px; }
.rev-exen { font-size: 13px; color: var(--text-2); margin-top: 4px; }

.rev-nav { display: flex; gap: 8px; margin-top: 14px; }
.rev-nav button { flex: 1; border: 1px solid var(--line); background: var(--card); cursor: pointer; border-radius: 10px; padding: 11px 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.rev-nav #rev-known.on { background: #eafaf0; border-color: var(--ok); color: var(--ok); }

.rev-q { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px; text-align: center; font-size: 46px; font-weight: 700; margin-bottom: 14px; }
.rev-qsub { display: block; font-size: 15px; font-weight: 400; color: var(--text-2); margin-top: 8px; }
.rev-opts { display: flex; flex-direction: column; gap: 8px; }
.rev-opt { border: 1px solid var(--line); background: var(--card); cursor: pointer; border-radius: 10px; padding: 13px; font-size: 14px; font-weight: 600; color: var(--ink); text-align: left; }
.rev-opt.correct { background: #eafaf0; border-color: var(--ok); color: var(--ok); }
.rev-opt.wrong { background: #fdecec; border-color: #d8453c; color: #c0392b; }
.rev-result { text-align: center; padding: 30px 16px; }
.rev-score { font-size: 44px; font-weight: 800; color: var(--blue); }
.rev-result p { font-size: 14px; color: var(--text-2); margin: 8px 0 18px; }
.rev-empty { text-align: center; color: var(--muted); padding: 30px; }

/* ============ JLPT N5 FULL COURSE ============ */
.crs-progress { height: 6px; background: var(--line); flex: none; }
.crs-progress-fill { height: 100%; background: var(--ok); width: 0; transition: width .3s ease; }
.crs-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }
.crs-hint { font-size: 12px; color: var(--text-2); margin: 0 0 10px; text-align: center; }
.crs-book { font-size: 12px; color: var(--text-2); margin: 0 0 12px; text-align: center; background: var(--surface-2, rgba(125,125,125,.08)); border-radius: 10px; padding: 8px 10px; }
.crs-h4 { font-size: 13px; margin: 14px 0 8px; }
.crs-h4 small { color: var(--text-2); font-weight: 400; }

.crs-kana-row { display: flex; gap: 10px; margin-bottom: 10px; }
.crs-kana-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); cursor: pointer; font-size: 13px;
}
.crs-kana-big { font-size: 34px; line-height: 1.1; }
.crs-kana-card small { font-size: 10.5px; color: var(--text-2); }

/* official exam-section skill cards */
.crs-skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.crs-skill-card {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer;
}
.crs-skill-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.crs-skill-card.done { border-color: var(--ok); }
.crs-skill-icon { font-size: 20px; flex: none; }
.crs-skill-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crs-skill-text strong { font-size: 12px; }
.crs-skill-text small { font-size: 10px; color: var(--text-2); }
.crs-skill-best { font-size: 11px; font-weight: 700; color: var(--text-2); flex: none; }
.crs-skill-card.done .crs-skill-best { color: var(--ok); }
.crs-group-h { margin: 16px 2px 2px; }

/* listening drill: big replay button, no text shown */
.crs-q-listen { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crs-listen-big {
  font-size: 38px; width: 88px; height: 88px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--card); cursor: pointer;
}
/* reading drill: sentence-sized question, wraps */
.crs-q-read { font-size: 21px; line-height: 1.55; }

/* IELTS writing practice (real Task 1 / Task 2 writing room) */
.crs-writ-prompt {
  padding: 12px; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 10px; background: var(--card); font-size: 13.5px; line-height: 1.55; margin-bottom: 10px;
}
.crs-writ-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 12.5px; }
.crs-writ-table caption { caption-side: top; text-align: left; font-weight: 700; font-size: 12px; padding: 0 0 6px 2px; color: var(--text-2); }
.crs-writ-table th, .crs-writ-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.crs-writ-table tr:first-child th { background: var(--card); }
.crs-writ-table td { font-variant-numeric: tabular-nums; }
.crs-writ-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#crs-writ-wc { font-size: 12px; font-weight: 700; color: var(--text-2); }
#crs-writ-wc.ok { color: var(--ok); }
.crs-writ-timeup { color: #dc2626; border-color: #dc2626; }
.crs-writ-ta {
  width: 100%; min-height: 260px; resize: vertical; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: inherit;
  font: inherit; font-size: 14px; line-height: 1.6; margin-bottom: 10px;
}
.crs-writ-ta:focus { outline: none; border-color: var(--brand); }
.crs-writ-score { text-align: center; margin: 6px 0 12px; display: flex; flex-direction: column; }
.crs-writ-score span { font-size: 42px; font-weight: 800; }
.crs-writ-score.pass span { color: var(--ok); }
.crs-writ-score small { font-size: 11px; color: var(--text-2); }
.crs-writ-chk {
  display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 12.5px; line-height: 1.45;
}
.crs-writ-chk.ok { border-color: var(--ok); }
.crs-writ-chk.no { border-color: #dc2626; }
.crs-writ-chk.self { cursor: pointer; }
.crs-writ-chk.self input { margin-top: 2px; accent-color: var(--ok); }
.crs-writ-found { font-size: 11.5px; color: var(--text-2); margin: 2px 2px 10px; line-height: 1.5; }
.crs-writ-model { margin: 10px 0; }
.crs-writ-model summary {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: 13px; font-weight: 700; cursor: pointer;
}
.crs-writ-modeltext { padding: 10px 12px; font-size: 13.5px; line-height: 1.6; }
.crs-writ-modeltext p { margin: 0 0 10px; }

.crs-mock {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px; margin-bottom: 12px; border: 1px solid #6b21a8; border-radius: 14px;
  background: #6b21a8; color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
}
.crs-mock small { font-size: 11px; font-weight: 500; opacity: .9; }

.crs-list { display: flex; flex-direction: column; gap: 8px; }
.crs-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer;
}
.crs-row.done { border-color: var(--ok); }
.crs-row-icon { font-size: 22px; flex: none; }
.crs-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crs-row-text strong { font-size: 13.5px; }
.crs-row-text small { font-size: 11px; color: var(--text-2); }
.crs-row-mark { flex: none; font-size: 14px; font-weight: 700; color: var(--ok); }

.crs-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.crs-cell {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 8px 2px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer;
}
.crs-cell span { font-size: 20px; line-height: 1.2; }
.crs-cell small { font-size: 9.5px; color: var(--text-2); }
.crs-body .btn-primary.wide { margin-top: 14px; }

.crs-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.crs-tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: 12.5px; line-height: 1.2;
}
.crs-tabs button small { font-size: 10px; color: var(--text-2); }
.crs-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.crs-tabs button.active small { color: #eee; }

.crs-items { display: flex; flex-direction: column; gap: 8px; }
.crs-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.crs-item-jp { font-size: 18px; font-weight: 700; }
.crs-item-kana { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.crs-item-roma { font-size: 11.5px; color: var(--muted); }
.crs-item-mean { font-size: 13px; color: var(--blue); font-weight: 600; margin-top: 2px; }
.crs-item-ex { font-size: 14px; margin-top: 6px; }
.crs-item-ex small { display: block; font-size: 11.5px; color: var(--text-2); }
.crs-note-body { font-size: 14px; line-height: 1.6; margin-top: 6px; color: var(--text-2); }
.crs-note-body b { color: var(--ink); }
.crs-audio { border: none; background: none; cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; vertical-align: middle; }
.crs-passed { text-align: center; font-size: 13px; font-weight: 700; color: var(--ok); margin-top: 10px; }

.crs-qbar { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; text-align: center; }
.crs-q {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 24px 14px; text-align: center; font-size: 34px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 12px;
}
.crs-qsub { font-size: 15px; font-weight: 500; color: var(--text-2); }
.crs-opts { display: flex; flex-direction: column; gap: 8px; }
.crs-opt {
  padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer; font-size: 13.5px; text-align: left;
}
.crs-opt.correct { border-color: var(--ok); background: #e8f7ef; }
.crs-opt.wrong { border-color: #d33; background: #fdeaea; }

.crs-result { text-align: center; padding-top: 30px; }
.crs-score { font-size: 52px; font-weight: 800; color: #d33; }
.crs-score.pass { color: var(--ok); }
.crs-verdict { font-size: 14px; margin: 10px 0 18px; }
.crs-result .btn-ghost.wide { width: 100%; margin-top: 8px; }

/* course level switch (N5 / N4) */
.crs-levels { display: flex; gap: 6px; margin-bottom: 10px; }
.crs-levels button {
  flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: 13px; font-weight: 700;
}
.crs-levels button.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- counsellor chat (live support) ---------- */
.quick { position: relative; }
#counsel-badge { top: 6px; right: 6px; }

.chat-panel {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.chat-panel[hidden] { display: none !important; }

.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  padding-left: calc(8px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
  background: linear-gradient(135deg, var(--crimson), #b01030);
  color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.chat-back {
  border: none; background: none; color: #fff;
  font-size: 30px; line-height: 1; padding: 0 6px; cursor: pointer;
}
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-who strong { font-size: 15px; display: block; }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: grid; place-items: center;
  font-weight: 800; font-size: 13px; flex: none;
}
.chat-sub { font-size: 11.5px; opacity: .85; }

.chat-log {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 8px;
}
.chat-empty {
  margin: auto; text-align: center; color: var(--muted);
  font-size: 13px; max-width: 240px; line-height: 1.5;
}
.cmsg { max-width: 78%; display: flex; flex-direction: column; }
.cmsg.them { align-self: flex-start; align-items: flex-start; }
.cmsg.me { align-self: flex-end; align-items: flex-end; }
.cmsg .bubble {
  padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  word-wrap: break-word; white-space: pre-wrap;
}
.cmsg.them .bubble {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-bottom-left-radius: 4px;
}
.cmsg.me .bubble {
  background: var(--crimson); color: #fff; border-bottom-right-radius: 4px;
}
.cmsg.me.pending .bubble { opacity: .6; }
.cmsg .cmeta { font-size: 10px; color: var(--muted); margin: 2px 4px 0; }
/* AI auto-reply bubbles: counsellor side, dashed edge + label = clearly a bot */
.cmsg.ai .bubble { border-style: dashed; }
.ai-tag { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 3px; letter-spacing: .2px; }

.chat-compose {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  padding-left: calc(12px + env(safe-area-inset-left));
  padding-right: calc(12px + env(safe-area-inset-right));
  background: var(--card); border-top: 1px solid var(--line);
}
/* min-width:0 lets the field shrink — without it the input keeps its intrinsic
 * width and shoves the 🎤 / send buttons off a narrow phone screen */
#chat-input {
  flex: 1 1 auto; min-width: 0; width: 100%;
  border: 1px solid var(--line); border-radius: 22px;
  padding: 10px 14px; font-size: 14px; background: var(--bg); color: var(--ink);
  outline: none;
}
#chat-input:focus { border-color: var(--crimson); }
.chat-send {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: var(--crimson); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.chat-send svg { width: 20px; height: 20px; }
.chat-send:disabled { opacity: .5; cursor: default; }

/* attach buttons (photo / mic) in the compose row */
.chat-attach {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: none; font-size: 20px; cursor: pointer;
  display: grid; place-items: center; color: var(--ink);
}
.chat-attach:active { background: var(--line); }
.chat-attach.recording { background: #fdecec; animation: recpulse 1s infinite; }

/* reply-to context bar above the compose row */
.chat-replybar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--card); border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.chat-replybar[hidden] { display: none !important; }
.chat-replybar .crb-ico { flex: none; color: var(--crimson); font-size: 15px; }
.chat-replybar .crb-text {
  flex: 1 1 auto; min-width: 0; line-height: 1.35;
  border-left: 3px solid var(--crimson); padding-left: 8px;
}
.chat-replybar .crb-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-replybar b { display: block; color: var(--ink); font-size: 12px; }
#crb-cancel { flex: none; }
#crb-cancel {
  border: none; background: none; font-size: 20px; color: var(--muted);
  cursor: pointer; padding: 0 4px; line-height: 1;
}

/* voice recording bar */
.chat-recbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--card); border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink);
}
.chat-recbar[hidden] { display: none !important; }
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #e11d48;
  animation: recpulse 1s infinite;
}
@keyframes recpulse { 50% { opacity: .3; } }
.rec-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 16px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.rec-btn.rec-go { background: var(--crimson); color: #fff; border-color: var(--crimson); margin-left: auto; }

/* quoted message block inside a bubble — wraps to 2 lines instead of running
 * under the bubble edge, and never inherits the bubble's pre-wrap */
.cquote {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: none; border-left: 3px solid rgba(255,255,255,.65);
  background: rgba(0,0,0,.14); color: inherit;
  border-radius: 8px; padding: 5px 8px; margin: 0 0 6px;
  font-family: inherit; font-size: 12px; line-height: 1.35; opacity: .92;
  overflow: hidden;
}
.cmsg.them .cquote { border-left-color: var(--crimson); background: rgba(0,0,0,.05); }
.cquote b { display: block; font-size: 11px; margin-bottom: 1px; }
.cquote span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal; overflow-wrap: anywhere;
}

/* photo message */
.cimg { border-radius: 10px; overflow: hidden; margin: 0 -4px 4px; }
.cimg:only-child { margin-bottom: -2px; }
.cimg img { display: block; max-width: 100%; max-height: 260px; cursor: zoom-in; }
.cimg-ph {
  min-width: 140px; min-height: 90px; display: grid; place-items: center;
  font-size: 12px; color: var(--muted); background: rgba(0,0,0,.08);
}

/* voice message */
.cvoice audio { display: block; width: 210px; max-width: 100%; height: 36px; }
.cvoice-ph { font-size: 12px; opacity: .8; }

/* reply affordance in the meta row */
.creply {
  border: none; background: none; color: var(--muted); font-size: 10px;
  cursor: pointer; padding: 0 2px;
}

/* flash the original when a quote is tapped */
/* outline-offset keeps the ring inside the bubble so it can't paint over the
 * neighbouring message */
.cmsg.flash .bubble { outline: 2px solid var(--crimson); outline-offset: -2px; transition: outline-color .2s; }

/* full-size photo overlay */
.cimg-overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92);
  display: grid; place-items: center; cursor: zoom-out;
}
.cimg-overlay img { max-width: 96vw; max-height: 92vh; }

/* AI SOP Writer overlay */
.sop-panel { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); }
.sop-panel[hidden] { display: none !important; }
.sop-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(135deg, var(--blue), #0a4fc0); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.sop-head strong { font-size: 15px; display: block; }
.sop-head .chat-sub { color: #fff; opacity: .85; }
.sop-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sop-l { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.sop-l input, .sop-l textarea {
  display: block; width: 100%; margin-top: 5px; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--card); color: var(--ink); font-size: 14px; box-sizing: border-box;
}
.sop-l input:focus, .sop-l textarea:focus { outline: none; border-color: var(--blue); }
#sop-text {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 14px; line-height: 1.55; background: var(--card); color: var(--ink);
  font-family: inherit; resize: vertical;
}
.sop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sop-actions button { margin-top: 0; flex: 1; min-width: 46%; }
.sop-generating { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 10px; }
.sop-st { border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.sop-st.wait { background: #fef3e2; color: #b9770a; }
.sop-st.ok { background: #eafaf0; color: var(--ok); }
.sop-st.bad { background: #fdecec; color: var(--crimson); }
.sop-promo { background: linear-gradient(135deg, var(--blue), #0a4fc0); }

/* AI document pre-check line on doc cards */
.doc-ai { display: block; font-size: 11.5px; font-weight: 600; margin-top: 3px; line-height: 1.35; }
.doc-ai.checking { color: var(--muted); }
.doc-ai.ok { color: var(--ok); }
.doc-ai.warn { color: #b9770a; }
.doc-ai.bad { color: var(--crimson); }

/* fast lane: the single scanned "WhatsApp" PDF that holds every document */
.doc-fastlane {
  border: 1.5px solid var(--blue); border-radius: 12px;
  background: linear-gradient(135deg, #f2f7ff, #fdf3f5);
  padding: 10px 12px 4px; margin-bottom: 10px;
}
.doc-fastlane-note { font-size: 12.5px; line-height: 1.45; margin-bottom: 6px; }
.doc-fastlane-ne { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.doc-fastlane .doc-row { border: 0; background: transparent; padding-left: 0; padding-right: 0; }
.doc-fastlane-or { text-align: center; color: var(--muted); font-size: 11.5px; padding: 6px 0 8px; }

/* ===== Home announcement ticker (news-channel style) ===== */
.news-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--crimson), #a30f2d);
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.ticker-label {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}
.ticker-viewport {
  flex: 1 1 auto;
  overflow: hidden;
  /* fade the text in/out at the edges like a real news strip */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll 48s linear infinite;
}
.ticker-item {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding-right: 48px; /* gap between the loop copies */
}
.ticker-sep {
  display: inline-block;
  padding: 0 16px;
  opacity: 0.7;
}
/* track holds 2 identical copies → -50% lands exactly on copy #2 = seamless loop */
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.news-ticker:hover .ticker-track,
.news-ticker:active .ticker-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-viewport { -webkit-mask-image: none; mask-image: none; }
  .ticker-item { white-space: normal; }
  .ticker-item[aria-hidden="true"] { display: none; }
}

/* ===== Gmail document lane (docs section) ===== */
.doc-email {
  border: 1.5px dashed var(--blue); border-radius: 12px;
  background: #f7fbff;
  padding: 10px 12px; margin-top: 10px;
}
.doc-email-note { font-size: 12.5px; line-height: 1.45; }
.doc-email-ne { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.doc-email-addr {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fff; border: 1px solid #dbe7f5; border-radius: 8px;
  padding: 7px 10px; margin: 8px 0;
  font-weight: 600; font-size: 13px; word-break: break-all;
}
.doc-email-copy {
  border: 1px solid var(--blue); color: var(--blue); background: #fff;
  border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  flex-shrink: 0; cursor: pointer;
}
.doc-email-btn {
  display: block; text-align: center; text-decoration: none;
  background: var(--blue); color: #fff; border-radius: 9px;
  padding: 9px 12px; font-weight: 700; font-size: 13.5px;
}
.doc-email-hint { color: var(--muted); font-size: 11.5px; margin-top: 6px; text-align: center; }

/* ============ Friday weekly mock exam (exam.js) ============ */
.wexam-bar { display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
#wexam-timer { font-variant-numeric: tabular-nums; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
#wexam-timer.low { color: #fff; background: var(--crimson); border-color: var(--crimson);
  animation: wexam-pulse 1s infinite; }
@keyframes wexam-pulse { 50% { opacity: .55; } }
.wexam-sec { font-size: 12.5px; font-weight: 800; letter-spacing: .03em;
  color: var(--blue); margin: 4px 0 10px; text-transform: uppercase; }
.wexam-opt.picked { border-color: var(--blue); background: #eaf0fb; font-weight: 700; }
.wexam-nav { display: flex; gap: 10px; margin-top: 14px; }
.wexam-nav button { flex: 1; }
.wexam-intro { text-align: center; padding-top: 8px; }
.wexam-intro-icon { font-size: 44px; margin-bottom: 6px; }
.wexam-rules { text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 14px 0; display: grid; gap: 9px;
  font-size: 13.5px; }
.wexam-row { position: relative; }
.wexam-chip { font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.wexam-chip.done { background: #e8f7ef; color: var(--ok); }
.wexam-chip.take { background: var(--crimson); color: #fff; }
.wexam-chip.live { background: #fff4e5; color: #b45309; }
.wexam-chip.closed { background: var(--line); color: var(--muted); }
.wexam-home-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wexam-home-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--card); border-radius: 999px; padding: 7px 11px; font-size: 13px;
  font-weight: 700; cursor: pointer; }
.wexam-boardbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 14px 0; text-align: left; }
.wexam-boardbox h4 { font-size: 13px; margin-bottom: 8px; }
.wexam-boardrow { display: flex; align-items: center; gap: 10px; padding: 6px 2px;
  font-size: 13.5px; border-top: 1px solid var(--line); }
.wexam-boardrow:first-of-type { border-top: 0; }
.wexam-boardrow span:first-child { width: 26px; text-align: center; font-weight: 800; }
.wexam-boardrow span:nth-child(2) { flex: 1; }
.wexam-boardrow.me { background: #eaf0fb; border-radius: 8px; }
.wexam-rev { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; margin-bottom: 9px; font-size: 13.5px; }
.wexam-rev-q { font-weight: 700; margin-bottom: 5px; }
.wexam-rev-a { color: var(--ok); }
.wexam-rev-w { color: var(--crimson); }

/* ---------- community feed (Feed tab — ported from PlayVibe; feed.js) ---------- */
.fd-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; }
.fd-card.fd-pending { border-style: dashed; }
.fd-head { display: flex; align-items: center; gap: 10px; }
.fd-avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--blue);
  color: #fff; font-weight: 800; font-size: 16px; display: inline-flex; align-items: center;
  justify-content: center; overflow: hidden; }
.fd-avatar-sm { width: 28px; height: 28px; font-size: 12.5px; }
.fd-avatar-official { background: #fff; border: 1px solid var(--line); }
.fd-avatar-official img { width: 100%; height: 100%; object-fit: cover; }
.fd-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.fd-who strong { font-size: 14.5px; }
.fd-time { color: var(--muted); font-size: 12px; }
.fd-badge { font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.fd-badge-official { background: #eaf0fb; color: var(--blue); }
.fd-badge-pin { background: #fff4e5; color: #b45309; }
.fd-badge-wait { background: var(--line); color: var(--text-2); }
.fd-content { margin: 10px 0 0; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: break-word; }
.fd-media { margin: 10px -14px 0; background: #f0f1f5; text-align: center; }
.fd-media img { max-width: 100%; max-height: 420px; display: inline-block; cursor: zoom-in; }
/* ---- reaction summary: overlapping ringed badges + count (Facebook style) ---- */
.fd-sum { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12.5px; color: var(--text-2); }
.fd-sum-stack { display: inline-flex; align-items: center; }
.fd-sum-stack span { width: 19px; height: 19px; border-radius: 50%; background: var(--card);
  box-shadow: 0 0 0 1.5px var(--card), 0 1px 2px rgba(0,0,0,.18); display: inline-flex;
  align-items: center; justify-content: center; font-size: 11.5px; line-height: 1;
  margin-right: -5px; z-index: calc(9 - var(--s, 0)); }
.fd-sum-stack span:last-child { margin-right: 3px; }
.fd-sum-total { font-weight: 600; }
.fd-sum.fd-bump .fd-sum-stack span { animation: fd-badge-in .34s cubic-bezier(.2,1.5,.5,1) backwards;
  animation-delay: calc(var(--s, 0) * 45ms); }
.fd-sum.fd-bump .fd-sum-total { animation: fd-count-bump .32s ease; }
@keyframes fd-badge-in { from { transform: scale(0) translateY(4px); } to { transform: scale(1) translateY(0); } }
@keyframes fd-count-bump { 40% { transform: translateY(-3px); } 100% { transform: translateY(0); } }

/* ---- action row ---- */
.fd-actions { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.fd-act { flex: 1; border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--text-2); padding: 7px 4px; border-radius: 9px; cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease; }
.fd-act:active { background: var(--bg); }
.fd-act.on { color: var(--blue); }
/* the active reaction tints the button its own colour, the way Facebook does */
/* --re is set on the CARD, not the button, so the picker (a sibling of the
 * button) inherits the same colour for the selected-reaction ring */
.fd-card { --re: var(--blue); }
.fd-card[data-my="like"]  { --re: #1877f2; }
.fd-card[data-my="love"]  { --re: #f3425f; }
.fd-card[data-my="haha"],
.fd-card[data-my="wow"],
.fd-card[data-my="sad"]   { --re: #e0a325; }
.fd-card[data-my="angry"] { --re: #e9710f; }
.fd-react-btn.on { color: var(--re); }
.fd-react-btn { position: relative; }
.fd-react-btn .fd-react-face { display: inline-block; position: relative; font-size: 15px; }
.fd-react-btn.pressing { transform: scale(.93); background: var(--bg); }
.fd-react-btn.fd-pop .fd-react-face { animation: fd-face-pop .42s cubic-bezier(.2,1.6,.45,1); }
/* a ring snaps outward from the emoji the moment a reaction lands */
.fd-react-btn.fd-pop .fd-react-face::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
  margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid var(--re);
  pointer-events: none; animation: fd-ring .52s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes fd-ring {
  0%   { transform: scale(.35); opacity: .9; border-width: 2px; }
  100% { transform: scale(3.6); opacity: 0; border-width: .5px; }
}
.fd-react-btn.fd-pop .fd-react-label { animation: fd-label-in .3s ease; }
@keyframes fd-face-pop {
  0% { transform: scale(0) rotate(-25deg); }
  60% { transform: scale(1.35) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes fd-label-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- the picker bar ---- */
.fd-react-host { position: relative; flex: 1; display: flex; }
.fd-react-host .fd-act { flex: 1; }
.fd-picker {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 20;
  display: flex; align-items: flex-end; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 7px;
  box-shadow: 0 8px 26px rgba(0,0,0,.20), 0 2px 6px rgba(0,0,0,.08);
  transform-origin: 22% bottom;
  /* closed state — springs open on .open */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(.55) translateY(14px);
  transition: transform .16s cubic-bezier(.4,0,.6,1), opacity .14s ease, visibility 0s linear .16s;
}
.fd-picker.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: scale(1) translateY(0);
  transition: transform .30s cubic-bezier(.18,1.42,.44,1), opacity .16s ease, visibility 0s;
}
.fd-picker button {
  position: relative; border: 0; background: none; line-height: 1; padding: 2px;
  cursor: pointer; transform-origin: 50% 100%;
  transform: scale(.2) translateY(10px); opacity: 0;
  transition: transform .26s cubic-bezier(.2,1.55,.45,1), opacity .18s ease;
}
.fd-picker.open button {
  transform: scale(1) translateY(0); opacity: 1;
  /* stagger — each emoji lands ~34ms after the one before it */
  transition-delay: calc(var(--i, 0) * 34ms);
}
.fd-re-glyph { display: block; font-size: 30px; line-height: 1; will-change: transform; }

/* ---- each emoji gets its own performance --------------------------------
 * Facebook's reactions are animated icons, not glyphs, which is why a single
 * shared bob reads cheap. The button owns the magnify transform and the glyph
 * owns the personality, so the two never fight over `transform`.
 * The durations are deliberately co-prime-ish: they drift out of phase within a
 * second or two, so the bar keeps breathing instead of pulsing as one block. */
.fd-picker.open button[data-re="like"]  .fd-re-glyph { animation: fd-a-like  2.40s ease-in-out infinite; }
.fd-picker.open button[data-re="love"]  .fd-re-glyph { animation: fd-a-love  1.70s ease-in-out infinite; }
.fd-picker.open button[data-re="haha"]  .fd-re-glyph { animation: fd-a-haha  1.90s ease-in-out infinite; }
.fd-picker.open button[data-re="wow"]   .fd-re-glyph { animation: fd-a-wow   2.70s ease-in-out infinite; }
.fd-picker.open button[data-re="sad"]   .fd-re-glyph { animation: fd-a-sad   3.10s ease-in-out infinite; }
.fd-picker.open button[data-re="angry"] .fd-re-glyph { animation: fd-a-angry 1.45s ease-in-out infinite; }
/* Hold each one still until the bar has finished springing open. Needs the
 * [data-re] to match the specificity of the six rules above — the `animation`
 * shorthand there resets animation-delay, so a weaker selector loses it. */
.fd-picker.open button[data-re] .fd-re-glyph { animation-delay: calc(.30s + var(--i, 0) * 70ms); }

@keyframes fd-a-like {   /* thumb thrusts up, then settles */
  0%, 60%, 100% { transform: translateY(0) rotate(0deg); }
  70%           { transform: translateY(-5px) rotate(-15deg); }
  80%           { transform: translateY(-1px) rotate(-4deg); }
}
@keyframes fd-a-love {   /* two-beat heartbeat */
  0%, 52%, 100% { transform: scale(1); }
  60%           { transform: scale(1.24); }
  68%           { transform: scale(1); }
  76%           { transform: scale(1.13); }
}
@keyframes fd-a-haha {   /* rocking back and forth laughing */
  0%, 100% { transform: rotate(0deg) translateY(0); }
  18%      { transform: rotate(-14deg) translateY(-2px); }
  38%      { transform: rotate(12deg) translateY(-5px); }
  58%      { transform: rotate(-9deg) translateY(-2px); }
  78%      { transform: rotate(5deg) translateY(-1px); }
}
@keyframes fd-a-wow {    /* a slow gasp */
  0%, 42%, 100% { transform: scale(1) translateY(0); }
  66%           { transform: scale(1.18) translateY(-4px); }
}
@keyframes fd-a-sad {    /* droops, then lifts again */
  0%, 38%, 100% { transform: translateY(0) rotate(0deg); }
  64%           { transform: translateY(3px) rotate(-8deg); }
}
@keyframes fd-a-angry {  /* seething shake */
  0%, 58%, 100% { transform: translateX(0) scale(1); }
  64%           { transform: translateX(-2.5px) scale(1.06); }
  70%           { transform: translateX(2.5px) scale(1.06); }
  76%           { transform: translateX(-2px) scale(1.04); }
  82%           { transform: translateX(1.5px) scale(1.02); }
}

/* magnify the aimed emoji, and lift its neighbours a little — the Facebook falloff */
/* transition-delay must be cleared here or the stagger would lag the magnify */
.fd-picker button:hover, .fd-picker button.hot { transform: scale(1.62) translateY(-15px); z-index: 3; transition-delay: 0s; }
.fd-picker button:hover + button, .fd-picker button.hot + button,
.fd-picker button:has(+ button:hover), .fd-picker button:has(+ button.hot) { transform: scale(1.2) translateY(-4px); z-index: 2; transition-delay: 0s; }
/* pressing one on desktop dips it, so a click feels physical */
.fd-picker button:active { transform: scale(1.38) translateY(-9px); transition-duration: .09s; }
/* aiming makes that emoji perform harder — same keyframes, roughly 3× the tempo.
 * Needs .open in the selector to out-specify the per-reaction rules above, and
 * must come after them (equal specificity, so source order decides). */
.fd-picker.open button:hover .fd-re-glyph,
.fd-picker.open button.hot .fd-re-glyph { animation-duration: .62s; animation-delay: 0s; }

/* your current reaction sits in a tinted well, so it's obvious which one is
 * yours — and that tapping it again takes it back off */
.fd-card[data-my="like"]  .fd-picker button[data-re="like"],
.fd-card[data-my="love"]  .fd-picker button[data-re="love"],
.fd-card[data-my="haha"]  .fd-picker button[data-re="haha"],
.fd-card[data-my="wow"]   .fd-picker button[data-re="wow"],
.fd-card[data-my="sad"]   .fd-picker button[data-re="sad"],
.fd-card[data-my="angry"] .fd-picker button[data-re="angry"] {
  background: var(--bg); border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--re, var(--blue));
}

/* the name pill above the aimed emoji */
.fd-re-name {
  position: absolute; bottom: calc(100% + 5px); left: 50%;
  transform: translateX(-50%) scale(.6); transform-origin: 50% 100%;
  background: rgba(20,22,26,.92); color: #fff; font-size: 9.5px; font-weight: 700;
  letter-spacing: .2px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .13s ease, transform .16s cubic-bezier(.2,1.5,.5,1);
}
.fd-picker button:hover .fd-re-name, .fd-picker button.hot .fd-re-name {
  opacity: 1; transform: translateX(-50%) scale(1);
}

/* the emoji that arcs from the bar into the button when you commit */
.fd-fly {
  position: fixed; z-index: 90; font-size: 30px; line-height: 1; pointer-events: none;
  transform: translate(-50%, -50%);
  animation: fd-fly .42s cubic-bezier(.55,.05,.35,1) forwards;
}
/* arcs up and over on the way down rather than sliding in a straight line */
@keyframes fd-fly {
  0%   { transform: translate(-50%, -50%) scale(1.55) rotate(0deg); opacity: 1; }
  35%  { transform: translate(calc(-50% + var(--dx) * .38), calc(-50% + var(--dy) * .12 - 16px)) scale(1.2) rotate(-10deg); opacity: .95; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4) rotate(8deg); opacity: 0; }
}

/* small Androids (360px and below): shrink the bar so all six still fit the card */
@media (max-width: 360px) {
  .fd-re-glyph { font-size: 25px; }
  .fd-picker { gap: 1px; padding: 4px 6px; }
  .fd-picker button { padding: 2px 1px; }
}

@media (prefers-reduced-motion: reduce) {
  .fd-picker, .fd-picker.open, .fd-picker button, .fd-picker.open button { transition-duration: .01ms; transition-delay: 0s; }
  .fd-picker.open button { transform: none; }
  /* kill every per-reaction performance, not just the old shared one */
  .fd-picker.open button .fd-re-glyph,
  .fd-picker.open button[data-re] .fd-re-glyph,
  .fd-picker.open button:hover .fd-re-glyph,
  .fd-picker.open button.hot .fd-re-glyph { animation: none; }
  .fd-picker button:hover, .fd-picker button.hot { transform: scale(1.25); }
  .fd-picker button:active { transform: scale(1.25); }
  .fd-picker button:hover + button, .fd-picker button.hot + button,
  .fd-picker button:has(+ button:hover), .fd-picker button:has(+ button.hot) { transform: none; }
  .fd-react-btn.fd-pop .fd-react-face, .fd-react-btn.fd-pop .fd-react-label,
  .fd-react-btn.fd-pop .fd-react-face::after,
  .fd-sum.fd-bump .fd-sum-stack span, .fd-sum.fd-bump .fd-sum-total { animation: none; }
  .fd-react-btn.fd-pop .fd-react-face::after { display: none; }
  .fd-fly { display: none; }
}
/* comments */
.fd-comments { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.fd-cmt { display: flex; gap: 8px; margin-bottom: 8px; }
.fd-cmt-reply { margin-left: 34px; }
.fd-cmt-main { min-width: 0; flex: 1; }
.fd-cmt-bubble { position: relative; background: var(--bg); border-radius: 12px; padding: 7px 11px; }
.fd-cmt-bubble strong { font-size: 12.5px; display: block; }
.fd-cmt-bubble p { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: break-word; }
.fd-cmt-del { position: absolute; top: 4px; right: 7px; border: 0; background: none; color: var(--muted);
  font-size: 14px; cursor: pointer; }
.fd-cmt-meta { display: flex; gap: 12px; margin: 3px 0 0 8px; font-size: 11.5px; color: var(--muted); }
.fd-cmt-meta button { border: 0; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.fd-cmt-meta button.on { color: var(--blue); }
.fd-cmt-empty { font-size: 13px; margin-bottom: 8px; }
.fd-comment-row { display: flex; gap: 8px; }
.fd-comment-row input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px;
  font: inherit; font-size: 13.5px; background: var(--bg); }
.fd-send { border: 0; background: var(--blue); color: #fff; width: 36px; height: 36px; border-radius: 50%;
  font-size: 15px; cursor: pointer; }
.fd-replying { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2);
  margin-bottom: 6px; background: var(--bg); border-radius: 999px; padding: 3px 10px; }
.fd-replying button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; }
/* composer */
.fd-compose-row { display: flex; gap: 10px; }
.fd-compose-row textarea { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
  font: inherit; font-size: 14px; resize: none; background: var(--bg); }
.fd-compose-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.fd-compose-bar .fd-act { flex: none; }
.fd-compose-preview { position: relative; margin-top: 9px; }
.fd-compose-preview img { max-width: 100%; max-height: 220px; border-radius: 10px; }
.fd-compose-preview button { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; cursor: pointer; }
.fd-compose > .btn-primary { margin-top: 10px; }
.fd-more-wrap { text-align: center; padding-bottom: 10px; }
#fd-more { width: 100%; }

/* ── Feed: own-post menu, edit box, share sheet, deep-link highlight ── */
.fd-head { position: relative; }
.fd-menu-host { margin-left: auto; position: relative; }
.fd-menu-btn { border: 0; background: none; font-size: 20px; line-height: 1; padding: 4px 8px;
  color: var(--muted, #6b7280); cursor: pointer; border-radius: 8px; }
.fd-menu-btn:active { background: rgba(0,0,0,.06); }
.fd-menu { position: absolute; right: 0; top: 100%; z-index: 30; min-width: 130px;
  background: var(--card, #fff); border: 1px solid rgba(0,0,0,.1); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); overflow: hidden; }
.fd-menu button { display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 14px; font-size: 14px; cursor: pointer; }
.fd-menu button:active { background: rgba(0,0,0,.06); }
.fd-edited { color: var(--muted, #9ca3af); font-size: 11px; }
.fd-edit { margin: 8px 0; }
.fd-edit textarea { width: 100%; border: 1px solid rgba(0,0,0,.15); border-radius: 10px;
  padding: 8px 10px; font: inherit; resize: vertical; }
.fd-edit-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.fd-share-ov { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; }
.fd-share-sheet { background: var(--card, #fff); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.fd-share-title { margin: 0 0 12px; font-weight: 700; text-align: center; }
.fd-share-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fd-share-grid a, .fd-share-grid button { display: flex; flex-direction: column; align-items: center;
  gap: 4px; border: 0; background: none; font-size: 11px; color: inherit; text-decoration: none;
  padding: 8px 2px; border-radius: 10px; cursor: pointer; }
.fd-share-grid span { font-size: 26px; }
.fd-share-grid a:active, .fd-share-grid button:active { background: rgba(0,0,0,.06); }
.fd-share-close { display: block; width: 100%; margin-top: 12px; border: 0; border-radius: 10px;
  padding: 10px; background: rgba(0,0,0,.06); font-size: 14px; cursor: pointer; }
.fd-hilite { outline: 2px solid var(--crimson, #DC143C); outline-offset: 2px;
  transition: outline-color .5s; }

/* ================= social layer: profiles + classmates (social.js) ================= */

/* avatar images sit on top of the letter initial; a 404 img removes itself */
.fd-avatar { position: relative; }
.fd-avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.fd-avatar[data-uid]:not([data-uid=""]) { cursor: pointer; }
.fd-who strong[data-uid], .fd-cmt-bubble strong[data-uid] { cursor: pointer; }
.fd-avatar-xl { width: 76px; height: 76px; font-size: 30px; }

/* feed-top entry strip */
.sc-strip { margin: 0 0 10px; }
.sc-strip-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px;
  font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; }
.sc-badge { min-width: 18px; height: 18px; border-radius: 999px; background: #e11d48; color: #fff;
  font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; margin-left: 2px; }

/* person rows (directory / requests / friends) */
.sc-person { display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.sc-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.sc-person-main strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-person-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-person-act { flex: none; display: flex; gap: 6px; }

/* overlays (profile page, friends list, editor) — bottom sheet on phones */
.sc-ov { position: fixed; inset: 0; z-index: 70; background: rgba(15, 18, 24, 0.55);
  display: flex; align-items: flex-end; justify-content: center; }
.sc-sheet { position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--bg, #f4f5f8); border-radius: 18px 18px 0 0; padding: 18px 14px 24px;
  animation: sc-up 0.22s ease; }
@keyframes sc-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .sc-ov { align-items: center; } .sc-sheet { border-radius: 18px; } }
.sc-close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 30px; height: 30px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer; }

/* profile page */
.sc-prof-head { text-align: center; padding: 8px 0 14px; }
.sc-prof-head .fd-avatar { margin: 0 auto 8px; display: flex; }
.sc-prof-head h3 { font-size: 18px; margin: 2px 0; }
.sc-prof-meta { font-size: 13px; font-weight: 600; margin: 6px 0 0; }
.sc-prof-goal { font-size: 13px; margin: 6px 0 0; }
.sc-prof-bio { font-size: 13.5px; color: var(--ink); margin: 8px auto 0; max-width: 420px; white-space: pre-line; }
.sc-prof-actions { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; }
.sc-prof-menu { position: relative; }
.sc-prof-posts { border-top: 1px solid var(--line); padding-top: 10px; }

/* editor */
.sc-edit-avatar { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.sc-edit-avatar .fd-avatar { flex: none; }

/* ============ IELTS Exam Room (ielts-practice.js) ============ */
.crs-examroom {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px; margin-bottom: 12px; border: 1px solid var(--crimson); border-radius: 14px;
  background: linear-gradient(135deg, #b91c1c, var(--crimson)); color: #fff;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.crs-examroom small { font-size: 11px; font-weight: 500; opacity: .92; }

#ier-screen {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
body.ier-lock { overflow: hidden; }

.ier-top {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--ink); color: #fff; flex: 0 0 auto;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
.ier-back {
  width: 34px; height: 34px; border: none; border-radius: 10px; background: rgba(255,255,255,.14);
  color: #fff; font-size: 20px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.ier-top-title { flex: 1; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ier-clock {
  min-width: 64px; text-align: center; padding: 6px 10px; border-radius: 10px;
  background: rgba(255,255,255,.14); font-weight: 800; font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.ier-clock.danger { background: var(--crimson); animation: ier-blink 1s step-end infinite; }
.ier-clock-ghost { visibility: hidden; }
@keyframes ier-blink { 50% { opacity: .55; } }

.ier-body { flex: 1; overflow-y: auto; padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px)); }

.ier-hero { margin-bottom: 14px; }
.ier-hero h2 { margin: 0 0 4px; font-size: 19px; }
.ier-hero p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.ier-ne { color: var(--muted); }

.ier-paper {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); cursor: pointer;
}
.ier-paper-icon { font-size: 26px; }
.ier-paper-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ier-paper-text strong { font-size: 15px; }
.ier-paper-text small { font-size: 11.5px; color: var(--text-2); }
.ier-bandchip {
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  background: #16a34a; color: #fff; white-space: nowrap;
}
.ier-bandchip.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.ier-note {
  padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin: 10px 0;
  background: var(--card);
}
.ier-rules {
  padding: 12px; border: 1px solid var(--line); border-left: 4px solid var(--crimson);
  border-radius: 12px; background: var(--card); margin-bottom: 12px;
}
.ier-rules h3 { margin: 0 0 6px; font-size: 14px; }
.ier-rules ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.ier-rules-ne { text-align: center; font-size: 12px; color: var(--muted); }
.ier-start {
  width: 100%; padding: 13px; border: none; border-radius: 14px; margin: 6px 0 8px;
  background: var(--crimson); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer;
}

.ier-parts { display: flex; gap: 6px; padding: 8px 10px; background: var(--card); border-bottom: 1px solid var(--line); flex: 0 0 auto; overflow-x: auto; }
.ier-part {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text-2);
}
.ier-part.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.ier-split { flex: 1; display: grid; overflow: hidden; grid-template-rows: auto 1fr; }
.ier-split.reading { grid-template-rows: 42% 1fr; }
.ier-passage { overflow-y: auto; padding: 12px 14px; background: var(--card); border-bottom: 2px solid var(--line); }
.ier-passage h3 { margin: 8px 0 6px; font-size: 14.5px; }
.ier-passage p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; }
.ier-p-instr, .ier-g-instr {
  font-size: 11.5px; color: var(--text-2); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; line-height: 1.45;
}
.ier-qs { overflow-y: auto; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
.ier-group { margin-bottom: 16px; }
.ier-g-instr { margin-bottom: 10px; }
.ier-optlist {
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  padding: 8px 10px; margin-bottom: 10px; font-size: 12.5px; line-height: 1.6;
}
.ier-q { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.ier-q.pulse { box-shadow: 0 0 0 3px rgba(220, 20, 60, .35); }
.ier-q-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ier-qn {
  flex: 0 0 auto; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 0 4px;
}
.ier-q-text { flex: 1; font-size: 13.5px; line-height: 1.5; }
.ier-flag { border: none; background: transparent; font-size: 15px; cursor: pointer; opacity: .3; padding: 0 2px; }
.ier-flag.on { opacity: 1; }
.ier-opts { display: flex; flex-direction: column; gap: 6px; }
.ier-opt {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 13px; line-height: 1.45; cursor: pointer;
}
.ier-opt input { display: none; }
.ier-opt.sel { border-color: var(--crimson); background: rgba(220, 20, 60, .07); }
.ier-opt b { flex: 0 0 auto; }
.ier-tfng { display: flex; gap: 6px; flex-wrap: wrap; }
.ier-tf {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-2);
}
.ier-tf.sel { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.ier-gap {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: var(--bg);
}
.ier-gap:focus { outline: none; border-color: var(--crimson); }
.ier-match { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: var(--bg); }

.ier-audiocard { padding: 12px 14px; background: var(--card); border-bottom: 2px solid var(--line); }
.ier-audiocard h3 { margin: 0 0 4px; font-size: 14.5px; }
.ier-audiocard p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.ier-playbtn {
  padding: 10px 16px; border: none; border-radius: 12px; background: var(--crimson);
  color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.ier-playbtn:disabled { background: var(--muted); cursor: default; }
.ier-audio-status { margin-top: 6px; font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.ier-speaking { color: var(--crimson); font-weight: 700; }
.ier-played { color: #16a34a; font-weight: 700; }

.ier-bottom {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line);
}
.ier-palette { flex: 1; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.ier-pal {
  flex: 0 0 auto; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; font-size: 11.5px; font-weight: 700; color: var(--text-2); cursor: pointer; position: relative;
}
.ier-pal.done { background: var(--ink); border-color: var(--ink); color: #fff; }
.ier-pal.flag::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--crimson); }
.ier-submit {
  flex: 0 0 auto; padding: 10px 16px; border: none; border-radius: 12px;
  background: var(--crimson); color: #fff; font-weight: 800; font-size: 13.5px; cursor: pointer;
}

.ier-band { text-align: center; padding: 18px 0 10px; }
.ier-band-num { font-size: 56px; font-weight: 800; color: var(--crimson); line-height: 1; }
.ier-band-label { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--muted); margin-top: 4px; }
.ier-band-raw { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.ier-secgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.ier-sec {
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  display: flex; flex-direction: column; gap: 2px; text-align: center;
}
.ier-sec small { font-size: 10.5px; color: var(--text-2); }
.ier-sec b { font-size: 17px; }
.ier-sec.under b { color: var(--crimson); }
.ier-rev-h { font-size: 15px; margin: 14px 0 8px; }
.ier-rev { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.ier-rev.ok { border-left: 4px solid #16a34a; }
.ier-rev.bad { border-left: 4px solid var(--crimson); }
.ier-rev-head { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 600; line-height: 1.45; }
.ier-rev-q { flex: 1; }
.ier-rev-ans { font-size: 12.5px; margin: 6px 0 0 32px; color: var(--text-2); }
.ier-rev-why { font-size: 12px; margin: 4px 0 0 32px; color: var(--muted); line-height: 1.5; }
.ier-transcript { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 10px 12px; margin: 10px 0; }
.ier-transcript summary { font-size: 13px; font-weight: 700; cursor: pointer; }
.ier-transcript h4 { margin: 10px 0 4px; font-size: 12.5px; }
.ier-transcript p { margin: 0 0 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }

.ier-writ { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ier-writ-prompt { flex: 0 0 auto; max-height: 38%; overflow-y: auto; padding: 10px 14px; background: var(--card); border-bottom: 2px solid var(--line); }
.ier-writ-prompt p { margin: 8px 0; font-size: 13.5px; line-height: 1.55; }
.ier-chart { width: 100%; max-width: 420px; display: block; margin: 4px auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.ier-writ-text {
  flex: 1; width: 100%; border: none; resize: none; padding: 12px 14px; font-size: 14.5px;
  line-height: 1.6; background: var(--bg); font-family: inherit;
}
.ier-writ-text:focus { outline: none; }
.ier-writ-bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line);
}
.ier-wc { font-size: 13px; font-weight: 700; color: var(--crimson); }
.ier-wc.enough { color: #16a34a; }

@media (min-width: 900px) {
  .ier-split, .ier-split.reading { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .ier-passage, .ier-audiocard { border-bottom: none; border-right: 2px solid var(--line); }
  .ier-body { max-width: 760px; margin: 0 auto; width: 100%; }
}


/* feed audience filter chips (phase 3) */
.fd-filter { margin: 0 0 10px; }

/* ---- Minna practice tab: 文型 / 会話 / drills (course.js renderMinna*) ---- */
.crs-kaiwa { display: flex; flex-direction: column; gap: 10px; }
.crs-kaiwa-line { display: flex; gap: 10px; align-items: flex-start; }
.crs-kaiwa-line b { flex: 0 0 auto; min-width: 52px; font-size: 12.5px; color: var(--blue); padding-top: 3px; }
.crs-kaiwa-line span { font-size: 16px; font-weight: 600; line-height: 1.5; }
.crs-kaiwa-line span small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.crs-q-minna { font-size: 22px; line-height: 1.6; }
.crs-gap { color: var(--blue); background: rgba(37, 99, 235, 0.08); border-radius: 6px; padding: 0 2px; }
.crs-minna-passage { font-size: 18px; font-weight: 600; line-height: 1.7; text-align: left; }
.crs-q-order { font-size: 18px; }
.crs-order-answer {
  min-height: 48px; border: 1.5px dashed var(--line); border-radius: 12px; background: var(--card);
  padding: 8px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.crs-order-answer.correct { border-color: var(--ok); background: #e8f7ef; }
.crs-order-answer.wrong { border-color: #d33; background: #fdeaea; }
.crs-order-right { text-align: center; font-size: 15px; font-weight: 700; color: var(--ok); margin: 6px 0 0; }
.crs-order-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.crs-order-chip {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.crs-order-chip.picked { background: rgba(37, 99, 235, 0.08); border-color: var(--blue); cursor: default; }
.crs-order-chip:disabled { opacity: 0.35; }
.crs-order-btns { display: flex; gap: 8px; }
.crs-order-btns .btn-primary { flex: 1; }

/* ================= classmate DMs (dm.js) ================= */

.sc-strip { display: flex; gap: 8px; }
.sc-strip-btn { flex: 1; }

.dm-safety { font-size: 11.5px; color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
  border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; line-height: 1.45; }

/* inbox */
.dm-thread { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.dm-thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dm-thread-main strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-thread-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-thread-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.dm-when { font-size: 11px; color: var(--muted); }
.dm-unread strong { font-weight: 800; }

/* chat sheet */
.dm-chat-sheet { display: flex; flex-direction: column; height: 88vh; }
.dm-chat-head { display: flex; align-items: center; gap: 8px; padding: 2px 34px 10px 2px;
  border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.dm-chat-head strong { flex: 1; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-chat-menu { position: relative; }
.dm-msgs { flex: 1; overflow-y: auto; padding: 4px 2px; display: flex; flex-direction: column; gap: 8px; }
.dm-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.dm-mine { align-self: flex-end; align-items: flex-end; }
.dm-bubble { position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px; padding: 8px 12px; font-size: 13.5px; white-space: pre-wrap;
  word-break: break-word; }
.dm-mine .dm-bubble { background: var(--blue); border-color: var(--blue); color: #fff;
  border-radius: 14px 14px 4px 14px; }
.dm-mine .dm-bubble .muted, .dm-mine .dm-bubble i { color: #dbe7ff; }
.dm-del { position: absolute; top: -7px; left: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 11px;
  line-height: 1; cursor: pointer; display: none; }
.dm-msg:hover .dm-del, .dm-msg:focus-within .dm-del { display: block; }
.dm-msg-when { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.dm-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dm-form input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px;
  font-size: 13.5px; background: var(--card); color: var(--ink); }

/* ---- IELTS Speaking rehearsal room (ielts-speaking.js) ---- */
#isp-screen {
  position: fixed; inset: 0; z-index: 61; background: var(--bg);
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
.isp-part-card {
  display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.isp-part-card strong { font-size: 13.5px; }
.isp-part-card small { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.isp-warn { border-color: var(--crimson); border-style: solid; color: var(--crimson); }

.isp-progress { flex: 0 0 auto; height: 3px; background: var(--line); }
.isp-progress > div { height: 100%; background: var(--crimson); transition: width .3s; }

.isp-phase { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; letter-spacing: .3px; }
.isp-question { font-size: 17px; line-height: 1.5; font-weight: 600; margin-bottom: 14px; }
.isp-hint { font-size: 12.5px; color: var(--text-2); margin: 0 0 12px; line-height: 1.5; }

.isp-cue {
  padding: 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); margin-bottom: 14px;
}
.isp-cue h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.4; }
.isp-cue p { margin: 0 0 4px; font-size: 12.5px; color: var(--text-2); }
.isp-cue ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }

.isp-rec { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.isp-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--crimson); flex: 0 0 auto;
  animation: isp-pulse 1.2s ease-in-out infinite;
}
@keyframes isp-pulse { 50% { opacity: .25; transform: scale(.85); } }
.isp-level { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.isp-level-fill { height: 100%; width: 0; background: linear-gradient(90deg, #16a34a, #eab308, var(--crimson)); transition: width .08s linear; }
.isp-ringwrap { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.isp-ring { height: 100%; width: 0; background: var(--ink); }
.isp-actions { margin-top: 6px; }

.isp-ans { padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.isp-ans-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 5px; }
.isp-ans-q { flex: 1; font-size: 13px; line-height: 1.45; font-weight: 600; }
.isp-ans-meta { font-size: 11.5px; color: var(--text-2); margin-bottom: 7px; }
.isp-ans audio { width: 100%; height: 34px; display: block; }
.isp-dl { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--crimson); text-decoration: none; }
.isp-tr { margin-top: 7px; }
.isp-tr summary { font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.isp-tr p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }


/* ---- IELTS Speaking rehearsal room (ielts-speaking.js) ---- */
#isp-screen {
  position: fixed; inset: 0; z-index: 61; background: var(--bg);
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
.isp-part-card {
  display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.isp-part-card strong { font-size: 13.5px; }
.isp-part-card small { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.isp-warn { border-color: var(--crimson); border-style: solid; color: var(--crimson); }

.isp-progress { flex: 0 0 auto; height: 3px; background: var(--line); }
.isp-progress > div { height: 100%; background: var(--crimson); transition: width .3s; }

.isp-phase { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; letter-spacing: .3px; }
.isp-question { font-size: 17px; line-height: 1.5; font-weight: 600; margin-bottom: 14px; }
.isp-hint { font-size: 12.5px; color: var(--text-2); margin: 0 0 12px; line-height: 1.5; }

.isp-cue {
  padding: 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); margin-bottom: 14px;
}
.isp-cue h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.4; }
.isp-cue p { margin: 0 0 4px; font-size: 12.5px; color: var(--text-2); }
.isp-cue ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }

.isp-rec { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.isp-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--crimson); flex: 0 0 auto;
  animation: isp-pulse 1.2s ease-in-out infinite;
}
@keyframes isp-pulse { 50% { opacity: .25; transform: scale(.85); } }
.isp-level { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.isp-level-fill { height: 100%; width: 0; background: linear-gradient(90deg, #16a34a, #eab308, var(--crimson)); transition: width .08s linear; }
.isp-ringwrap { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.isp-ring { height: 100%; width: 0; background: var(--ink); }
.isp-actions { margin-top: 6px; }

.isp-ans { padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.isp-ans-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 5px; }
.isp-ans-q { flex: 1; font-size: 13px; line-height: 1.45; font-weight: 600; }
.isp-ans-meta { font-size: 11.5px; color: var(--text-2); margin-bottom: 7px; }
.isp-ans audio { width: 100%; height: 34px; display: block; }
.isp-dl { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--crimson); text-decoration: none; }
.isp-tr { margin-top: 7px; }
.isp-tr summary { font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.isp-tr p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }

/* ── Feed: video posts (2026-08-12) ──────────────────────────────────
 * The video sits in the same edge-to-edge .fd-media slot as a photo, on a
 * dark plate so letterboxing round a portrait phone clip reads as deliberate. */
.fd-media-video { background: #000; }
.fd-media video { width: 100%; max-height: 480px; display: block; background: #000; outline: none; }
.fd-compose-preview video { max-width: 100%; max-height: 240px; border-radius: 10px; display: block; background: #000; }


/* ── Team recognition: founder, developer + staff roles (social.js) ────
 * 2026-08-12 founder + developer; 2026-08-13 MD, supervisor, counsellor and
 * the two barista roles. Crimson = Tesla Education itself (the founder), blue
 * = the tech side, and each staff role carries its own accent so students can
 * tell a counsellor from a trainer at a glance. The tick rides inside the
 * name, so it never wraps away from it and comment-bubble names keep their
 * single line.
 *
 * Every role sets three tokens once, below; the tick, chip, directory line and
 * avatar ring all read them, so a new role is one line here plus one entry in
 * the server's TEAM list. */
.sc-tick, .sc-role, .sc-person-role, .sc-prof-head {
  --sc-accent: var(--crimson); --sc-soft: #fdeaee; --sc-soft-line: #f7ccd5; }
.sc-tick[data-kind="developer"], .sc-role[data-kind="developer"],
.sc-person-role[data-kind="developer"], .sc-prof-head[data-kind="developer"] {
  --sc-accent: var(--blue); --sc-soft: #eaf0fb; --sc-soft-line: #cbd9f2; }
/* partner institute (Brilliant Education) — deliberately neither brand colour */
.sc-tick[data-kind="md"], .sc-role[data-kind="md"],
.sc-person-role[data-kind="md"], .sc-prof-head[data-kind="md"] {
  --sc-accent: #6d28d9; --sc-soft: #f1ebfd; --sc-soft-line: #ddd0f8; }
.sc-tick[data-kind="supervisor"], .sc-role[data-kind="supervisor"],
.sc-person-role[data-kind="supervisor"], .sc-prof-head[data-kind="supervisor"] {
  --sc-accent: #0f766e; --sc-soft: #e4f3f1; --sc-soft-line: #c2e3de; }
.sc-tick[data-kind="counsellor"], .sc-role[data-kind="counsellor"],
.sc-person-role[data-kind="counsellor"], .sc-prof-head[data-kind="counsellor"] {
  --sc-accent: #1c7a3e; --sc-soft: #e6f4ea; --sc-soft-line: #c4e5cf; }
/* the two barista roles share the coffee family, manager darker than teacher */
.sc-tick[data-kind="barista-manager"], .sc-role[data-kind="barista-manager"],
.sc-person-role[data-kind="barista-manager"], .sc-prof-head[data-kind="barista-manager"] {
  --sc-accent: #6f4218; --sc-soft: #f4ebe2; --sc-soft-line: #e3d1bd; }
.sc-tick[data-kind="barista-teacher"], .sc-role[data-kind="barista-teacher"],
.sc-person-role[data-kind="barista-teacher"], .sc-prof-head[data-kind="barista-teacher"] {
  --sc-accent: #a1642a; --sc-soft: #f8f0e6; --sc-soft-line: #ecd8bf; }

.sc-tick { display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 4px; border-radius: 50%; flex: none;
  background: var(--sc-accent); color: #fff; vertical-align: -2px; }
.sc-tick svg { width: 72%; height: 72%; display: block; }
.sc-prof-head h3 .sc-tick { width: 19px; height: 19px; margin-left: 6px; vertical-align: -3px; }

.sc-role-line { margin: 8px 0 0; }
.sc-role { display: inline-flex; align-items: center; gap: 5px;
  background: var(--sc-soft); color: var(--sc-accent); border: 1px solid var(--sc-soft-line);
  font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 11px; }
.sc-role-blurb { font-size: 12.5px; color: var(--text-2); margin: 5px 0 0; }

/* directory / classmate rows: the role stands in for the course line */
.sc-person-role { font-size: 12px; font-weight: 700; color: var(--sc-accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the profile photo gets a matching ring so the whole header reads as one */
.sc-prof-team .fd-avatar-xl { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--sc-accent); }

/* ---------------- in-app push banner (2026-08-14) ----------------
 * A push that arrives while the app is in the foreground gets no heads-up
 * alert from Android/iOS — the OS assumes you can see it. This is that alert,
 * drawn by the app: tappable, and it deep-links to the chat/post it is about.
 * Lives outside .phone (which clips) so it is position:fixed on the viewport
 * but still tracks the 430px shell width. */
.push-banner {
  position: fixed; z-index: 60;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  width: min(414px, calc(100vw - 16px));
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  font: inherit;
  cursor: pointer;
}
.push-banner.pb-in { transform: translate(-50%, 0); opacity: 1; }
.push-banner[hidden] { display: none; }
.pb-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(135deg, var(--crimson), var(--blue));
}
.pb-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pb-text b { font-size: 13.5px; }
.pb-text span {
  font-size: 12.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Me-tab profile photo (2026-08-14) ----------
 * The Me tab only ever showed two initials, so a student who had uploaded a
 * photo never saw it on their own profile card. Same trick as .fd-avatar: the
 * image lies on top of the initials, and a 404 leaves the initials showing. */
.avatar { position: relative; overflow: hidden; }
.avatar > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}

/* ---------- Friday Mock Exam entry fee · eSewa (2026-08-14) ----------
 * Practising the paper stays free; these styles only dress the ONE scored
 * attempt. The eSewa wordmark is the real brand asset (app/icons/esewa.png)
 * so it must sit on white with room to breathe — never recoloured, never
 * stretched: fixed height, width auto. */
.wexam-chip.pay { background: #0f7f3f; color: #fff; }
.wexam-chip.pending { background: #fff4e5; color: #b45309; }

.wpay-card {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 4px 0 14px;
  box-shadow: 0 6px 20px rgba(20, 28, 38, .06);
}
.wpay-card.rejected { border-color: #f5c2c7; }
.wpay-card.waiting { text-align: center; }
.wpay-bad { background: #fdecee; color: #b02a37; border-radius: 10px; padding: 9px 11px;
  font-size: 13px; margin-bottom: 12px; }
.wpay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wpay-label { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); }
.wpay-amount { font-size: 30px; font-weight: 900; color: var(--ink); line-height: 1.15; }
.wpay-logo { height: 30px; width: auto; display: block; }
.wpay-logo.lg { height: 42px; margin: 0 auto 10px; }
.wpay-perks { list-style: none; margin: 13px 0; display: grid; gap: 7px; font-size: 13.5px;
  color: var(--text-2); }
.wpay-foot { margin-top: 9px; }
.wpay-ref { font-size: 13px; margin-top: 6px; }
.wpay-wait-icon { font-size: 34px; }
.wpay-card.waiting h4 { margin: 6px 0 6px; font-size: 16px; }
.wpay-card.waiting p { font-size: 13.5px; color: var(--text-2); }

.wpay-screen { text-align: left; }
.wpay-brandbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; }
.wpay-amount-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 10px; font-size: 13.5px; color: var(--text-2); }
.wpay-amount-row b { font-size: 20px; color: var(--ink); }
.wpay-testbar { background: #fff4e5; color: #b45309; border-radius: 10px; padding: 8px 11px;
  font-size: 12.5px; font-weight: 700; margin-top: 10px; }
.wpay-tabs { display: flex; gap: 8px; margin: 12px 0 10px; }
.wpay-tab { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 9px 10px; font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.wpay-tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.wpay-pane { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; margin-bottom: 12px; font-size: 13.5px; color: var(--text-2); }
.wpay-pane p { margin-bottom: 12px; }
.wpay-steps { margin: 0 0 13px 18px; display: grid; gap: 7px; }
.wpay-qr { display: block; width: 190px; height: 190px; object-fit: contain; margin: 0 auto 13px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
/* eSewa's own green — the pay button reads as eSewa, not as our crimson CTA */
.btn-primary.wpay-go { background: #60BB46; display: inline-flex; align-items: center;
  justify-content: center; gap: 10px; }
.wpay-go img { height: 20px; width: auto; }
.wpay-field { display: block; margin-bottom: 12px; }
.wpay-field span { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink);
  margin-bottom: 5px; }
.wpay-field input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 15px; font-family: inherit; letter-spacing: .04em; text-transform: uppercase; }
.wpay-field input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.wpay-shot { display: block; text-align: center; margin-bottom: 12px; cursor: pointer; }
.wpay-shot.has-file { border-color: var(--ok); color: var(--ok); }

/* ---------------- notification opt-in nudge (2026-08-15) ----------------
 * Asked once, at a moment the student cares (just messaged / just connected).
 * Bottom sheet rather than a toast: it needs a real tap, because that tap is
 * the user gesture iOS requires before Notification.requestPermission(). */
.pn-ov {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(12, 16, 22, 0);
  transition: background .22s ease;
}
.pn-ov.pn-in { background: rgba(12, 16, 22, .45); }
.pn-card {
  width: min(430px, 100%);
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
}
.pn-ov.pn-in .pn-card { transform: translateY(0); }
.pn-icon {
  width: 54px; height: 54px; margin: 0 auto 12px;
  border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(135deg, var(--crimson), var(--blue));
}
.pn-card h3 { font-size: 18px; margin-bottom: 6px; }
.pn-card p { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }
.pn-card .pn-yes { margin-bottom: 6px; }
.pn-card .pn-no { width: 100%; }

/* ---------------- feed post types: 📚 Educational vs 🙋 About me (2026-08-16) ---------------- */
.fd-badge-edu { background: #e7f6ee; color: #157347; }
.fd-type-filter { margin-top: -4px; }
/* composer + edit-sheet tag picker */
.fd-compose-type { display: flex; gap: 8px; margin-top: 9px; }
.fd-type-chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--text-2);
  font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 5px 12px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.fd-type-chip.on { border-color: #157347; background: #e7f6ee; color: #157347; }
.fd-type-chip[data-ctype="personal"].on { border-color: var(--blue); background: #eaf0fb; color: var(--blue); }
.fd-edit .fd-compose-type { margin: 8px 0 0; }

/* ---- comment inline edit (2026-08-17) ---- */
.fd-cmt-editbox { margin: 4px 0 2px; }
.fd-cmt-editbox input { width: 100%; border: 1px solid rgba(0,0,0,.15); border-radius: 10px;
  padding: 7px 10px; font: inherit; font-size: 13.5px; background: #fff; }
.fd-cmt-editbox .fd-edit-bar { margin-top: 6px; }

/* ---- feed pull-to-refresh indicator (2026-08-17) ---- */
#fd-ptr { position: fixed; top: 64px; left: 50%; z-index: 40; margin-left: -20px; width: 40px; height: 40px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); display: flex; align-items: center;
  justify-content: center; font-size: 20px; font-weight: 700; color: #DC143C; opacity: 0;
  transform: translateY(-56px); transition: transform .18s ease, opacity .18s ease; pointer-events: none; }
#fd-ptr.pull { transition: none; }
#fd-ptr.ready { color: #fff; background: #DC143C; }
#fd-ptr.spin .fd-ptr-icon { display: inline-block; animation: fd-ptr-rot .7s linear infinite; }
@keyframes fd-ptr-rot { to { transform: rotate(360deg); } }

/* ---- group chats (dmg-*, 2026-08-17) — rides the dm-* chat styles ---- */
.dmg-new { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 10px; padding: 10px 14px;
  border: 1px dashed var(--line); border-radius: 12px; background: var(--card); font-weight: 700;
  font-size: 13.5px; color: #DC143C; cursor: pointer; }
.dmg-avatar { display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #DC143C, #1d4ed8); color: #fff; font-size: 16px; }
.dmg-sys { text-align: center; font-size: 11.5px; color: var(--text-2, #6b7280); margin: 8px 0; }
.dmg-sender { display: block; font-size: 11px; font-weight: 700; color: #1d4ed8; margin: 0 0 2px 12px; cursor: pointer; }
.dm-mine .dmg-sender { display: none; }
.dmg-pick { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; margin-bottom: 10px; }
.dmg-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.dmg-pick-row:active { background: rgba(0,0,0,.04); }
.dmg-pick-row strong { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmg-pick-row input { width: 20px; height: 20px; accent-color: #DC143C; flex: none; }
.fd-send-wide { display: block; width: 100%; padding: 12px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #DC143C, #b01031); color: #fff; font-weight: 800; font-size: 14px; cursor: pointer; }
.dmg-members { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; margin-bottom: 10px; }
.dmg-member { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.dmg-member strong { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.dmg-role { flex: none; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  color: #1d4ed8; background: #dbeafe; border-radius: 999px; padding: 3px 8px; }
.dmg-kick { flex: none; border: 1px solid var(--line); background: var(--card); color: #b91c1c;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }

/* ---- reply-to (WhatsApp style, 2026-08-17) ---- */
.dm-msg { will-change: transform; }
.dm-msg.dm-swipe-arm .dm-bubble { box-shadow: 0 0 0 2px rgba(220,20,60,.35); }
.dm-quote { display: flex; flex-direction: column; gap: 1px; margin: -2px 0 6px;
  padding: 6px 9px; border-left: 3px solid #DC143C; border-radius: 8px;
  background: rgba(0,0,0,.05); cursor: pointer; }
.dm-mine .dm-quote { background: rgba(255,255,255,.55); }
.dm-quote b { font-size: 11px; color: #DC143C; }
.dm-quote span { font-size: 12px; color: var(--text-2, #4b5560); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.dm-replybar { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0;
  background: var(--card); margin-top: 8px; }
.dm-replybar[hidden] { display: none; }
.dm-replybar + .dm-form { border-top: 0; padding-top: 4px; }
.dm-replybar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
  border-left: 3px solid #DC143C; padding-left: 8px; }
.dm-replybar-main b { font-size: 11.5px; color: #DC143C; }
.dm-replybar-main span { font-size: 12px; color: var(--text-2, #4b5560);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-replybar-x { flex: none; border: 0; background: none; font-size: 19px; line-height: 1;
  color: var(--text-2, #6b7280); cursor: pointer; padding: 2px 6px; }
@keyframes dm-flash-kf { 0%, 60% { background: rgba(220,20,60,.12); } 100% { background: transparent; } }
.dm-flash { animation: dm-flash-kf 1.2s ease; border-radius: 12px; }

/* ---- DM message reactions (2026-08-17) — reuses the feed's .fd-picker ---- */
.dm-msg { position: relative; }
.dm-msg .fd-picker { bottom: calc(100% - 4px); left: -4px; }
.dm-mine .fd-picker { left: auto; right: -4px; transform-origin: 78% bottom; }
.dm-msg .fd-re-glyph { font-size: 26px; }
.dm-rx { position: absolute; bottom: 8px; left: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 1px;
  border: 1.5px solid #fff; border-radius: 999px; padding: 1.5px 6px;
  background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.16);
  font-size: 12px; line-height: 1.25; cursor: pointer; }
.dm-mine .dm-rx { left: auto; right: 10px; }
.dm-rx b { font-size: 10.5px; font-weight: 700; color: var(--text-2, #4b5560); margin-left: 2px; }
.dm-rx.dm-rx-mine { border-color: #bfdbfe; background: #eff6ff; }
.dm-msg:has(.dm-rx) { padding-bottom: 12px; }
.dm-msg:has(.dm-rx) .dm-msg-when { margin-top: 4px; }

/* ===== Friday Mock Exam prize money (.wprize-*) ===== */
.wprize-banner{background:linear-gradient(135deg,#fff7e0,#ffefc2);border:1px solid #f0d98c;border-radius:14px;padding:12px 14px;margin:0 0 12px}
.wprize-banner-line{font-size:15px}
.wprize-banner small{display:block;margin-top:4px;color:#8a6d1a;line-height:1.45}
.wprize-card{border-radius:14px;padding:14px;margin:0 0 12px;border:1px solid #e2e6ec;background:#fff}
.wprize-card.won{background:linear-gradient(135deg,#DC143C,#8f1030);border-color:#8f1030;color:#fff}
.wprize-card.won small{color:#ffd9e0}
.wprize-card.claimed{background:#f4f7ff;border-color:#c9d6f5}
.wprize-card.paid{background:#f0fbf4;border-color:#bfe8cd}
.wprize-big{font-size:17px;font-weight:700;margin-bottom:4px}
.wprize-card small{display:block;line-height:1.5;color:#5b6673}
.wprize-card.won .wprize-big{color:#fff}
.wprize-claim{display:flex;gap:8px;margin-top:10px}
.wprize-claim input{flex:1;min-width:0;border:1px solid #d5dae2;border-radius:10px;padding:10px 12px;font-size:15px}
.wprize-card.won .wprize-claim input{border-color:#ffffff55;background:#ffffffee}
.wprize-claim .btn-primary,.wprize-claim .btn-outline{white-space:nowrap;padding:10px 14px}
.wprize-card.won .wprize-claim .btn-primary{background:#fff;color:#DC143C}

/* ===== Exam Hall (timed doors + admit card) — 2026-08-18 ===== */
.whall-card{border:2px dashed #b9a7ff;border-radius:14px;padding:14px;margin:12px 0;background:linear-gradient(180deg,#f6f2ff,#fff);text-align:left}
.whall-card.live{border-color:#25a55b;background:linear-gradient(180deg,#eefcf3,#fff)}
.whall-card.over{border-color:#ccc;background:#fafafa}
.whall-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:6px}
.whall-label{font-size:.72rem;font-weight:800;letter-spacing:.08em;color:#6b4fd8}
.whall-card.live .whall-label{color:#1c7f46}
.whall-card.over .whall-label{color:#888}
.whall-seat{font-family:ui-monospace,Consolas,monospace;font-weight:800;font-size:.95rem;background:#fff;border:1px solid #ddd;border-radius:8px;padding:2px 10px}
.whall-line{margin:4px 0 6px;font-size:.92rem}
.whall-count{font-family:ui-monospace,Consolas,monospace;font-size:1.9rem;font-weight:800;text-align:center;letter-spacing:.04em;color:#3b2b85;margin:8px 0 4px}
.whall-banner{border:1px solid #d9cfff;background:#f6f2ff;border-radius:12px;padding:10px 12px;margin:10px 0;font-size:.9rem}
.whall-banner.live{border-color:#9adfb8;background:#eefcf3}
.whall-home-line{margin:6px 0 0;font-size:.88rem;color:#4a3ba0}
.whall-home-line.live{color:#1c7f46}
.wexam-chip.seat{background:#f0eaff;color:#5a3fd0}
