/* app-only styles */
body { padding-bottom: 84px; }
.appbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.appbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 500; position: relative; }
.nav a.on { background: var(--primary-soft); color: var(--primary); }
#logout { margin-inline-start: 4px; }
.nav:not(.hidden) ~ #logout { margin-inline-start: 0; }
#nav.hidden ~ #logout { margin-inline-start: auto; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; margin-inline-start: 4px; }

/* bottom tab bar on phones */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 500; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { color: var(--primary); }
@media (min-width: 760px) { .tabbar { display: none !important; } body { padding-bottom: 32px; } }
@media (max-width: 759px) { .nav.student { display: none; } }

main#view { padding-top: 22px; padding-bottom: 24px; outline: none; }
.loading { display: grid; place-items: center; min-height: 40vh; }
.page-head { margin-bottom: 18px; }
.page-head .row { margin-top: 6px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: .92rem; margin-bottom: 6px; }

/* login */
.auth { max-width: 420px; margin: 6vh auto 0; }
.code-input { letter-spacing: .4em; text-align: center; font-size: 1.4rem; font-family: var(--font-he); }

/* home */
.today .item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.today .item:last-child { border-bottom: 0; }
.today .item .txt { flex: 1; }
.today .item .txt b { display: block; }
.today .prompt { margin-top: 4px; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; font-size: .95rem; }
.tickbox { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: transparent; font-size: 18px; transition: .15s; }
.tickbox.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tickbox:disabled { cursor: default; }
.streak { display: flex; align-items: center; gap: 14px; }
.streak .num { font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.days14 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 10px; }
.days14 i { aspect-ratio: 1; border-radius: 4px; background: var(--line); display: block; }
.days14 i.on { background: var(--ok); }
.days14 i.part { background: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.days14 i.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.weekcard { background: linear-gradient(135deg, #0A4F8F, #013D73); color: #fff; border: 0; }
.weekcard .muted { color: rgba(255,255,255,.8); }
.weekcard .btn { background: #fff; color: #0A4F8F; }
.stat { text-align: center; }
.stat .n { font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1.2; }

/* week list */
.weeks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.wk { display: block; text-decoration: none; color: inherit; }
.wk.locked { opacity: .55; pointer-events: none; }
.wk .n { font-size: .82rem; color: var(--muted); }

/* week page */
.sec { margin-top: 18px; }
.sec > h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 8px; }
.sec-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: .9rem; font-weight: 700; flex: none; }
.toc { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 6px; padding-inline: 16px; scrollbar-width: none; }
.toc a { flex: none; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.daylist .d { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.daylist .d:last-child { border-bottom: 0; }
.daylist .d.now { background: var(--accent-soft); margin: 0 -18px; padding-inline: 18px; }
.daylist .dn { font-size: .8rem; color: var(--muted); }
.pattern { border-inline-start: 4px solid var(--primary); }
.pattern .he-big { font-family: var(--font-he); font-size: 1.35rem; font-weight: 600; direction: rtl; }
.pattern .ex { margin-top: 8px; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; }
.dialogue .tr { color: var(--muted); font-size: .93rem; }
.dialogue.hide-tr .tr { filter: blur(6px); cursor: pointer; }
.dialogue.hide-tr .tr.peek { filter: none; }
.dialogue td.he { font-size: 1.05rem; }
.drill { text-align: center; padding: 26px 18px; }
.drill .q { font-size: 1.35rem; font-weight: 600; min-height: 2.2em; }
.drill .a { font-family: var(--font-he); font-size: 1.4rem; color: var(--primary); min-height: 1.8em; margin-top: 8px; }
.drill .bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 16px auto 18px; max-width: 260px; }
.drill .bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: right; }
.drill .bar i.run { animation: shrink 3s linear forwards; }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.root-head { font-family: var(--font-he); font-size: 1.6rem; font-weight: 700; color: var(--primary); }

/* recorder */
.rec { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.rec .timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: #d33; display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
audio { width: 100%; height: 40px; }
.recitem { padding: 12px 0; border-bottom: 1px solid var(--line); }
.recitem:last-child { border-bottom: 0; }
.fb { margin-top: 8px; display: grid; gap: 6px; }
.fb .s { background: var(--ok-soft); padding: 6px 10px; border-radius: 8px; }
.fb .n { background: var(--accent-soft); padding: 6px 10px; border-radius: 8px; }

/* flashcards */
.flash { min-height: 230px; display: grid; place-items: center; text-align: center; padding: 26px 18px; cursor: pointer; user-select: none; }
.flash .front { font-size: 1.35rem; font-weight: 600; }
.flash .back { font-family: var(--font-he); font-size: 1.35rem; color: var(--primary); margin-top: 14px; }
.flash .k { font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.grades .btn { flex-direction: column; gap: 0; min-height: 54px; border-radius: 12px; padding: 4px; line-height: 1.2; }
.grades .btn small { font-weight: 400; opacity: .8; font-size: .75rem; }
.g0 { background: var(--warn-soft) !important; color: var(--warn) !important; }
.g1 { background: var(--accent-soft) !important; color: var(--accent) !important; }
.g2 { background: var(--primary-soft) !important; color: var(--primary) !important; }
.g3 { background: var(--ok-soft) !important; color: var(--ok) !important; }

/* progress */
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.wcell { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; background: var(--surface); font-size: .82rem; }
.wcell b { display: block; font-size: .95rem; }
.wcell .m { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.wcell .m span { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; background: var(--surface-2); color: var(--muted); }
.wcell .m span.on { background: var(--ok); color: #fff; }
.wcell.future { opacity: .45; }
.meter { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--primary); }

/* teacher */
.tlist .it { padding: 14px 0; border-bottom: 1px solid var(--line); }
.tlist .it:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.flag { color: var(--warn); font-weight: 600; }
.clickrow { cursor: pointer; }
.clickrow:hover td { background: var(--surface-2); }

.stats3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats3 .card { padding: 12px 8px; }
@media (max-width: 480px) { .stats3 .n { font-size: 1.4rem; } .stats3 .small { font-size: .78rem; line-height: 1.4; } }
