:root {
  --bg: #fbfaf7; --card: #ffffff; --panel: #f3f0ea; --ink: #1b1b1b; --muted: #6d6a64; --faint: #a39f97;
  --rule: #e4dfd5; --accent: #f2731a; --accent-ink: #b44f08; --black: #0d0d0d;
  --hi: rgba(255, 214, 0, .45); --solo: rgba(59, 130, 246, .28); --gone: rgba(120, 120, 120, .3);
  --de: #2257c9; --fr: #7c3aed; --la: #8a5a2c; --he: #0f766e; --gr: #4338ca; --aram: #73331a;
  --good: #15803d; --bad: #c02626;
  --greek: "Gentium Book Plus", "Times New Roman", serif;
  --hebrew: "Noto Serif Hebrew", "SBL Hebrew", "Times New Roman", serif;
  --serif: "Libre Baskerville", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --card: #1b1b1b; --panel: #232220; --ink: #ecebe8; --muted: #a6a29a; --faint: #75716a;
    --rule: #34322e; --accent-ink: #ff9a4d; --hi: rgba(255, 214, 0, .3); --solo: rgba(96, 165, 250, .3);
    --de: #7aa7ff; --fr: #b99bff; --la: #d2a06b; --he: #4fd1c1; --gr: #9ea4ff; --aram: #e0a07c;
    --good: #4ade80; --bad: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent-ink); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.pad { padding: 1rem 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }

/* site chrome, matching paulwhitehorn.com */
header.site { background: var(--black); border-bottom: 3px solid var(--accent); }
.site-row { max-width: 64rem; margin: 0 auto; padding: .55rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-name { font-family: var(--serif); color: #fff; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.site-nav { display: flex; gap: .2rem 1rem; flex-wrap: wrap; font-size: .85rem; }
.site-nav a { color: #cfcfcf; text-decoration: none; }
.site-nav a:hover, .site-name:hover { color: var(--accent); }
.appbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--rule); }
.appbar-in { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem; display: flex; align-items: center; gap: 1rem; }
.app-title { display: flex; align-items: center; gap: .5rem; font-family: var(--serif); font-weight: 700; color: var(--ink); text-decoration: none; padding: .55rem 0; white-space: nowrap; }
.app-title img { border-radius: 7px; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; gap: .1rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { text-decoration: none; color: var(--muted); padding: .85rem .6rem .7rem; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .92rem; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-color: var(--accent); font-weight: 600; }
@media (max-width: 40rem) {
  .appbar-in { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
  .app-title { padding: .45rem 1.25rem 0; }
  .tabs { padding: 0 .75rem; }
}
.view { max-width: 50rem; margin: 0 auto; padding: 0 1.25rem 4rem; min-height: 60vh; }
.site-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; border-top: 1px solid var(--rule); }

/* controls */
.toolbar { position: sticky; top: 3.1rem; z-index: 10; background: var(--bg); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; }
@media (max-width: 40rem) { .toolbar { position: static; } .w { font-size: 1.3rem; } .semitic .w { font-size: 1.45rem; } }
.toolbar h1 { font-family: var(--serif); font-size: 1.2rem; margin: 0 auto 0 0; }
select, .btn { font: inherit; font-size: .9rem; padding: .38rem .7rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; }
.btn:hover, select:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.warn { border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; background: var(--card); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: .38rem .8rem; cursor: pointer; font-size: .9rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.menu { position: relative; }
.menu-pop { position: absolute; top: calc(100% + .35rem); left: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: .4rem; min-width: 14rem; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 30; }
.menu-pop label { display: flex; align-items: center; gap: .55rem; padding: .35rem .5rem; border-radius: 6px; cursor: pointer; font-size: .92rem; }
.menu-pop label:hover { background: var(--panel); }
.menu-pop hr { border: 0; border-top: 1px solid var(--rule); margin: .35rem 0; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: .1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.icon-btn svg { width: 1.35em; height: 1.35em; }
.icon-btn.stop { color: var(--bad); }
.icon-btn.off { color: var(--faint); }

/* reader */
.lang-marker { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 1.6rem 0 .6rem; }
.lang-marker::before, .lang-marker::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.verse { margin: 0 0 1.6rem; scroll-margin-top: 7rem; }
.vline { line-height: 2.05; }
.vline .icon-btn { vertical-align: -.2em; margin-inline-end: .3rem; font-size: 1.1rem; }
.vnum { font-size: .7rem; font-weight: 700; color: var(--muted); vertical-align: super; margin-inline-end: .35rem; }
.w { border: 0; background: none; padding: 0 .08em; margin: 0; cursor: pointer; border-radius: 4px; font-family: var(--greek); font-size: 1.45rem; color: var(--ink); }
.semitic .w { font-family: var(--hebrew); font-size: 1.6rem; }
.w.aram { color: var(--aram); }
.w:hover { background: var(--panel); }
.w.hi { background: var(--hi); }
.w.solo { background: var(--solo); }
.w.gone { background: var(--gone); }
.tr { margin: .3rem 0 0; }
.tr.en { color: var(--muted); }
.tr.de { color: var(--de); font-style: italic; }
.tr.fr { color: var(--fr); font-style: italic; }
.tr.la { color: var(--la); font-style: italic; font-family: var(--greek); font-size: 1.08rem; }
.tr.he { color: var(--he); font-family: var(--hebrew); font-size: 1.2rem; text-align: right; }
.tr.gr { color: var(--gr); font-family: var(--greek); font-size: 1.12rem; }
.tr .icon-btn { font-size: .95rem; vertical-align: -.15em; margin-inline-end: .35rem; }
.caption { display: flex; gap: .5rem; align-items: baseline; margin-top: .45rem; font-size: .88rem; }
.chip { display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .05em; padding: .12rem .45rem; border-radius: 99px; background: var(--accent); color: #111; text-transform: uppercase; white-space: nowrap; }
.chip.dim { background: var(--panel); color: var(--muted); }
.blank { display: inline-flex; gap: .3rem; padding: .2rem; border-radius: 8px; background: rgba(242, 115, 26, .1); vertical-align: middle; margin: 0 .15rem; flex-wrap: wrap; }
.blank button { border: 1px solid rgba(242, 115, 26, .55); background: var(--card); color: var(--accent-ink); border-radius: 6px; padding: .05rem .45rem; font-family: var(--greek); font-size: 1.05rem; cursor: pointer; }
.semitic .blank button { font-family: var(--hebrew); }
.answer { font-family: var(--greek); font-size: 1.45rem; padding: 0 .1em; }
.semitic .answer { font-family: var(--hebrew); }
.answer.good { color: var(--good); font-weight: 700; }
.answer.bad { color: var(--bad); font-size: 1.25rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }

/* sheet (word detail, results) */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.sheet-card { position: relative; background: var(--card); width: 100%; max-width: 34rem; max-height: 85vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 1.5rem 1.5rem 2rem; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
@media (min-width: 48rem) { .sheet { align-items: center; } .sheet-card { border-radius: 18px; } }
.sheet-x { position: absolute; top: .6rem; right: .8rem; border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--muted); cursor: pointer; }
.wd-head { display: flex; align-items: center; gap: .7rem; }
.wd-word { font-family: var(--greek); font-size: 2.5rem; line-height: 1.2; }
.wd-word.semitic, .wd-lemma.semitic { font-family: var(--hebrew); }
.wd-lemma { font-family: var(--greek); font-size: 1.5rem; color: var(--muted); }
.pill { display: inline-block; font-size: .8rem; padding: .15rem .6rem; border-radius: 99px; background: var(--panel); }
.wd-icon { width: 56px; height: 56px; }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }

/* cards */
.card-stage { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; padding: 1.2rem 0; }
.flash { position: relative; width: 100%; max-width: 30rem; min-height: 15rem; background: var(--card); border: 1px solid var(--rule); border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 2rem 1.5rem; text-align: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.04); transition: transform .35s; }
.flash.turn { transform: rotateY(180deg); }
.flash .front { font-family: var(--greek); font-size: 2.8rem; line-height: 1.2; }
.flash .front.semitic { font-family: var(--hebrew); }
.flash .front.plain { font-family: var(--serif); font-size: 2.2rem; }
.flash .gloss { font-size: 1.3rem; }
.flash .speak { position: absolute; top: .6rem; right: .7rem; font-size: 1.2rem; }
.flash img { width: 64px; height: 64px; }
.grade { display: flex; gap: 1rem; width: 100%; max-width: 30rem; }
.grade .btn { flex: 1; padding: .6rem; }

/* compare */
.nav-verse { display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-radius: 12px; padding: .5rem .8rem; margin-bottom: 1rem; }
.nav-verse .ref { text-align: center; }
.nav-verse .ref b { display: block; font-family: var(--serif); }
.lcard { display: flex; gap: .7rem; align-items: flex-start; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: .8rem; margin-bottom: .8rem; }
.lcard .chip { min-width: 2.4rem; text-align: center; margin-top: .25rem; }
.lcard .txt { flex: 1; }
.lcard .txt.greek { font-family: var(--greek); font-size: 1.3rem; }
.lcard .txt.semitic { font-family: var(--hebrew); font-size: 1.4rem; text-align: right; }
.letters { display: flex; flex-wrap: wrap; gap: .35rem; }
.letters span { min-width: 2.1rem; text-align: center; background: var(--panel); border-radius: 7px; padding: .2rem .35rem; font-family: var(--greek); }
.letters.rtl span { font-family: var(--hebrew); }

/* basics */
.bx h2 { font-family: var(--serif); font-size: 1.1rem; margin: 2rem 0 .6rem; }
.bx p { margin: .5rem 0; }
.bx .note { color: var(--muted); }
.bx h4 { margin: .9rem 0 .3rem; font-size: .95rem; }
.bx .formula { display: inline-block; background: rgba(242, 115, 26, .12); border-radius: 8px; padding: .3rem .8rem; font-family: var(--greek); font-size: 1.15rem; }
.tbl-wrap { overflow-x: auto; margin: .6rem 0; }
.tbl { border-collapse: collapse; font-size: .95rem; min-width: 60%; }
.tbl th, .tbl td { border-bottom: 1px solid var(--rule); padding: .35rem .7rem; text-align: left; vertical-align: top; }
.tbl th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.tbl td { font-family: var(--greek); font-size: 1.05rem; }
.tbl.rtl td { font-family: var(--hebrew); }
.pairs { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .35rem 1rem; margin: .6rem 0; }
.pairs dt { font-family: var(--greek); font-weight: 700; font-size: 1.05rem; }
.pairs.rtl dt { font-family: var(--hebrew); }
.pairs dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.chips figure { margin: 0; text-align: center; background: var(--panel); border-radius: 8px; padding: .3rem .45rem; min-width: 2.6rem; }
.chips .g { font-family: var(--greek); font-size: 1.15rem; display: block; }
.chips.rtl .g { font-family: var(--hebrew); font-size: 1.35rem; }
.chips figcaption { white-space: pre-line; font-size: .66rem; color: var(--muted); line-height: 1.25; }

/* lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li a, .list li button { display: flex; justify-content: space-between; align-items: center; gap: 1rem; width: 100%; text-align: left; padding: .8rem .2rem; border: 0; border-bottom: 1px solid var(--rule); background: none; color: var(--ink); text-decoration: none; cursor: pointer; }
.list li a:hover, .list li button:hover { background: var(--panel); }
.list .sub { color: var(--muted); font-size: .88rem; }
.src h2 { font-family: var(--serif); font-size: 1rem; margin: 1.8rem 0 .4rem; }
.src h3 { font-size: .98rem; margin: .8rem 0 .15rem; }
.src p { margin: 0; color: var(--muted); font-size: .9rem; }

/* write */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .8rem; }
.vgrid button { background: var(--panel); border: 0; border-radius: 12px; padding: .8rem .2rem; cursor: pointer; font-weight: 700; font-size: 1.1rem; }
.stars { color: #e2a400; font-size: .8rem; letter-spacing: .05em; display: block; font-weight: 400; }
.wcells { display: flex; flex-wrap: wrap; gap: .45rem .6rem; align-items: center; min-height: 2.4rem; margin: .5rem 0; }
.wcells .done { font-family: var(--greek); font-size: 1.3rem; }
.wcells .todo { display: inline-block; height: 4px; border-radius: 3px; background: var(--rule); }
.wcells .now { display: inline-block; height: 18px; border-radius: 5px; background: rgba(242, 115, 26, .3); }
.soFar { font-family: var(--greek); font-size: 1.5rem; letter-spacing: .12em; text-align: center; min-height: 2.2rem; }
.soFar i { color: var(--faint); font-style: normal; }
.pad-wrap { position: relative; height: min(58vh, 30rem); border: 1.5px solid var(--accent); border-radius: 20px; background: var(--panel); touch-action: none; }
.pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 20px; }
.pad-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 1.2rem; pointer-events: none; }
.write-foot { display: flex; gap: .7rem; align-items: center; margin-top: .8rem; flex-wrap: wrap; }
.write-foot .grow { flex: 1; }

/* songs */
.song-controls { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: 1rem 0; }
.song-controls .play { width: 4rem; height: 4rem; border-radius: 50%; border: 0; background: var(--accent); color: #111; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.song-controls .play svg { width: 1.8rem; height: 1.8rem; }
.song-controls input[type=range] { width: 100%; accent-color: var(--accent); }
.song-controls .times { display: flex; justify-content: space-between; width: 100%; font-size: .8rem; color: var(--muted); }
.lyric-sec h3 { font-size: .75rem; letter-spacing: .08em; color: var(--accent-ink); margin: 1.6rem 0 .5rem; }
.lyric { margin: .5rem 0; font-size: 1.08rem; }
.lyric .sw { transition: all .15s; border-radius: 5px; padding: 0 .06em; }
.lyric .sw.now { background: var(--hi); font-weight: 700; color: var(--accent-ink); }
.vbadge { display: inline-block; font-size: .66rem; font-weight: 700; color: #fff; background: var(--de); border-radius: 99px; padding: .05rem .45rem; margin-bottom: .15rem; }
.vbadge.skip { background: var(--accent); color: #111; }
.fnote { display: flex; gap: .4rem; font-size: .85rem; color: var(--accent-ink); background: rgba(242, 115, 26, .1); border-radius: 6px; padding: .35rem .6rem; margin: .25rem 0; }
.hook { display: inline-flex; gap: .3rem; padding: .15rem; border-radius: 9px; background: rgba(242, 115, 26, .1); vertical-align: middle; }
.hook button { border: 1px solid rgba(242, 115, 26, .55); background: var(--card); border-radius: 6px; font-family: var(--greek); padding: .05rem .5rem; cursor: pointer; }
.hook-done { font-family: var(--greek); }
.hook-done.good { color: var(--good); font-weight: 700; }
.hook-done.bad { color: var(--muted); }
.hook-blank { color: var(--faint); letter-spacing: -.1em; }

/* about */
.about img { width: 100%; border-radius: 16px; display: block; }
.about h1 { font-family: var(--serif); font-size: 1.8rem; }
.intro-card { background: var(--panel); border-radius: 14px; padding: 1rem 1.2rem; margin: 1rem 0; font-size: .92rem; }
