/* ---------- fonts (stored with the site, so it works offline) ---------- */
@font-face { font-family: "Tiro Sanskrit"; src: url("../fonts/TiroDevanagariSanskrit-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Mukta"; src: url("../fonts/Mukta-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mukta"; src: url("../fonts/Mukta-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --wood: #3B2417;
  --wood-2: #4B3020;
  --wood-3: #5C3C28;
  --leaf: #F0E0B6;
  --leaf-2: #E7D39F;
  --leaf-3: #DCC38A;
  --leaf-edge: #C4A56A;
  --ink: #2A1A0D;
  --ink-soft: #6A5234;
  --on-wood: #F3E6C8;
  --on-wood-soft: #CBB38C;
  --turmeric: #E8A33A;
  --turmeric-dark: #C9831C;
  --green: #3F7D46;
  --green-bg: #DCEBCF;
  --kumkum: #B8362A;
  --kumkum-bg: #F5D5C8;
  --scale: 1;
  --sa: "Tiro Sanskrit", "Noto Serif Devanagari", "Kohinoor Devanagari", serif;
  --ui: "Mukta", "Noto Sans Devanagari", system-ui, sans-serif;
  --radius: 18px;
  --tap: 60px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; font-size: calc(18px * var(--scale)); -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; min-height: 100%;
  background: var(--wood) radial-gradient(120% 700px at 50% 0%, #4A2E1E 0%, var(--wood) 70%) no-repeat;
  color: var(--on-wood); font-family: var(--ui); line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 14px 16px 150px; overflow-wrap: anywhere; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 3px; }
.sa { font-family: var(--sa); }
.en { font-family: var(--ui); }
.muted { color: var(--on-wood-soft); }

/* ---------- home ---------- */
.topline { display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.iconbtn {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--wood-3);
  background: var(--wood-2); display: grid; place-items: center; color: var(--on-wood);
}
.iconbtn svg { width: 24px; height: 24px; }
.title { font-family: var(--sa); font-size: 3.4rem; line-height: 1.1; margin: 10px 0 2px; color: var(--on-wood); font-weight: 400; }
.tagline { font-size: 1rem; color: var(--on-wood-soft); margin: 0 0 22px; }

.lamps { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 22px; }
.lamp { display: grid; justify-items: center; gap: 2px; font-size: .78rem; color: var(--on-wood-soft); }
.lamp svg { width: 30px; height: 36px; }
.lamp .flame { fill: #F6B94A; }
.lamp.off .flame { fill: none; }
.lamp .bowl { fill: #B7773D; }
.lamp.off .bowl { fill: var(--wood-3); }
.streak { margin-left: auto; text-align: right; }
.streak b { font-family: var(--sa); font-size: 1.9rem; font-weight: 400; color: var(--on-wood); display: block; line-height: 1; }

/* the palm leaf */
.leaf {
  position: relative; background: var(--leaf); color: var(--ink);
  border: 1px solid var(--leaf-edge); border-radius: 26px 26px 26px 26px / 22px 22px 22px 22px;
  padding: 34px 20px 22px;
  background-image:
    repeating-linear-gradient(0deg, rgba(122, 88, 36, .045) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #F4E6C0, var(--leaf) 40%, #EBD8A8);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 10px 24px rgba(0,0,0,.28);
}
.leaf::before, .leaf::after {
  content: ""; position: absolute; top: 13px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--wood); box-shadow: inset 0 1px 2px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.4);
}
.leaf::before { left: 30%; } .leaf::after { right: 30%; }

.today h2 { font-family: var(--sa); font-weight: 400; font-size: 2rem; margin: 0; line-height: 1.2; }
.today p { margin: 4px 0 18px; color: var(--ink-soft); }

.primary {
  width: 100%; min-height: var(--tap); border: 0; border-radius: 14px;
  background: var(--turmeric); color: var(--ink); font-family: var(--sa); font-size: 1.5rem;
  box-shadow: 0 3px 0 var(--turmeric-dark); display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 6px 16px;
}
.primary small { font-family: var(--ui); font-size: .85rem; opacity: .75; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--turmeric-dark); }
.primary[disabled] { background: #8A6B45; color: #D8C4A0; box-shadow: none; cursor: default; }

.modes { display: grid; gap: 10px; margin: 18px 0 28px; }
.mode {
  display: flex; align-items: center; gap: 14px; text-align: left; min-height: 72px;
  padding: 12px 16px; border-radius: 16px; border: 1px solid var(--wood-3); background: var(--wood-2);
}
.mode .glyph { font-family: var(--sa); font-size: 1.9rem; width: 44px; text-align: center; color: var(--turmeric); }
.mode b { font-family: var(--sa); font-weight: 400; font-size: 1.35rem; display: block; line-height: 1.2; }
.mode span { font-size: .92rem; color: var(--on-wood-soft); }

h3.section { font-family: var(--sa); font-weight: 400; font-size: 1.5rem; margin: 0 0 4px; }
.progress-note { font-size: .92rem; color: var(--on-wood-soft); margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: 52px repeat(8, 1fr); gap: 5px; align-items: center; }
.grid .h { font-family: var(--sa); font-size: .95rem; text-align: center; color: var(--on-wood-soft); }
.grid .rowlab { font-family: var(--sa); font-size: 1.05rem; }
.dot { aspect-ratio: 1; border-radius: 7px; background: var(--wood-2); border: 1px solid var(--wood-3); }
.dot.l1 { background: #6E5236; } .dot.l2 { background: #9C7A45; } .dot.l3 { background: #C9A55C; } .dot.l4 { background: var(--leaf); }
.dot.locked { background: transparent; border-style: dashed; opacity: .5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--on-wood-soft); margin-top: 10px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }

/* ---------- session ---------- */
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.track { flex: 1; height: 12px; border-radius: 99px; background: var(--wood-2); overflow: hidden; border: 1px solid var(--wood-3); }
.track i { display: block; height: 100%; background: var(--turmeric); border-radius: 99px; transition: width .35s ease; }
.count { font-family: var(--sa); font-size: 1.1rem; color: var(--on-wood-soft); min-width: 56px; text-align: right; }

.qhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.instr { font-size: 1rem; color: var(--ink-soft); margin: 0; }
.hintbtn {
  flex: none; border: 1px solid var(--leaf-edge); background: var(--leaf-2); border-radius: 99px;
  padding: 4px 14px; min-height: 40px; font-family: var(--sa); font-size: 1.05rem; color: var(--ink);
}
.hintbtn small { font-family: var(--ui); font-size: .78rem; color: var(--ink-soft); margin-left: 4px; }
.hint { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.45); border: 1px dashed var(--leaf-edge); font-size: 1rem; color: var(--ink); }
.hint p { margin: 0; } .hint p + p { margin-top: 8px; }

.big { font-family: var(--sa); font-size: 2.6rem; line-height: 1.3; margin: 18px 0 4px; text-align: center; overflow-wrap: anywhere; }
.sub { text-align: center; color: var(--ink-soft); font-family: var(--sa); font-size: 1.15rem; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.chip { font-family: var(--sa); font-size: 1.15rem; padding: 4px 14px; border-radius: 99px; background: var(--wood); color: var(--on-wood); }
.claim { text-align: center; margin-top: 16px; font-family: var(--sa); font-size: 1.5rem; }
.claim::before { content: "="; margin-right: 10px; color: var(--ink-soft); }
.sentence { font-family: var(--sa); font-size: 1.85rem; line-height: 1.7; margin: 18px 0 6px; text-align: center; }
.blank { display: inline-block; min-width: 3.4em; border-bottom: 3px solid var(--ink); margin: 0 .15em; height: 1.2em; vertical-align: -0.15em; }
.blank.filled { border-bottom-color: transparent; min-width: 0; height: auto; }
.mark { background: rgba(232, 163, 58, .35); border-radius: 6px; padding: 0 .2em; }
.analogy { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 10px; align-items: center; margin: 18px 0 6px; font-family: var(--sa); font-size: 1.6rem; text-align: center; }
.analogy span { overflow-wrap: anywhere; min-width: 0; }
.analogy .arrow { color: var(--ink-soft); font-size: 1.3rem; }
.analogy .q { color: var(--kumkum); }

.options { display: grid; gap: 10px; margin-top: 16px; }
.opt {
  min-width: 0; overflow-wrap: anywhere;
  min-height: var(--tap); padding: 8px 16px; border-radius: 14px; text-align: center;
  background: var(--leaf); border: 2px solid var(--leaf-edge); color: var(--ink);
  font-family: var(--sa); font-size: 1.55rem; line-height: 1.3;
}
.opt.small { font-size: 1.25rem; }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--leaf-3); box-shadow: 0 0 0 2px var(--ink) inset; }
.opt.right { background: var(--green-bg); border-color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; }
.opt.wrong { background: var(--kumkum-bg); border-color: var(--kumkum); box-shadow: 0 0 0 2px var(--kumkum) inset; }
.opt.multi { display: flex; align-items: center; gap: 12px; text-align: left; }
.opt.multi::before { content: ""; flex: none; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--ink-soft); background: #fff8; }
.opt.multi[aria-pressed="true"]::before { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--leaf-3); }
.tfrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* tiles */
.answer-line { min-height: 70px; margin: 16px 0 8px; padding: 8px; border-bottom: 3px solid var(--ink); display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.tile { min-width: 56px; min-height: 56px; padding: 4px 12px; border-radius: 12px; border: 2px solid var(--leaf-edge); background: #FBF3DC; font-family: var(--sa); font-size: 1.7rem; color: var(--ink); box-shadow: 0 2px 0 var(--leaf-edge); }
.tile.used { opacity: .28; box-shadow: none; }

/* tokens (find the mistake) */
.tok { font-family: var(--sa); font-size: 1.85rem; border: 0; background: none; padding: 2px 4px; border-bottom: 3px dotted var(--ink-soft); border-radius: 6px; color: var(--ink); line-height: 1.4; }
.tok[aria-pressed="true"] { background: rgba(232,163,58,.4); border-bottom-style: solid; border-bottom-color: var(--ink); }
.tok.wrong { background: var(--kumkum-bg); border-bottom-color: var(--kumkum); }
.tok.right { background: var(--green-bg); border-bottom-color: var(--green); }

/* match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .opt { font-size: 1.3rem; min-height: 64px; }
.match .opt.lab { font-size: 1.05rem; }
.match .opt.done { opacity: .35; background: var(--green-bg); border-color: var(--green); }
.match .opt.shake { animation: shake .3s; }
@keyframes shake { 0%,100% { transform: none; } 30% { transform: translateX(-5px); } 70% { transform: translateX(5px); } }

/* declension table */
.wordhead { text-align: center; margin: 6px 0 12px; }
.wordhead b { font-family: var(--sa); font-weight: 400; font-size: 2rem; display: block; line-height: 1.2; }
.wordhead span { font-family: var(--sa); color: var(--ink-soft); font-size: 1.05rem; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.dtable th { font-family: var(--sa); font-weight: 400; color: var(--ink-soft); font-size: .95rem; padding: 2px 4px; }
.dtable th.rh { text-align: left; width: 27%; font-size: 1rem; color: var(--ink); }
.dtable td { font-family: var(--sa); font-size: 1.25rem; text-align: center; padding: 5px 2px; border-radius: 10px; background: rgba(255,255,255,.35); overflow-wrap: anywhere; line-height: 1.3; }
.dtable td.hl { background: rgba(232,163,58,.45); box-shadow: 0 0 0 2px var(--turmeric-dark) inset; }
.dtable td.slot { padding: 0; background: none; }
.slotbtn { width: 100%; min-height: 46px; border-radius: 10px; border: 2px dashed var(--ink-soft); background: rgba(255,255,255,.55); font-family: var(--sa); font-size: 1.2rem; color: var(--ink); padding: 4px 2px; overflow-wrap: anywhere; }
.slotbtn.sel { border-style: solid; border-color: var(--ink); background: #fff; box-shadow: 0 0 0 3px var(--turmeric) ; }
.slotbtn.full { border-style: solid; border-color: var(--leaf-edge); background: #FBF3DC; }
.slotbtn.right { border-color: var(--green); background: var(--green-bg); }
.slotbtn.wrong { border-color: var(--kumkum); background: var(--kumkum-bg); }
.slotbtn .fix { display: block; font-size: 1rem; color: var(--green); }
.bank { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0 0 10px; max-height: 27vh; overflow-y: auto; padding: 2px; }
.dock.solid { background: var(--wood); box-shadow: 0 -8px 20px rgba(0,0,0,.35); border-top: 1px solid var(--wood-3); padding-top: 14px; }
.bank .tile { font-size: 1.2rem; min-height: 46px; min-width: 0; padding: 2px 10px; }

/* bottom action and feedback sheet */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(59,36,23,0), var(--wood) 30%); z-index: 5; }
.dock-inner { max-width: 560px; margin: 0 auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--leaf); color: var(--ink); border-radius: 22px 22px 0 0; padding: 18px 18px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px rgba(0,0,0,.35); border-top: 6px solid var(--green); max-height: 78vh; overflow-y: auto; animation: rise .22s ease-out; }
.sheet.bad { border-top-color: var(--kumkum); }
@keyframes rise { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner { max-width: 560px; margin: 0 auto; }
.verdict { font-family: var(--sa); font-size: 1.9rem; margin: 0; color: var(--green); display: flex; align-items: center; gap: 10px; }
.sheet.bad .verdict { color: var(--kumkum); }
.verdict svg { width: 30px; height: 30px; flex: none; }
.ans { font-family: var(--sa); font-size: 1.6rem; margin: 6px 0 2px; }
.ans small { font-size: 1rem; color: var(--ink-soft); display: block; }
.why { font-family: var(--sa); font-size: 1.15rem; margin: 8px 0 0; }
.note { font-size: .98rem; color: var(--ink-soft); margin: 8px 0 0; }
.filled-sent { font-family: var(--sa); font-size: 1.35rem; margin: 10px 0 0; padding: 8px 12px; background: rgba(255,255,255,.45); border-radius: 10px; }
.sheet .primary { position: sticky; bottom: 0; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 14px; }
.linkbtn { border: 1px solid var(--leaf-edge); background: var(--leaf-2); border-radius: 99px; min-height: 44px; padding: 4px 14px; font-family: var(--sa); font-size: 1.05rem; }
.linkbtn small { font-family: var(--ui); font-size: .78rem; color: var(--ink-soft); margin-left: 4px; }
.peek { margin: 4px 0 12px; }
.peek .dtable td { font-size: 1.1rem; }

/* intro, done, reference */
.intro-use { font-size: 1.05rem; margin: 8px 0 6px; }
.intro-ex { font-family: var(--sa); font-size: 1.35rem; margin: 0 0 12px; }
.done-num { font-family: var(--sa); font-size: 3.2rem; text-align: center; margin: 6px 0 0; line-height: 1.1; }
.center { text-align: center; }
.stack { display: grid; gap: 12px; margin-top: 18px; }
.ghost { width: 100%; min-height: 56px; border-radius: 14px; border: 1px solid var(--wood-3); background: var(--wood-2); color: var(--on-wood); font-family: var(--sa); font-size: 1.3rem; }
.ghost small { font-family: var(--ui); font-size: .85rem; color: var(--on-wood-soft); margin-left: 6px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.tab { min-height: 56px; border-radius: 12px; border: 1px solid var(--wood-3); background: var(--wood-2); color: var(--on-wood); font-family: var(--sa); font-size: 1.3rem; line-height: 1.1; }
.tab small { display: block; font-size: .8rem; color: var(--on-wood-soft); }
.tab[aria-pressed="true"] { background: var(--leaf); color: var(--ink); border-color: var(--leaf-edge); }
.tab[aria-pressed="true"] small { color: var(--ink-soft); }
select.words { width: 100%; min-height: 54px; border-radius: 12px; font-family: var(--sa); font-size: 1.3rem; padding: 6px 12px; background: var(--leaf-2); color: var(--ink); border: 1px solid var(--leaf-edge); margin-bottom: 12px; }

/* speed round */
.timer { height: 10px; border-radius: 99px; background: var(--leaf-3); overflow: hidden; margin: 8px 0 4px; }
.timer i { display: block; height: 100%; background: var(--kumkum); transition: width 1s linear; }
.flash-right { animation: flashg .35s; } .flash-wrong { animation: flashr .35s; }
@keyframes flashg { 50% { background: var(--green-bg); } } @keyframes flashr { 50% { background: var(--kumkum-bg); } }

/* settings */
.overlay { position: fixed; inset: 0; background: rgba(20,10,5,.6); z-index: 10; display: grid; align-items: end; }
.panel { background: var(--leaf); color: var(--ink); border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px)); max-width: 560px; width: 100%; margin: 0 auto; }
.panel h3 { font-family: var(--sa); font-weight: 400; font-size: 1.7rem; margin: 0 0 12px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--leaf-edge); }
.setrow .lbl b { font-family: var(--sa); font-weight: 400; font-size: 1.25rem; display: block; }
.setrow .lbl span { font-size: .9rem; color: var(--ink-soft); }
.sizes { display: flex; gap: 6px; }
.sizes button { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--leaf-edge); background: var(--leaf-2); font-family: var(--sa); }
.sizes button[aria-pressed="true"] { background: var(--ink); color: var(--leaf); }
.switch { width: 64px; height: 38px; border-radius: 99px; border: 0; background: var(--leaf-3); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { left: 30px; }
.danger { border: 1px solid var(--kumkum); color: var(--kumkum); background: transparent; border-radius: 12px; min-height: 48px; padding: 4px 16px; }
.fineprint { font-size: .85rem; color: var(--ink-soft); margin: 14px 0 0; }

@media (min-width: 520px) {
  .options.two { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- tab bar (app-shell.js) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  background: var(--wood-2); border-top: 1px solid var(--wood-3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -6px 18px rgba(0,0,0,.3);
}
.tabbar[hidden] { display: none; }
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbtn {
  min-height: var(--tap); border: 0; background: none; color: var(--on-wood-soft);
  display: grid; justify-items: center; align-content: center; gap: 1px; padding: 6px 2px;
}
.tabbtn .glyph { font-size: 1.5rem; line-height: 1; color: inherit; }
.tabbtn span:last-child { font-size: .9rem; }
.tabbtn[aria-pressed="true"] { color: var(--turmeric); }
.tabbtn[aria-pressed="true"] .glyph { color: var(--turmeric); }

/* ---------- progress page ---------- */
.title.small { font-size: 2.2rem; margin: 6px 0 0; }
.topline h1 { flex: 1; }
.dtable td.empty { color: var(--ink-soft); background: rgba(255,255,255,.18); }
.dtable.wide td, .dtable.wide th { font-size: 1.05rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--wood-2); border: 1px solid var(--wood-3); border-radius: 14px;
  padding: 12px 14px; display: grid; gap: 2px;
}
.stat b { font-weight: 400; font-size: 1.15rem; color: var(--on-wood); }
.stat .num { font-size: 1.6rem; color: var(--turmeric); line-height: 1.2; }
.stat small { font-size: .82rem; color: var(--on-wood-soft); }
.lipigrid { display: flex; flex-wrap: wrap; gap: 5px; }
.ldot {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px;
  font-family: var(--sa); font-size: 1.25rem;
  background: var(--wood-2); border: 1px solid var(--wood-3); color: var(--on-wood-soft);
}
.ldot.l1 { background: #6E5236; color: var(--on-wood); }
.ldot.l2 { background: #9C7A45; color: var(--ink); }
.ldot.l3 { background: #C9A55C; color: var(--ink); }
.ldot.l4 { background: var(--leaf); color: var(--ink); }
.twobtn { display: flex; gap: 8px; flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }

/* ---------- selection cards on the drill home ---------- */
.pickcard { margin-top: 14px; }
.pickcard h2 { font-family: var(--sa); font-weight: 400; font-size: 1.7rem; margin: 0; }
.pickcard > p { margin: 4px 0 10px; color: var(--ink-soft); }
.chiplab { font-size: .85rem; color: var(--ink-soft); margin: 10px 0 6px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.selchip {
  font-family: var(--sa); font-size: 1.1rem; min-height: 44px; padding: 4px 12px;
  border-radius: 99px; border: 1.5px solid var(--leaf-edge); background: var(--leaf-2); color: var(--ink);
}
.selchip[aria-pressed="true"] { background: var(--ink); color: var(--leaf); border-color: var(--ink); }
.selchip.locked { opacity: .35; }
.pickcard .primary { margin-top: 14px; }

/* ---------- script page ---------- */
.latin { font-family: var(--ui); letter-spacing: .01em; }
.big.latin { font-size: 2.4rem; }
.opt.latin { font-size: 1.35rem; }
.claim.latin::before { content: "="; }
.ans.latin { font-family: var(--ui); }
.pickcard .chiprow .ldot { width: 44px; height: 44px; }

/* ---------- reading page ---------- */
.levelhead { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; }
.levelhead b { font-weight: 400; font-size: 1.5rem; }
.levelhead span { color: var(--on-wood-soft); font-size: .92rem; }
.storylist { display: grid; gap: 10px; margin-bottom: 10px; }
.story {
  display: grid; gap: 2px; text-align: left; width: 100%; min-height: 72px;
  padding: 12px 16px; border-radius: 16px; border: 1px solid var(--wood-3); background: var(--wood-2); color: var(--on-wood);
}
.story .stitle { font-size: 1.4rem; line-height: 1.3; }
.story .ssource { font-size: .88rem; color: var(--on-wood-soft); }
.story .smeta { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.story .diff { font-family: var(--sa); font-size: .95rem; padding: 1px 10px; border-radius: 99px; border: 1px solid var(--wood-3); color: var(--on-wood-soft); }
.story .diff.d1 { color: var(--leaf); } .story .diff.d2 { color: var(--turmeric); } .story .diff.d3 { color: #E3876F; }
.story .sdone { font-family: var(--sa); font-size: .95rem; color: #9FCB8A; }
.story.read { border-color: #5F7A4A; }
.story.locked { opacity: .45; margin-top: 10px; }

.rtitle { margin: 4px 0 14px; }
.rtitle h1 { font-weight: 400; font-size: 2rem; margin: 0; line-height: 1.2; }
.rtitle p { margin: 2px 0 0; color: var(--on-wood-soft); font-size: .92rem; }
.reader { display: grid; gap: 6px; }
.rwrap { background: var(--leaf); color: var(--ink); border-radius: 18px; padding: 12px 16px 10px; border: 1px solid var(--leaf-edge);
  transition: opacity .25s ease; }
.rwrap.past { opacity: .45; }
.rline { font-size: 1.7rem; line-height: 1.8; margin: 0 0 4px; }
.rline.enter { animation: rlin .25s ease-out; }
@keyframes rlin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rmark {
  font: inherit; color: inherit; border: 0; background: rgba(232,163,58,.28); border-radius: 8px;
  padding: 0 .18em; border-bottom: 3px solid var(--turmeric-dark); min-height: 44px; line-height: 1.5;
}
.rmark.ok { background: var(--green-bg); border-bottom-color: var(--green); }
.rmark.bad { background: var(--kumkum-bg); border-bottom-color: var(--kumkum); }
.rmark.ok::after { content: "✓"; font-family: var(--ui); font-size: .6em; color: var(--green); margin-left: .15em; vertical-align: super; }
.rmean { font-size: 1rem; color: var(--ink-soft); margin: 6px 0 2px; }
.linkbtn.small { min-height: 36px; font-size: .95rem; padding: 2px 12px; }
.rfield { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0 0 10px; }
.rfield span { font-size: 1.2rem; } .rfield small { color: var(--ink-soft); font-size: .82rem; }
.rsel { min-height: 54px; border-radius: 12px; font-family: var(--sa); font-size: 1.3rem; padding: 6px 12px;
  background: #FBF3DC; color: var(--ink); border: 1.5px solid var(--leaf-edge); }

/* settings rows wrap on narrow phones instead of pushing the panel sideways */
.setrow { flex-wrap: wrap; }
.setrow .lbl { flex: 1 1 170px; min-width: 0; }
.panel { overflow-wrap: anywhere; }

/* ---------- pronouns ---------- */
.setup { font-size: 1.25rem; color: var(--ink-soft); text-align: center; margin: 14px 0 0; opacity: .8; }
.chiprow.muted-row { opacity: .45; }
.grid.wide { grid-template-columns: 76px repeat(7, 1fr) !important; }
.grid .rowlab.small { font-size: .9rem; line-height: 1.1; }
.grid .rowlab.locked { opacity: .4; }

/* ---------- word pictures (js/images.js, tools/images.py) ---------- */
/* Only drawn when a picture exists, so a word without one looks exactly as before. */
.pic {
  width: 7.5rem; aspect-ratio: 1 / 1; margin: 10px auto 0; border-radius: 18px; overflow: hidden;
  background: #F7EDD3; box-shadow: 0 0 0 1px var(--leaf-edge), 0 4px 10px rgba(59, 36, 23, .18);
}
.pic.small { width: 5.75rem; border-radius: 14px; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- add to home screen card ---------- */
.install { background: var(--wood-2); border: 1px solid var(--wood-3); border-radius: 16px; padding: 14px 16px; margin: 0 0 18px; }
.install b { display: block; font-size: 1.05rem; color: var(--on-wood); }
.install p { margin: 4px 0 10px; color: var(--on-wood-soft); font-size: .95rem; }
.install .how { color: var(--on-wood); }
.install .linkbtn { background: var(--leaf-2); color: var(--ink); font-family: var(--ui); }

/* ---------- reading: passages and the answer panel ---------- */
.rpass { background: var(--leaf); color: var(--ink); border-radius: 18px; padding: 16px 18px 12px; border: 1px solid var(--leaf-edge);
  margin-bottom: 10px; transition: opacity .3s ease;
  background-image: repeating-linear-gradient(0deg, rgba(122, 88, 36, .04) 0 1px, transparent 1px 8px), linear-gradient(180deg, #F4E6C0, var(--leaf) 40%, #EBD8A8); }
.rpass.past { opacity: .55; }
.rtext { font-size: 1.6rem; line-height: 1.95; margin: 0 0 6px; }
.rtext.enter { animation: rlin .3s ease-out; }
.rw { border-radius: 6px; padding: 0 .08em; transition: background-color .2s ease; }
.rw.cur { background: rgba(232, 163, 58, .38); box-shadow: 0 0 0 2px rgba(201, 131, 28, .55); }
.rmean p { margin: 4px 0; }
.apanel { background: var(--leaf); color: var(--ink); border-radius: 18px; padding: 10px 10px 8px; }
.apanel.done { padding: 12px 14px; }
.arow { display: grid; gap: 6px; margin-bottom: 6px; }
.arow.top { grid-template-columns: 3fr 2fr; gap: 10px; margin-bottom: 8px; }
.agroup { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.arow.vibs { grid-template-columns: repeat(auto-fill, minmax(3.9em, 1fr)); }
.arow.vibs .achip { font-size: .92rem; }
.achip { min-height: 44px; min-width: 0; border-radius: 12px; border: 1.5px solid var(--leaf-edge); background: #FBF3DC; color: var(--ink);
  font-family: var(--sa); font-size: 1.05rem; padding: 2px 2px; line-height: 1.15; overflow-wrap: anywhere; }
.achip[aria-pressed="true"] { background: var(--ink); color: var(--leaf); border-color: var(--ink); }
.aact { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 8px; }
.acount { font-family: var(--sa); color: var(--ink-soft); font-size: 1rem; }
.averdict { font-family: var(--sa); font-size: 1.5rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.averdict svg { width: 26px; height: 26px; }
.averdict.ok { color: var(--green); } .averdict.bad { color: var(--kumkum); }
.apanel .ans { font-size: 1.35rem; margin: 6px 0 2px; }
.apanel .why { font-size: 1.05rem; margin: 0 0 8px; }
.apanel .peek { max-height: 34vh; overflow-y: auto; margin-bottom: 8px; }
.apanel .primary { margin-top: 4px; }
.ascore { text-align: center; color: var(--on-wood); font-size: 1.2rem; margin: 0 0 10px; }
