/* English Step by Step – Stylesheet (screen + printable worksheets) */
:root {
  --bg: #faf8f3;
  --card: #ffffff;
  --ink: #1e2430;
  --muted: #5b6472;
  --line: #e4dfd4;
  --brand: #0e7c66;
  --brand-dark: #095a49;
  --brand-soft: #e6f4f0;
  --teach: #b45309;
  --teach-soft: #fef3c7;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --close: #b45309;
  --close-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 40, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Sinhala", "Noto Sans Tamil", "Iskoola Pota", "Nirmala UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; font-size: 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); margin: 0.3rem 0 0.6rem; line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 1.2rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0.8rem 0 0.4rem; }
p { margin: 0.45rem 0; }
.si, [data-ui="si"] { line-height: 1.7; }
.ta, [data-ui="ta"] { line-height: 1.7; }
.hidden { display: none !important; }
.center { text-align: center; margin: 1.5rem 0; }
.lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.2rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.65rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; color: var(--ink); font-size: 1.08rem; }
.brand:hover { text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 1rem;
}
.nav { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.nav a { padding: 0.4rem 0.75rem; border-radius: 8px; color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.nav a.active, .nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.langs { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.langs button {
  border: 0; background: transparent; padding: 0.35rem 0.65rem; cursor: pointer;
  font-family: inherit; font-size: 0.88rem; color: var(--muted); font-weight: 600;
}
.langs button.on { background: var(--brand); color: #fff; }

/* Page shell */
.page { max-width: 960px; margin: 0 auto; padding: 1.3rem 1.1rem 3rem; }
.foot { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 1.5rem 1rem 2.2rem; border-top: 1px solid var(--line); }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: 0.55rem 1rem; border-radius: 10px; font-weight: 600; font-size: 0.96rem;
  font-family: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.alt { background: var(--teach); border-color: var(--teach); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.btn.small { padding: 0.38rem 0.7rem; font-size: 0.86rem; }
.btn.tiny { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 0.3rem 0.45rem; cursor: pointer; color: var(--brand-dark); line-height: 1;
}
.icon-btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.inp {
  width: 100%; padding: 0.55rem 0.7rem; border: 1.5px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 1rem; background: #fff; color: var(--ink);
}
.inp:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 124, 102, 0.15); }
.inp.small { font-size: 0.92rem; padding: 0.42rem 0.65rem; background: #fcfbf8; }
.inp.big { font-size: 1.02rem; line-height: 1.65; }
.inp.ok { border-color: var(--ok); background: var(--ok-bg); }
.inp.bad { border-color: var(--bad); background: var(--bad-bg); }

.mylang {
  display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.35rem 0.65rem; font-size: 0.9rem; color: var(--muted); margin: 0.5rem 0 0.9rem;
}
.mylang button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 0.2rem 0.6rem;
  font-family: inherit; cursor: pointer; font-weight: 600;
}
.mylang button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Home */
.hero {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.8rem 1.3rem; box-shadow: var(--shadow);
}
.tagline { color: var(--muted); max-width: 640px; margin: 0.3rem auto 1.2rem; font-size: 1.06rem; }
.ask { font-size: 1.15rem; margin-bottom: 0.9rem; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; max-width: 720px; margin: 0 auto 1rem; }
.role-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
  padding: 1.5rem 1.25rem; border-radius: var(--radius); border: 2px solid var(--line);
  background: #fff; color: var(--ink); text-align: center; transition: transform 0.12s, border-color 0.12s;
}
.role-card:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--brand); }
.role-card.teach:hover { border-color: var(--teach); }
.role-tag {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.18rem 0.65rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark);
}
.role-card.teach .role-tag { background: var(--teach-soft); color: var(--teach); }
.role-card b { font-size: 1.24rem; color: var(--brand-dark); }
.role-card.teach b { color: var(--teach); }
.role-card small { color: var(--muted); font-size: 0.93rem; line-height: 1.45; }

