/* Ma'amikim's look (owner's choice 2026-10-19: option A, navy and gold on light blue; a night switch comes next).
   Every color, size and font is a token here, defined once; the rest of the file only uses the tokens.
   The old names (--bg, --card, --accent...) stay as aliases because the admin page uses them. */

/* The classic Hebrew font for everything (owner: "everything classic"), kept with the site so it looks the
   same on every computer. Frank Ruhl Libre, SIL Open Font License (fonts/OFL-Frank-Ruhl-Libre.txt). */
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 400; font-display: swap; src: url(/fonts/frank-ruhl-libre-hebrew-400-normal.woff2) format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 500; font-display: swap; src: url(/fonts/frank-ruhl-libre-hebrew-500-normal.woff2) format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 700; font-display: swap; src: url(/fonts/frank-ruhl-libre-hebrew-700-normal.woff2) format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 400; font-display: swap; src: url(/fonts/frank-ruhl-libre-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 500; font-display: swap; src: url(/fonts/frank-ruhl-libre-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Frank Ruhl Libre"; font-weight: 700; font-display: swap; src: url(/fonts/frank-ruhl-libre-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* colors */
  --page: #E4EEF9;          /* light blue page (the owner likes it) */
  --surface: #FFFFFF;       /* source boxes and panels */
  --surface-soft: #F3F7FC;  /* boxes inside boxes, hover */
  --navy: #0C2340;          /* the logo's navy: names, outlines of quiet buttons */
  --bar: #0C2340;           /* the top bar and filled buttons (stays dark at night) */
  --navy-hover: #1A3358;
  --gold: #C9A24A;          /* the logo's gold: thin lines and accents */
  --gold-light: #E8C26A;    /* gold text on navy */
  --on-navy: #E4EEF9;       /* light text on navy */
  --on-navy-muted: #AFC2DA;
  --text: #1C1C1C;
  --muted: #5A6577;         /* small print */
  --line: #C8D8EC;          /* borders */
  --line-strong: #8FA9CC;   /* lines of the trail tree, focus */
  --link: #1E40AF;          /* links and quiet buttons (royal blue) */
  --ai-bg: #FFF4DC;         /* the AI badge stays soft amber */
  --ai-text: #7A4A00;
  --ok: #22622F;
  --danger: #9B3D35;
  --flash: #E8C26A;
  --tip-bg: #0C2340;        /* hover meanings */
  --tip-text: #F3F7FC;
  /* shape */
  --radius: 12px;
  --radius-sm: 8px;
  --pill: 999px;
  --shadow: 0 1px 3px rgba(12, 35, 64, .08);
  --shadow-up: 0 4px 14px rgba(12, 35, 64, .12);
  --ease: .15s ease;
  /* fonts: classic everywhere (owner) */
  --font-text: "Frank Ruhl Libre", "David", "Times New Roman", serif;
  --font-ui: var(--font-text);
  color-scheme: light;
  /* old names, used by the admin page */
  --bg: var(--page); --top: var(--navy); --card: var(--surface); --tint: var(--surface-soft); --accent: var(--navy);
}

/* Night mode (design step 3): the same parts, dark navy with gold. The switch is in the top bar (nav.js);
   the choice is remembered on the device. Printing always stays black on white. */
:root[data-theme="dark"] {
  --page: #0F1724;
  --surface: #17223A;
  --surface-soft: #1E2B47;
  --navy: #DCE6F5;          /* names and outlines turn light */
  --bar: #0A111F;
  --navy-hover: #1F2D4A;
  --gold: #D4AE55;
  --gold-light: #E8C26A;
  --on-navy: #DCE6F5;
  --on-navy-muted: #8FA3BF;
  --text: #E6E9EF;
  --muted: #9AA7BA;
  --line: #2A3A58;
  --line-strong: #4A6189;
  --link: #93B4F2;
  --ai-bg: #3A2E12;
  --ai-text: #F0C978;
  --ok: #7BD394;
  --danger: #F08A80;
  --tip-bg: #DCE6F5;
  --tip-text: #0A111F;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-up: 0 4px 14px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font-family: var(--font-ui); font-size: 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: var(--link); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }
main { max-width: 820px; margin: 0 auto; padding: 16px; }

/* ---------- the top bar ---------- */
.top { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--bar); color: var(--on-navy); }
.home-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.top .logo { width: 44px; height: 44px; flex: none; }
.brand { font-family: var(--font-text); font-size: 24px; font-weight: 700; color: var(--gold-light); }
.sub { color: var(--on-navy-muted); font-size: 14px; }
.lang-switch { margin-inline-start: auto; background: transparent; border: 1px solid var(--on-navy-muted); color: var(--on-navy);
  border-radius: var(--pill); padding: 4px 14px; cursor: pointer; font-size: 14px; transition: background var(--ease); }
.lang-switch:hover { background: var(--navy-hover); }
.sheet-counter { margin-inline-start: auto; background: transparent; color: var(--gold-light); border: 1px solid var(--gold-light);
  border-radius: var(--pill); font-size: 14px; padding: 4px 14px; cursor: pointer; transition: background var(--ease); }
.sheet-counter:hover { background: var(--navy-hover); }
.sheet-counter:not([hidden]) + .lang-switch { margin-inline-start: 0; }

/* ---------- buttons ---------- */
/* Main buttons: navy with gold text. Quiet buttons: white with a navy outline. All soft and rounded. */
.ask button { font-size: 16px; padding: 10px 22px; border-radius: var(--pill); border: none; background: var(--bar);
  color: var(--gold-light); cursor: pointer; transition: background var(--ease); }
.ask button:hover { background: var(--navy-hover); }
.more { display: block; margin: 10px auto 32px; font-size: 15px; padding: 9px 22px; border-radius: var(--pill);
  border: 1px solid var(--navy); background: var(--surface); color: var(--navy); cursor: pointer; transition: background var(--ease); }
.toggle { background: var(--surface); border: 1px solid var(--navy); color: var(--navy); cursor: pointer; font-size: 13px;
  padding: 3px 12px; border-radius: var(--pill); margin: 2px 0 6px; transition: background var(--ease), color var(--ease); }
.more:hover, .toggle:hover { background: var(--surface-soft); }
.toggle.on { background: var(--bar); color: var(--gold-light); }
.chip { font-size: 13px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--pill); padding: 3px 11px;
  color: var(--navy); cursor: pointer; transition: background var(--ease); }
