@font-face { font-family: "Cinzel Decorative"; font-weight: 700; font-display: swap; src: url("/fonts/cinzel-decorative-700.woff2") format("woff2"); }
@font-face { font-family: "Cinzel Decorative"; font-weight: 900; font-display: swap; src: url("/fonts/cinzel-decorative-900.woff2") format("woff2"); }
/* Gentium Book Plus (SIL OFL, web/fonts/OFL-gentium.txt) for Greek only: its unicode-range leaves Latin letters to the next font */
@font-face { font-family: "Gentium Book Plus"; font-weight: 400; font-display: swap; src: url("/fonts/gentium-book-plus-400-greek-ext.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Gentium Book Plus"; font-weight: 400; font-display: swap; src: url("/fonts/gentium-book-plus-400-greek.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "Gentium Book Plus"; font-weight: 700; font-display: swap; src: url("/fonts/gentium-book-plus-700-greek-ext.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Gentium Book Plus"; font-weight: 700; font-display: swap; src: url("/fonts/gentium-book-plus-700-greek.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
/* Ezra SIL (SIL OFL, web/fonts/OFL-ezra.txt) for Hebrew only: made for the Hebrew Bible's points and cantillation */
@font-face { font-family: "Ezra SIL"; font-display: swap; src: url("/fonts/SILEOT.ttf") format("truetype"); unicode-range: U+0590-05FF, U+FB1D-FB4F; size-adjust: 118%; }

/* Lectio — themes: bw (black on white), dark (white on black), blue (black on a pale blue), and the colourful ones
   (web/js/themes.js lists them all) */
:root, [data-theme="bw"] {
  --bg: #ffffff; --fg: #111111; --muted: #666666; --faint: #999999;
  --surface: #ffffff; --surface-2: #f5f5f5; --border: #dddddd; --border-strong: #111111;
  --accent: #111111; --accent-fg: #ffffff; --good: #1d6b35; --bad: #a3261d;
  --hl-yellow: #fff1a8; --hl-green: #cdeccf; --hl-blue: #cfe3fb; --hl-pink: #f8d3e1; --hl-fg: #111111;
  --shadow: 0 6px 24px rgba(0,0,0,.14);
  --style: #1f5fa8;
}
[data-theme="dark"] {
  --bg: #0d0d0d; --fg: #eeeeee; --muted: #a3a3a3; --faint: #777777;
  --surface: #151515; --surface-2: #1e1e1e; --border: #333333; --border-strong: #eeeeee;
  --accent: #eeeeee; --accent-fg: #0d0d0d; --good: #6fce8b; --bad: #ff8a80;
  --hl-yellow: #fff1a8; --hl-green: #cdeccf; --hl-blue: #cfe3fb; --hl-pink: #f8d3e1; --hl-fg: #111111;
  --shadow: 0 6px 24px rgba(0,0,0,.6);
  --style: #8ab4f8;
}
[data-theme="blue"] {
  --bg: #eef5fc; --fg: #111111; --muted: #4a5a6e; --faint: #8394a8;
  --surface: #f7fbff; --surface-2: #e1edf9; --border: #c3d7ec; --border-strong: #111111;
  --accent: #111111; --accent-fg: #ffffff; --good: #1d6b35; --bad: #a3261d;
  --hl-yellow: #fff1a8; --hl-green: #cdeccf; --hl-blue: #cfe3fb; --hl-pink: #f8d3e1; --hl-fg: #111111;
  --shadow: 0 6px 24px rgba(20,60,110,.14);
  --style: #1f5fa8;
}
[data-theme="blue-dark"] {  /* Light blue's dark version: pale text on a deep blue (not black) */
  --bg: #111b26; --fg: #e3eaf2; --muted: #9fb0c3; --faint: #6f8297;
  --surface: #172331; --surface-2: #1e2c3d; --border: #2b3c51; --border-strong: #e3eaf2;
  --accent: #e3eaf2; --accent-fg: #111b26; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #111b26;
  --shadow: 0 6px 24px rgba(0,0,0,.5);
  --style: #8fb6e0;
}
/* The colourful themes: each a palette from one colour scheme, muted (nothing bright), on a ground that suits it.
   --c1 the main colour (buttons, the page you are on, headings), --c2 its complement (section headings, Review),
   --c3 and --c4 the two that complete the scheme (tints only); -deep a darker shade for text, -tint a pale one for
   grounds.  The rules they share are at the end of this file, under [data-colorful]. */
[data-theme="friendly"] {  /* Teal & Terracotta: split-complementary (teal, its complement terracotta, ochre and sage), warm paper */
  --bg: #f7f4ee; --fg: #2a2826; --muted: #6b645b; --faint: #9a9184;
  --surface: #fffdf9; --surface-2: #efe9df; --border: #e2d9cb; --border-strong: #3c5a5c;
  --accent: #2f6b6e; --accent-fg: #fffdf9; --good: #3f7a4c; --bad: #a8473a;
  --hl-yellow: #f4e3a8; --hl-green: #d3e4cc; --hl-blue: #cfe1e6; --hl-pink: #f0d3c8; --hl-fg: #2a2826;
  --shadow: 0 8px 26px rgba(60,50,35,.13); --style: #2f6b6e;
  --c1: #2f6b6e; --c1-deep: #23484b; --c1-tint: #e3eeec;
  --c2: #b5603c; --c2-deep: #8f4a2e; --c2-tint: #f6e9e0;
  --c3: #b8892f; --c3-tint: #f5eedb;
  --c4: #6f8f6a; --c4-tint: #e9efe4;
  --topbar: #f1ece3; --line: #cdbfac; --sel: #d9e7e5; --h3: #4f6466;
}
[data-theme="sage-rose"] {  /* Sage & Rose: complementary (a muted green and a dusty rose), with old gold and slate, on cream */
  --bg: #f8f6f0; --fg: #2a2a27; --muted: #67645c; --faint: #9a958a;
  --surface: #fffefa; --surface-2: #eeebe2; --border: #e0dbcf; --border-strong: #3f5c46;
  --accent: #4f7a5a; --accent-fg: #fffefa; --good: #3f7a4c; --bad: #a5463f;
  --hl-yellow: #f2e4ad; --hl-green: #d5e6d4; --hl-blue: #d6e0ec; --hl-pink: #f1d6d6; --hl-fg: #2a2a27;
  --shadow: 0 8px 26px rgba(55,55,40,.12); --style: #4f7a5a;
  --c1: #4f7a5a; --c1-deep: #36573f; --c1-tint: #e5eee6;
  --c2: #b0646a; --c2-deep: #8a4a50; --c2-tint: #f5e7e7;
  --c3: #b39350; --c3-tint: #f3eddc;
  --c4: #5f7593; --c4-tint: #e6ebf2;
  --topbar: #f0ede4; --line: #cbc5b5; --sel: #dbe8dd; --h3: #4d5f52;
}
[data-theme="slate-ochre"] {  /* Slate & Ochre: complementary (a greyed blue and its orange), with dusty teal and clay, on warm grey */
  --bg: #f5f4f1; --fg: #26282c; --muted: #626670; --faint: #959aa3;
  --surface: #fdfdfb; --surface-2: #ebe9e4; --border: #dcd9d2; --border-strong: #2c4566;
  --accent: #3f5f86; --accent-fg: #fdfdfb; --good: #3f7a4c; --bad: #a8473a;
  --hl-yellow: #f3e3a9; --hl-green: #d3e6dc; --hl-blue: #d5e0ee; --hl-pink: #f0d9cf; --hl-fg: #26282c;
  --shadow: 0 8px 26px rgba(35,45,60,.13); --style: #3f5f86;
  --c1: #3f5f86; --c1-deep: #2c4566; --c1-tint: #e4eaf2;
  --c2: #b7832e; --c2-deep: #8c6120; --c2-tint: #f5ecd8;
  --c3: #4f8a8a; --c3-tint: #e2eeee;
  --c4: #b0705a; --c4-tint: #f3e6df;
  --topbar: #eceae5; --line: #c6c3bb; --sel: #d8e1ee; --h3: #4d5a6b;
}
[data-theme="plum-olive"] {  /* Plum & Olive: complementary (a greyed violet and its yellow-green), with rose-taupe and mist blue */
  --bg: #f7f5f3; --fg: #2b2730; --muted: #69636d; --faint: #9b95a0;
  --surface: #fefdfc; --surface-2: #eeeae7; --border: #e1dbd7; --border-strong: #4e3456;
  --accent: #6a4a73; --accent-fg: #fefdfc; --good: #4f7a3f; --bad: #a8473a;
  --hl-yellow: #f1e5ad; --hl-green: #dfe6cc; --hl-blue: #d9e1ee; --hl-pink: #eedbe2; --hl-fg: #2b2730;
  --shadow: 0 8px 26px rgba(60,45,65,.12); --style: #6a4a73;
  --c1: #6a4a73; --c1-deep: #4e3456; --c1-tint: #efe7f1;
  --c2: #7d8a3c; --c2-deep: #5b6629; --c2-tint: #eef0de;
  --c3: #a8746a; --c3-tint: #f3e8e4;
  --c4: #5e7493; --c4-tint: #e6ebf2;
  --topbar: #efebe8; --line: #cbc3c4; --sel: #e6dcea; --h3: #5b4d63;
}
[data-theme="seaside"] {  /* Seaside: ocean turquoise and its complement coral, with sand gold and seafoam, on sand under a pale sky */
  --bg: #f6efe0; --fg: #1f3340; --muted: #5d6b70; --faint: #93999a;
  --surface: #fffaf0; --surface-2: #efe4cf; --border: #e3d6bc; --border-strong: #0f5f66;
  --accent: #1a8a93; --accent-fg: #fffaf0; --good: #2f7d53; --bad: #b4443d;
  --hl-yellow: #f6e3a3; --hl-green: #cfeadf; --hl-blue: #cde8ea; --hl-pink: #f6d3c6; --hl-fg: #1f3340;
  --shadow: 0 8px 26px rgba(20,60,70,.14); --style: #1a8a93;
  --c1: #1a8a93; --c1-deep: #0f5f66; --c1-tint: #dcf0ef;
  --c2: #e0704f; --c2-deep: #b2502f; --c2-tint: #fbe6dd;
  --c3: #d1a24a; --c3-tint: #f6ead0;
  --c4: #6fb7a2; --c4-tint: #e2f2ec;
  --topbar: #e3f1ef; --bg-image: linear-gradient(180deg, #e8f5f3 0, #f6efe0 340px);
  --line: #d8c6a4; --sel: #cfe9e7; --h3: #2e5c63;
}
[data-theme="sunset"] {  /* Sunset: burnt orange and its complement dusky violet, with golden-hour amber and rose, on peach */
  --bg: #fbf0e8; --fg: #2e1f2b; --muted: #6e5a63; --faint: #a08f95;
  --surface: #fffaf6; --surface-2: #f6e2d6; --border: #ecd3c4; --border-strong: #9e4320;
  --accent: #d0612f; --accent-fg: #fffaf6; --good: #3f7a4c; --bad: #b03b3b;
  --hl-yellow: #f8e2a6; --hl-green: #d9e8cf; --hl-blue: #dcd8ef; --hl-pink: #f6d0da; --hl-fg: #2e1f2b;
  --shadow: 0 8px 26px rgba(90,40,30,.14); --style: #6d4c8a;
  --c1: #d0612f; --c1-deep: #9e4320; --c1-tint: #fbe3d6;
  --c2: #6d4c8a; --c2-deep: #4f3566; --c2-tint: #ece4f3;
  --c3: #e0a53b; --c3-tint: #fbefd4;
  --c4: #c4577a; --c4-tint: #f8e1e8;
  --topbar: #fbe4d6; --bg-image: linear-gradient(180deg, #fde5d4 0, #fbf0e8 360px);
  --line: #dfc0ae; --sel: #f6d5c3; --h3: #6a4a5c;
}
[data-theme="beach-sunset"] {  /* Beach Sunset: deep-sea blue and sunset coral, with golden light and a lilac sky, on warm sand */
  --bg: #fbf1e6; --fg: #233041; --muted: #5f6878; --faint: #969cab;
  --surface: #fffaf4; --surface-2: #f4e4d6; --border: #ead6c6; --border-strong: #164f63;
  --accent: #1f6f8b; --accent-fg: #fffaf4; --good: #2f7d53; --bad: #b4443d;
  --hl-yellow: #f8e3a6; --hl-green: #d3e9dc; --hl-blue: #d2e5ee; --hl-pink: #f7d4cf; --hl-fg: #233041;
  --shadow: 0 8px 26px rgba(40,50,80,.14); --style: #1f6f8b;
  --c1: #1f6f8b; --c1-deep: #164f63; --c1-tint: #dceef4;
  --c2: #e46f61; --c2-deep: #b24c40; --c2-tint: #fbe2de;
  --c3: #f0b252; --c3-tint: #fcefd6;
  --c4: #9b7fbf; --c4-tint: #eee6f6;
  --topbar: #fbe3d9; --bg-image: linear-gradient(180deg, #fde0d6 0, #fcecd8 220px, #fbf1e6 440px);
  --line: #e2c9b6; --sel: #f7d9cf; --h3: #3d5c6f;
}
[data-theme="pine-mountain"] {  /* Pine & Mountain: pine green and its warm complement cedar bark, with stone blue and lichen, in mist */
  --bg: #f1f3ef; --fg: #1f2a24; --muted: #57645b; --faint: #8b978e;
  --surface: #fbfcfa; --surface-2: #e4e9e2; --border: #d4dcd2; --border-strong: #1f4a30;
  --accent: #2f6a46; --accent-fg: #fbfcfa; --good: #2f6a46; --bad: #a8473a;
  --hl-yellow: #efe3a8; --hl-green: #d0e5d5; --hl-blue: #d3e0ec; --hl-pink: #efd8cf; --hl-fg: #1f2a24;
  --shadow: 0 8px 26px rgba(25,45,35,.14); --style: #5d7a96;
  --c1: #2f6a46; --c1-deep: #1f4a30; --c1-tint: #e0ece3;
  --c2: #9a5a34; --c2-deep: #74411f; --c2-tint: #f1e5da;
  --c3: #5d7a96; --c3-tint: #e4ebf2;
  --c4: #8a9a4b; --c4-tint: #edf0dc;
  --topbar: #e0e9e2; --bg-image: linear-gradient(180deg, #e2eae5 0, #f1f3ef 320px);
  --line: #c5cfc3; --sel: #d3e4d8; --h3: #3c5244;
}
[data-theme="italia"] {  /* Italia: Mediterranean blue and terracotta roofs, with lemon and olive, on warm stucco */
  --bg: #f8f1e3; --fg: #2f2622; --muted: #6c5d52; --faint: #9e8f82;
  --surface: #fffaf0; --surface-2: #f0e3cd; --border: #e5d4b6; --border-strong: #173f66;
  --accent: #22598c; --accent-fg: #fffaf0; --good: #4f7a2f; --bad: #b03b2b;
  --hl-yellow: #f7e39d; --hl-green: #e0e8c8; --hl-blue: #d5e1ee; --hl-pink: #f4d4c6; --hl-fg: #2f2622;
  --shadow: 0 8px 26px rgba(70,45,25,.14); --style: #22598c;
  --c1: #22598c; --c1-deep: #173f66; --c1-tint: #dfe8f2;
  --c2: #c1532f; --c2-deep: #94391d; --c2-tint: #f8e2d7;
  --c3: #e2b33b; --c3-tint: #faefcf;
  --c4: #6f7d32; --c4-tint: #ecefd9;
  --topbar: #f5e6d8; --bg-image: linear-gradient(180deg, #f6e6d8 0, #f8f1e3 320px);
  --line: #dbc6a3; --sel: #f5ddcf; --h3: #5a4636;
}
[data-theme="romantic"] {  /* Romantic: wine and dusty rose, with antique gold and mauve, on blush ivory */
  --bg: #faf1ef; --fg: #34222a; --muted: #6e5560; --faint: #a08c94;
  --surface: #fffaf8; --surface-2: #f3e2e1; --border: #ead3d3; --border-strong: #5e1f33;
  --accent: #7a2840; --accent-fg: #fffaf8; --good: #4f7a4f; --bad: #b23a3a;
  --hl-yellow: #f6e2a8; --hl-green: #dbe8d6; --hl-blue: #dfe0ef; --hl-pink: #f6d3da; --hl-fg: #34222a;
  --shadow: 0 8px 26px rgba(80,30,45,.14); --style: #7a2840;
  --c1: #7a2840; --c1-deep: #5e1f33; --c1-tint: #f4dfe4;
  --c2: #c4707f; --c2-deep: #9c4f5d; --c2-tint: #f8e2e6;
  --c3: #b8924a; --c3-tint: #f5ecd8;
  --c4: #8a6f9e; --c4-tint: #ece5f2;
  --topbar: #f6e0e2; --bg-image: linear-gradient(180deg, #f8e1e3 0, #faf1ef 320px);
  --line: #e0c4c6; --sel: #f4d6dc; --h3: #5e3a48;
}
[data-theme="friendly-dark"] {  /* Teal and terracotta on a deep teal-brown: the dark version (the ground a deep shade of its own colour) */
  --bg: #122323; --fg: #e1eaea; --muted: #abb9ba; --faint: #7b8d8e;
  --surface: #1b2e2f; --surface-2: #263a3b; --border: #364d4e; --border-strong: #7ec5c8;
  --accent: #7ec5c8; --accent-fg: #122323; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #122323;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #e3bbab;
  --c1: #7ec5c8; --c1-deep: #b8dfe0; --c1-tint: #244142;
  --c2: #d19175; --c2-deep: #e3bbab; --c2-tint: #422d24;
  --c3: #d6b371; --c3-tint: #423824;
  --c4: #8ec186; --c4-tint: #2d3b2b;
  --topbar: #0f1c1d;
  --bg-image: linear-gradient(180deg, #1a3132 0, #122323 360px);
  --line: #435f60; --sel: #326567; --h3: #b8cbcc;
}
[data-theme="sage-rose-dark"] {  /* Sage and rose on a deep forest: the dark version (the ground a deep shade of its own colour) */
  --bg: #152118; --fg: #e1eae3; --muted: #abbaaf; --faint: #7b8e80;
  --surface: #1d2d21; --surface-2: #263b2b; --border: #364e3c; --border-strong: #86c195;
  --accent: #86c195; --accent-fg: #152118; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #152118;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #d9b5b8;
  --c1: #86c195; --c1-deep: #bddbc5; --c1-tint: #283e2e;
  --c2: #c1858a; --c2-deep: #d9b5b8; --c2-tint: #422426;
  --c3: #c7b07f; --c3-tint: #423824;
  --c4: #869fc1; --c4-tint: #28313e;
  --topbar: #111a13;
  --bg-image: linear-gradient(180deg, #1e2e22 0, #152118 360px);
  --line: #43604a; --sel: #3c5d45; --h3: #b8ccbd;
}
[data-theme="plum-olive-dark"] {  /* Plum and olive on a deep aubergine: the dark version (the ground a deep shade of its own colour) */
  --bg: #1e1521; --fg: #e8e1ea; --muted: #b7abba; --faint: #8a7b8e;
  --surface: #291d2d; --surface-2: #36263b; --border: #49364e; --border-strong: #b486c1;
  --accent: #b486c1; --accent-fg: #1e1521; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #1e1521;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #d6ddb1;
  --c1: #b486c1; --c1-deep: #d5bddb; --c1-tint: #39283e;
  --c2: #bbc77f; --c2-deep: #d6ddb1; --c2-tint: #3d4224;
  --c3: #c18f86; --c3-tint: #402a26;
  --c4: #869ec1; --c4-tint: #28313e;
  --topbar: #18111a;
  --bg-image: linear-gradient(180deg, #2b1e2f 0, #1e1521 360px);
  --line: #5a4360; --sel: #563c5d; --h3: #c7b8cc;
}
[data-theme="seaside-dark"] {  /* Turquoise and coral on a night sea: the dark version (the ground a deep shade of its own colour) */
  --bg: #122223; --fg: #e1e9ea; --muted: #abb9ba; --faint: #7b8d8e;
  --surface: #1b2d2f; --surface-2: #263a3b; --border: #364c4e; --border-strong: #71ced6;
  --accent: #71ced6; --accent-fg: #122223; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #122223;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #e6b6a8;
  --c1: #71ced6; --c1-deep: #b3e2e6; --c1-tint: #244042;
  --c2: #d68871; --c2-deep: #e6b6a8; --c2-tint: #422b24;
  --c3: #d6b371; --c3-tint: #423824;
  --c4: #85c2b0; --c4-tint: #244239;
  --topbar: #0f1c1d;
  --bg-image: linear-gradient(180deg, #1a3132 0, #122223 360px);
  --line: #435e60; --sel: #326367; --h3: #b8cacc;
}
[data-theme="sunset-dark"] {  /* Orange and violet on dusk: the dark version (the ground a deep shade of its own colour) */
  --bg: #1b1323; --fg: #e6e1ea; --muted: #b3abba; --faint: #857b8e;
  --surface: #261b2f; --surface-2: #31263b; --border: #43364e; --border-strong: #d69071;
  --accent: #d69071; --accent-fg: #1b1323; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #1b1323;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #c8b6d8;
  --c1: #d69071; --c1-deep: #e6c2b3; --c1-tint: #422d24;
  --c2: #a586c1; --c2-deep: #c8b6d8; --c2-tint: #342442;
  --c3: #d6b271; --c3-tint: #423724;
  --c4: #cf7793; --c4-tint: #42242e;
  --topbar: #160f1c;
  --bg-image: linear-gradient(180deg, #271b31 0, #1b1323 360px);
  --line: #534360; --sel: #674232; --h3: #c2b8cc;
}
[data-theme="beach-sunset-dark"] {  /* Sea blue and coral on a twilight shore: the dark version (the ground a deep shade of its own colour) */
  --bg: #121f23; --fg: #e1e8ea; --muted: #abb6ba; --faint: #7b898e;
  --surface: #1b2a2f; --surface-2: #26363b; --border: #36484e; --border-strong: #71bcd6;
  --accent: #71bcd6; --accent-fg: #121f23; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #121f23;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #e6afa8;
  --c1: #71bcd6; --c1-deep: #b3d8e6; --c1-tint: #243a42;
  --c2: #d67c71; --c2-deep: #e6afa8; --c2-tint: #422724;
  --c3: #d6ae71; --c3-tint: #423624;
  --c4: #9f85c2; --c4-tint: #312442;
  --topbar: #0f191d;
  --bg-image: linear-gradient(180deg, #1a2c32 0, #121f23 360px);
  --line: #435960; --sel: #325967; --h3: #b8c7cc;
}
[data-theme="pine-mountain-dark"] {  /* Pine and cedar on a dark forest: the dark version (the ground a deep shade of its own colour) */
  --bg: #122319; --fg: #e1eae4; --muted: #abbab1; --faint: #7b8e82;
  --surface: #1b2f23; --surface-2: #263b2e; --border: #364e40; --border-strong: #80c79b;
  --accent: #80c79b; --accent-fg: #122319; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #122319;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #e3c0ab;
  --c1: #80c79b; --c1-deep: #b8e0c8; --c1-tint: #244230;
  --c2: #d19876; --c2-deep: #e3c0ab; --c2-tint: #422f24;
  --c3: #86a4c1; --c3-tint: #27333f;
  --c4: #b6c384; --c4-tint: #3c4224;
  --topbar: #0f1d14;
  --bg-image: linear-gradient(180deg, #1a3224 0, #122319 360px);
  --line: #43604e; --sel: #326747; --h3: #b8ccc0;
}
[data-theme="italia-dark"] {  /* Blue and terracotta on a Roman night: the dark version (the ground a deep shade of its own colour) */
  --bg: #231612; --fg: #eae3e1; --muted: #baafab; --faint: #8e807b;
  --surface: #2f201b; --surface-2: #3b2b26; --border: #4e3c36; --border-strong: #71a5d6;
  --accent: #71a5d6; --accent-fg: #231612; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #231612;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #e6b7a8;
  --c1: #71a5d6; --c1-deep: #b3cde6; --c1-tint: #243442;
  --c2: #d68a71; --c2-deep: #e6b7a8; --c2-tint: #422b24;
  --c3: #d6b971; --c3-tint: #423a24;
  --c4: #bccb7c; --c4-tint: #3d4224;
  --topbar: #1d120f;
  --bg-image: linear-gradient(180deg, #32201a 0, #231612 360px);
  --line: #604a43; --sel: #324e67; --h3: #ccbdb8;
}
[data-theme="romantic-dark"] {  /* Wine and rose by candlelight: the dark version (the ground a deep shade of its own colour) */
  --bg: #231217; --fg: #eae1e4; --muted: #baabaf; --faint: #8e7b81;
  --surface: #2f1b21; --surface-2: #3b262c; --border: #4e363d; --border-strong: #d27590;
  --accent: #d27590; --accent-fg: #231217; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #231217;
  --shadow: 0 8px 26px rgba(0,0,0,.45); --style: #ecc4c4;
  --c1: #d27590; --c1-deep: #e6b3c1; --c1-tint: #42242d;
  --c2: #dfa0a0; --c2-deep: #ecc4c4; --c2-tint: #422429;
  --c3: #cbb07b; --c3-tint: #423824;
  --c4: #a886c1; --c4-tint: #34293d;
  --topbar: #1d0f13;
  --bg-image: linear-gradient(180deg, #321a21 0, #231217 360px);
  --line: #60434c; --sel: #673241; --h3: #ccb8be;
}

[data-theme="evening"] {  /* Evening: complementary brass and slate-teal on deep navy, with clay and moss; for night reading */
  --bg: #141922; --fg: #e8e4da; --muted: #a8a397; --faint: #7c786f;
  --surface: #1b2230; --surface-2: #232c3c; --border: #2f3a4d; --border-strong: #c8a25e;
  --accent: #c8a25e; --accent-fg: #141922; --good: #8cc49a; --bad: #e58f84;
  --hl-yellow: #e6d49a; --hl-green: #b9d6b9; --hl-blue: #b5cbe0; --hl-pink: #e3bfc4; --hl-fg: #141922;
  --shadow: 0 8px 26px rgba(0,0,0,.5); --style: #9cc3d0;
  --c1: #c8a25e; --c1-deep: #e2c48a; --c1-tint: #2b2a26;
  --c2: #6f9fb0; --c2-deep: #9cc3d0; --c2-tint: #1d2b33;
  --c3: #b98a6a; --c3-tint: #2d2522;
  --c4: #8aa67f; --c4-tint: #212a22;
  --topbar: #11161e; --line: #3a465b; --sel: #3a4a5e; --h3: #b9c3cf;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.serif, .lat, .eng, .lesson, .card-front, .sentence { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
h1, h2, h3 { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", Palatino, Georgia, serif; font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 21px; margin: 24px 0 10px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.hidden, [hidden] { display: none !important; }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px;
  background: var(--bg); border-bottom: 1px solid var(--border); }
/* the language menu: the current language; the others unfold in a column below it, over the page (the bar stays put) */
.lang-menu { position: relative; flex: none; }
.lang-pill { display: flex; align-items: center; gap: 6px; width: 100%; font-size: 14px; font-weight: 600; white-space: nowrap;
  padding: 4px 10px; border: 1.5px solid var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--fg);
  cursor: pointer; text-align: left; }
.lang-pill.current::after { content: "▾"; font-size: 11px; color: var(--muted); margin-left: auto; transition: transform .25s ease; }
.lang-menu.single .lang-pill.current::after { content: none; }
.lang-drop { position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; display: flex; flex-direction: column; gap: 4px;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  max-height: 0; opacity: 0; overflow: hidden; pointer-events: none; transform: translateY(-4px); z-index: 30;
  transition: max-height .3s ease, opacity .2s ease, transform .25s ease; }
.lang-menu.single .lang-drop { display: none; }
.lang-drop .lang-pill { border-color: var(--border); color: var(--muted); font-weight: 500; }
.lang-drop .lang-pill:hover, .lang-drop .lang-pill:focus-visible { color: var(--fg); border-color: var(--border-strong); background: var(--surface-2); }
/* a bridge over the gap, so the column stays open as the pointer moves down to it */
.lang-menu::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 6px; }
.lang-menu:hover .lang-drop, .lang-menu:focus-within .lang-drop, .lang-menu.open .lang-drop {
  max-height: 320px; opacity: 1; pointer-events: auto; transform: none; }
.lang-menu:hover .lang-pill.current::after, .lang-menu:focus-within .lang-pill.current::after, .lang-menu.open .lang-pill.current::after {
  transform: rotate(180deg); }
/* BETA: electric blue, with a bolt and a flicker of light running across it */
.beta-badge { position: relative; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 4px; border-radius: 999px;
  font: 800 9.5px/1.4 ui-sans-serif, system-ui, sans-serif; letter-spacing: .12em; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, #0a3cff 0%, #1e90ff 45%, #00e5ff 100%);
  box-shadow: 0 0 6px rgba(0, 170, 255, .75), 0 0 14px rgba(30, 110, 255, .45), inset 0 0 4px rgba(255, 255, 255, .35);
  text-shadow: 0 0 4px rgba(190, 240, 255, .9); animation: beta-glow 2.4s ease-in-out infinite; }
.beta-badge svg { width: 8px; height: 11px; fill: #eaffff; filter: drop-shadow(0 0 2px #9ef3ff); animation: beta-bolt 2.4s steps(1) infinite; }
.beta-badge::after { content: ""; position: absolute; inset: 0; transform: translateX(-120%) skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: beta-sweep 2.4s ease-in-out infinite; }
@keyframes beta-glow { 0%, 100% { box-shadow: 0 0 6px rgba(0, 170, 255, .75), 0 0 14px rgba(30, 110, 255, .45), inset 0 0 4px rgba(255, 255, 255, .35); }
  50% { box-shadow: 0 0 9px rgba(0, 220, 255, .95), 0 0 22px rgba(30, 110, 255, .7), inset 0 0 5px rgba(255, 255, 255, .5); } }
@keyframes beta-bolt { 0%, 46%, 54%, 58%, 100% { opacity: 1; } 50%, 56% { opacity: .35; } }
@keyframes beta-sweep { 0%, 55% { transform: translateX(-120%) skewX(-20deg); } 80%, 100% { transform: translateX(160%) skewX(-20deg); } }
@media (prefers-reduced-motion: reduce) {
  .beta-badge, .beta-badge svg, .beta-badge::after { animation: none; }
  .lang-drop, .lang-pill.current::after { transition: none; } }
.brand { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", Palatino, Georgia, serif; font-size: 22px; font-weight: 700; text-decoration: none; letter-spacing: .04em; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.nav a:hover { color: var(--fg); }
.nav a.active { color: var(--fg); background: var(--surface-2); font-weight: 600; }
.review-btn { text-decoration: none; border: 1.5px solid var(--border-strong); border-radius: 18px; padding: 4px 12px; font-weight: 600; white-space: nowrap; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 12px; text-align: center; }

main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
main.full { max-width: none; padding: 0; }
#view > .page { display: contents; }  /* the current page's box (app.js render) */

/* ---------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--border-strong); background: transparent; border-radius: 8px;
  padding: 7px 14px; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { opacity: .88; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: var(--border); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=search], input[type=number], select, textarea {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--border-strong); }
.chip { display: inline-block; border: 1px solid var(--border); border-radius: 14px; padding: 2px 10px; font-size: 13px; cursor: pointer; user-select: none; }
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tag { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.state-new { } .state-learning, .state-relearning { border-color: var(--fg); } .state-review { background: var(--surface-2); } .state-known { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.grid { display: grid; gap: 16px; }
.bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--fg); }
.stat { font-size: 26px; font-weight: 700; font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-fg); padding: 9px 16px;
  border-radius: 8px; z-index: 100; box-shadow: var(--shadow); font-weight: 600; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; }

/* ---------- home */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.stats-row .card { padding: 12px 14px; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.recent-card { cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.recent-card:hover { border-color: var(--border-strong); }
.page-preview { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; background: var(--surface-2); font-size: 13.5px; line-height: 1.45;
  max-height: 150px; overflow: hidden; position: relative; }
.page-preview.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.page-preview .eng { color: var(--muted); }
.page-preview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: linear-gradient(transparent, var(--surface-2)); }
.side-col { border-left: 1px solid var(--border); padding-left: 22px; }
.hl-item { padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.hl-item:hover .hl-text { text-decoration: underline; text-decoration-color: var(--faint); }
.hl-text { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; }
.hl-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; border: 1px solid var(--border); }

/* ---------- library */
.lib-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0 18px; }
.lib-tools input { flex: 1; min-width: 220px; }
.work-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.work { display: flex; flex-direction: column; gap: 6px; }
.work .title { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 18px; font-weight: 600; }
.work .meta { font-size: 13px; color: var(--muted); }
.work .desc { font-size: 13.5px; }
.coll { margin: 8px 0 16px; }
.coll > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.coll-books { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 10px; }
.coll-books .chip { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 14px; }

/* ---------- reader */
/* In the reader only the two text panes scroll: the page, the menu bar and the reader bar stay fixed. */
html.reading, html.reading body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.reader { display: flex; flex-direction: column; height: calc(100dvh - 52px); overflow: hidden; }
.rbar { flex: none; }
.rbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rbar .rtitle { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-weight: 600; font-size: 17px; margin-right: auto; min-width: 0; }
.rbar .rtitle .muted { font-weight: 400; font-size: 14px; }
.rbar select { max-width: 320px; }
.panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.panes.latin-only { grid-template-columns: 1fr; }
.pane { overflow-y: auto; overscroll-behavior: contain; padding: 22px 32px 40vh; scroll-behavior: auto; }
.pane.lat-pane { border-right: 1px solid var(--border); }
.panes.latin-only .pane.eng-pane { display: none; }
.panes.latin-only .pane.lat-pane { border-right: none; max-width: 820px; margin: 0 auto; width: 100%; }
.pane-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.sec-title { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 22px; margin: 0 0 18px; }
.seg { margin: 0 0 1.05em; position: relative; }
.seg .ref { font-size: 11px; color: var(--faint); font-family: -apple-system, Helvetica, sans-serif; margin-bottom: 1px; user-select: none; }
.seg .txt { line-height: 1.62; }
.seg.verse .txt { white-space: pre-line; }
.seg-head { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 16px; font-weight: 600; margin: 1.4em 0 .5em; }
.seg.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0% { background: var(--hl-yellow); color: var(--hl-fg); } 100% { background: transparent; } }
.w { cursor: pointer; border-radius: 3px; }
.w:hover { background: var(--surface-2); outline: 1px solid var(--border); }
/* a touch screen (the iPad): no grey flash on a tapped word, no zoom on a double tap, and no hover look left on a word
   after its tap (the open popup says which word it is) */
@media (hover: none) {
  html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
  .w, .gt, mark.hl, .btn, button, a { -webkit-tap-highlight-color: transparent; }
  .w:hover { background: none; outline: none; }
}
.w.known-word { }
.show-status .w.st-new { text-decoration: underline dotted var(--faint); text-underline-offset: 4px; }
.inline-eng { display: none; margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--border); color: var(--muted); font-size: .9em; }
.seg.show-eng .inline-eng { display: block; }
.eng-toggle { position: absolute; right: -26px; top: 18px; font-size: 10px; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; cursor: pointer;
  color: var(--faint); background: var(--bg); display: none; }
.panes.latin-only .eng-toggle { display: block; }
.nextsec { margin: 30px 0; display: flex; gap: 10px; justify-content: space-between; }
/* decorated initial at the start of each chapter (woodcut style) */
.dropcap { float: left; position: relative; width: 4.6em; height: 4.6em; margin: .28em .55em .1em 0; color: var(--fg);
  display: flex; align-items: center; justify-content: center; line-height: 1; }
.seg.verse .dropcap { width: 3.5em; height: 3.5em; margin: .22em .5em .2em 0; }
.seg.verse .dc-letter { font-size: 2.2em; }
.dc-orn { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dc-orn .frame-outer { fill: var(--bg); stroke: currentColor; stroke-width: 1.6; }
.dc-orn .field { fill: currentColor; }
.dc-orn .frame-inner { fill: none; stroke: var(--bg); stroke-width: .7; }
.dc-orn .dots { fill: var(--bg); opacity: .55; }
.dc-orn .vine { fill: none; stroke: var(--bg); stroke-width: 1.25; stroke-linecap: round; }
.dc-orn .vine.thin { stroke-width: .85; }
.dc-orn .lf { fill: currentColor; stroke: var(--bg); stroke-width: .7; }
.dc-orn .vein { stroke: var(--bg); stroke-width: .35; }
.dc-orn .berry { fill: var(--bg); }
.dc-orn .corner { fill: var(--bg); stroke: currentColor; stroke-width: .7; }
.dc-letter { position: relative; font-family: "Cinzel Decorative", "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", Palatino, serif; font-weight: 900;
  font-size: 2.85em; line-height: 1; text-transform: uppercase; color: var(--bg); margin-top: .08em;
  text-shadow: 0 0 .03em var(--fg), 0 0 .06em var(--fg), 0 0 .09em var(--fg), 0 0 .12em var(--fg), 0 0 .16em var(--fg); }
.eng .dropcap { font-size: 1.08em; }
mark.hl { color: var(--hl-fg); border-radius: 2px; padding: 0 1px; cursor: pointer; }
mark.hl-yellow { background: var(--hl-yellow); } mark.hl-green { background: var(--hl-green); }
mark.hl-blue { background: var(--hl-blue); } mark.hl-pink { background: var(--hl-pink); }
mark.hl.has-note { border-bottom: 2px solid var(--hl-fg); }
mark.hl.flash { outline: 3px solid var(--border-strong); }
.seltool { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 6px;
  box-shadow: var(--shadow); display: flex; gap: 6px; align-items: center; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); cursor: pointer; }
.swatch.yellow { background: #fff1a8; } .swatch.green { background: #cdeccf; } .swatch.blue { background: #cfe3fb; } .swatch.pink { background: #f8d3e1; }
.swatch.on { border-color: var(--border-strong); border-width: 2.5px; }
.note-pop { position: absolute; z-index: 60; width: 320px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px;
  box-shadow: var(--shadow); }
.note-pop textarea { width: 100%; min-height: 90px; resize: vertical; margin: 8px 0; }

/* ---------- word popup */
.popup { position: fixed; z-index: 80; width: 360px; max-width: calc(100vw - 20px); background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 14px; }
.popup .pform { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.popup .entry { padding: 8px 0; border-top: 1px solid var(--border); }
.popup .entry:first-of-type { border-top: none; }
.popup .dform { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-weight: 600; font-size: 15.5px; }
.popup .gloss { margin: 2px 0 4px; }
.popup .parse { font-size: 12.5px; color: var(--muted); font-style: italic; }
.popup .here { margin: 5px 0 3px; padding: 4px 8px; border-left: 3px solid var(--fg); background: var(--hover, rgba(127,127,127,.08)); font-size: 14px; font-weight: 600; }
.popup .here .here-label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.popup .actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.popup .more { font-size: 12px; color: var(--muted); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 50px 16px; overflow-y: auto; }
.modal { background: var(--bg); color: var(--fg); border: 1px solid var(--border-strong); border-radius: 14px; padding: 22px 24px; width: 820px; max-width: 100%; box-shadow: var(--shadow); }
.modal .close { float: right; cursor: pointer; font-size: 20px; border: none; background: none; }

table.para { border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; }
table.para th, table.para td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
table.para th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; }
table.para td { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; }
.para-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.para-block h4 { margin: 6px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- grammar-term glossary */
.gt { text-decoration: underline dotted var(--faint); text-underline-offset: 3px; cursor: help; }
.gt:hover { text-decoration-color: var(--fg); }
.termpop { position: fixed; z-index: 95; width: 380px; max-width: calc(100vw - 20px); background: var(--surface); color: var(--fg);
.termpop .tp-lesson { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.gt[data-lesson] { cursor: pointer; }
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); font-size: 15px; line-height: 1.5;
  font-style: normal; text-align: left; font-weight: 400; text-transform: none; letter-spacing: normal; }
.termpop .tp-title { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.termpop .tp-ex { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); display: grid; gap: 3px; }
.termpop .tp-la { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-style: italic; font-size: 16px; }
.termpop .tp-en { color: var(--muted); }
/* a grammar lesson opened from a term while reading: a panel at the side, the text left where it was */
.lesson-panel { position: fixed; z-index: 70; top: 52px; right: 0; bottom: 0; width: min(480px, 100vw); overflow-y: auto;
  background: var(--surface); color: var(--fg); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
  padding: 0 22px 28px; animation: lp-in .18s ease-out; }
@keyframes lp-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.lesson-panel .lp-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); padding: 12px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.lesson-panel .lp-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lesson-panel .lp-close { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.lesson-panel .lp-close:hover { color: var(--fg); }
.lesson-panel .lp-title { margin: 12px 0 6px; }
.lesson-panel .lesson { font-size: 16px; }
.lesson-panel .lp-open { margin-top: 14px; }

/* ---------- review */
.review { max-width: 760px; margin: 0 auto; }
.card-front { font-size: 34px; font-weight: 600; text-align: center; margin: 16px 0 4px; }
.card-sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.answer-box { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.grades .btn { justify-content: center; flex-direction: column; gap: 0;  touch-action: manipulation; min-height: 52px; }
.grades .btn small { font-weight: 400; color: inherit; opacity: .7; font-size: 11px; }
.form-drill { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 8px 12px; align-items: center; margin: 12px 0; }
.form-drill .drill-head { grid-column: 1 / -1; font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-weight: 700; font-size: 16px; margin: 10px 0 0; padding-bottom: 3px; border-bottom: 1px solid var(--border); }
.form-drill label { font-size: 14px; color: var(--muted); text-align: right; }
.form-drill input.ok { border-color: var(--good); } .form-drill input.bad { border-color: var(--bad); }
.form-drill .fix { grid-column: 2; font-size: 13px; margin-top: -4px; font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; }
.progress-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
/* a review's header: the switch in the middle, above the word, whatever the texts beside it */
.progress-line:has(.mode-switch) { display: grid; grid-template-columns: 1fr auto 1fr; }
.progress-line:has(.mode-switch) > :last-child { justify-self: end; text-align: right; }
.mode-switch { display: inline-flex; border: 1.5px solid var(--border-strong); border-radius: 999px; padding: 2px; gap: 2px; }
.mode-switch .mode-opt { border: none; background: transparent; color: var(--fg); border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; }
.mode-switch .mode-opt:hover { background: var(--surface-2); }
.mode-switch .mode-opt.on { background: var(--accent); color: var(--accent-fg); }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* ---------- one word's practice (from the word popup, over the page) */
.modal.practice-modal { width: 520px; margin-top: 8vh; }
.practice .pr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-right: 28px; }
.practice .pr-lemma { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 20px; font-weight: 600; }
.practice .pr-gloss { color: var(--muted); margin-top: 2px; }
.practice .pr-modes { margin: 14px 0 6px; }
.practice .pr-prompt { text-align: center; margin: 18px 0 14px; }
.practice .pr-form { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 34px; font-weight: 600; }
.practice .pr-label { font-size: 20px; font-weight: 600; }
.practice .pr-field { position: relative; }
.practice .pr-input { width: 100%; box-sizing: border-box; font-size: 17px; padding: 9px 12px; }
.practice .pr-input.ok { border-color: var(--good); } .practice .pr-input.bad { border-color: var(--bad); }
.practice .pr-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 2; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow); }
.practice .pr-opt { padding: 6px 12px; cursor: pointer; font-size: 14.5px; }
.practice .pr-opt.hi { background: var(--surface-2); }
.practice .pr-feedback { min-height: 3.2em; margin-top: 12px; padding-left: 10px; border-left: 3px solid transparent; }
.practice .pr-feedback.ok { border-left-color: var(--good); } .practice .pr-feedback.bad { border-left-color: var(--bad); }
.practice .pr-word { font-weight: 600; }
.practice .pr-help { margin: 10px 0 0; }

/* ---------- grammar */
.levels { display: grid; gap: 20px; }
.concepts { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.concept { cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.concept:hover { border-color: var(--border-strong); }
.concept.next { border: 2px solid var(--border-strong); }
.concept .ct { font-weight: 600; }
.mastered { font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.lesson { font-size: 17px; line-height: 1.6; max-width: 820px; }
.lesson ul { padding-left: 22px; }
.practice { margin-top: 14px; }
/* the three rungs of a concept: forms -> simple sentences -> real sentences */
.rungs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.rung { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--fg); cursor: pointer; font: inherit; }
.rung:hover { border-color: var(--border-strong); }
.rung.on { border: 2px solid var(--fg); }
.rung .rung-n { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.rung.done .rung-n { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.rung .rung-t { font-weight: 600; font-size: 14.5px; }
.rung .rung-s { font-size: 12px; color: var(--muted); }
.level-note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--border-strong); padding: 2px 10px; margin: 0 0 8px; }
.mastered-note { margin-top: 8px; font-weight: 600; }
.form-prompt { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 2px; }
.form-word { font-size: 21px; }
.form-word .muted { font-size: 15px; }
.form-what { font-size: 15px; font-weight: 600; }
.form-prompt .sentence { margin: 8px 0 4px; }
.rung-dots { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.rung-dots .dot { width: 7px; height: 7px; border-radius: 50%; border: 1.3px solid var(--border-strong); }
.rung-dots .dot.on { background: var(--fg); border-color: var(--fg); }
.sentence { font-size: 21px; line-height: 1.9; margin: 16px 0; }
.sentence input.blank { font-family: inherit; font-size: 19px; padding: 1px 8px; border-radius: 6px; text-align: center; min-width: 90px; }
.sentence .answer-ok { border-bottom: 3px solid var(--good); font-weight: 700; }
.sentence .answer-bad { border-bottom: 3px solid var(--bad); font-weight: 700; }
.feedback { border-radius: 10px; padding: 12px 14px; border: 1.5px solid var(--border); margin-top: 10px; }
.feedback.ok { border-color: var(--good); } .feedback.bad { border-color: var(--bad); }
.hintline { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; }
/* word classes (practice sentences and reader): pale tints, dark text, readable in every theme */
.pos-on .pos-noun, .pos-legend .pos-noun { background: #cfe3fb; color: #111; }
.pos-on .pos-verb, .pos-legend .pos-verb { background: #f8d3e1; color: #111; }
.pos-on .pos-adj, .pos-legend .pos-adj { background: #cdeccf; color: #111; }
.pos-on .pos-pron, .pos-legend .pos-pron { background: #e4d9f6; color: #111; }
.pos-on .pos-adv, .pos-legend .pos-adv { background: #fde0c2; color: #111; }
.pos-on .pos-prep, .pos-legend .pos-prep { background: #e3e3e3; color: #111; }
.pos-on .pos-conj, .pos-legend .pos-conj { background: #fff1a8; color: #111; }
.pos-on .pos-num, .pos-legend .pos-num { background: #d3f1f1; color: #111; }
.pos-on .pos-part, .pos-legend .pos-part { background: #f1e6d6; color: #111; }
.pos-on .pos-art, .pos-legend .pos-art { background: #dfe8c6; color: #111; }
/* in dark mode, deep shades of the same colours under light text (the pale ones glare on a dark page) */
[data-dark] .pos-on .pos-noun, [data-dark] .pos-legend .pos-noun { background: #284262; color: var(--fg); }
[data-dark] .pos-on .pos-verb, [data-dark] .pos-legend .pos-verb { background: #5e2c3f; color: var(--fg); }
[data-dark] .pos-on .pos-adj, [data-dark] .pos-legend .pos-adj { background: #305a33; color: var(--fg); }
[data-dark] .pos-on .pos-pron, [data-dark] .pos-legend .pos-pron { background: #40305a; color: var(--fg); }
[data-dark] .pos-on .pos-adv, [data-dark] .pos-legend .pos-adv { background: #624528; color: var(--fg); }
[data-dark] .pos-on .pos-prep, [data-dark] .pos-legend .pos-prep { background: #454545; color: var(--fg); }
[data-dark] .pos-on .pos-conj, [data-dark] .pos-legend .pos-conj { background: #625828; color: var(--fg); }
[data-dark] .pos-on .pos-num, [data-dark] .pos-legend .pos-num { background: #305a5a; color: var(--fg); }
[data-dark] .pos-on .pos-part, [data-dark] .pos-legend .pos-part { background: #5a4930; color: var(--fg); }
[data-dark] .pos-on .pos-art, [data-dark] .pos-legend .pos-art { background: #4f5a30; color: var(--fg); }
.practice.pos-on .sentence .w { padding: 1px 3px; border-radius: 4px; }
.practice.pos-on .sentence .w.el { padding-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.practice.pos-on .sentence .w.el + .w { padding-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.lat-pane.pos-on .txt .w { border-radius: 3px; box-shadow: 0 0 0 1px var(--bg); }
.lat-pane.pos-on mark.hl .w { background: transparent; }  /* a highlight shows over the word colours */
.pos-legend { display: none; flex-wrap: wrap; gap: 6px; font-size: 12.5px; margin: -6px 0 12px; }
.practice.pos-on .pos-legend { display: flex; }
.reader-legend { display: flex; margin: 0; padding: 6px 16px; border-bottom: 1px solid var(--border); flex: none; }
.pos-legend .pos-chip { padding: 1px 7px; border-radius: 10px; }
.translation { border-left: 3px solid var(--border-strong); padding: 6px 12px; margin: 4px 0 12px; font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 16.5px; line-height: 1.5; }
.translation .tr-label { font-family: -apple-system, Helvetica, sans-serif; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.translation .tr-text { white-space: pre-line; }
.translation.none { border-left-color: var(--border); color: var(--muted); font-family: -apple-system, Helvetica, sans-serif; font-size: 13.5px; }

/* ---------- vocab lists */
.vocab-table td.lat { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-weight: 600; }
.sticky-actions { position: sticky; top: 52px; background: var(--bg); padding: 10px 0; z-index: 5; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; margin: 10px 0 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; }
  .side-col { border-left: none; padding-left: 0; }
  .form-drill { grid-template-columns: 1fr; }
.form-drill label { text-align: left; }
  .form-drill .fix { grid-column: 1; }
  .topbar { gap: 10px; padding: 0 12px; }
  /* an iPad upright: every tab still in the bar, without scrolling it */
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 14px; }
  .brand { font-size: 19px; }
  .review-btn { padding: 4px 9px; }
}
@media (max-width: 860px) {
  .topbar .brand { display: none; }
  .topbar { gap: 8px; }
  .nav a { padding: 6px 5px; }
  .topbar .signout-btn { margin-left: -2px; padding-left: 8px; padding-right: 8px; }
}

/* ---------- write: the checker */
.write { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .write { grid-template-columns: 1fr; } }
.editor-wrap { position: relative; }
.editor, .editor-backdrop { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 19px; line-height: 1.75;
  padding: 16px 18px; margin: 0; border: 1.5px solid var(--border); border-radius: 12px; width: 100%; min-height: 260px;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; letter-spacing: normal; }
.editor { position: relative; z-index: 1; background: transparent; color: var(--fg); resize: vertical; overflow: hidden; display: block; }
.editor:focus { outline: none; border-color: var(--border-strong); }
.editor-backdrop { position: absolute; inset: 0; color: transparent; background: var(--surface); overflow: hidden; pointer-events: none; }
.editor-backdrop mark { color: transparent; background: none; border-radius: 3px; text-decoration-line: underline;
  text-decoration-thickness: 2px; text-underline-offset: 4px; }
.editor-backdrop mark.err { text-decoration-style: wavy; text-decoration-color: var(--bad); }
.editor-backdrop mark.sty { text-decoration-style: dashed; text-decoration-color: var(--style); }
.editor-backdrop mark.focus.err { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.editor-backdrop mark.focus.sty { background: color-mix(in srgb, var(--style) 20%, transparent); }
.write-status { margin-top: 6px; min-height: 20px; }
.write-about { margin: -6px 0 14px; color: var(--muted); max-width: 900px; }
.write-about summary { cursor: pointer; color: var(--fg); }
.write-about ul { margin: 8px 0; padding-left: 20px; }
.write-about li { margin: 3px 0; }
.write-about p { margin: 6px 0 0; }
.write-legend { display: flex; gap: 12px; align-items: center; margin: -4px 0 12px; flex-wrap: wrap; }
.write-legend .lg { padding-bottom: 2px; text-decoration-line: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.write-legend .lg.err { text-decoration-style: wavy; text-decoration-color: var(--bad); }
.write-legend .lg.sty { text-decoration-style: dashed; text-decoration-color: var(--style); }
.issue-list { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.issue { border: 1.5px solid var(--border); border-left-width: 4px; border-radius: 10px; padding: 10px 12px; background: var(--surface); cursor: pointer; }
.issue.err { border-left-color: var(--bad); }
.issue.sty { border-left-color: var(--style); }
.issue.clean { border-left-color: var(--good); cursor: default; }
.issue.focus, .issue:hover { border-color: var(--border-strong); }
.issue-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.issue-kind { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.issue-word { font-size: 16px; font-weight: 600; }
.issue-title { font-weight: 600; margin-top: 2px; }
.issue-msg { font-size: 13.5px; margin: 3px 0 8px; }
.issue-actions .btn { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", Palatino, Georgia, serif; font-size: 15px; }

/* ---------- Greek */
input[lang=grc], textarea[lang=grc] { font-family: "Gentium Book Plus", "Ezra SIL", "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.08em; }
.translit-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 4px; }
.translit-key kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* Hebrew runs right to left: every element carrying its text is marked lang="hbo" */
[lang="hbo"] { direction: rtl; unicode-bidi: isolate; }
.lat[lang="hbo"], .sentence [lang="hbo"], .card-front[lang="hbo"] { line-height: 2; }
input[lang="hbo"] { direction: rtl; font-family: "Ezra SIL", serif; font-size: 20px; }
.seg-note { font-size: 13px; color: var(--muted); margin: 2px 0 4px; direction: ltr; text-align: left; }

/* Decorative home-page companions: float above notes without intercepting input. */
.home .home-mascot {
  position: fixed;
  left: var(--mascot-center, 50%);
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(var(--mascot-width, 280px), 32vw);
  height: auto;
  max-height: 180px;
  object-fit: contain;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 600px) {
  .home .home-mascot { width: min(var(--mascot-width, 280px), 38vw); max-height: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  .home .home-mascot { display: none; }
}

/* graded reading (library): a small card that opens down and out into a reader of its own */
.graded { margin: 14px 0 22px; }
.graded-card { max-width: 100%; margin: 0 auto; cursor: pointer; transition: max-width .5s cubic-bezier(.2,.7,.2,1), padding .4s, box-shadow .4s; }
.graded-card:hover { border-color: var(--border-strong); }
.graded.open .graded-card { max-width: 100%; cursor: default; padding: 18px 24px 16px; box-shadow: var(--shadow); }
.graded.open .graded-card:hover { border-color: var(--border); }
.graded-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.graded-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.graded-closed { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .4s ease, opacity .3s; }
.graded-closed > * { overflow: hidden; min-height: 0; }
.graded.open .graded-closed { grid-template-rows: 0fr; opacity: 0; }
.graded-preview { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 17px; line-height: 1.55; margin: 8px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: opacity .25s; }
.graded-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.2,.7,.2,1); }
.graded.open .graded-body { grid-template-rows: 1fr; }
.graded-body-inner { overflow: hidden; min-height: 0; }
.graded-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-top: 6px; }
.graded-legend { display: flex; margin: 8px 0 0; }
.graded-legend[hidden] { display: none; }
.graded-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; margin-top: 10px; transition: opacity .25s; --g-size: 19px; }
.graded-panes .graded-lat { border-right: 1px solid var(--border); padding-right: 30px; }
.graded-panes .txt.lat { font-size: var(--g-size); }
.graded-panes .txt.eng { font-size: calc(var(--g-size) * .92); }
.graded-panes.latin-only { grid-template-columns: minmax(0, 820px); justify-content: center; }
.graded-panes.latin-only .graded-eng { display: none; }
.graded-panes.latin-only .graded-lat { border-right: none; }
.graded-panes.latin-only .eng-toggle { display: block; right: -4px; }
.graded.loading .graded-panes, .graded.loading .graded-preview { opacity: .4; }
.graded-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.graded-share { color: var(--muted); max-width: 520px; }
.graded-next { margin-left: auto; }
.graded-slider-box { display: flex; align-items: center; gap: 10px; }
.graded-track { position: relative; width: 220px; display: flex; }
.graded-slider { width: 100%; accent-color: var(--fg); cursor: pointer; }
.graded-bubble { position: absolute; bottom: 26px; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: 12px;
  font-weight: 600; padding: 2px 7px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .7s ease .15s; white-space: nowrap; }
.graded-bubble.show { opacity: 1; transition: opacity .08s; }
/* a phone's width: one column, the English under each passage on a tap of "EN" (an iPad, even upright, keeps the two
   side by side) */
@media (max-width: 700px) {
  .panes { grid-template-columns: 1fr; }
  .pane.eng-pane { display: none; }
  .pane { padding: 16px 16px 40vh; }
  .eng-toggle { display: block; right: 0; top: -2px; }
}
@media (max-width: 700px) {
  .graded-panes { grid-template-columns: 1fr; }
  .graded-panes .graded-eng { display: none; }
  .graded-panes .graded-lat { border-right: none; padding-right: 22px; }
  .graded-panes .eng-toggle { display: block; right: 0; top: -2px; }
}
.graded-panes.bold-new .w.new-word { font-weight: 700; }

/* the word popup: choosing a word's reading for its passage */
.popup .entry.pickable { position: relative; cursor: pointer; border-radius: 6px; transition: background-color .35s ease; }
.popup .entry.pickable:hover { background: var(--surface-2); }
/* (above the hover grey: the pointer is on the tab, which is part of the card, while it flashes) */
.popup .entry.pickable.flash-good, .popup .entry.pickable.flash-good:hover { background: #cdeccf; color: #111; transition: background-color .12s; }
.popup .entry.pickable.flash-bad, .popup .entry.pickable.flash-bad:hover { background: #f8d3e1; color: #111; transition: background-color .12s; }
.popup .pick-wrap { position: absolute; top: 6px; left: calc(100% + 15px); width: 170px; overflow: hidden; pointer-events: none; }
.popup .pick-wrap.left { left: auto; right: calc(100% + 15px); }
.popup .pick-tab { display: block; width: 100%; text-align: left; font-size: 12.5px; line-height: 1.3; padding: 8px 10px; cursor: pointer;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); border-left: none; border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow); transform: translateX(-102%); transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.popup .pick-wrap.left .pick-tab { border-left: 1px solid var(--border-strong); border-right: none; border-radius: 8px 0 0 8px; transform: translateX(102%); }
.popup .pick-wrap.out { pointer-events: auto; }
.popup .pick-wrap.out .pick-tab { transform: translateX(0); }
.popup .pick-tab:hover { background: var(--surface-2); }
/* a touch screen (phone, iPad): no tab at the side (off the screen when the popup is a sheet as wide as it); the
   button slides open inside the card, under the reading, the width of the card */
.touch .popup .pick-wrap, .touch .popup .pick-wrap.left { position: static; width: auto; max-height: 0; margin-top: 0; overflow: hidden;
  transition: max-height .28s cubic-bezier(.2,.7,.2,1), margin-top .28s; }
.touch .popup .pick-wrap.out { max-height: 80px; margin-top: 10px; }
.touch .popup .pick-tab, .touch .popup .pick-wrap.left .pick-tab { transform: none; text-align: center; font-size: 15px; font-weight: 600;
  padding: 11px 12px; border: 0; border-radius: 10px; box-shadow: none; background: var(--accent); color: var(--accent-fg); }
.touch .popup .pick-tab:hover { background: var(--accent); }
.touch .popup .entry.pickable:hover { background: none; }
.popup .alt-toggle { margin-top: 2px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; color: var(--muted);
  cursor: pointer; text-align: center; }
.popup .alt-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
.popup .alt-readings { margin-top: 4px; }

/* library: sorting and narrowing the list (the icon beside the search, and its panel) */
.lf-anchor { position: relative; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 38px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--fg); cursor: pointer; position: relative; }
.icon-btn:hover, .icon-btn.on { border-color: var(--border-strong); }
.lf-badge { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent);
  color: var(--accent-fg); font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; }
.lf-badge[hidden] { display: none; }
.lf-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(620px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px 12px; }
.lf-panel[hidden] { display: none; }
.lf-section { margin-bottom: 14px; }
.lf-title, .lf-label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.lf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lf-chips .chip { background: var(--surface); color: var(--fg); font: inherit; font-size: 13px; }
.lf-chips .chip.on { background: var(--accent); color: var(--accent-fg); }
.lf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 12px; }
.lf-select { position: relative; display: block; }
.lf-select select { -webkit-appearance: none; appearance: none; width: 100%; font: inherit; font-size: 14px; line-height: 1.4;
  padding: 7px 30px 7px 10px; cursor: pointer; }
.lf-select::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; pointer-events: none;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-75%) rotate(45deg); }
.lf-combo { position: relative; }
.lf-combo input { width: 100%; font: inherit; font-size: 14px; line-height: 1.4; padding: 7px 30px 7px 10px; }
.lf-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 2px 6px; cursor: pointer; }
.lf-clear[hidden] { display: none; }
.lf-clear:hover { color: var(--fg); }
.lf-options { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.lf-options[hidden] { display: none; }
.lf-option { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.lf-option.on, .lf-option:hover { background: var(--surface-2); }
.lf-n { color: var(--faint); font-size: 12.5px; }
.lf-none { padding: 6px 8px; color: var(--muted); font-size: 14px; }
.lf-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.lf-count { font-size: 13px; color: var(--muted); }
.lf-summary { margin: -10px 0 14px; }
.lf-summary:empty { display: none; }
@media (max-width: 600px) { .lf-grid { grid-template-columns: 1fr; } }

/* library: Scripture as a card for each Testament, opened out into its books */
.testaments { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; margin-bottom: 18px; }
.testament { cursor: pointer; padding: 22px 24px 18px; display: flex; flex-direction: column; gap: 4px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.testament:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.t-kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.t-title { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 30px; font-weight: 600; line-height: 1.15; }
.t-sub { color: var(--muted); margin-bottom: 6px; }
.t-meta { font-size: 13px; color: var(--muted); }
.testament .bar { margin: 8px 0 6px; }
.t-preview { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 14px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.testament-open { grid-column: 1 / -1; }
.t-open-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 2px 0 12px; }
.t-open-head .t-kicker { flex-basis: 100%; }
.t-open-head .t-title { font-size: 26px; }
.t-open-head .t-sub { margin: 0; }
.t-hint { font-size: 12.5px; color: var(--faint); }
.t-books > .card { animation: t-fan .34s cubic-bezier(.2,.7,.2,1) both; }
@keyframes t-fan { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
.testament-open.closing .t-books > .card { animation: t-fold .17s ease-in both; animation-delay: 0s !important; }
@keyframes t-fold { to { opacity: 0; transform: translateY(-8px) scale(.96); } }
.coll-head { font-weight: 600; margin: 4px 0 8px; }
.testament [lang], .t-open-head [lang] { text-align: left; }  /* (Hebrew right to left within its line, the card aligned as the rest) */
.testaments.t-columns { grid-template-columns: repeat(var(--t-cols, 2), minmax(0, 1fr)); align-items: start; }
.testament-open.t-col { grid-column: auto; }
.t-col .t-open-head { gap: 2px 12px; }
/* a Testament's books down its column: as many to a row as fit, in a compact card */
.t-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.t-stack > .card.work { padding: 12px 13px; font-size: 13.5px; }
.t-stack > .card.work .title { font-size: 16px; }
.t-stack > .card.work .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-stack > .card.work .meta { font-size: 12px; }
.t-stack > .card.work .btn { padding: 3px 8px; font-size: 12px; }
.testaments.t-columns { gap: 12px; }
.t-columns .testament { padding: 18px 18px 14px; min-width: 0; }
.t-columns .t-title { font-size: clamp(22px, 2.4vw, 30px); }
@media (max-width: 620px) { .testaments.t-columns { grid-template-columns: 1fr; } }
.t-shared { flex-basis: 100%; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.t-shared .t-hint { margin: 0; }
.t-shared:empty { display: none; }

/* ---------- the colourful themes: their palette's colours (variables above) on headings, buttons, cards and bars */
[data-colorful] ::selection { background: var(--sel); }
[data-colorful] .topbar { background: var(--topbar); border-bottom-color: var(--border); }
[data-colorful] body { background: var(--bg-image, var(--bg)) no-repeat, var(--bg); }  /* (the place themes: a wash down from the top) */
[data-colorful] .brand { color: var(--c1-deep); }
[data-colorful] .nav a.active { background: var(--c1-tint); color: var(--c1-deep); }
[data-colorful] .lang-pill { border-color: var(--line); background: var(--surface); }
[data-colorful] .review-btn { background: var(--c2-tint); border-color: color-mix(in srgb, var(--c2) 50%, var(--surface)); color: var(--c2-deep); }
[data-colorful] .review-btn .badge { background: var(--c2); color: var(--surface); }
[data-colorful] h1 { color: var(--c1-deep); }
[data-colorful] h2 { color: var(--c2-deep); }
[data-colorful] h3 { color: var(--h3); }
[data-colorful] .btn { border-color: var(--line); }
[data-colorful] .btn:hover { background: var(--surface-2); }
[data-colorful] .btn.primary { background: var(--c1); border-color: var(--c1); color: var(--accent-fg); }
[data-colorful] .btn.primary:hover { background: var(--c1-deep); border-color: var(--c1-deep); opacity: 1; }
[data-colorful] .btn.ghost { border-color: var(--border); }
[data-colorful] .chip { border-color: var(--line); }
[data-colorful] .chip:hover { background: var(--surface-2); }
[data-colorful] .chip.on { background: var(--c1); border-color: var(--c1); color: var(--accent-fg); }
[data-colorful] .work-list > .card.work, [data-colorful] .t-stack > .card.work { border-top: 3px solid color-mix(in srgb, var(--c1) 40%, var(--surface)); }
[data-colorful] .work-list > .card.work:nth-child(4n+2), [data-colorful] .t-stack > .card.work:nth-child(4n+2) { border-top-color: color-mix(in srgb, var(--c2) 45%, var(--surface)); }
[data-colorful] .work-list > .card.work:nth-child(4n+3), [data-colorful] .t-stack > .card.work:nth-child(4n+3) { border-top-color: color-mix(in srgb, var(--c3) 45%, var(--surface)); }
[data-colorful] .work-list > .card.work:nth-child(4n+4), [data-colorful] .t-stack > .card.work:nth-child(4n+4) { border-top-color: color-mix(in srgb, var(--c4) 45%, var(--surface)); }
[data-colorful] .bar { background: var(--surface-2); border-color: var(--border); }
[data-colorful] .bar > span { background: linear-gradient(90deg, var(--c1), var(--c4)); }
[data-colorful] .testament { background: var(--c4-tint); border-color: color-mix(in srgb, var(--c4) 25%, var(--surface)); }
[data-colorful] .testament:nth-child(2) { background: var(--c2-tint); border-color: color-mix(in srgb, var(--c2) 25%, var(--surface)); }
[data-colorful] .testament:nth-child(3) { background: var(--c3-tint); border-color: color-mix(in srgb, var(--c3) 25%, var(--surface)); }
[data-colorful] .t-title { color: var(--c1-deep); }
[data-colorful] .graded-card { background: linear-gradient(135deg, var(--surface), var(--c1-tint)); border-color: color-mix(in srgb, var(--c1) 22%, var(--surface)); }
[data-colorful] .graded-label { color: var(--c1); }
[data-colorful] .stats-row .card:nth-child(5n+1) { background: var(--c1-tint); }
[data-colorful] .stats-row .card:nth-child(5n+2) { background: var(--c4-tint); }
[data-colorful] .stats-row .card:nth-child(5n+3) { background: var(--c3-tint); }
[data-colorful] .stats-row .card:nth-child(5n+4) { background: var(--c2-tint); }
[data-colorful] .stats-row .card:nth-child(5n+5) { background: var(--surface-2); }
[data-colorful] .concept:hover { border-color: color-mix(in srgb, var(--c1) 35%, var(--surface)); }
[data-colorful] .concept.next { border-color: var(--c1); background: color-mix(in srgb, var(--c1) 5%, var(--surface)); }
[data-colorful] .lf-panel, [data-colorful] .popup { border-color: var(--line); }
[data-colorful] .icon-btn { border-color: var(--line); color: var(--c1-deep); }
[data-colorful] .empty { border-color: var(--line); }

/* Settings: the themes as small swatches */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-tile { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.theme-tile:hover { border-color: var(--muted); }
.theme-tile.on { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.theme-swatch { display: flex; align-items: center; gap: 5px; height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); }
.theme-swatch span { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.theme-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.theme-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 1.4em; }
.theme-modes { display: inline-flex; border: 1.5px solid var(--border); border-radius: 10px; padding: 3px; margin-bottom: 10px; gap: 3px; }
.theme-mode { border: none; background: none; font: inherit; font-size: 13.5px; padding: 4px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.theme-mode.on { background: var(--accent); color: var(--accent-fg); }

/* the top bar's dark-mode switch: a moon (or, in dark mode, a sun) */
.dark-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  border: 1.5px solid var(--border); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.dark-toggle:hover { color: var(--fg); border-color: var(--border-strong); }

/* background gradients off (Settings): the same colours, solid */
[data-flat] body, [data-flat][data-colorful] body { background: var(--bg); }
[data-flat] .graded-card { background: var(--surface); }
[data-flat][data-colorful] .graded-card { background: var(--c1-tint); }
[data-flat][data-colorful] .bar > span { background: var(--c1); }

/* Vocabulary placement uses the same cards, type and theme colours as study. */
.placement { max-width: 850px; margin-top: 20px; }
.placement h2 { margin-top: 0; }
.placement-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.placement-question { margin-top: 20px; padding: 28px; }
.placement .placement-word { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 2.6rem; margin: 18px 0 8px; outline: none; }
.placement-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.placement-options .btn { text-align: start; white-space: normal; line-height: 1.5; padding: 16px; height: 100%; }
.placement-skip { margin-top: 16px; }
.placement-bands { margin: 24px 0; }
.placement-band { display: grid; grid-template-columns: 110px 1fr 210px; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.placement-band .bar { margin: 0; }
.placement-missed { margin-top: 24px; }
.placement-missed summary { cursor: pointer; margin-bottom: 12px; }
@media (max-width: 600px) {
  .placement-options { grid-template-columns: 1fr; }
  .placement-question { padding: 18px; }
  .placement-band { grid-template-columns: 95px 1fr; gap: 8px; }
  .placement-band > :last-child { grid-column: 2; }
}
.placement-toggle { display: block; width: 100%; padding: 0; text-align: start; border: 0; background: transparent; color: var(--fg); cursor: pointer; font: inherit; }
.placement-toggle .graded-top { justify-content: space-between; }
.placement-toggle .graded-preview { font-size: 22px; font-weight: 600; }
.placement-content { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 22px; }
.placement-content[hidden] { display: none; }
.placement-shell .placement { max-width: none; margin-top: 0; }
.placement-shell .placement-question { padding: 12px 0; }
.placement-shell .graded-card { cursor: default; }

/* Vocabulary: the dictionary, a panel of its own above your word lists */
.dict-panel { margin: 18px 0 26px; padding: 16px 18px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.dict-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dict-top h2 { margin: 0; }
.dict-modes { display: inline-flex; border: 1.5px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface); }
.dict-mode { border: none; background: none; font: inherit; font-size: 13.5px; padding: 4px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.dict-mode.on { background: var(--accent); color: var(--accent-fg); }
.dict-search .dict-input { width: 100%; font-size: 16px; padding: 10px 12px; background: var(--surface); }
.dict-results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dict-results:empty { display: none; }
.dict-empty { color: var(--muted); padding: 10px 2px; }
.dict-entry { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dict-entry.open { border-color: var(--border-strong); }
.dict-row { display: grid; grid-template-columns: minmax(130px, auto) auto 1fr auto 14px; align-items: baseline; gap: 4px 14px; width: 100%;
  padding: 9px 12px; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.dict-row:hover { background: var(--surface-2); }
.dict-word { font-family: "Gentium Book Plus", "Ezra SIL", Palatino, Georgia, serif; font-size: 17px; font-weight: 600; }
.dict-class { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dict-gloss { font-size: 14px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dict-chev { color: var(--faint); transition: transform .2s; }
.dict-entry.open .dict-chev { transform: rotate(90deg); }
.dict-detail { padding: 4px 14px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.dict-detail[hidden] { display: none; }
.dict-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 4px 0 2px; }
.dict-senses ol { margin: 0; padding-left: 20px; }
.dict-senses li { margin: 2px 0; }
.dict-forms { overflow-x: auto; }
.words-head { margin-bottom: 4px; }
@media (max-width: 640px) {
  .dict-row { grid-template-columns: 1fr auto 14px; }
  .dict-class, .dict-state { display: none; }
  .dict-gloss { grid-column: 1 / -1; white-space: normal; }
}

/* Settings: your data */
.data-card p { margin-top: 0; }
.backup-list { max-height: 320px; overflow-y: auto; }
.backup-table td, .backup-table th { vertical-align: middle; }

/* accounts (Lectio served to several people): the sign-in card, a strong password's rules, the Account section */
.signed-out .topbar .nav, .signed-out .topbar .review-btn, .signed-out .topbar .lang-menu, .signed-out .topbar .dark-toggle { visibility: hidden; }
.auth-page { display: flex; justify-content: center; padding: 6vh 16px 40px; }
.auth-card { width: min(440px, 100%); padding: 28px 28px 20px; }
.auth-title { margin: 0 0 6px; font-family: "Gentium Book Plus", Palatino, Georgia, serif; font-size: 34px; }
.auth-lead { margin: 0 0 16px; }
.auth-form { display: grid; gap: 12px; }
.auth-field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-field input, .pw-change input { font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg); color: var(--fg); }
.auth-submit { justify-self: start; margin-top: 4px; }
.auth-error { color: var(--bad); font-size: 14px; }
.auth-swap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: var(--accent); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.pw-rules li::before { content: "○"; display: inline-block; width: 18px; color: var(--faint); }
.pw-rules li.ok { color: var(--good); }
.pw-rules li.ok::before { content: "✓"; color: var(--good); }
.pw-rules li.no::before { content: "✗"; color: var(--bad); }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pw-change { display: grid; gap: 10px; margin-top: 14px; max-width: 380px; }
.topbar .signout-btn { flex: none; white-space: nowrap; margin-left: -8px; }

/* ---------------------------------------------------------------- phones (up to 700 px wide)
   As phone apps are: the sections in a tab bar along the bottom (More: a sheet with the rest), a slim top bar, the
   word popup and a grammar term's box as sheets rising from the bottom, larger tap targets, and text fields at 16 px
   (smaller makes Safari zoom in on them). */
.tabbar, .sheet-bg { display: none; }
:root { --tabbar-h: 0px; }
@media (max-width: 700px) {
  :root { --tabbar-h: calc(56px + env(safe-area-inset-bottom)); }
  body { padding-bottom: var(--tabbar-h); }
  .topbar { height: 48px; gap: 10px; padding: 0 max(12px, env(safe-area-inset-left)); }
  .topbar .nav, .topbar .review-btn, .topbar .signout-btn { display: none; }
  .topbar .brand { display: block; flex: 1; font-size: 19px; }
  .reader { height: calc(100dvh - 48px - var(--tabbar-h)); }
  main { padding: 16px 16px 32px; }
  main.full { padding: 0; }
  h1 { font-size: 26px; }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--tabbar-h);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 0; background: none; font: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
    color: var(--muted); text-decoration: none; -webkit-tap-highlight-color: transparent; cursor: pointer; padding: 0; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .tab-more svg { fill: currentColor; stroke: none; }
  .tabbar .active { color: var(--accent); }
  [data-colorful] .tabbar .active { color: var(--c1); }
  .tab-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
  .signed-out .tabbar { display: none; }
  .signed-out body, body:has(.auth-page) { padding-bottom: 0; }

  .sheet-bg:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.32); animation: sheet-fade .15s; }
  .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 16px 16px 0 0;
    padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.18); animation: sheet-up .2s ease-out; }
  .sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); opacity: .35; margin: 4px auto 8px; }
  .sheet a, .sheet .sheet-out { display: block; width: 100%; text-align: left; padding: 14px 10px; font: inherit; font-size: 17px;
    color: var(--fg); text-decoration: none; border: 0; border-top: 1px solid var(--border); background: none; }
  .sheet a:first-of-type { border-top: 0; }
  .sheet .sheet-who { padding: 12px 10px 2px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 6px; }
  .sheet .sheet-out { color: var(--bad); border-top: 0; }

  /* the word popup and a term's box: sheets from the bottom, over the tab bar */
  .popup, .termpop { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important;
    max-width: none !important; max-height: 62vh; overflow-y: auto; border-radius: 16px 16px 0 0 !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important; animation: sheet-up .18s ease-out; }
  .lesson-panel { top: 48px; bottom: var(--tabbar-h); width: 100vw; border-left: 0; }

  /* touch-sized controls; 16 px text in fields */
  .btn { min-height: 38px; }
  .btn.small { min-height: 34px; padding-left: 12px; padding-right: 12px; }
  input, select, textarea { font-size: 16px !important; }
  .seltool { padding: 8px; }
  .seltool .swatch { width: 30px; height: 30px; }
}
.rctl { display: contents; }
.lat-pane.all-eng .inline-eng, .graded-lat.all-eng .inline-eng { display: block; }
.phone-only, .ropts.phone-hide { display: none; }
.ropts { display: contents; }
@media (max-width: 700px) {
  /* the reader: back, the title and "⋯" (the reading options, in a sheet) on one line, the sections under it; the
     word classes' key in one swiped line: the text gets the screen */
  .phone-only { display: inline-flex; }
  .rbar { flex-wrap: wrap; row-gap: 8px; }
  .rbar .rtitle { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rbar > .ropts, .graded-body-inner > .graded-tools { display: none; }
  .rctl { display: flex; gap: 6px; flex: 0 0 100%; }
  .rctl select { flex: 1; max-width: none; }
  .opts-btn { font-size: 20px; line-height: 1; padding: 0 12px; letter-spacing: .05em; }
  .graded-card { position: relative; }
  .graded-body-inner > .opts-btn { position: absolute; top: 10px; right: 10px; }
  .graded:not(.open) .graded-body-inner > .opts-btn { display: none; }
  .reader-legend, .graded-legend { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
  .reader-legend::-webkit-scrollbar, .graded-legend::-webkit-scrollbar { display: none; }
  .reader-legend > *, .graded-legend > * { flex: none; }
  .legend-note { display: none; }
  .all-eng .eng-toggle { display: none !important; }

  /* the options sheet: its buttons as a phone menu's rows, the text sizes side by side */
  .sheet-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 2px 10px 8px; }
  .opts-sheet .sheet > .ropts, .opts-sheet .sheet > .graded-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
  .opts-sheet .sheet > * > .btn { display: flex; align-items: center; justify-content: center; min-height: 46px; font-size: 16px;
    border: 1px solid var(--border); background: var(--bg); text-decoration: none; }
  .opts-sheet [title="Sources"]::after { content: " About the texts"; }
  .opts-sheet .sheet > * > .btn:not([title="Smaller text"]):not([title="Larger text"]) { grid-column: 1 / -1; }

  /* the language menu and the library's sort and filters: sheets from the bottom too */
  .lang-menu.open .lang-drop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; max-height: 70vh; overflow-y: auto;
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); gap: 8px; border-radius: 16px 16px 0 0; transform: none;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,.32); z-index: 95; background: var(--surface); }
  .lang-menu.open .lang-drop .lang-pill { font-size: 17px; padding: 12px 14px; }
  .topbar:has(.lang-menu.open) { z-index: 96; }  /* (the sheet is the bar's: over the tab bar while it is open) */
  .lang-menu:not(.open):hover .lang-drop { max-height: 0; opacity: 0; pointer-events: none; }
  .lf-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 78vh; overflow-y: auto;
    border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 0 0 100vmax rgba(0,0,0,.32);
    z-index: 95; animation: sheet-up .2s ease-out; }
}
}
/* a touch screen has no keyboard to press: no "space" / "Enter" hints on the buttons */
.touch .btn kbd { display: none; }
@media (max-width: 700px), (hover: none), (any-pointer: coarse) { .btn kbd { display: none; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