.type-pill, .lc-tag {
  display: inline-block; font-size: 0.76rem; font-weight: 700;
  padding: 0.12rem 0.5rem; border-radius: 6px; background: #f1efe8; color: var(--muted);
  border: 1px solid var(--line);
}
.lc-tag { flex-shrink: 0; font-size: 0.8rem; }

.levels-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; margin-top: 1.2rem; }
.lp { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.lp-icon { font-size: 1.5rem; margin-right: 0.35rem; }
.lp small { display: block; color: var(--muted); font-weight: 600; }
.lp p { font-size: 0.92rem; color: var(--muted); }

/* Level & Day cards */
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.level-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem; color: var(--ink); box-shadow: var(--shadow);
}
.level-card:hover { border-color: var(--brand); text-decoration: none; }
.lvl-icon { font-size: 2rem; }
.level-card b { font-size: 1.25rem; }
.ages { background: var(--brand-soft); color: var(--brand-dark); padding: 0.15rem 0.55rem; border-radius: 99px; font-size: 0.82rem; font-weight: 600; align-self: flex-start; }
.level-card p { color: var(--muted); font-size: 0.93rem; flex: 1; }
.level-card .meta { font-weight: 600; font-size: 0.9rem; color: var(--brand-dark); }
.bar { display: block; height: 6px; background: #ece8de; border-radius: 99px; overflow: hidden; margin-top: 0.35rem; }
.bar i { display: block; height: 100%; background: var(--brand); }

.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 0.85rem; }
.day-card {
  display: flex; flex-direction: column; gap: 0.4rem;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0.95rem 1rem; color: var(--ink); min-height: 118px;
}
.day-card:hover { border-color: var(--brand); text-decoration: none; }
.day-card.complete { border-color: var(--ok); }
.day-top { display: flex; align-items: center; justify-content: space-between; gap: 0.35rem; flex-wrap: wrap; }
.day-n { font-weight: 800; font-size: 1.06rem; }
.day-types { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.day-card small { color: var(--muted); font-size: 0.84rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 0.2rem; }
.day-card .bar { margin-top: auto; }

.lesson-list { display: flex; flex-direction: column; gap: 0.65rem; }
.lesson-card { display: flex; align-items: stretch; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.lesson-card:hover { border-color: var(--brand); }
.lc-main { flex: 1; display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; color: var(--ink); }
.lc-main:hover { text-decoration: none; }
.lc-icon { font-size: 1.5rem; }
.lc-text { flex: 1; display: flex; flex-direction: column; }
.lc-text small { color: var(--muted); font-size: 0.88rem; }
.lc-pct { font-weight: 700; font-size: 0.9rem; color: var(--muted); padding: 0.2rem 0.55rem; border-radius: 99px; background: #f2efe7; }
.lc-pct.done { background: var(--ok-bg); color: var(--ok); }
.lc-dl { display: flex; align-items: center; padding: 0 0.9rem; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; font-weight: 600; background: #faf7f0; }

/* Lesson view */
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.kicker { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.lesson-tools { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.stepper {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.25rem;
}
.stepper li a {
  display: flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  padding: 0.42rem 0.75rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 0.88rem; font-weight: 600;
}
.stepper li.cur a { background: var(--brand); color: #fff; border-color: var(--brand); }
.stepper li.done:not(.cur) a { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.stepper .num, .step-card h2 .num {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 99px;
  background: rgba(0, 0, 0, 0.08); font-size: 0.78rem; font-weight: 800;
}
.stepper li.cur .num { background: rgba(255, 255, 255, 0.25); }

.step-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.step-card h2 { margin-top: 0; display: flex; align-items: center; gap: 0.5rem; }
.how { background: var(--brand-soft); color: var(--brand-dark); padding: 0.65rem 0.85rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.95rem; }
.step-nav { display: flex; justify-content: space-between; margin-top: 1.1rem; }
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.9rem 0; }
.rate { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--muted); background: #f8f6f0; padding: 0.28rem 0.6rem; border-radius: 8px; border: 1px solid var(--line); }
.rate-val { font-weight: 700; color: var(--brand-dark); min-width: 2.3rem; }
.voice-sel { border: 1px solid var(--line); border-radius: 6px; padding: 0.2rem 0.4rem; font-family: inherit; font-size: 0.85rem; max-width: 210px; background: #fff; color: var(--ink); }
.tip { color: var(--muted); font-size: 0.9rem; margin-top: 0.8rem; }
.warn { background: var(--close-bg); color: var(--close); padding: 0.6rem 0.8rem; border-radius: 9px; }

/* Dictation & Meanings (Blurred click-to-reveal, neat non-overflowing cards) */
.dict-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 0.6rem; }
.mean-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 0.7rem; }
.dict-row, .mean-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.65rem; overflow: hidden; min-width: 0;
}
.dict-row.ok { border-color: var(--ok); background: var(--ok-bg); }
.dict-row.bad { border-color: var(--bad); background: var(--bad-bg); }
.n { color: var(--muted); font-weight: 700; min-width: 1.4rem; font-size: 0.86rem; flex-shrink: 0; }
.mean-row .w {
  min-width: 78px; max-width: 120px; font-size: 0.98rem;
  flex-shrink: 0; overflow-wrap: anywhere; word-break: break-word; line-height: 1.3;
}
.mean-row .icon-btn { flex-shrink: 0; }
.res { font-weight: 800; }

.meaning-pill {
  flex: 1 1 0%; min-width: 0; max-width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
  border: 1.5px solid #cbd5e1; background: #f8fafc; border-radius: 8px;
  padding: 0.42rem 0.65rem; cursor: pointer; font-family: inherit; font-size: 0.93rem;
  color: var(--ink); text-align: left; transition: all 0.18s ease;
  white-space: normal; overflow: hidden;
}
.meaning-pill:hover { border-color: var(--brand); background: var(--brand-soft); }
.meaning-pill .meaning-txt {
  flex: 1 1 auto; min-width: 0; font-weight: 700; color: var(--brand-dark);
  line-height: 1.45; overflow-wrap: anywhere; word-break: break-word;
  transition: filter 0.2s ease, opacity 0.2s ease;
}
.meaning-pill .meaning-eye { font-size: 0.85rem; opacity: 0.45; flex-shrink: 0; }
.meaning-pill.blurred { background: #f1f5f9; border-style: dashed; }
.meaning-pill.blurred .meaning-txt { filter: blur(6px); opacity: 0.65; user-select: none; }
.meaning-pill.blurred .meaning-eye { opacity: 0.9; }

/* High-visibility Red Answer Tag / Box */
.ans-tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: #fef2f2; color: #dc2626; border: 1.5px solid #f87171;
  padding: 0.22rem 0.6rem; border-radius: 7px; font-weight: 800; font-size: 0.93rem;
  white-space: normal; line-height: 1.4;
}
.inp.ans-in-box {
  color: #dc2626 !important; background: #fef2f2 !important;
  border-color: #ef4444 !important; font-weight: 800 !important;
}

/* Sentences, Dialogues & Underlines */
.u {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
  text-decoration-color: var(--teach); background: var(--teach-soft); padding: 0 0.2rem; border-radius: 4px; font-weight: 600;
}
.u-new {
  background: var(--ok-bg); color: var(--ok); padding: 0.05rem 0.35rem; border-radius: 5px;
  font-weight: 800; border-bottom: 2px solid var(--ok);
}
.dlg-example {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #f59e0b; border-radius: 12px; padding: 0.95rem 1.1rem; margin: 0.6rem 0 1.1rem;
}
.dlg-example h3 { margin: 0 0 0.6rem; color: #92400e; font-size: 1.05rem; }
.dlg-ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.65rem; }
.dlg-ex-step { background: #ffffff; border: 1px solid #fde68a; border-radius: 9px; padding: 0.6rem 0.75rem; }
.dlg-ex-lbl { display: block; font-size: 0.82rem; font-weight: 700; color: #78350f; margin-bottom: 0.25rem; }
.dlg-ex-sent { margin: 0; font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }

.set { border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.8rem; }
.sent-row, .negq-row { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.85rem; margin-bottom: 0.65rem; display: flex; flex-direction: column; gap: 0.45rem; }
.model-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.model { font-size: 1.04rem; display: flex; align-items: center; gap: 0.45rem; font-weight: 600; }
.sample-ans { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0.1rem 0 0.2rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.45rem; }
.four { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.4rem; }

/* Primary Negative & Questions and Tenses full-line inputs */
.nq-lines, .chg-lines { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.35rem; }
.nq-line-wrap, .chg-line-wrap { display: flex; flex-direction: column; gap: 0.3rem; }
.nq-input-row, .chg-input-row { display: flex; align-items: center; gap: 0.45rem; }
.nq-badge, .chg-badge {
  flex-shrink: 0; min-width: 145px; font-size: 0.86rem; font-weight: 700;
  padding: 0.35rem 0.6rem; border-radius: 8px; background: #f1efe8; color: var(--ink);
  border: 1px solid var(--line);
}
.chg-badge.pos { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.chg-badge.neg, .nq-badge.neg { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.chg-badge.q, .nq-badge.q { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.chg-badge.nq { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.nq-ans, .chg-ans { display: flex; align-items: center; gap: 0.4rem; padding-left: 0.2rem; flex-wrap: wrap; }
@media (max-width: 600px) {
  .nq-input-row, .chg-input-row { flex-wrap: wrap; }
  .nq-badge, .chg-badge { min-width: auto; }
}

/* Blanks – actual numbered blank lines (1__________) on screen & in print */
.bank { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.8rem; margin-bottom: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 99px;
  padding: 0.22rem 0.65rem; font-family: inherit; font-size: 0.92rem; cursor: pointer; font-weight: 600;
}
.chip:hover, .chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.used { opacity: 0.42; text-decoration: line-through; }
.bl { line-height: 2.35; margin: 0.4rem 0; font-size: 1.02rem; }
.blank { display: inline-flex; align-items: center; gap: 0.22rem; margin: 0 0.22rem; vertical-align: baseline; }
.blank-num {
  display: inline-block; font-weight: 800; color: var(--brand-dark);
  font-size: 0.92rem; margin-right: 1px;
}
.blank-in {
  width: 128px; display: inline-block; padding: 0.2rem 0.45rem; text-align: center; font-weight: 700;
  border: 1.5px solid #cbd5e1; border-bottom: 2.5px solid #334155; border-radius: 6px;
  background: #ffffff;
}
.blank-in::placeholder { color: #94a3b8; font-weight: 400; letter-spacing: 0.5px; }

/* Teacher mode & screen blank lines (1____________) */
.teach-blank-p { line-height: 2.1; margin: 0.45rem 0; font-size: 1rem; }
.pblank { display: inline-flex; align-items: baseline; margin: 0 0.2rem; white-space: nowrap; }
.pblank-no { font-weight: 800; color: var(--teach); margin-right: 2px; font-size: 0.95em; }
.pblank-line {
  display: inline-block; min-width: 82px; border-bottom: 2px solid #334155;
  color: transparent; user-select: text; text-align: center; line-height: 1.1;
}

/* Essay, Translation, Model Essay Box & Diff */
.meaning-btn-bar { margin: 0.6rem 0 1rem; }
.meaning-toggle-btn {
  padding: 0.7rem 1.25rem; font-size: 1.02rem; font-weight: 700;
  background: var(--teach-soft); color: #7c2d12; border: 2px solid #f59e0b;
  border-radius: 11px; box-shadow: 0 2px 6px rgba(245, 158, 11, 0.15);
}
.meaning-toggle-btn:hover, .meaning-toggle-btn.active {
  background: var(--teach); color: #fff; border-color: var(--teach);
}
.essay p { padding: 0.45rem 0.6rem; border-radius: 8px; }
.essay p.speaking { background: var(--teach-soft); }
.essay .tr { display: block; color: var(--brand-dark); font-weight: 600; margin-top: 0.25rem; padding-left: 2.2rem; }
.model-essay-box {
  background: #fcfbf8; border: 1.5px solid var(--brand); border-radius: 12px;
  padding: 1rem 1.2rem; margin-top: 1rem;
}
.model-essay-box h3 { margin: 0 0 0.6rem; color: var(--brand-dark); }
.model-essay-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.45rem; }
.model-essay-list li { line-height: 1.6; }
.legend { display: flex; gap: 0.6rem; margin: 0.5rem 0; font-size: 0.88rem; }
.tr-row, .find-row, .chg-row { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.8rem; margin-bottom: 0.6rem; }
.src { font-weight: 600; margin-bottom: 0.35rem; }
.fb { font-size: 0.92rem; margin-top: 0.35rem; padding: 0.35rem 0.55rem; border-radius: 8px; }
.fb.ok, .score.ok { background: var(--ok-bg); color: var(--ok); }
.fb.close, .score.close { background: var(--close-bg); color: var(--close); }
.fb.bad, .score.bad { background: var(--bad-bg); color: var(--bad); }
.score { padding: 0.65rem 0.9rem; border-radius: 10px; font-weight: 700; margin: 0.6rem 0; }
.diff { margin-top: 0.25rem; line-height: 1.7; }
.d-ok { color: var(--ok); }
.d-miss { background: var(--close-bg); color: var(--close); padding: 0 0.25rem; border-radius: 4px; font-weight: 700; }
.d-extra { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; padding: 0 0.25rem; border-radius: 4px; }
.model-ans { color: var(--muted); margin-top: 0.25rem; }

/* Tenses */
.tok { cursor: pointer; padding: 0.12rem 0.28rem; border-radius: 5px; display: inline-block; }
.tok:hover { background: var(--brand-soft); }
.tok.on, mark { background: var(--teach-soft); color: #7c2d12; padding: 0.12rem 0.32rem; border-radius: 4px; font-weight: 700; }
.find-input-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.45rem; }
.find-verb-in { max-width: 260px; flex: 1 1 180px; }
.find-ans { display: inline-flex; align-items: center; gap: 0.35rem; }
.verbs, .ex, .conv { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.verbs th, .verbs td, .ex th, .ex td, .conv td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; }
.verbs th, .ex th { background: #f4f1e8; }
.patterns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.7rem; margin: 0.6rem 0; }
.pattern { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.8rem; }
.pattern h4 { margin: 0 0 0.35rem; color: var(--brand-dark); }
.pm { display: inline-block; min-width: 1.5rem; font-weight: 800; color: var(--teach); }
.tense-pick {
  background: #fcfbf8; border: 1px solid var(--line); border-radius: 12px;
  padding: 0.85rem 1rem; margin-bottom: 0.75rem;
}
.tense-pick-lbl { display: block; margin-bottom: 0.55rem; color: var(--ink); font-size: 0.96rem; }
.tense-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chg-row { padding: 0.85rem 1rem; margin-bottom: 0.85rem; }
.chg-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.chg-head .src { margin: 0; font-size: 1.04rem; }
.timehint { font-size: 0.94rem; color: var(--brand-dark); background: var(--brand-soft); padding: 0.5rem 0.8rem; border-radius: 9px; margin: 0.5rem 0 0.85rem; font-weight: 600; }
.notes { background: var(--teach-soft); padding: 0.75rem 0.95rem; border-radius: 10px; margin-bottom: 0.8rem; }
.tips { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.8rem; margin-bottom: 0.8rem; }
.tips summary { cursor: pointer; font-weight: 700; }

/* Teach mode */
.print-bar {
  background: var(--teach-soft); border: 1px solid #f3d078; border-radius: 12px;
  padding: 0.75rem 0.95rem; display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin: 0.8rem 0 1.1rem;
}
.guide { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.g-step { display: flex; gap: 0.85rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.g-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 99px;
  background: var(--teach); color: #fff; font-weight: 800; display: grid; place-items: center;
}
.g-body { flex: 1; min-width: 0; }
.g-body h2 { margin-top: 0; }
.g-material { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.9rem; margin-top: 0.6rem; }
.g-prints { margin-top: 0.6rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.wordchips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.wc { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.22rem 0.55rem; display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; }
.wc i { font-style: normal; color: var(--muted); font-size: 0.8rem; }
.wc-m { color: var(--brand-dark); font-weight: 600; font-size: 0.9rem; }
.answers { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.answers span { background: #fff; border: 1px solid var(--line); padding: 0.2rem 0.55rem; border-radius: 7px; font-weight: 600; }
.answers i { font-style: normal; color: var(--brand-dark); margin-right: 0.2rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.9rem; }

/* Method page – clean handbook layout */
.method-stack { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1rem; }
.method-section {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.5rem; box-shadow: var(--shadow);
}
.method-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  border-bottom: 1.5px solid var(--line); padding-bottom: 0.7rem; margin-bottom: 1rem;
}
.method-head h2 { margin: 0; font-size: 1.25rem; color: var(--brand-dark); }
.method-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.8rem; }
.method-steps li { display: flex; align-items: flex-start; gap: 0.85rem; }
.ms-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #b6dfd4;
  font-weight: 800; font-size: 0.88rem; display: grid; place-items: center; margin-top: 0.1rem;
}
.ms-txt { flex: 1; font-size: 1rem; line-height: 1.65; color: var(--ink); max-width: 72ch; }
.author { background: var(--card); border-left: 4px solid var(--brand); padding: 1.15rem 1.4rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; font-style: italic; line-height: 1.7; }

/* Mobile & Phone Optimization */
@media (max-width: 680px) {
  .topbar {
    position: static;
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }
  .brand {
    font-size: 0.95rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .logo { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; }
  .langs button { padding: 0.28rem 0.5rem; font-size: 0.8rem; }
  .nav {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    border-top: 1px solid var(--line);
    padding-top: 0.45rem;
  }
  .nav a { text-align: center; padding: 0.38rem 0.3rem; font-size: 0.88rem; }

  .page { padding: 0.85rem 0.75rem 2.2rem; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.12rem; }
  .lead { font-size: 0.96rem; margin-bottom: 0.9rem; }

  .hero { padding: 1.25rem 0.9rem; }
  .role-cards { grid-template-columns: 1fr; gap: 0.75rem; }
  .role-card { padding: 1.15rem 0.95rem; }

  .day-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .day-card { padding: 0.75rem 0.8rem; min-height: 104px; }
  .day-n { font-size: 0.98rem; }

  .lesson-head { flex-direction: column; align-items: stretch; gap: 0.55rem; }
  .lesson-tools { width: 100%; }
  .lesson-tools .btn { flex: 1; justify-content: center; }

  .stepper { gap: 0.3rem; margin-bottom: 0.75rem; padding-bottom: 0.35rem; }
  .stepper li a { padding: 0.36rem 0.62rem; font-size: 0.82rem; }

  .step-card { padding: 0.95rem 0.8rem; }
  .how { padding: 0.55rem 0.7rem; font-size: 0.9rem; }

  .toolbar { gap: 0.45rem; }
  .rate { width: 100%; justify-content: space-between; }
  .voice-sel { max-width: 100%; flex: 1; }

  .dict-list, .mean-list { grid-template-columns: 1fr; gap: 0.5rem; }
  .mean-row .w { min-width: 72px; max-width: 110px; }

  .dlg-ex-grid { grid-template-columns: 1fr; }
  .sent-row, .negq-row, .tr-row, .find-row, .chg-row { padding: 0.65rem 0.65rem; }

  /* Give inputs 100% width on phones in Negative/Questions & Change the Tense */
  .nq-input-row, .chg-input-row {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .nq-badge, .chg-badge {
    min-width: auto;
    font-size: 0.8rem;
    padding: 0.24rem 0.55rem;
  }
  .nq-input-row [data-act="rev-one"],
  .chg-input-row [data-act="rev-one"] {
    margin-left: auto;
  }
  .nq-input-row .inp,
  .chg-input-row .inp {
    order: 3;
    width: 100%;
    flex: 0 0 100%;
  }

  .find-input-row .find-verb-in {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .bl { line-height: 2.25; font-size: 0.96rem; }
  .blank-in { width: 108px; font-size: 0.95rem; padding: 0.18rem 0.35rem; }

  .meaning-toggle-btn { width: 100%; justify-content: center; font-size: 0.95rem; padding: 0.6rem 0.9rem; }

  .verbs th, .verbs td, .ex th, .ex td, .conv td { padding: 0.35rem 0.4rem; font-size: 0.88rem; }
  .g-step { flex-direction: column; gap: 0.5rem; padding: 0.95rem 0.85rem; }
  .method-section { padding: 1rem 0.9rem; }
}

@media (max-width: 400px) {
  .day-grid { grid-template-columns: 1fr; }
}

/* Printable worksheet (#print-root is hidden on screen, shown when printing) */
#print-root { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  body.printing #app { display: none !important; }
  body.printing #print-root { display: block !important; }
  .sheet { padding: 0; }
  .sheet-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 6pt; margin-bottom: 10pt; }
  .sh-site { font-size: 9pt; color: #444; }
  .sh-title { font-size: 14pt; font-weight: 800; }
  .sh-meta { font-size: 9.5pt; color: #333; }
  .sh-name { font-size: 10pt; line-height: 1.8; text-align: right; }
  .sh-key { border: 2px solid #000; padding: 3pt 8pt; font-weight: 800; }
  .sh-instr { font-style: italic; margin-bottom: 8pt; }
  .p-dict { column-count: 2; column-gap: 24pt; padding-left: 18pt; }
  .p-dict li { margin-bottom: 10pt; break-inside: avoid; }
  .wline { border-bottom: 1px solid #333; height: 18pt; margin-top: 3pt; }
  .wline.light { border-bottom-style: dashed; border-color: #666; }
  .p-table { width: 100%; border-collapse: collapse; }
  .p-table th, .p-table td { border: 1px solid #333; padding: 5pt 6pt; text-align: left; }
  .p-item { margin-bottom: 9pt; break-inside: avoid; }
  .p-item p { margin: 0 0 2pt; font-weight: 600; }
  .p-bank, .p-ex { border: 1px solid #333; padding: 6pt 8pt; margin-bottom: 10pt; font-weight: 600; }
  .p-blank { line-height: 2.1; margin: 4pt 0; }
  .pblank { display: inline-flex; align-items: baseline; margin: 0 2pt; }
  .pblank-no { color: #000; font-weight: 800; margin-right: 2pt; }
  .pblank-line { min-width: 75pt; border-bottom: 1px solid #000; color: transparent; }
  .p-ans span { display: inline-block; min-width: 85pt; margin: 2pt 6pt 2pt 0; }
  .u { background: none; text-decoration: underline; font-weight: 700; }
  .lab { float: left; width: 18pt; font-weight: 700; margin-top: 4pt; }
}
