/* Layout: one centered column (max 760px) with a sticky top bar and a bottom tab bar on phones.
   Chunky "pressable" buttons sit on a solid darker edge to look 3D. */
:root {
  --bg: #EEF1FA; --surface: #FFFFFF; --surface-2: #F5F7FD; --ink: #17203D; --muted: #5C6584; --line: #DCE1F0;
  --pri: #19C3D8; --pri-edge: #0E8FA0; --pri-soft: #D3F4F9;
  --teal: #12B5A6; --teal-edge: #0A8277; --teal-soft: #D5F5F1;
  --sun: #FFC531; --sun-edge: #D29A00; --sun-soft: #FFF1C7;
  --sky: #3D7BFF; --sky-edge: #2453C2; --sky-soft: #DEE8FF;
  --ok: #2DB84C; --ok-edge: #1E8A37; --ok-soft: #DDF6E2;
  --bad: #EE3E59; --bad-edge: #B4243C; --bad-soft: #FDE1E5;
  --gray-edge: #C7CDE0;
  --exam-bg: #F4F5F7; --exam-head: #263247; --exam-text: #1B1F27;
  /* Arabic letters are not in Fredoka or Rubik, so the browser takes them from Noto Sans Arabic. */
  --f-display: "Fredoka", "Rubik", "Noto Sans Arabic", system-ui, sans-serif;
  --f-body: "Rubik", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-en: "Source Serif 4", Georgia, "Times New Roman", serif;
  --r: 18px;
  /* Accessible text colors (WCAG AA): dark ink on bright fills, darker shades where white text is needed. */
  --on-c: #17203D; --pri-text: #0A6E7D; --sky-strong: #2F64E0; --sky-strong-edge: #1F45A8; --bad-strong: #D42B47; --bad-strong-edge: #9B1C31; --sky-text: #2F64E0;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --pri-text: #5FD8EA; --sky-text: #8FB2FF;
  --bg: #0F1428; --surface: #1A2140; --surface-2: #222B4F; --ink: #EEF1FF; --muted: #A3ABCB; --line: #2E3862;
  --pri-soft: #0D3A44; --sun-soft: #4A3A0E; --teal-soft: #0F3D3A; --sky-soft: #1E2D5C; --ok-soft: #133A20; --bad-soft: #471722;
  --gray-edge: #0A0E1E; --exam-bg: #161A22; --exam-head: #0D1119; --exam-text: #E6E8EE; color-scheme: dark; } }
:root[data-theme="dark"] {
  --pri-text: #5FD8EA; --sky-text: #8FB2FF;
  --bg: #0F1428; --surface: #1A2140; --surface-2: #222B4F; --ink: #EEF1FF; --muted: #A3ABCB; --line: #2E3862;
  --pri-soft: #0D3A44; --sun-soft: #4A3A0E; --teal-soft: #0F3D3A; --sky-soft: #1E2D5C; --ok-soft: #133A20; --bad-soft: #471722;
  --gray-edge: #0A0E1E; --exam-bg: #161A22; --exam-head: #0D1119; --exam-text: #E6E8EE; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 1rem; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0; font-weight: 600; }
h1 { font-size: clamp(28px, 6vw, 40px); } h2 { font-size: 1.5rem; } h3 { font-size: 1.1875rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.en { font-family: var(--f-en); direction: ltr; text-align: left; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tnum { font-variant-numeric: tabular-nums; }

.wrap { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 110px; display: grid; gap: 18px; }
.wrap.wide { max-width: 1100px; }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 2px solid var(--line); }
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.logo { font-family: var(--f-display); font-weight: 700; font-size: 1.375rem; display: flex; align-items: center; gap: 8px; }
.logo b { color: var(--pri-text); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--pri); box-shadow: 0 4px 0 var(--pri-edge);
  display: grid; place-items: center; color: var(--on-c); font-size: 1.125rem; font-weight: 700; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 600;
  font-size: 0.875rem; background: var(--surface-2); border: 2px solid var(--line); white-space: nowrap; }
.chip.fire { background: var(--pri-soft); border-color: transparent; color: var(--ink); }
.chip.xp { background: var(--sky-soft); border-color: transparent; }
.demo-banner { background: var(--sun); color: #2A2000; text-align: center; font-weight: 600; font-size: 0.875rem; padding: 6px 16px; }

/* 3D buttons */
.btn { --c: var(--pri); --e: var(--pri-edge); --t: var(--on-c); appearance: none; border: 0; cursor: pointer; background: var(--c);
  color: var(--t); font-family: var(--f-display); font-weight: 600; font-size: 1.125rem; letter-spacing: .2px; border-radius: var(--r);
  padding: 14px 22px; box-shadow: 0 6px 0 var(--e); transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; text-align: center; user-select: none; }
.btn:hover { filter: brightness(1.05); }
.btn:active, .btn.pressed { transform: translateY(6px); box-shadow: 0 0 0 var(--e); }
.btn[disabled] { --c: var(--line); --e: var(--gray-edge); --t: var(--muted); cursor: not-allowed; filter: none; }
.btn.teal { --c: var(--teal); --e: var(--teal-edge); }
.btn.sky { --c: var(--sky-strong); --e: var(--sky-strong-edge); --t: #fff; }
.btn.sun { --c: var(--sun); --e: var(--sun-edge); --t: #2A2000; }
.btn.ok { --c: var(--ok); --e: var(--ok-edge); }
.btn.bad { --c: var(--bad-strong); --e: var(--bad-strong-edge); --t: #fff; }
.btn.ghost { --c: var(--surface); --e: var(--line); --t: var(--ink); border: 2px solid var(--line); }
.btn.big { font-size: 1.375rem; min-height: 68px; padding: 18px 26px; border-radius: 22px; }
.btn.sm { font-size: 0.9375rem; min-height: 42px; padding: 8px 14px; border-radius: 14px; box-shadow: 0 4px 0 var(--e); }
.btn.sm:active { transform: translateY(4px); }
.btn.block { width: 100%; }

.card { background: var(--surface); border: 2px solid var(--line); border-radius: 22px; padding: 20px; display: grid; gap: 14px; min-width: 0; align-content: start; }
details.card summary { cursor: pointer; list-style-position: inside; }
details.card[open] summary { margin-bottom: 4px; }
.exam .passage { max-height: 60vh; }
@media (max-width: 820px) { .exam .passage { max-height: 40vh; } }
.card.flat { box-shadow: none; }
.card.hero { background: var(--ink); color: var(--bg); border: 0; }
.card.hero .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } }
/* Phones (up to the 430px of the largest iPhone) get one column: two columns of skill cards were squeezed at 390px. */
@media (max-width: 430px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.grid2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.skill .row { justify-content: space-between; }

/* progress */
.bar { height: 14px; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--c, var(--teal)); border-radius: 999px; transition: width .4s; }
.hero .bar { background: color-mix(in srgb, var(--bg) 18%, transparent); border-color: transparent; }
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--f-display); font-size: 1.875rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 0.875rem; color: var(--muted); }
.hero .stat span { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.level-pill { display: inline-flex; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 0.875rem;
  background: var(--teal-soft); color: var(--ink); }
.hero .level-pill { background: var(--teal); color: var(--on-c); }

/* skill tiles */
.skill { appearance: none; text-align: start; cursor: pointer; background: var(--surface); border: 2px solid var(--line);
  border-bottom-width: 6px; border-radius: 22px; padding: 16px; display: grid; gap: 10px; transition: transform .08s; min-width: 0; }
.skill:active { transform: translateY(4px); border-bottom-width: 2px; margin-top: 4px; }
.skill .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--c-soft, var(--sky-soft)); }
.skill h3 { font-size: 1.125rem; }
.skill .lvl { font-size: 0.875rem; color: var(--muted); }

/* tab bar */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--surface); border-top: 2px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs-in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 760px; }
.tab { appearance: none; background: none; border: 0; cursor: pointer; padding: 8px 4px 10px; display: grid; justify-items: center; gap: 2px;
  font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.tab .ti { font-size: 1.5rem; width: 48px; height: 34px; display: grid; place-items: center; border-radius: 12px; }
.tab.on { color: var(--pri-text); } .tab.on .ti { background: var(--pri-soft); }

/* auth */
.auth { position: relative; min-height: 100%; display: grid; place-items: center; padding-block: 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-box { width: 100%; max-width: 440px; display: grid; gap: 18px; }
.auth-hero { text-align: center; display: grid; gap: 10px; justify-items: center; }
.auth-hero .logo-mark { width: 74px; height: 74px; font-size: 2.25rem; border-radius: 22px; box-shadow: 0 8px 0 var(--pri-edge); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { appearance: none; border: 0; background: none; border-radius: 12px; padding: 10px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.lang-seg { width: 100%; max-width: 280px; justify-self: center; }
label.f { display: grid; gap: 6px; font-weight: 600; font-size: 0.9375rem; }
.inp { width: 100%; border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 16px; font-size: 1.0625rem; min-height: 54px; }
.inp:focus { border-color: var(--sky); outline: none; }
textarea.inp { min-height: 90px; resize: vertical; }
.err { background: var(--bad-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 500; }
.note { background: var(--sky-soft); border-radius: 14px; padding: 12px 14px; font-size: 0.875rem; }

/* practice */
.qtop { display: flex; align-items: center; gap: 12px; }
.qtop .bar { flex: 1; height: 18px; }
.x { appearance: none; border: 0; background: none; font-size: 1.625rem; cursor: pointer; color: var(--muted); width: 44px; height: 44px; border-radius: 12px; }
.qcard { display: grid; gap: 16px; }
.qlabel { font-weight: 700; font-size: 0.875rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.verify-tag { background: var(--sun); color: #2A2000; border-radius: 999px; padding: 2px 10px; font-size: 0.875rem; }
.prompt { font-size: 1.3125rem; line-height: 1.55; }
.prompt .blank { display: inline-block; min-width: 80px; border-bottom: 3px solid var(--pri); margin-inline: 4px; }
.passage { background: var(--surface-2); border-radius: 16px; padding: 16px 18px; max-height: 42vh; overflow: auto; font-size: 1.0625rem; line-height: 1.65; display: grid; gap: 10px; }
.passage h4 { margin: 0; font-family: var(--f-en); font-size: 1.1875rem; }
.opts { display: grid; gap: 12px; }
.opt { appearance: none; cursor: pointer; text-align: left; direction: ltr; width: 100%; background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px; padding: 14px 16px; font-size: 1.125rem; font-family: var(--f-en);
  display: flex; gap: 12px; align-items: center; min-height: 58px; transition: transform .06s; }
.opt .k { flex: none; width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line); display: grid; place-items: center;
  font-family: var(--f-body); font-weight: 700; font-size: 0.9375rem; color: var(--muted); }
.opt:active { transform: translateY(3px); border-bottom-width: 2px; margin-top: 3px; }
.opt.sel { border-color: var(--sky); background: var(--sky-soft); }
.opt.sel .k { border-color: var(--sky); color: var(--sky-text); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); color: var(--on-c); border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad-strong); color: #fff; border-color: var(--bad-strong); }
/* The word next to a checked answer (נכון / שגוי), so right and wrong are not told by colour alone. */
.opt .mark { margin-left: auto; flex: none; font-family: var(--f-body); font-size: 0.9375rem; font-weight: 700; }
.opt.right .mark { color: #146C2E; } .opt.wrong .mark { color: #9B1C31; }
:root[data-theme="dark"] .opt.right .mark { color: #7BE495; } :root[data-theme="dark"] .opt.wrong .mark { color: #FF9AAA; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .opt.right .mark { color: #7BE495; } :root:not([data-theme="light"]) .opt.wrong .mark { color: #FF9AAA; } }
.opt[disabled] { cursor: default; }
.feedback { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; padding-block: 18px calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--ok-soft); border-top: 3px solid var(--ok); animation: up .22s ease-out; }
.feedback.bad { background: var(--bad-soft); border-top-color: var(--bad); }
.feedback-in { max-width: 760px; margin: 0 auto; display: grid; gap: 12px; }
.feedback h3 { color: #146C2E; } .feedback.bad h3 { color: #9B1C31; }
:root[data-theme="dark"] .feedback h3 { color: #7BE495; } :root[data-theme="dark"] .feedback.bad h3 { color: #FF9AAA; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .feedback h3 { color: #7BE495; } :root:not([data-theme="light"]) .feedback.bad h3 { color: #FF9AAA; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: none; opacity: 1; } }
.pop { animation: pop .4s ease-out; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* flashcards */
.flash { perspective: 1000px; cursor: pointer; }
.flash-in { position: relative; min-height: 220px; transition: transform .45s; transform-style: preserve-3d; }
.flash.flip .flash-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 24px; display: grid; place-items: center; text-align: center;
  padding: 20px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 7px; }
.face.back { transform: rotateY(180deg); background: var(--teal-soft); }
.face .w { font-family: var(--f-en); font-size: 2.375rem; font-weight: 600; }

/* exam list */
.exams { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.ex { appearance: none; cursor: pointer; border: 2px solid var(--line); border-bottom-width: 6px; border-radius: 18px; background: var(--surface);
  padding: 12px 8px; display: grid; gap: 4px; justify-items: center; min-height: 104px; align-content: center; }
.ex b { font-family: var(--f-display); font-size: 1.625rem; }
.ex.open { border-color: var(--teal); background: var(--teal-soft); }
.ex.done { border-color: var(--sky); background: var(--sky-soft); }
.ex.locked { background: var(--surface-2); border-style: dashed; color: var(--muted); cursor: not-allowed; }
.ex .s { font-size: 0.875rem; font-weight: 600; color: var(--muted); }

/* exam mode: plain and serious, like the real test screen */
.exam { min-height: 100%; background: var(--exam-bg); color: var(--exam-text); font-family: Arial, "Rubik", sans-serif; }
.exam-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--exam-head); color: #fff; }
.exam-head-in { max-width: 980px; margin: 0 auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.timer { font-family: ui-monospace, Menlo, monospace; font-size: 1.25rem; font-weight: 700; background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 8px; }
.timer.low { background: var(--bad-strong); }
.exam-body { max-width: 980px; margin: 0 auto; padding-block: 18px 120px; padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
.exam-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .exam-split { grid-template-columns: 1fr; } }
.exam .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: grid; gap: 14px; min-width: 0; }
.exam .passage { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; max-height: 60vh; }
.exam .opt { border-radius: 8px; border-bottom-width: 2px; min-height: 52px; font-size: 1.0625rem; }
.exam .opt:active { transform: none; border-bottom-width: 2px; margin-top: 0; }
.exam .prompt { font-family: var(--f-en); font-size: 1.1875rem; }
.qnav { display: flex; gap: 8px; flex-wrap: wrap; direction: ltr; }
.qnav button { appearance: none; width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--exam-text); }
.qnav button.ans { background: var(--sky-soft); border-color: var(--sky); }
.qnav button.cur { outline: 3px solid var(--sky); }
.exam-foot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 5;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.exam-foot-in { max-width: 980px; margin: 0 auto; display: flex; gap: 10px; padding-block: 10px; flex-wrap: wrap;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.ebtn { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--exam-text); border-radius: 6px; padding: 10px 18px;
  font-weight: 700; cursor: pointer; min-height: 46px; font-size: 1rem; }
.ebtn.pri { background: var(--sky-strong); border-color: var(--sky-strong-edge); color: #fff; }

/* result */
.score-ring { width: 200px; height: 200px; margin: 0 auto; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; }
.score-ring .lbl b { font-family: var(--f-display); font-size: 3.5rem; line-height: 1; }
.path { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.path div { border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 0.875rem; font-weight: 600; background: var(--surface-2); border: 2px solid var(--line); }
.path div.here { background: var(--pri); border-color: var(--pri-edge); color: var(--on-c); }
.path div.past { background: var(--teal-soft); border-color: transparent; }
@media (max-width: 480px) { .path { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rev { display: grid; gap: 8px; border-inline-start: 5px solid var(--ok); padding: 10px 14px; background: var(--surface-2); border-radius: 12px; }
.rev.bad { border-inline-start-color: var(--bad); }

/* teacher */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { text-align: start; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.875rem; color: var(--muted); font-weight: 600; letter-spacing: .3px; background: var(--surface-2); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.mini-bar { width: 90px; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; background: var(--teal); }
.grant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.g { appearance: none; border: 2px solid var(--line); background: var(--surface); border-radius: 12px; height: 48px; font-weight: 700; cursor: pointer; }
.g.on { background: var(--teal); border-color: var(--teal-edge); color: var(--on-c); }
.g.done { background: var(--sky-strong); border-color: var(--sky-strong-edge); color: #fff; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 90px; }
.days div { background: var(--teal); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.days div.zero { background: var(--line); }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.toggle input { width: 24px; height: 24px; accent-color: var(--teal); }
.toast { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.confirm { background: var(--bad-soft); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; width: 100%; height: 100%; }

/* vocabulary */
.vo-word { font-size: clamp(30px, 8vw, 44px); font-weight: 600; text-align: center; padding-block: 8px; font-family: var(--f-display); }
.vo-word.en { font-family: var(--f-en); }
.opts.he .opt { direction: rtl; text-align: right; font-family: var(--f-body); }
.lvl-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lvl-btn { appearance: none; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 6px; border-radius: 18px;
  padding: 12px; display: grid; gap: 6px; text-align: center; font-family: var(--f-display); font-size: 1.0625rem; color: var(--ink); min-width: 0; }
.lvl-btn span { font-family: var(--f-body); font-size: 0.875rem; color: var(--muted); }
.lvl-btn.on { border-color: var(--pri); background: var(--pri-soft); }
.dict { display: grid; gap: 2px; max-height: 360px; overflow: auto; }
.dict-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.face .w.he-w { font-family: var(--f-display); }

/* brand */
.logo { gap: 10px; }
.logo-svg { display: block; flex: none; }
.wordmark { font-family: var(--f-display); font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.wordmark b { color: var(--pri-text); font-weight: 700; }
.hero-name { font-size: clamp(30px, 7vw, 44px); }
.hero .wordmark b { color: var(--sun); }
.hero-owl { flex: none; filter: drop-shadow(0 6px 0 rgba(0,0,0,.18)); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.card.hero { background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--pri) 38%, var(--ink)) 0%, var(--ink) 55%); position: relative; overflow: hidden; }
.card.hero::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%; background: color-mix(in srgb, var(--teal) 30%, transparent); pointer-events: none; }
.card.hero > * { position: relative; z-index: 1; }

/* Amiros */
.bot-fab { position: fixed; z-index: 9; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  appearance: none; border: 0; cursor: pointer; background: var(--surface); border-radius: 22px; padding: 6px 12px 6px 6px; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 5px 0 var(--teal-edge), 0 10px 24px rgba(23,32,61,.18); border: 2px solid var(--teal); transition: transform .08s, opacity .2s; }
.bot-fab:active { transform: translateY(5px); box-shadow: 0 0 0 var(--teal-edge); }
.bot-fab-tag { font-family: var(--f-display); font-weight: 600; color: var(--ink); }
.bot { position: fixed; z-index: 12; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(400px, calc(100% - 32px)); max-height: min(560px, calc(100% - 140px)); display: grid; grid-template-rows: auto 1fr auto;
  background: var(--surface); border: 2px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 18px 50px rgba(23,32,61,.28); animation: pop .25s ease-out; }
.bot-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--teal); color: var(--on-c); }
.bot-head span { display: block; opacity: .9; }
.bot-head .x { color: var(--on-c); }
.bot-body { min-height: 0; overflow-y: auto; padding: 14px; display: grid; gap: 12px; align-content: start; background: var(--surface-2); }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.from-me { justify-content: flex-start; flex-direction: row-reverse; }
.msg-owl { flex: none; }
.bubble { max-width: 85%; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.msg.from-me .bubble { background: var(--pri); color: var(--on-c); border-color: var(--pri-edge); }
/* Text inside an orange bubble keeps the bubble's text colour (grey on orange is too faint). */
.msg.from-me .bubble .muted { color: inherit; opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { appearance: none; cursor: pointer; border: 2px solid var(--teal); background: var(--teal-soft); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 0.875rem; font-weight: 600; }
.bot-form { display: flex; gap: 8px; padding: 10px; border-top: 2px solid var(--line); }
.bot-form .inp { min-height: 46px; padding: 10px 14px; }

/* certificate */
.cert-wrap { border-radius: 16px; overflow: hidden; border: 2px solid var(--line); box-shadow: 0 12px 30px rgba(23,32,61,.15); }
.cert-wrap img { display: block; width: 100%; height: auto; }
.tagline { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 0.875rem; text-align: center; }
.card.empty { justify-items: center; text-align: center; }

/* packages */
.access-card.trial { background: var(--sun-soft); border-color: transparent; }
.access-card.off { border-color: var(--pri); }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
@media (max-width: 640px) { .plans { grid-template-columns: minmax(0, 1fr); } }
.plan { min-width: 0; overflow-wrap: anywhere; }
.plan { position: relative; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 6px; border-radius: 22px; padding: 20px 18px; display: grid; gap: 10px; align-content: start; }
.plan.hot { border-color: var(--pri); background: var(--pri-soft); }
.plan-tag { position: absolute; top: -13px; inset-inline-start: 16px; background: var(--pri); color: var(--on-c); font-weight: 700; font-size: 0.875rem; padding: 3px 12px; border-radius: 999px; }
.plan .price { font-family: var(--f-display); font-size: 1.125rem; }
.plan .price b { font-size: 2.5rem; }
.plan ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; }
.pay-info { white-space: normal; font-weight: 600; }
.card.diag { border-color: var(--teal); background: var(--teal-soft); }
.card.upsell { border-color: var(--pri); background: var(--pri-soft); }
/* accessibility helpers */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.linkish { appearance: none; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: start; }
.linkish:hover b { text-decoration: underline; }
main:focus { outline: none; }
.pay-links { display: grid; gap: 12px; }
.foot-links { text-align: center; font-size: 0.875rem; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.auth-a11y { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-end: 16px; }
.exam-head .a11y-btn { color: #fff; }
.support-thread { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.support-thread .msg { display: flex; }
.support-thread .msg.from-me { justify-content: flex-start; }
.support-thread .msg.from-bot { justify-content: flex-end; }
.support-thread .bubble { max-width: 85%; border-radius: 16px; padding: 10px 14px; border: 2px solid var(--line); background: var(--surface-2); }
.note-card { border-color: var(--sky); background: var(--sky-soft); }
.stars .row { gap: 8px; }
.star-opt { position: relative; }
.star-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.star-opt span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 1.125rem; }
.star-opt input:checked + span { background: var(--sun); border-color: var(--sun-edge); color: var(--on-c); }
.star-opt input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
fieldset.f { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.f legend { font-weight: 600; margin-bottom: 6px; }
.quote { margin: 0; padding: 10px 14px; border-inline-start: 4px solid var(--teal); background: var(--surface-2); border-radius: 10px; }
.passage .pn { color: var(--muted); font-weight: 600; font-size: .85em; margin-inline-end: 4px; }
.rev details { margin: 6px 0; }
.rev details .passage { max-height: 50vh; }
/* Exam on small screens: the foot can wrap to two rows when confirming, so keep room for it. */
.exam-body { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 820px) { .exam .passage { max-height: 38vh; } }
/* Phone held sideways: thinner bars so the question and its options fit. */
@media (max-height: 500px) {
  .exam-head-in, .exam-foot-in { padding-block: 4px; }
  .exam .passage { max-height: 45vh; }
  .exam-body { padding-block: 8px 110px; }
  .opt { min-height: 44px; padding-block: 6px; }
}
/* Sideways phone: the header scrolls away, and a question without a passage shows its 4 options in 2 columns. */
@media (max-height: 500px) and (orientation: landscape) {
  .exam-head { position: static; }
  .exam-body > .panel .opts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .exam .panel { padding: 12px; gap: 10px; }
  .ebtn { min-height: 40px; padding-block: 6px; }
  .qnav button { width: 36px; height: 36px; }
}
/* Amiros button: smaller on phones, and out of the way while scrolling. */
@media (max-width: 480px) { .bot-fab { transform: scale(.82); transform-origin: left bottom; } .bot-fab-tag { display: none; } }
/* Hidden means hidden for the keyboard too: visibility takes it out of the Tab order once the fade-out has ended. */
.bot-fab.hide { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s .2s; }
/* Teacher's student list on a phone: each student is a card instead of a wide table row. */
@media (max-width: 640px) {
  table.stu { min-width: 0; }
  table.stu thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stu tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px; border-bottom: 2px solid var(--line); }
  table.stu td { display: block; padding: 0; border: 0; }
  table.stu td:first-child { grid-column: 1 / -1; font-size: 1.0625rem; }
  table.stu td:not(:first-child)::before { display: block; font-size: .875rem; color: var(--muted); }
  table.stu td:nth-child(2)::before { content: "חבילה"; } table.stu td:nth-child(3)::before { content: "פעילות אחרונה"; }
  table.stu td:nth-child(4)::before { content: "שאלות"; } table.stu td:nth-child(5)::before { content: "דיוק"; }
  table.stu td:nth-child(6)::before { content: "מוכנות"; } table.stu td:nth-child(7)::before { content: "מבחנים"; }
  table.stu td:nth-child(8)::before { content: "ציון אחרון"; }
}
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button.linkish.small { color: var(--ink); text-decoration: underline; min-height: 44px; }
/* Large text: the top bar wraps instead of pushing the accessibility button off the screen. */
.top-in, .exam-head-in { flex-wrap: wrap; row-gap: 6px; }
.top-in .logo { min-width: 0; }

/* Tip after a mistake: a short rule, a line to remember and an example. */
.tip { background: var(--sun-soft); border: 2px solid var(--sun); border-radius: 14px; padding: 10px 14px; display: grid; gap: 4px; text-align: start; color: var(--ink); }
.tip p { margin: 0; }
.tip-h { font-size: 1rem; }
/* word games */
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match .opt { justify-content: center; text-align: center; min-height: 52px; padding-inline: 8px; overflow-wrap: anywhere; }
.match-col:last-child .opt { direction: rtl; }
.game-last { min-height: 1.6em; margin: 4px 0 8px; font-weight: 600; }
.game-last.ok { color: #146C2E; } .game-last.bad { color: #9B1C31; }
:root[data-theme="dark"] .game-last.ok { color: #7BE495; } :root[data-theme="dark"] .game-last.bad { color: #FF9AAA; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .game-last.ok { color: #7BE495; } :root:not([data-theme="light"]) .game-last.bad { color: #FF9AAA; } }
.pay-ways .toggle { min-height: 44px; }
.pay-ways img { display: block; width: auto; }
/* Card marks on white in both themes: Visa blue and the full-colour Mastercard symbol are made for light backgrounds. */
.card-marks { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.check { align-items: flex-start; gap: 8px; flex-wrap: nowrap; } .check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal); }
.listen { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; }
.listen h4 { margin: 0; font-family: var(--f-en); font-size: 1.1875rem; }
.listen .passage { background: var(--surface); }
/* After a card payment: a large notice that says where the receipt is. */
.pay-notice { border: 3px solid var(--sun-edge); background: var(--sun-soft); }
.pay-notice.done { border-color: var(--ok-edge); background: var(--ok-soft); }
.pay-notice h2 { margin: 0 0 6px; font-size: 1.5rem; }
.pay-notice .big-line { font-size: 1.1875rem; line-height: 1.6; margin: 0 0 12px; }