.chip:hover, .chip[aria-expanded="true"] { background: var(--surface-soft); }

/* ---------- the question box ---------- */
.ask { display: flex; gap: 8px; }
.ask input { flex: 1; font-size: 17px; padding: 10px 16px; border: 1.5px solid var(--line); border-radius: var(--pill);
  background: var(--surface); color: var(--text); }
.ask input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(12, 35, 64, .12); }
.settings { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.settings select { font-size: 14px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); }
.status { color: var(--muted); min-height: 1.4em; }
.section-title { font-size: 16px; color: var(--navy); font-weight: 700; margin: 18px 0 8px; }

/* "Did you mean...?" */
.suggest { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 10px; }
.suggest:empty { display: none; }
.suggest-title { font-size: 14px; color: var(--muted); }

/* ---------- source boxes ---------- */
.results { list-style: none; padding: 0; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow); transition: box-shadow var(--ease), border-color var(--ease); }
.card.collapsed:hover { border-color: var(--line-strong); box-shadow: var(--shadow-up); }
.card-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.card .card-head { cursor: pointer; margin-bottom: 4px; }
.where { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.label { font-weight: 700; font-size: 17px; color: var(--navy); }
.group { font-size: 12px; color: var(--navy); background: var(--page); border-radius: var(--pill); padding: 1px 9px; }
.text { font-family: var(--font-text); font-size: 19px; line-height: 1.8; margin: 4px 0 8px; direction: rtl; text-align: right; }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.meta a { color: var(--link); }
.via { font-size: 12px; color: var(--ai-text); }
.results.nested .card { background: var(--surface-soft); box-shadow: none; margin-bottom: 8px; }
.card.flash, .sefer.flash { outline: 3px solid var(--flash); outline-offset: 2px; }

/* The compact list: a closed source shows only its line and the first words. */
.card-arrow { background: none; border: none; color: var(--gold); font-size: 16px; cursor: pointer; padding: 0 2px;
  line-height: 1; transition: transform var(--ease); }
.card:not(.collapsed) > .card-head .card-arrow { transform: rotate(90deg); }
html[dir="rtl"] .card.collapsed > .card-head .card-arrow { transform: scaleX(-1); }
.card.collapsed { padding-top: 9px; padding-bottom: 9px; margin-bottom: 8px; }
.card.collapsed > *:not(.card-head):not(.preview) { display: none; }
.card:not(.collapsed) > .preview { display: none; }
.preview { color: var(--muted); font-size: 15px; line-height: 1.5; cursor: pointer; font-family: var(--font-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badges are labels, not buttons: a small dot and colored text. */
.badge { font-size: 12px; white-space: nowrap; cursor: default; user-select: none; }
.badge::before { content: "●"; font-size: 9px; margin-inline-end: 4px; vertical-align: 1px; }
.badge-source { color: var(--gold); }
.badge-ai_unreviewed { color: var(--ai-text); background: var(--ai-bg); border-radius: 4px; padding: 0 6px; }
.badge-reviewed { color: var(--ok); }
.badge-human { color: var(--muted); }

/* The line before the less close sources */
.weak-divider { list-style: none; margin: 18px 0 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong);
  color: var(--muted); font-size: 14px; }

/* ---------- translations and the text setting ---------- */
.trans { border-inline-start: 3px solid var(--gold); padding: 2px 12px; margin: 4px 0 8px; }
.trans-head { margin-bottom: 2px; }
.trans-text { margin: 4px 0; line-height: 1.7; font-size: 16px; }
.trans-en .trans-text { text-align: left; }
.trans-credit { font-size: 11px; color: var(--muted); direction: ltr; text-align: left; }
.trans-he .trans-credit { direction: rtl; text-align: right; }
.missing { font-size: 13px; color: var(--muted); font-style: italic; margin: 2px 0 8px; }
.orig { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 4px 10px; margin: 4px 0; }
.chip-source .text, .orig .text { direction: rtl; text-align: right; }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 640px) { .side { grid-template-columns: 1fr; } }

/* ---------- the pesukim box ---------- */
.pesukim .section-title { border-bottom: 2px solid var(--gold); padding-bottom: 4px; display: inline-block; }

/* ---------- prepared threads and the maskana (hidden for now; kept working) ---------- */
.thread { border: 1px solid #F0D49A; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; background: #FFFCF4; }
.thread-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.thread-kind { font-size: 13px; color: var(--muted); }
.thread-title { font-size: 18px; margin: 6px 0 10px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { border-inline-start: 3px solid var(--line); padding: 4px 10px 8px; margin-bottom: 8px; }
.step-kushya { border-inline-start-color: #C0392B; }
.step-terutz { border-inline-start-color: #2E7D32; }
.step-machloket { border-inline-start-color: #6A4C93; }
.role { font-size: 12px; font-weight: 700; color: var(--muted); }
.step-text { margin: 2px 0 6px; line-height: 1.6; }
.chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.chip-source { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 6px 10px; margin-top: 4px; }
.chip-source .text { font-size: 17px; }
.chip-wrap { align-self: stretch; }
.chip-missing { color: var(--muted); border-style: dashed; text-decoration: none; }
.thread-note { font-size: 12px; color: var(--ai-text); margin: 6px 0 0; }
.maskana-wrap { margin: 6px 0 0; }
.maskana-btn { font-weight: 700; }
.maskana { border: 1px solid #F0D49A; background: var(--surface); border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 6px; }
.maskana-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.maskana-text { margin: 4px 0 6px; line-height: 1.6; }
.opinions { list-style: none; padding: 0; margin: 6px 0; }
.opinion { border-inline-start: 3px solid #6A4C93; padding: 2px 10px 6px; margin-bottom: 6px; }
.opinion-line { margin: 2px 0 4px; line-height: 1.6; }
.halacha { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 6px; }
.halacha-label { font-size: 12px; font-weight: 700; color: #6B4E16; }
.halacha-text { margin: 4px 0 6px; line-height: 1.6; font-size: 15px; }
.card-threads { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.card-threads .thread { margin-top: 4px; width: 100%; }

/* ---------- mefarshim, halacha trail, related sugyos ---------- */
.links { margin-top: 8px; }
.link-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.link-panel { margin-top: 6px; }
.link-panel:empty { display: none; }
.sefer { border-inline-start: 3px solid var(--gold); padding: 4px 0; padding-inline-start: 12px; margin: 8px 0; }
.sefer-name { font-weight: 700; font-size: 15px; color: var(--navy); margin-bottom: 4px; }
.not-loaded { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.8; }
.not-loaded a { color: var(--muted); }

/* ---------- "Your trail": the cleaner, bigger tree (owner 2026-10-19) ---------- */
/* At the top, on the side where the page starts (top right in Hebrew, top left in English). */
.trail { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow-up); }
.trail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.trail-head strong { flex: 1; color: var(--navy); }
.trail-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.trail-open { position: fixed; bottom: 16px; inset-inline-start: 16px; z-index: 10; background: var(--bar); color: var(--gold-light);
  border: none; border-radius: var(--pill); padding: 8px 16px; cursor: pointer; box-shadow: var(--shadow-up); }

.trail-list { list-style: none; margin: 0; padding: 0; }
.trail-tree { overflow-x: auto; padding-bottom: 6px; }
.trail-tree ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 18px 0 0; border: none; position: relative; }
.trail-tree .trail-list.root { padding-top: 0; }
.trail-tree li.trail-node { position: relative; padding: 18px 4px 0; margin: 0; display: flex; flex-direction: column;
  align-items: center; text-align: center; }
.trail-tree .trail-list.root > li.trail-node { padding-top: 0; }
/* the lines: across the top of each child, and down from the parent */
.trail-tree li.trail-node::before, .trail-tree li.trail-node::after {
  content: ""; position: absolute; top: 0; width: 50%; height: 18px; border-top: 2px solid var(--line-strong); }
.trail-tree li.trail-node::before { right: 50%; }
.trail-tree li.trail-node::after { left: 50%; border-left: 2px solid var(--line-strong); }
.trail-tree li.trail-node:only-child::before, .trail-tree li.trail-node:only-child::after { border-top: none; }
.trail-tree li.trail-node:first-child::before, .trail-tree li.trail-node:last-child::after { border-top: none; }
.trail-tree li.trail-node:last-child::before { border-right: 2px solid var(--line-strong); border-radius: 0 6px 0 0; }
.trail-tree li.trail-node:only-child::before { border-right: none; }
.trail-tree li.trail-node:first-child::after { border-radius: 6px 0 0 0; }
.trail-tree .trail-list.root > li.trail-node::before, .trail-tree .trail-list.root > li.trail-node::after { display: none; }
.trail-tree ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid var(--line-strong); }
.trail-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; max-width: 170px; padding: 6px 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer;
  transition: background var(--ease); }
.trail-btn:hover { background: var(--surface-soft); }
.trail-btn.root-btn { background: var(--surface-soft); }
.trail-btn.here { background: var(--bar); border-color: var(--bar); color: var(--gold-light); }
.trail-name { font-size: 15px; font-family: var(--font-text); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trail-kind { font-size: 11px; color: var(--muted); }
.trail-btn.here .trail-kind { color: var(--on-navy-muted); }
.trail-unopened { background: none; border: none; color: var(--link); font-size: 12px; cursor: pointer; margin-top: 4px; white-space: nowrap; }
.trail-unopened:hover { text-decoration: underline; }
.trail-unopened-list { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 220px; margin-top: 4px; }
.trail-unopened-list .chip { font-size: 12px; }

/* ---------- hover meanings (hover with a mouse; tap on a phone) ---------- */
.gloss { border-bottom: 1px dotted var(--line-strong); cursor: help; position: relative; outline: none; }
.gloss:hover::after, .gloss:focus::after {
  content: attr(data-tip); position: absolute; bottom: 125%; right: 0; z-index: 20; width: max-content; max-width: 260px;
  background: var(--tip-bg); color: var(--tip-text); font: 13px/1.5 var(--font-ui); padding: 6px 10px; border-radius: var(--radius-sm);
  white-space: pre-line; text-align: start; direction: rtl; unicode-bidi: plaintext; box-shadow: var(--shadow-up); }
html[dir="ltr"] .gloss:hover::after, html[dir="ltr"] .gloss:focus::after { right: auto; left: 0; }

/* ---------- report a problem, didn't help ---------- */
.report-btn { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline dotted; padding: 0; }
.report-form { display: block; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-top: 6px; width: 100%; font-size: 14px; color: var(--text); }
.report-title { font-weight: 700; margin-bottom: 4px; }
.report-reason { display: block; margin: 2px 0; cursor: pointer; }
.report-note { display: block; width: 100%; min-height: 48px; margin: 6px 0; font: inherit; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.report-form .toggle { margin-inline-end: 6px; }
.report-msg { font-size: 13px; color: var(--danger); margin-top: 4px; }
.report-msg.ok { color: var(--ok); }
.unhelpful { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 32px; }

/* ---------- source sheets: the add button on each source ---------- */
.sheet-btn { background: var(--surface); border: 1px solid var(--navy); color: var(--navy); border-radius: var(--pill);
  font-size: 13px; padding: 2px 12px; cursor: pointer; transition: background var(--ease), color var(--ease); }
.sheet-btn:hover { background: var(--surface-soft); }
.sheet-btn.on { background: var(--bar); border-color: var(--bar); color: var(--gold-light); }

/* ---------- the quiet link to the owner's page at the bottom ---------- */
.foot { margin: 48px 0 24px; text-align: center; font-size: 13px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- the welcome page (body.home = no question asked yet) ---------- */
.welcome, .examples { display: none; }
body.home .welcome { display: block; text-align: center; padding: 6vh 0 18px; }
body.home .examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 6px; }
body.home .top .sub { visibility: hidden; }
body.home .ask { max-width: 620px; margin: 0 auto; }
body.home .ask input { padding: 14px 22px; font-size: 18px; border-color: var(--navy); }
body.home .ask button { padding: 12px 26px; }
body.home .settings { justify-content: center; text-align: center; margin-top: 18px; }
body.home #trail, body.home #trail-open { display: none !important; }
.welcome-logo { width: 104px; height: 104px; }
.welcome-name { font-family: var(--font-text); font-size: 44px; font-weight: 700; color: var(--navy); margin: 8px 0 4px; }
.welcome-line { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
.example { font-size: 14px; padding: 7px 15px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--surface);
  color: var(--navy); cursor: pointer; transition: background var(--ease), border-color var(--ease); }
.example:hover { background: var(--surface-soft); border-color: var(--navy); }

/* ---------- the source sheet page ---------- */
.sheet-back { color: var(--on-navy); font-size: 14px; text-decoration: none; margin-inline-start: 8px; }
.sheet-back:hover { text-decoration: underline; }
.sheet-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 4px; }
.sheet-picker select { font-size: 14px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); max-width: 260px; }
.sheet-pick-btn { background: var(--surface); border: 1px solid var(--navy); color: var(--navy); border-radius: var(--pill);
  font-size: 13px; padding: 5px 14px; cursor: pointer; transition: background var(--ease); }
.sheet-pick-btn:hover { background: var(--surface-soft); }
.sheet-pick-btn.danger { border-color: var(--danger); color: var(--danger); margin-inline-start: auto; }
.sheet-title { width: 100%; font-family: var(--font-text); font-size: 30px; font-weight: 700; color: var(--navy); background: transparent;
  border: none; border-bottom: 2px solid var(--gold); padding: 6px 2px; margin: 8px 0 10px; }
.sheet-title:focus, .sheet-notes:focus, .sheet-note:focus { outline: none; border-color: var(--navy); }
.sheet-notes, .sheet-note { width: 100%; font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); padding: 8px 10px; resize: vertical; }
.sheet-empty { color: var(--muted); font-size: 16px; text-align: center; margin: 40px 0; }
.sheet-items { list-style: none; padding: 0; margin: 16px 0 0; }
.sheet-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 14px; box-shadow: var(--shadow); }
.sheet-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sheet-num { font-family: var(--font-text); font-size: 18px; color: var(--gold); font-weight: 700; }
.sheet-item-head .label { font-family: var(--font-text); font-size: 18px; }
.sheet-tools { margin-inline-start: auto; display: flex; gap: 4px; }
.sheet-icon { background: var(--surface); border: 1px solid var(--line); color: var(--navy); border-radius: var(--radius-sm);
  width: 30px; height: 28px; cursor: pointer; font-size: 13px; transition: background var(--ease); }
.sheet-icon:hover:not(:disabled) { background: var(--surface-soft); }
.sheet-icon:disabled { opacity: .35; cursor: default; }
.sheet-text { font-family: var(--font-text); font-size: 19px; line-height: 1.8; white-space: pre-wrap; margin: 4px 0 8px; }
.sheet-tr.en { font-size: 17px; }
.sheet-tr-credit { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sheet-ai { color: var(--ai-text); background: var(--ai-bg); border-radius: 4px; padding: 0 6px; margin-inline-start: 8px; }
.sheet-note { margin-top: 6px; }
.sheet-saved { font-size: 12px; color: var(--muted); text-align: center; margin: 24px 0 40px; }
.sheet-print-btn { margin-inline-start: auto; background: var(--bar); color: var(--gold-light); border: none; border-radius: var(--pill);
  font-size: 14px; padding: 7px 16px; cursor: pointer; transition: background var(--ease); }
.sheet-print-btn:hover { background: var(--navy-hover); }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .text { font-size: 18px; }
  .ask button { padding: 10px 14px; }
  body.home .welcome { padding-top: 4vh; }
  .welcome-logo { width: 80px; height: 80px; }
  .welcome-name { font-size: 36px; }
  .welcome-line { font-size: 15px; }
  .sheet-title { font-size: 22px; }
  .side { grid-template-columns: 1fr; }
}

/* ---------- printing a source sheet / saving it as PDF ---------- */
/* Black on white, no buttons or boxes; each source stays on one page when it fits. */
.print-only { display: none; }
@media print {
  /* "מעמיקים · page N" at the bottom of every page (browsers without page margin boxes just skip it) */
  @page { margin: 16mm 14mm 18mm; @bottom-center { content: "מעמיקים · " counter(page); font-size: 9pt; color: #555; } }
  :root, :root[data-theme="dark"] { color-scheme: light; background: #fff; }   /* white paper, also from night mode */
  body, body.sheet-page { background: #fff; color: #000; }
  .top, .settings, .sheet-tools, .sheet-picker, .sheet-title, .sheet-notes, .sheet-note, .sheet-saved, .sheet-empty,
  .meta a { display: none !important; }
  main.sheet { max-width: none; padding: 0; margin: 0; }
  .print-only { display: block; }
  .print-only[hidden] { display: none !important; }
  .print-title { font-family: var(--font-text); font-size: 26px; font-weight: 500; text-align: center; margin: 0 0 6px;
    padding-bottom: 6px; border-bottom: 1.5px solid #000; }
  .print-date { text-align: center; font-size: 9pt; color: #555; margin: -2px 0 8px; }
  .print-note { font-size: 13px; white-space: pre-wrap; margin: 6px 0 10px; padding-inline-start: 8px; border-inline-start: 2px solid #999; }
  .sheet-items { margin-top: 12px; }
  .sheet-item { background: none; border: none; border-radius: 0; box-shadow: none; padding: 8px 0 10px; margin: 0;
    border-bottom: 0.5px solid #bbb; break-inside: avoid; page-break-inside: avoid; }
  .sheet-item-head { margin-bottom: 2px; }
  .sheet-item-head .label { color: #000; font-weight: 700; }
  .sheet-item-head .group { background: none; border: 1px solid #999; color: #444; }
  .sheet-num { color: #000; }
  .sheet-text { font-size: 15pt; line-height: 1.6; margin: 2px 0 4px; }
  .sheet-tr.en { font-size: 12pt; }
  .meta, .sheet-tr-credit { font-size: 8pt; color: #555; }
  .side { gap: 10mm; }
}

/* ---------- the top menu (design step 2) ---------- */
.top-gap { flex: 1; }
.top .lang-switch, .top .sheet-counter { margin-inline-start: 0; }
.trial { font-size: 11px; color: var(--on-navy-muted); border: 1px solid var(--navy-hover); border-radius: var(--pill); padding: 1px 8px; }
.menu { display: flex; gap: 4px; align-items: center; margin-inline-start: 12px; }
.menu-item { color: var(--on-navy); text-decoration: none; font-size: 16px; padding: 6px 14px; border-radius: var(--pill);
  transition: background var(--ease), color var(--ease); }
.menu-item:hover { background: var(--navy-hover); }
.menu-item[aria-current="page"] { color: var(--gold-light); box-shadow: inset 0 -2px 0 var(--gold-light); border-radius: 0; }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--on-navy-muted); color: var(--on-navy);
  border-radius: var(--radius-sm); font-size: 18px; line-height: 1; padding: 5px 10px; cursor: pointer; }
/* Phones: the menu folds into ☰ and opens as a panel under the bar. */
@media (max-width: 720px) {
  .top { position: relative; flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .top .logo { display: none; }   /* the name is enough on a phone; it keeps the bar on one line */
  .top { flex-wrap: nowrap; }
  .brand { font-size: 21px; }
  .trial { display: none; }
  .menu-toggle { display: block; }
  .menu { display: none; position: absolute; top: 100%; inset-inline: 0; z-index: 30; flex-direction: column; align-items: stretch;
    gap: 0; margin: 0; background: var(--bar); border-top: 1px solid var(--navy-hover); box-shadow: var(--shadow-up); }
  .menu.open { display: flex; }
  .menu-item { border-radius: 0; padding: 12px 18px; border-bottom: 1px solid var(--navy-hover); }
  .menu-item[aria-current="page"] { box-shadow: inset -3px 0 0 var(--gold-light); }
  html[dir="ltr"] .menu-item[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold-light); }
  .lang-switch { padding: 3px 10px; font-size: 13px; }
  .sheet-counter { padding: 3px 10px; font-size: 13px; }
}

/* ---------- the night switch (design step 3) ---------- */
.theme-switch { background: transparent; border: 1px solid var(--gold-light); color: var(--gold-light); border-radius: var(--pill);
  padding: 4px 12px; cursor: pointer; font-size: 14px; transition: background var(--ease); }
.theme-switch:hover { background: var(--navy-hover); }
@media (max-width: 720px) { .theme-switch .theme-word { display: none; } .theme-switch { padding: 3px 10px; } }
/* At night the filled buttons turn gold, so they still stand out on the dark page. */
:root[data-theme="dark"] :is(.ask button, .sheet-print-btn, .toggle.on, .sheet-btn.on, .trail-btn.here, .trail-open) {
  background: var(--gold-light); border-color: var(--gold-light); color: var(--bar); }
:root[data-theme="dark"] :is(.ask button, .sheet-print-btn):hover { background: #F2D58E; }
:root[data-theme="dark"] .trail-btn.here .trail-kind { color: #3A4A66; }
:root[data-theme="dark"] .ask input:focus { box-shadow: 0 0 0 3px rgba(232, 194, 106, .25); border-color: var(--gold-light); }

/* ---------- using the space (design step 4) ---------- */
/* Results: on a computer, the sources and a side column (pesukim, "Your trail"); the side column takes no
   room while it is empty. Narrower screens: one column, pesukim first, the trail floating at the bottom. */
.results-layout { display: flex; flex-direction: column; }
.results-side { display: contents; }
.results-side .pesukim { order: -1; }
.trail { position: fixed; bottom: 64px; inset-inline: 16px; max-height: 45vh; overflow: auto; z-index: 10; }
@media (min-width: 1100px) {
  /* the page is one centered column; only while the side column has something does it widen */
  main:has(.results-side > :not([hidden])) { max-width: 1180px; }
  main:has(.results-side > :not([hidden])) > :not(.results-layout) { max-width: calc(100% - 400px); }
  .results-layout:has(.results-side > :not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px;
    align-items: start; }
  .results-layout:has(.results-side > :not([hidden])) .results-side { display: flex; flex-direction: column; gap: 12px;
    position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
  .results-side .trail { position: static; max-height: none; box-shadow: var(--shadow); }
  .results-side .pesukim { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold);
    border-radius: var(--radius); padding: 6px 12px 4px; box-shadow: var(--shadow); }
  .results-side .pesukim .section-title { border: none; margin: 4px 0 8px; }
  .results-side .pesukim .card { box-shadow: none; background: var(--surface-soft); margin-bottom: 8px; }
}
/* The welcome page: example questions and my sheets, side by side under the search. */
.welcome-boxes { display: none; }
body.home .welcome-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0 6px; }
.welcome-box { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  border-radius: 0 0 var(--radius) var(--radius); padding: 10px 14px 12px; box-shadow: var(--shadow); }
.welcome-box:nth-child(2) { border-top-color: var(--navy); }
.welcome-box-title { font-size: 16px; font-weight: 700; color: var(--navy); margin: 0 0 8px; }
body.home .welcome-box .examples { justify-content: flex-start; margin: 0; }
.my-sheets { list-style: none; margin: 0; padding: 0; }
.my-sheets li { padding: 4px 0; border-bottom: 1px solid var(--surface-soft); }
.my-sheets li:last-child { border-bottom: none; }
.my-sheet { color: var(--link); text-decoration: none; }
.my-sheet:hover { text-decoration: underline; }
.my-sheets-empty { color: var(--muted); font-size: 14px; }
@media (max-width: 760px) { body.home .welcome-boxes { grid-template-columns: 1fr; } }

/* ---------- Daf Yomi (Phase 2) ---------- */
.daf-bar { text-align: center; margin: 18px 0 6px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--gold); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
.daf-kicker { color: var(--muted); font-size: 14px; }
.daf-title { font-family: var(--font-text); font-size: 34px; font-weight: 700; color: var(--navy); margin: 2px 0 10px; }
.daf-nav { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.daf-nav .toggle { margin: 0; font-size: 14px; padding: 4px 14px; }
.daf-date { font: inherit; font-size: 14px; padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); }
.daf-note { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.amud-heading { list-style: none; font-family: var(--font-text); font-size: 18px; font-weight: 700; color: var(--navy);
  margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--gold); display: inline-block; }
body.daf-mode .settings { margin-top: 10px; }
body.daf-mode #unhelpful, body.daf-mode #more { display: none !important; }

/* The welcome page's Daf Yomi box (part 3): today's daf, big, with a link that opens it. */
.welcome-daf { font-family: var(--font-text); font-size: 26px; font-weight: 700; color: var(--navy); margin: 2px 0 8px; }
.welcome-daf-open { display: inline-block; background: var(--bar); color: var(--gold-light); text-decoration: none;
  border-radius: var(--pill); padding: 5px 16px; font-size: 14px; transition: background var(--ease); }
.welcome-daf-open:hover { background: var(--navy-hover); }
:root[data-theme="dark"] .welcome-daf-open { background: var(--gold-light); color: var(--bar); }
.welcome-box.daf-box { text-align: center; }
/* Phones: previous and next together on the first row, the date and "today" under them. */
@media (max-width: 520px) {
  .daf-nav #daf-prev { order: 1; flex: 1 1 40%; }
  .daf-nav #daf-next { order: 2; flex: 1 1 40%; }
  .daf-nav .daf-date { order: 3; }
  .daf-nav #daf-today { order: 4; }
  .daf-title { font-size: 30px; }
}

/* ---------- search filters (owner, 2026-10-21) ---------- */
.filters { display: none; }
body:not(.home):not(.daf-mode) .filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 0;
  font-size: 14px; color: var(--muted); }
.filter-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip[aria-pressed="true"] { background: var(--bar); border-color: var(--bar); color: var(--gold-light); }
:root[data-theme="dark"] .filter-chip[aria-pressed="true"] { background: var(--gold-light); border-color: var(--gold-light); color: var(--bar); }
.filter-masechta { font: inherit; font-size: 14px; padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); }
.filter-clear { background: none; border: none; color: var(--link); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 0; }

/* ---------- "add the mefarshim too" on the sheet page (owner, 2026-10-21) ---------- */
.sheet-mef-btn { background: var(--surface); border: 1px solid var(--navy); color: var(--navy); border-radius: var(--pill);
  font-size: 13px; padding: 2px 12px; cursor: pointer; margin-inline-end: 6px; transition: background var(--ease); }
.sheet-mef-btn:hover { background: var(--surface-soft); }
.mef-picker { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 8px; }
.mef-title { font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.mef-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.mef-name { flex: 1; }
.mef-count { font-size: 12px; color: var(--muted); }
.mef-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.mef-msg { font-size: 13px; color: var(--muted); }
/* a mefaresh added under a source sits a little in, with a gold line, so the sheet shows what goes with what */
.sheet-item.under { margin-inline-start: 28px; border-inline-start: 3px solid var(--gold); }
@media print { .sheet-item.under { margin-inline-start: 8mm; border-inline-start: 1.5px solid #999; padding-inline-start: 3mm; }
  .mef-picker, .sheet-mef-btn { display: none !important; } }

/* ---------- headings between sources on the sheet (owner, 2026-10-21) ---------- */
.sheet-heading { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.sheet-heading-text { flex: 1; font-family: var(--font-text); font-size: 22px; font-weight: 700; color: var(--navy);
  background: transparent; border: none; border-bottom: 2px solid var(--gold); padding: 4px 2px; }
.sheet-heading-text:focus { outline: none; border-bottom-color: var(--navy); }
.sheet-add-heading { display: block; margin: 4px auto 0; background: none; border: 1px dashed var(--line-strong); color: var(--navy);
  border-radius: var(--pill); padding: 5px 16px; font-size: 14px; cursor: pointer; }
.sheet-add-heading:hover { background: var(--surface); }
@media print {
  .sheet-heading { display: block; margin: 14px 0 4px; break-after: avoid; page-break-after: avoid; }
  .sheet-heading-text, .sheet-add-heading { display: none !important; }
  .print-heading { font-family: var(--font-text); font-size: 17pt; font-weight: 700; margin: 0; padding-bottom: 2px;
    border-bottom: 1px solid #000; }
}

/* ---------- the top of a sheet (owner, 2026-10-21) ---------- */
.sheet-giver { width: 100%; font: inherit; font-size: 16px; color: var(--navy); background: transparent; border: none;
  border-bottom: 1px dashed var(--line); padding: 4px 2px; margin: -4px 0 10px; }
.sheet-giver:focus { outline: none; border-bottom-color: var(--navy); }
@media print {
  .sheet-giver { display: none !important; }
  .print-logo { display: block; width: 16mm; height: 16mm; margin: 0 auto 2mm; }
  .print-giver { text-align: center; font-size: 13pt; margin: 0 0 2px; }
  .print-title { border-bottom: none; padding-bottom: 0; margin-bottom: 2px; }
  .print-date { padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1.5px solid #000; }
}

/* ---------- print layouts of a sheet (owner, 2026-10-21) ---------- */
.sheet-page .settings select#sheet-layout { margin-inline-end: 4px; }
@media print {
  /* two columns: the sources flow down two columns like a printed source sheet; headings go across both */
  .layout-columns .sheet-items { column-count: 2; column-gap: 8mm; column-rule: 0.5px solid #bbb; }
  .layout-columns .sheet-heading { column-span: all; }
  .layout-columns .sheet-item { break-inside: avoid; }
  .layout-columns .sheet-text { font-size: 12.5pt; line-height: 1.5; }
  .layout-columns .side { grid-template-columns: 1fr; gap: 2mm; }
  /* compact: one column, smaller text, less space: more on each page */
  .layout-compact .sheet-item { padding: 4px 0 5px; }
  .layout-compact .sheet-text { font-size: 12pt; line-height: 1.4; margin: 1px 0 2px; }
  .layout-compact .sheet-tr.en { font-size: 10pt; }
  .layout-compact .sheet-item-head { margin-bottom: 0; }
  .layout-compact .sheet-heading { margin: 8px 0 2px; }
  .layout-compact .print-heading { font-size: 14pt; }
  .layout-compact .print-note { margin: 2px 0 4px; font-size: 11px; }
  .layout-compact .print-logo { width: 11mm; height: 11mm; }
  .layout-compact .print-title { font-size: 20px; }
}

/* ---------- drag to reorder on the sheet page (owner, 2026-10-21) ---------- */
.sheet-grip { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 2px; user-select: none;
  touch-action: none; border-radius: 6px; transition: color var(--ease), background var(--ease); }
.sheet-grip:hover { color: var(--navy); background: var(--surface-soft); }
.sheet-item.dragging, .sheet-heading.dragging { opacity: 0.85; box-shadow: 0 6px 18px rgba(12, 35, 64, 0.22);
  outline: 2px solid var(--gold); outline-offset: 2px; }
.sheet-item.dragging .sheet-grip, .sheet-heading.dragging .sheet-grip { cursor: grabbing; }
body:has(.dragging) { user-select: none; }
@media print { .sheet-grip { display: none !important; } }

/* ---------- "download as Word" on the sheet page (owner, 2026-10-21) ---------- */
.sheet-word-btn { background: var(--surface); color: var(--navy); border: 1px solid var(--navy); border-radius: var(--pill);
  font-size: 14px; padding: 6px 16px; cursor: pointer; transition: background var(--ease); }
.sheet-word-btn:hover { background: var(--surface-soft); }
.sheet-word-btn:disabled { opacity: 0.6; cursor: wait; }
@media print { .sheet-word-btn { display: none !important; } }

/* ---------- open any daf (owner, 2026-10-21) ---------- */
.daf-pick { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
.daf-pick label { color: var(--muted); }
.daf-pick select { font: inherit; font-size: 14px; padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); }
.daf-pick .toggle { margin: 0; font-size: 14px; padding: 4px 16px; }
.daf-nav[hidden] { display: none; }
.amud-heading { scroll-margin-top: 16px; }

/* ---------- the halacha path picture (owner, 2026-10-21) ---------- */
.hpath { margin: 8px 0 14px; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.hpath-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.hpath-steps > li { display: flex; align-items: center; gap: 6px; }
.hpath-arrow { display: flex; align-items: center; color: var(--gold); font-size: 18px; font-weight: 700; }
.hpath-step { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 92px;
  padding: 7px 10px; background: var(--surface); border: 1px solid var(--navy); border-radius: var(--radius-sm);
  color: var(--navy); font: inherit; cursor: pointer; transition: background var(--ease), color var(--ease); }
button.hpath-step:hover { background: var(--page); }
.hpath-step.here { cursor: default; background: var(--bar); color: var(--gold-light); border-color: var(--bar); }
.hpath-step.on { background: var(--bar); color: var(--gold-light); border-color: var(--bar); }
:root[data-theme="dark"] .hpath-step.here, :root[data-theme="dark"] .hpath-step.on { background: var(--gold-light); color: var(--bar); border-color: var(--gold-light); }
.hpath-name { font-family: var(--font-text); font-weight: 700; font-size: 16px; }
.hpath-place { font-size: 12px; opacity: 0.85; max-width: 170px; text-align: center; }
.hpath-open:not(:empty) { margin-top: 10px; }
.hpath-others { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.hpath-others .toggle { margin: 0; font-size: 13px; padding: 2px 10px; }
.hpath-all { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
@media (max-width: 520px) { .hpath-step { min-width: 0; padding: 6px 8px; } .hpath-name { font-size: 15px; } }

/* ---------- the credit line for Sefaria's links (CC BY 4.0) ---------- */
.credit-links { margin: 0 auto 8px; max-width: 640px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.credit-links a { color: var(--muted); text-decoration: underline; }
@media print { .no-print { display: none !important; } }

/* ---------- the sheet page's settings row on narrow screens (owner, 2026-10-23: the buttons were cut off) ---------- */
.sheet-page .settings { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 640px) {
  /* the two buttons get their own line, side by side, each half the width */
  .sheet-page .settings .sheet-print-btn, .sheet-page .settings .sheet-word-btn {
    flex: 1 1 40%; margin-inline-start: 0; text-align: center; padding: 8px 10px; }
  .sheet-page .settings .sheet-print-btn { order: 10; }
  .sheet-page .settings .sheet-word-btn { order: 11; }
}
