/* =====================================================================
   AmharicLab · Grammar lessons page  (grammar_lesson.html)
   Brand: blue #17A2B8 · orange #FF8C42
   ===================================================================== */
.gl-page {
  --gl-blue: #17A2B8;
  --gl-blue-d: #117887;
  --gl-blue-l: #E8F9FB;
  --gl-orange: #FF8C42;
  --gl-orange-l: #FFF5EC;
  --gl-ink: #1F2A37;
  --gl-ink-2: #4B5563;
  --gl-muted: #6B7280;
  --gl-line: #E5E7EB;
  --gl-bg: #F6F8FB;
  --gl-card: #FFFFFF;
  --gl-ok: #16A34A;
  --gl-ok-l: #E8F7EE;
  --gl-bad: #DC2626;
  --gl-bad-l: #FDECEC;
  --gl-radius: 16px;
  --gl-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  background: var(--gl-bg);
  color: var(--gl-ink);
  font-family: 'Nunito', 'Noto Sans Ethiopic', system-ui, sans-serif;
}
.gl-am { font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif; }
.gl-page [hidden] { display: none !important; }
.gl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gl-muted { color: var(--gl-muted); }

/* ---------- Hero ---------- */
.gl-hero {
  background: var(--gl-blue);
  color: #fff;
  padding: 32px 16px 56px;
}
.gl-hero__inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.gl-hero__eyebrow {
  display: inline-block; background: rgba(255,255,255,.18); padding: 4px 12px;
  border-radius: 999px; font-weight: 700; font-size: .85rem; letter-spacing: .02em;
}
.gl-hero__title { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; margin: 10px 0 6px; line-height: 1.2; color: #fff; }
.gl-hero__title .gl-am { display: block; font-size: .62em; font-weight: 600; opacity: .95; margin-top: 4px; }
.gl-hero__sub { max-width: 560px; margin: 0; opacity: .95; }
.gl-hero__progress { display: flex; gap: 20px; align-items: center; background: rgba(255,255,255,.14); padding: 14px 18px; border-radius: var(--gl-radius); }
.gl-ring {
  --p: 0; width: 92px; height: 92px; border-radius: 50%;
  background: conic-gradient(var(--gl-orange) calc(var(--p) * 1%), rgba(255,255,255,.3) 0);
  display: grid; place-items: center; position: relative; flex: none;
}
.gl-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #128293; }
.gl-ring__num, .gl-ring__label { position: relative; text-align: center; line-height: 1; }
.gl-ring__num { font-size: 1.35rem; font-weight: 800; align-self: end; }
.gl-ring__label { font-size: .7rem; opacity: .9; align-self: start; margin-top: 2px; }
.gl-hero__stats { display: grid; gap: 6px; margin: 0; }
.gl-hero__stats div { display: flex; gap: 10px; justify-content: space-between; min-width: 170px; }
.gl-hero__stats dt { font-weight: 600; opacity: .9; }
.gl-hero__stats dd { margin: 0; font-weight: 800; }

/* ---------- Shell ---------- */
.gl-shell {
  max-width: 1200px; margin: -32px auto 48px; padding: 0 16px;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start;
}
.gl-side {
  background: var(--gl-card); border-radius: var(--gl-radius); box-shadow: var(--gl-shadow);
  position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto;
}
.gl-side__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; font-weight: 800; border-bottom: 1px solid var(--gl-line); font-size: .95rem;
}
.gl-side__count { background: var(--gl-blue-l); color: var(--gl-blue-d); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.gl-side__list { list-style: none; margin: 0; padding: 8px; }
.gl-nav-item {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 9px 10px; border-radius: 12px; cursor: pointer; color: inherit;
}
.gl-nav-item:hover { background: var(--gl-bg); }
.gl-nav-item.is-active { background: var(--gl-blue-l); box-shadow: inset 3px 0 0 var(--gl-blue); }
.gl-nav-item__icon {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--gl-orange-l); font-size: 1.05rem; font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 700; color: var(--gl-orange);
}
.gl-nav-item__text { min-width: 0; flex: 1; }
.gl-nav-item__am { display: block; font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.gl-nav-item__en { display: block; font-size: .78rem; color: var(--gl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-nav-item__state { flex: none; font-size: .8rem; color: var(--gl-muted); }
.gl-nav-item__state.is-done { color: var(--gl-ok); }
.gl-mobile-pick { display: none; }

.gl-main { min-width: 0; }
.gl-loading { background: var(--gl-card); border-radius: var(--gl-radius); padding: 40px; text-align: center; box-shadow: var(--gl-shadow); }

/* ---------- Lesson header ---------- */
.gl-lesson { background: var(--gl-card); border-radius: var(--gl-radius); box-shadow: var(--gl-shadow); padding: 24px; }
.gl-lesson__head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.gl-lesson__badge {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--gl-orange), #FFA85C); color: #fff; font-size: 1.9rem; font-weight: 800;
  font-family: 'Noto Sans Ethiopic', sans-serif;
}
.gl-lesson__titles { flex: 1; min-width: 200px; }
.gl-lesson__kicker { margin: 0; color: var(--gl-blue); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.gl-lesson__title { margin: 2px 0 0; font-size: 1.7rem; font-weight: 700; line-height: 1.25; }
.gl-lesson__title-en { margin: 0; color: var(--gl-ink-2); font-weight: 700; }
.gl-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: .8rem; font-weight: 700; }
.gl-chip--grade { background: var(--gl-blue-l); color: var(--gl-blue-d); }

.gl-goals { margin: 18px 0 6px; background: #FAFCFF; border: 1px solid #DCF3F6; border-radius: 12px; padding: 10px 16px; }
.gl-goals summary { cursor: pointer; font-weight: 800; color: var(--gl-blue-d); }
.gl-goals ul { margin: 10px 0 4px; padding: 0; list-style: none; display: grid; gap: 0; }
.gl-goals li {
  display: grid; grid-template-columns: 24px minmax(0, 1.1fr) minmax(0, 1fr); gap: 4px 16px; align-items: start;
  padding: 8px 0; border-top: 1px dashed #DCF3F6;
}
.gl-goals li:first-child { border-top: 0; }
.gl-goals__tick { color: var(--gl-ok); font-weight: 800; line-height: 1.6; }
.gl-goals .gl-am { font-weight: 600; line-height: 1.6; }
.gl-goals .gl-en { color: var(--gl-ink-2); font-size: .92rem; line-height: 1.6; border-left: 3px solid var(--gl-blue-l); padding-left: 12px; }
.gl-page.gl-no-en .gl-goals li { grid-template-columns: 24px 1fr; }
.gl-page.gl-no-en .gl-goals .gl-en { display: none; }

/* ---------- Tabs ---------- */
.gl-tabs { display: flex; gap: 6px; margin: 18px 0 18px; border-bottom: 2px solid var(--gl-line); overflow-x: auto; }
.gl-tab {
  border: 0; background: none; padding: 10px 14px; font-weight: 800; color: var(--gl-muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-size: .95rem; font-family: inherit;
}
.gl-tab.is-active { color: var(--gl-blue-d); border-bottom-color: var(--gl-blue); }
.gl-tab__am { font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 600; font-size: .85em; opacity: .8; }
.gl-tab__pill { background: var(--gl-orange); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .75rem; margin-left: 4px; }
.gl-view { display: none; }
.gl-view.is-active { display: block; }

/* ---------- Learn: topic pages ---------- */
.gl-toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.gl-topicbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gl-topicbar__label { font-weight: 800; color: var(--gl-blue-d); font-size: .9rem; }
.gl-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.gl-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid #BFE6EC; background: #fff; padding: 0; cursor: pointer;
  transition: transform .15s;
}
.gl-dot.is-seen { background: #BFE6EC; }
.gl-dot.is-current { background: var(--gl-orange); border-color: var(--gl-orange); transform: scale(1.25); }
.gl-toc { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.gl-toc__item {
  display: inline-flex; gap: 6px; align-items: center; color: var(--gl-ink-2); background: var(--gl-bg); border: 1px solid var(--gl-line);
  border-radius: 999px; padding: 4px 12px 4px 4px; font-size: .82rem; font-weight: 700; cursor: pointer;
  font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif;
}
.gl-toc__n { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: .72rem; border: 1px solid var(--gl-line); }
.gl-toc__item:hover { border-color: var(--gl-blue); color: var(--gl-blue-d); }
.gl-toc__item.is-seen .gl-toc__n { background: #BFE6EC; border-color: #BFE6EC; color: var(--gl-blue-d); }
.gl-toc__item.is-current { background: var(--gl-orange-l); border-color: var(--gl-orange); color: #A8551A; }
.gl-toc__item.is-current .gl-toc__n { background: var(--gl-orange); border-color: var(--gl-orange); color: #fff; }
.gl-page-card { min-height: 260px; }
.gl-section small { font-size: .65em; color: var(--gl-muted); font-weight: 600; }
.gl-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px;
  padding: 14px; background: var(--gl-bg); border-radius: 14px;
}
.gl-pager__mid { font-weight: 800; color: var(--gl-muted); }
.gl-switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .85rem; cursor: pointer; user-select: none; }
.gl-switch input { position: absolute; opacity: 0; }
.gl-switch__track { width: 40px; height: 22px; border-radius: 999px; background: #CBD5E1; position: relative; transition: background .2s; }
.gl-switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.gl-switch input:checked + .gl-switch__track { background: var(--gl-blue); }
.gl-switch input:checked + .gl-switch__track::after { transform: translateX(18px); }
.gl-switch input:focus-visible + .gl-switch__track { outline: 2px solid var(--gl-orange); outline-offset: 2px; }

/* ---------- Learn: sections ---------- */
.gl-section { border-top: 1px solid var(--gl-line); padding: 20px 0 6px; scroll-margin-top: 90px; }
.gl-section:first-child { border-top: 0; padding-top: 4px; }
.gl-section__title { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 0 0 12px; }
.gl-section__title .gl-am { font-size: 1.3rem; font-weight: 700; color: var(--gl-ink); }
.gl-section__title .gl-en { font-size: .95rem; font-weight: 700; color: var(--gl-blue); }
.gl-sub { margin: 18px 0 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.gl-sub .gl-am { font-weight: 700; font-size: 1.05rem; }
.gl-sub .gl-en { font-weight: 700; font-size: .85rem; color: var(--gl-blue); }

/* bilingual pair: Amharic | English */
.gl-pair { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; margin: 0 0 12px; }
.gl-pair__am { font-family: 'Noto Sans Ethiopic', sans-serif; line-height: 1.85; font-size: 1.02rem; }
.gl-pair__en { color: var(--gl-ink-2); line-height: 1.6; font-size: .95rem; border-left: 3px solid var(--gl-blue-l); padding-left: 14px; }
.gl-page.gl-no-en .gl-pair { grid-template-columns: 1fr; }
.gl-page.gl-no-en .gl-pair__en,
.gl-page.gl-no-en .gl-section__title .gl-en,
.gl-page.gl-no-en .gl-sub .gl-en { display: none; }

/* bulleted descriptions */
.gl-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.gl-list > li { position: relative; padding-left: 22px; }
.gl-list > li::before { content: ""; position: absolute; left: 6px; top: .75em; width: 7px; height: 7px; border-radius: 50%; background: var(--gl-orange); }
.gl-list .gl-pair { margin: 0; }

/* callouts */
.gl-callout { display: grid; grid-template-columns: 28px 1fr; gap: 10px; border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.gl-callout__icon { font-size: 1.2rem; line-height: 1.4; }
.gl-callout--note { background: #F3F7FF; border: 1px solid #DDE7FB; }
.gl-callout--tip { background: var(--gl-orange-l); border: 1px solid #FFE2C7; }
.gl-callout--teacher { background: #F4FBF6; border: 1px solid #D3EFDC; }
.gl-callout .gl-pair { margin: 0; }

/* examples */
.gl-example {
  background: linear-gradient(180deg, #FFFBF6, #FFF6EC); border: 1px dashed #FFC999; border-radius: 12px;
  padding: 12px 16px 12px 46px; margin: 0 0 14px; position: relative; font-family: 'Noto Sans Ethiopic', sans-serif; line-height: 1.9;
}
.gl-example::before { content: "💡"; position: absolute; left: 14px; top: 12px; }
.gl-example p { margin: 0 0 8px; }
.gl-example p:last-child { margin: 0; }
.gl-table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--gl-line); border-radius: 12px; }
.gl-table { width: 100%; border-collapse: collapse; font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif; font-size: .95rem; }
.gl-table th { background: var(--gl-blue-l); color: var(--gl-blue-d); text-align: left; padding: 9px 12px; font-weight: 700; white-space: nowrap; }
.gl-table td { padding: 8px 12px; border-top: 1px solid var(--gl-line); vertical-align: top; }
.gl-table tr:nth-child(even) td { background: #FBFCFE; }
.gl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.gl-chips span { background: var(--gl-orange-l); color: #A8551A; border-radius: 10px; padding: 6px 12px; font-weight: 700; font-family: 'Noto Sans Ethiopic', sans-serif; }


/* ---------- Buttons ---------- */
.gl-btn {
  border: 0; border-radius: 12px; padding: 11px 20px; font-weight: 800; cursor: pointer; font-family: inherit;
  background: var(--gl-orange); color: #fff; box-shadow: 0 2px 0 #D9701E; transition: transform .05s, filter .2s;
}
.gl-btn:hover { filter: brightness(1.05); }
.gl-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #D9701E; }
.gl-btn:disabled { opacity: .45; cursor: default; }
.gl-btn--ghost { background: #fff; color: var(--gl-blue-d); border: 2px solid var(--gl-blue); box-shadow: none; }
.gl-btn--blue { background: var(--gl-blue); box-shadow: 0 2px 0 var(--gl-blue-d); }
.gl-btn--sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.gl-btn:focus-visible, .gl-tab:focus-visible, .gl-nav-item:focus-visible, .gl-opt:focus-visible,
.gl-chip-btn:focus-visible, .gl-blank:focus-visible, .gl-basket:focus-visible { outline: 3px solid var(--gl-orange); outline-offset: 2px; }

/* ---------- Practice ---------- */
.gl-scorebar { display: flex; gap: 14px; align-items: center; background: var(--gl-bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.gl-scorebar__label { font-weight: 700; color: var(--gl-muted); font-size: .85rem; margin-right: 6px; }
.gl-scorebar__num { font-weight: 800; }
.gl-scorebar__track { flex: 1; min-width: 120px; height: 10px; border-radius: 999px; background: #E2E8F0; overflow: hidden; }
.gl-scorebar__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gl-ok), #4ADE80); transition: width .4s; }

.gl-steps { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; padding: 0; }
.gl-step {
  width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--gl-line); background: #fff; font-weight: 800;
  cursor: pointer; color: var(--gl-ink-2); font-family: inherit;
}
.gl-step.is-current { border-color: var(--gl-blue); color: var(--gl-blue-d); box-shadow: 0 0 0 3px var(--gl-blue-l); }
.gl-step.is-done { background: var(--gl-ok); border-color: var(--gl-ok); color: #fff; }
.gl-step.is-partial { background: #F59E0B; border-color: #F59E0B; color: #fff; }

.gl-act { border: 1px solid var(--gl-line); border-radius: var(--gl-radius); padding: 18px; background: #fff; }
.gl-act__head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.gl-act__num { color: var(--gl-orange); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.gl-act__title { margin: 2px 0 0; font-family: 'Noto Sans Ethiopic', sans-serif; font-size: 1.2rem; font-weight: 700; }
.gl-act__title-en { margin: 0; color: var(--gl-ink-2); font-weight: 700; font-size: .92rem; }
.gl-type { background: var(--gl-blue-l); color: var(--gl-blue-d); border-radius: 999px; padding: 3px 10px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.gl-act__ins { background: var(--gl-bg); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; font-family: 'Noto Sans Ethiopic', sans-serif; }
.gl-act__note { color: var(--gl-muted); font-size: .88rem; font-family: 'Noto Sans Ethiopic', sans-serif; margin: 10px 0 0; }
.gl-act__foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; border-top: 1px solid var(--gl-line); padding-top: 14px; }
.gl-act__result { font-weight: 800; }
.gl-act__result.is-ok { color: var(--gl-ok); }
.gl-act__result.is-part { color: #B45309; }
.gl-act__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gl-q { margin: 0 0 16px; }
.gl-q__stem { font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 600; margin: 0 0 8px; line-height: 1.7; }
.gl-q__stem b { color: var(--gl-orange); margin-right: 4px; }
.gl-q__note { font-size: .85rem; color: var(--gl-ok); font-weight: 700; margin: 6px 0 0; font-family: 'Noto Sans Ethiopic', sans-serif; }

/* multiple choice */
.gl-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.gl-opt {
  text-align: left; border: 2px solid var(--gl-line); background: #fff; border-radius: 12px; padding: 9px 12px; cursor: pointer;
  font-family: 'Noto Sans Ethiopic', sans-serif; font-size: .98rem; display: flex; gap: 8px; align-items: flex-start; color: var(--gl-ink);
}
.gl-opt__key { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--gl-bg); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.gl-opt:hover:not(:disabled) { border-color: var(--gl-blue); }
.gl-opt:disabled { cursor: default; }
.gl-opt.is-ok { border-color: var(--gl-ok); background: var(--gl-ok-l); }
.gl-opt.is-bad { border-color: var(--gl-bad); background: var(--gl-bad-l); }
.gl-opt.is-reveal { border-color: var(--gl-ok); border-style: dashed; }

/* word bank + blanks */
.gl-bank {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; margin: 0 0 14px;
  background: var(--gl-orange-l); border: 2px dashed #FFC999; border-radius: 12px; position: sticky; top: 76px; z-index: 2;
}
.gl-bank__label { width: 100%; font-size: .75rem; font-weight: 800; color: #A8551A; text-transform: uppercase; letter-spacing: .05em; }
.gl-chip-btn {
  border: 2px solid #FFC999; background: #fff; border-radius: 10px; padding: 6px 12px; cursor: grab;
  font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 700; font-size: 1rem; color: var(--gl-ink);
}
.gl-chip-btn.is-picked { background: var(--gl-orange); border-color: var(--gl-orange); color: #fff; }
.gl-chip-btn.is-used { opacity: .35; }
.gl-blank {
  display: inline-flex; min-width: 72px; min-height: 34px; align-items: center; justify-content: center; vertical-align: middle;
  border: 0; border-bottom: 3px solid var(--gl-blue); background: var(--gl-blue-l); border-radius: 8px 8px 2px 2px;
  padding: 2px 10px; margin: 2px 4px; cursor: pointer; font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 700; font-size: 1rem; color: var(--gl-blue-d);
}
.gl-blank:empty::after { content: "＿＿"; color: #9CD8E2; }
.gl-blank.is-drop { background: #CDEEF3; }
.gl-blank.is-ok { background: var(--gl-ok-l); border-color: var(--gl-ok); color: var(--gl-ok); }
.gl-blank.is-bad { background: var(--gl-bad-l); border-color: var(--gl-bad); color: var(--gl-bad); }
.gl-fill-item { display: flex; gap: 8px; align-items: baseline; margin: 0 0 10px; font-family: 'Noto Sans Ethiopic', sans-serif; font-size: 1.02rem; line-height: 2.2; flex-wrap: wrap; }
.gl-fill-item__n { font-weight: 800; color: var(--gl-orange); min-width: 20px; }
.gl-fill-item__img { font-size: .8rem; color: var(--gl-muted); border: 1px dashed var(--gl-line); border-radius: 8px; padding: 0 8px; }
.gl-fill-item__hint { color: var(--gl-muted); font-size: .9rem; }
.gl-toggle { display: inline-flex; border: 2px solid var(--gl-line); border-radius: 10px; overflow: hidden; margin-left: 6px; }
.gl-toggle button { border: 0; background: #fff; padding: 4px 10px; font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 700; cursor: pointer; }
.gl-toggle button.is-on { background: var(--gl-blue); color: #fff; }
.gl-toggle.is-ok { border-color: var(--gl-ok); }
.gl-toggle.is-bad { border-color: var(--gl-bad); }
.gl-passage { font-family: 'Noto Sans Ethiopic', sans-serif; line-height: 2.4; font-size: 1.05rem; background: #FCFDFF; border: 1px solid var(--gl-line); border-radius: 12px; padding: 12px 16px; }
.gl-table td .gl-blank { min-width: 54px; }

/* match */
.gl-match { display: grid; gap: 8px; }
.gl-match__row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1.1fr); gap: 10px; align-items: center; }
.gl-match__left { font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 600; background: var(--gl-bg); border-radius: 10px; padding: 9px 12px; }
.gl-match__arrow { color: var(--gl-muted); text-align: center; }
.gl-match select {
  width: 100%; border: 2px solid var(--gl-line); border-radius: 10px; padding: 9px 10px; font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif;
  font-size: .98rem; background: #fff; color: var(--gl-ink);
}
.gl-match select.is-ok { border-color: var(--gl-ok); background: var(--gl-ok-l); }
.gl-match select.is-bad { border-color: var(--gl-bad); background: var(--gl-bad-l); }

/* sort */
.gl-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 10px; border: 2px dashed var(--gl-line); border-radius: 12px; margin-bottom: 12px; }
.gl-pool:empty::after { content: "✓ All placed"; color: var(--gl-muted); font-weight: 700; align-self: center; }
.gl-baskets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.gl-basket {
  border: 2px solid var(--gl-blue-l); border-radius: 14px; background: #FAFCFF; padding: 10px; min-height: 110px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 6px; font-family: inherit;
}
.gl-basket.is-drop { border-color: var(--gl-blue); background: var(--gl-blue-l); }
.gl-basket__title { font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 800; color: var(--gl-blue-d); }
.gl-basket__items { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-chip-btn.is-ok { border-color: var(--gl-ok); background: var(--gl-ok-l); }
.gl-chip-btn.is-bad { border-color: var(--gl-bad); background: var(--gl-bad-l); }

/* order */
.gl-order { margin: 0 0 16px; }
.gl-order__line {
  min-height: 48px; border: 2px dashed var(--gl-blue); border-radius: 12px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; background: #FAFCFF; margin: 6px 0;
}
.gl-order__line.is-ok { border-style: solid; border-color: var(--gl-ok); background: var(--gl-ok-l); }
.gl-order__line.is-bad { border-style: solid; border-color: var(--gl-bad); background: var(--gl-bad-l); }
.gl-order__tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-order__answer { font-family: 'Noto Sans Ethiopic', sans-serif; color: var(--gl-ok); font-weight: 700; font-size: .9rem; }
.gl-seq { display: grid; gap: 8px; }
.gl-seq__item {
  display: flex; gap: 10px; align-items: center; border: 2px solid var(--gl-line); border-radius: 12px; padding: 8px 10px; background: #fff;
  font-family: 'Noto Sans Ethiopic', sans-serif; cursor: pointer; text-align: left; width: 100%; color: var(--gl-ink); font-size: .98rem;
}
.gl-seq__badge { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--gl-bg); display: grid; place-items: center; font-weight: 800; color: var(--gl-muted); }
.gl-seq__item.is-set .gl-seq__badge { background: var(--gl-blue); color: #fff; }
.gl-seq__label { font-size: .75rem; color: var(--gl-blue-d); font-weight: 800; }
.gl-seq__item.is-ok { border-color: var(--gl-ok); background: var(--gl-ok-l); }
.gl-seq__item.is-bad { border-color: var(--gl-bad); background: var(--gl-bad-l); }

/* write */
.gl-write label { display: block; font-family: 'Noto Sans Ethiopic', sans-serif; font-weight: 700; margin: 10px 0 4px; }
.gl-write textarea {
  width: 100%; border: 2px solid var(--gl-line); border-radius: 10px; padding: 8px 10px; font-family: 'Noto Sans Ethiopic', sans-serif;
  font-size: 1rem; min-height: 46px; resize: vertical;
}
.gl-write textarea:focus { border-color: var(--gl-blue); outline: none; }
.gl-starters { background: var(--gl-bg); border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-family: 'Noto Sans Ethiopic', sans-serif; }
.gl-starters ul { margin: 6px 0 0; padding-left: 18px; }
.gl-sample { background: var(--gl-ok-l); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-family: 'Noto Sans Ethiopic', sans-serif; line-height: 1.8; }

.gl-done { display: flex; gap: 14px; align-items: center; background: var(--gl-ok-l); border: 2px solid #BBE7CB; border-radius: var(--gl-radius); padding: 16px; margin-top: 16px; }
.gl-done__emoji { font-size: 2.2rem; }
.gl-done__title { margin: 0; font-weight: 800; font-size: 1.1rem; }
.gl-done__sub { margin: 0; color: var(--gl-ink-2); }

/* teachers */
.gl-games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.gl-game { border: 1px solid var(--gl-line); border-radius: 14px; padding: 14px; background: #FFFDFB; }
.gl-game h4 { margin: 0 0 6px; font-family: 'Noto Sans Ethiopic', sans-serif; font-size: 1.05rem; color: var(--gl-orange); }
.gl-game p { margin: 0; font-family: 'Noto Sans Ethiopic', sans-serif; line-height: 1.75; font-size: .95rem; }

.gl-footnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; border-top: 1px solid var(--gl-line); padding-top: 16px; }

@keyframes gl-pop { 0% { transform: scale(.96); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
.gl-pop { animation: gl-pop .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .gl-pop { animation: none; } .gl-scorebar__fill { transition: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .gl-shell { grid-template-columns: 1fr; margin-top: -28px; }
  .gl-side { display: none; }
  .gl-mobile-pick { display: block; }
  .gl-mobile-pick select {
    width: 100%; padding: 12px; border-radius: 12px; border: 0; box-shadow: var(--gl-shadow); font-weight: 700;
    font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif; font-size: 1rem; background: #fff;
  }
  .gl-hero__progress { width: 100%; justify-content: center; }
}
@media (max-width: 720px) {
  .gl-pair { grid-template-columns: 1fr; gap: 6px; }
  .gl-pair__en { border-left: 0; padding-left: 0; border-top: 1px dashed var(--gl-line); padding-top: 6px; }
  .gl-lesson { padding: 16px; }
  .gl-lesson__title { font-size: 1.4rem; }
  .gl-match__row { grid-template-columns: 1fr; gap: 4px; }
  .gl-match__arrow { display: none; }
  .gl-bank { top: 60px; }
  .gl-toc { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; width: 100%; }
  .gl-toc__item { white-space: nowrap; }
  .gl-goals li { grid-template-columns: 22px 1fr; }
  .gl-goals .gl-en { grid-column: 2; border-left: 0; padding-left: 0; }
  .gl-pager { position: sticky; bottom: 8px; box-shadow: var(--gl-shadow); background: #fff; z-index: 3; }
  .gl-pager .gl-btn { padding: 10px 14px; font-size: .9rem; }
  .gl-hero { padding-bottom: 46px; }
}

/* keep long topic names from stretching the topic list */
.gl-toc__item{max-width:280px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---------- Save my result ---------- */
.gl-scorebar__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.gl-btn--save { background: var(--gl-blue); box-shadow: 0 2px 0 var(--gl-blue-d); }
.gl-btn--save:disabled { opacity: .6; cursor: wait; }
.gl-done .gl-btn--save { margin-left: auto; }
.gl-save-msg {
  margin: -6px 0 14px; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  background: var(--gl-blue-l); color: var(--gl-blue-d); border: 1px solid #BFE6EC;
}
.gl-save-msg a { color: inherit; font-weight: 800; text-decoration: underline; }
.gl-save-msg.is-ok   { background: var(--gl-ok-l);  color: #166534; border-color: #BBE7CB; }
.gl-save-msg.is-warn { background: var(--gl-orange-l); color: #A8551A; border-color: #FFC999; }
.gl-save-msg.is-bad  { background: var(--gl-bad-l); color: #991B1B; border-color: #F5B8B8; }
@media (max-width: 720px) {
  .gl-scorebar__actions { margin-left: 0; width: 100%; }
  .gl-scorebar__actions .gl-btn { flex: 1; }
  .gl-done { flex-wrap: wrap; }
  .gl-done .gl-btn--save { margin-left: 0; width: 100%; }
}
.gl-act .gl-save-msg { margin: 12px 0 0; }

/* ---------- Subscription lock (lessons 3–12) ---------- */
.gl-lesson.is-locked .gl-tabs,
.gl-lesson.is-locked .gl-view { display: none !important; }
.gl-locked { position: relative; margin-top: 16px; min-height: 260px; }
.gl-locked__gate { min-height: 300px; border-radius: 14px; }
.gl-locked__preview {
  max-height: 340px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 40%, transparent);
          mask-image: linear-gradient(#000 40%, transparent);
}
.gl-locked__wait { text-align: center; font-weight: 700; color: var(--gl-muted); margin: 14px 0 0; }
.gl-nav-item__lock { margin-left: auto; font-size: .9rem; opacity: .75; }
.gl-nav-item.is-locked .gl-nav-item__state { display: none; }

/* =====================================================================
   Phone & app view (≤ 720px) — redesigned
   ===================================================================== */
.gl-short, .gl-topicpick, .gl-topicline { display: none; }

@media (max-width: 720px) {
  .gl-long { display: none; }
  .gl-short { display: inline; }
  .gl-page { overflow-x: hidden; }

  /* Hero: one compact band */
  .gl-hero { padding: 16px 14px 44px; }
  .gl-hero__inner { gap: 12px; }
  .gl-hero__eyebrow { font-size: .75rem; padding: 3px 10px; }
  .gl-hero__title { font-size: 1.3rem; margin: 8px 0 0; }
  .gl-hero__title .gl-am { font-size: .8em; }
  .gl-hero__sub { display: none; }
  .gl-hero__progress { width: 100%; gap: 14px; padding: 10px 12px; justify-content: flex-start; }
  .gl-ring { width: 58px; height: 58px; }
  .gl-ring::before { inset: 6px; }
  .gl-ring__num { font-size: .95rem; }
  .gl-ring__label { display: none; }
  .gl-ring__num { align-self: center; }
  .gl-hero__stats { flex: 1; grid-template-columns: repeat(3, 1fr); gap: 4px; text-align: center; }
  .gl-hero__stats div { min-width: 0; flex-direction: column-reverse; gap: 0; justify-content: flex-start; }
  .gl-hero__stats dt { font-size: .7rem; line-height: 1.2; }
  .gl-hero__stats dd { font-size: 1rem; }

  /* Lesson picker + lesson card use the full width */
  .gl-shell { padding: 0 10px; gap: 12px; margin-bottom: 24px; }
  .gl-mobile-pick select { padding: 12px 14px; font-size: .95rem; border-radius: 14px; }
  .gl-lesson { padding: 16px 14px 18px; border-radius: 18px; }

  /* Lesson header: icon + titles in one row, label underneath */
  .gl-lesson__head { gap: 12px; flex-wrap: nowrap; align-items: flex-start; position: relative; }
  .gl-lesson__badge { width: 48px; height: 48px; border-radius: 14px; font-size: 1.4rem; }
  .gl-lesson__titles { min-width: 0; }
  .gl-lesson__kicker { font-size: .7rem; }
  .gl-lesson__title { font-size: 1.25rem; }
  .gl-lesson__title-en { font-size: .9rem; }
  .gl-lesson__head .gl-chip--grade { position: absolute; right: 0; top: -2px; font-size: .68rem; padding: 3px 8px; }
  .gl-lesson__kicker { padding-right: 130px; }

  /* Goals: collapsed by default, tidy rows */
  .gl-goals { margin: 14px 0 4px; padding: 10px 12px; }
  .gl-goals summary { font-size: .9rem; }
  .gl-goals li { grid-template-columns: 20px 1fr; gap: 2px 8px; }
  .gl-goals .gl-am { font-size: .92rem; }
  .gl-goals .gl-en { grid-column: 2; border-left: 0; padding-left: 0; font-size: .85rem; }

  /* Tabs: one segmented control, three equal parts — never wider than the screen */
  .gl-tabs {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
    margin: 14px 0 12px; padding: 4px; border: 0; border-radius: 14px; background: var(--gl-bg); overflow: visible;
  }
  .gl-tab[hidden] { display: none; }
  .gl-tab {
    margin: 0; padding: 9px 4px; border: 0; border-radius: 11px; font-size: .85rem;
    display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0;
  }
  .gl-tab .gl-tab__am { display: none; }
  .gl-tab.is-active { background: #fff; color: var(--gl-blue-d); box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
  .gl-tab__pill { margin-left: 2px; padding: 0 6px; }

  /* Learn: topic picker + progress line (dots and chips hidden) */
  .gl-toolbar { flex-wrap: nowrap; gap: 10px; margin-bottom: 8px; }
  .gl-topicbar { display: none; }
  .gl-toc { display: none; }
  .gl-topicpick { display: block; flex: 1; min-width: 0; }
  .gl-topicpick select {
    width: 100%; appearance: none; -webkit-appearance: none;
    padding: 10px 34px 10px 12px; border-radius: 12px; border: 1.5px solid #BFE6EC; background: #fff;
    font-family: 'Noto Sans Ethiopic', 'Nunito', sans-serif; font-weight: 700; font-size: .9rem; color: var(--gl-blue-d);
    background-image: linear-gradient(45deg, transparent 50%, var(--gl-blue) 50%), linear-gradient(135deg, var(--gl-blue) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .gl-switch { flex: none; font-size: .8rem; }
  .gl-topicline { display: block; height: 4px; border-radius: 999px; background: #E2E8F0; overflow: hidden; margin: 0 0 14px; }
  .gl-topicline span { display: block; height: 100%; background: var(--gl-orange); border-radius: inherit; transition: width .25s; }

  /* Reading text */
  .gl-page-card { min-height: 0; }
  .gl-section__title { font-size: 1.2rem; }
  .gl-table { font-size: .88rem; }
  .gl-table th, .gl-table td { padding: 7px 9px; }
  .gl-table th { white-space: normal; }

  /* Topic pager: a slim bar fixed to the bottom of the screen */
  .gl-view[data-view="learn"].is-active { padding-bottom: 76px; }
  .gl-pager {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; margin: 0; border-radius: 18px 18px 0 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff;
    box-shadow: 0 -4px 18px rgba(16, 24, 40, .12); gap: 10px;
  }
  .gl-pager .gl-btn { flex: 1; padding: 12px 10px; font-size: .95rem; border-radius: 12px; }
  .gl-pager__mid { flex: none; font-size: .85rem; min-width: 44px; text-align: center; }
  .gl-lesson.is-locked .gl-pager { display: none; }

  /* Practice */
  .gl-scorebar { padding: 10px 12px; gap: 8px; }
  .gl-scorebar > div:first-child { width: 100%; display: flex; justify-content: space-between; align-items: baseline; }
  .gl-scorebar__label { font-size: .75rem; }
  .gl-scorebar__num { font-size: .85rem; text-align: right; }
  .gl-scorebar__track { width: 100%; flex: none; }
  .gl-scorebar__actions .gl-btn { padding: 9px 8px; font-size: .82rem; }
  .gl-steps { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 10px; scrollbar-width: none; }
  .gl-steps::-webkit-scrollbar { display: none; }
  .gl-step { flex: none; }
  .gl-act { padding: 14px 12px; border-radius: 16px; }
  .gl-act__btns { width: 100%; gap: 8px; }
  .gl-act__btns .gl-btn { padding: 11px 8px; font-size: .88rem; }
  .gl-act__btns .gl-btn[hidden] { display: none; }

  /* Word box: one compact row that scrolls sideways and stays in reach */
  .gl-bank {
    top: 6px; flex-wrap: nowrap; overflow-x: auto; padding: 8px; gap: 6px; border-width: 1.5px;
    box-shadow: 0 6px 14px rgba(16, 24, 40, .10); scrollbar-width: none;
  }
  .gl-bank::-webkit-scrollbar { display: none; }
  .gl-bank__label { display: none; }
  .gl-chip-btn { flex: none; padding: 6px 11px; font-size: .95rem; }
  /* Fill-in lines: number stays on the same line as the sentence */
  .gl-fill-item { display: block; line-height: 2.3; font-size: 1rem; }
  .gl-fill-item__n { display: inline-block; min-width: 0; margin-right: 6px; }
  .gl-fill-item .gl-toggle { display: inline-flex; margin: 2px 0 0 4px; vertical-align: middle; }
  /* Activity buttons: two per row, a single button fills the row */
  .gl-act__btns { display: flex; flex-wrap: wrap; }
  .gl-act__btns .gl-btn { flex: 1 1 40%; }
  .gl-act__result { width: 100%; text-align: center; }

  /* Bottom of the lesson */
  .gl-footnav .gl-btn { flex: 1; padding: 11px 10px; font-size: .9rem; }

  /* The site's back-to-top button would sit on the pager */
  .gl-page .back-to-top { bottom: 92px !important; }
}

/* Very small phones */
@media (max-width: 360px) {
  .gl-tab { font-size: .78rem; }
  .gl-hero__stats dt { font-size: .62rem; }
}
/* Long sentence chips (e.g. paragraph sorting) wrap instead of running off the screen */
.gl-chip-btn { max-width: 100%; white-space: normal; text-align: left; overflow-wrap: anywhere; }
@media (max-width: 720px) { .gl-bank .gl-chip-btn { max-width: 80vw; } }