:root { --wood:#3b2616; --wood2:#2a1a0e; --brass:#c9a45c; --paper:#fbf9f4; --ink:#1d1a16; --leather:#5a2e1e; }
* { box-sizing: border-box; }
body { margin:0; display:flex; min-height:100vh; font:17px/1.7 "Iowan Old Style","Palatino Linotype",Georgia,serif; color:var(--ink);
  background:url("/assets/bg2.jpg"); }
#side { width:190px; flex:none; padding:24px 20px; background:rgba(20,10,4,.55); }
#side a { display:block; color:#f1e6d0; text-decoration:none; font-size:20px; margin:14px 0; }
#side a:hover, a:focus-visible { color:var(--brass); }
.logo { font-size:26px; line-height:1.1; color:var(--brass); margin-bottom:28px; }
#desk { flex:1; display:grid; grid-template-columns:minmax(0,760px) 340px; gap:0 24px; padding:24px; align-content:start; justify-content:center; }
.pick { grid-column:1/-1; display:flex; gap:10px; align-items:center; margin-bottom:16px; color:#f1e6d0; }
.pick select, .pick input { font:inherit; font-size:15px; padding:5px 8px; border-radius:4px; border:1px solid var(--brass); background:var(--paper); }
.pick input { width:70px; } .pick a { color:var(--brass); }
#page { background:var(--paper); padding:40px 56px; border-radius:3px 0 0 3px; box-shadow:0 10px 30px #0008; column-width:300px; column-gap:40px; text-align:justify; hyphens:auto; }
#page h1 { column-span:all; text-align:center; font-weight:400; letter-spacing:.08em; margin:0 0 20px; font-size:24px; }
.v { cursor:pointer; } .v:hover { background:#0000000a; }
sup { font:600 11px sans-serif; margin-right:3px; color:var(--leather); }

.mark { color:var(--leather); font-size:13px; margin-left:3px; }
.hl-yellow { background:#fbe98a; } .hl-green { background:#bfe8b0; } .hl-blue { background:#b9d9f5; } .hl-pink { background:#f5c1d4; }
#tabs { background:var(--paper); border-radius:0 3px 3px 0; box-shadow:0 10px 30px #0008; font-size:15px; }
.tabbar { display:flex; background:var(--leather); }
.tabbar button { flex:1; padding:10px 6px; border:0; background:none; color:#f1e6d0; font:inherit; cursor:pointer; }
.tabbar button.on { background:var(--paper); color:var(--ink); }
.panel { padding:16px 20px; max-height:75vh; overflow:auto; } .panel h4 { margin:12px 0 4px; color:var(--leather); }
#bar { position:absolute; display:flex; gap:6px; align-items:center; padding:6px 8px; background:var(--wood2); border:1px solid var(--brass); border-radius:6px; z-index:5; }
#bar button { font:14px Georgia,serif; cursor:pointer; background:var(--paper); border:0; border-radius:3px; padding:4px 8px; }
#bar .sw { width:22px; height:22px; padding:0; } .sw.yellow { background:#fbe98a; } .sw.green { background:#bfe8b0; } .sw.blue { background:#b9d9f5; } .sw.pink { background:#f5c1d4; }
.plain { background:var(--paper); margin:40px auto; padding:24px 40px; max-width:700px; }
button:focus-visible, select:focus-visible, input:focus-visible { outline:2px solid var(--brass); outline-offset:2px; }


/* sign-in, search, sidebar account */
body.solo { display:block; }
.plain h1 { font-weight:400; letter-spacing:.04em; margin-top:0; }
.auth { display:grid; gap:14px; max-width:360px; }
.auth label { display:grid; gap:4px; font-size:15px; }
.plain input, .plain select { font:inherit; padding:8px 10px; border:1px solid #b9a98a; border-radius:4px; background:#fff; }
.plain button { font:inherit; padding:9px 14px; border:0; border-radius:4px; background:var(--leather); color:#f6ecd8; cursor:pointer; }
.err { color:#8a1c1c; background:#f8e4e0; padding:8px 12px; border-radius:4px; }
.find { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.hits { list-style:none; padding:0; } .hits li { margin:0 0 16px; } .hits a { font-weight:600; color:var(--leather); }
mark { background:#fbe98a; color:inherit; }
.sq { margin:0 0 18px; } .sq input { width:100%; font:inherit; font-size:15px; padding:7px 10px; border-radius:4px; border:1px solid var(--brass); background:#f3e8d0; }
.who { display:block; color:#f1e6d0; font-size:14px; word-break:break-all; margin-top:14px; }
#side .out { background:none; border:0; padding:0; margin:0 0 6px; font:inherit; font-size:14px; color:var(--brass); cursor:pointer; text-decoration:underline; }

/* fixes found in first real render */
#bar[hidden] { display:none; }
#bar .sw.yellow { background:#fbe98a; } #bar .sw.green { background:#bfe8b0; } #bar .sw.blue { background:#b9d9f5; } #bar .sw.pink { background:#f5c1d4; }
.plain a { color:var(--leather); }

/* notes + study lists */
.notes, .words { list-style:none; padding:0; margin:0; }
.notes li { margin:0 0 16px; } .notes a { font-weight:600; color:var(--leather); }
.notes textarea { display:block; width:100%; margin:4px 0 6px; font:inherit; font-size:15px; padding:6px 8px; border:1px solid #b9a98a; border-radius:4px; background:#fff; }
.notes button { font:inherit; font-size:14px; padding:4px 10px; border:0; border-radius:4px; background:var(--leather); color:#f6ecd8; cursor:pointer; }
.notes button[data-do=del] { background:#8a1c1c; }
.words li { margin:0 0 12px; } .words small { color:#6b5b45; }
.words details { margin-top:4px; font-size:14px; color:#4b3f2f; } .words summary { cursor:pointer; color:var(--leather); }
.words small { line-height:1.4; }

/* study: verse filter + hover match */

::highlight(hov) { background:#c9a45c99; }
.words li { padding:4px 6px; border-radius:4px; }
.words li.hit { background:#f1dfae; }
.vhead { display:flex; justify-content:space-between; align-items:center; position:sticky; top:-16px; z-index:1; margin:-16px 0 8px; padding:14px 0 8px; background:var(--paper); border-bottom:1px solid #e4d8bf; font-weight:600; color:var(--leather); }
.vhead button { font:inherit; font-size:13px; padding:3px 8px; border:1px solid var(--leather); background:none; color:var(--leather); border-radius:4px; cursor:pointer; }
.vhint { margin:0 0 10px; font-size:14px; color:#6b5b45; }

/* keep the right-hand tabs in view while reading a long chapter */
#tabs { position:sticky; top:16px; align-self:start; }
.panel { max-height:calc(100vh - 110px); }


/* the hidden attribute must always win over component display rules */
[hidden] { display:none !important; }

/* quick search (/) and shortcut help (?) */
#spot, #help { position:fixed; inset:0; z-index:20; display:flex; justify-content:center; background:rgba(20,10,4,.55); backdrop-filter:blur(3px); }
#spot { align-items:flex-start; padding-top:22vh; }
#spot form { width:min(640px, 92vw); background:var(--paper); border:1px solid var(--brass); border-radius:14px; box-shadow:0 18px 50px #000a; padding:10px 12px 6px; }
#spot-q { width:100%; border:0; outline:0; background:transparent; font:22px/1.4 "Iowan Old Style","Palatino Linotype",Georgia,serif; color:var(--ink); padding:8px 6px; }
#spot-hint { margin:0; min-height:1.6em; padding:2px 6px 6px; font-size:14px; color:var(--leather); border-top:1px solid #e4d8bf; }
#spot-hint:empty { border-top-color:transparent; }
#help { align-items:center; }
#help > div { width:min(520px, 92vw); background:var(--paper); border-radius:12px; padding:20px 26px; box-shadow:0 18px 50px #000a; }
#help h2 { margin:0 0 12px; font-weight:400; letter-spacing:.04em; }
#help dl { display:grid; grid-template-columns:auto 1fr; gap:8px 18px; margin:0; align-items:baseline; }
#help dd { margin:0; } #help p { margin:14px 0 0; font-size:13px; color:#6b5b45; }
kbd { font:600 13px/1 "SF Mono",Menlo,Consolas,monospace; background:#fff; border:1px solid #b9a98a; border-bottom-width:2px; border-radius:5px; padding:3px 6px; color:var(--ink); }
.kbdhint { margin:26px 0 0; font-size:13px; color:#cdbb97; } .kbdhint kbd { background:#f3e8d0; }

/* book-name completion: grey ghost text behind the quick-search input */
.spot-field { position:relative; }
#spot-ghost, #spot-q { font:22px/1.4 "Iowan Old Style","Palatino Linotype",Georgia,serif; padding:8px 6px; letter-spacing:normal; }
#spot-ghost { position:absolute; inset:0; white-space:pre; overflow:hidden; pointer-events:none; }
#spot-ghost span:first-child { visibility:hidden; }
#spot-ghost span:last-child { color:#b3a58a; }
#spot-q { position:relative; z-index:1; background:transparent; }

/* ---- reading modes (body[data-mode], set from the open tab; see app.js) ---- */
:root { --sel-marker: rgba(244,176,80,.55); }
/* study: word by word. Underline the selected verse; tagged words are interactive. */
body[data-mode="study"] .v.sel { box-shadow:inset 0 -2px 0 var(--brass); }
body[data-mode="study"] .w { border-bottom:1px dotted var(--leather); cursor:help; }
body[data-mode="study"] .w:hover { background:#c9a45c55; }
/* reading: verse by verse. The selected verse looks like it was marked with a highlighter pen. */
body[data-mode="reading"] .v.sel {
  background-image:linear-gradient(transparent 8%, var(--sel-marker) 8% 92%, transparent 92%);
  background-blend-mode:multiply;                       /* over a saved highlight it reads as a second pass of the pen */
  border-radius:.3em;
  -webkit-box-decoration-break:clone; box-decoration-break:clone;
}

/* ---- toolbar: clearer, and shows what the verse already has ---- */
#bar { gap:8px; }
.bar-label { color:#f1e6d0; font:13px Georgia,serif; letter-spacing:.04em; }
.bar-sep { width:1px; align-self:stretch; background:#6b5230; }
#bar .sw { width:24px; height:24px; border:2px solid transparent; border-radius:50%; }
#bar .sw.on { border-color:#fff; box-shadow:0 0 0 1px var(--leather); }

/* ---- tab badges: how much the selected verse has in each tab ---- */
.tabbar button { white-space:nowrap; }
.tabbar button[data-count]::after { content:attr(data-count); display:inline-block; min-width:1.5em; margin-left:6px; padding:0 .4em; border-radius:999px; background:var(--brass); color:#2a1a0e; font:600 12px/1.6 sans-serif; text-align:center; }
.tabbar button.on[data-count]::after { background:var(--leather); color:#f1e6d0; }

/* ---- desktop defaults for the pieces that only matter on a phone ---- */
#menu-btn, .grab, .pick .arr { display:none; }
#spot-hint:not(:empty) { cursor:pointer; }
#spot-hint .chip { font:inherit; font-size:15px; padding:6px 12px; margin:0 6px 6px 0; border:1px solid var(--leather); border-radius:999px; background:none; color:var(--leather); cursor:pointer; }
html { -webkit-text-size-adjust:100%; }
.v { -webkit-tap-highlight-color:transparent; }
#page, .tabbar, #bar { touch-action:manipulation; }

/* ================= PHONE LAYOUT (iPhone 13 mini, 375px, and up to 900px) =================
   top bar + one-column text + the tabs as a bottom sheet with three heights: peek / half / full */
@media (max-width: 900px) {
  :root { --peek-h: calc(70px + env(safe-area-inset-bottom, 0px)); --sheet-h: var(--peek-h); }
  body[data-sheet="peek"] { --sheet-h: var(--peek-h); }
  body[data-sheet="half"] { --sheet-h: 46vh; --sheet-h: 46dvh; }
  body[data-sheet="full"] { --sheet-h: 88vh; --sheet-h: 88dvh; }
  body { display:block; padding-bottom:calc(var(--sheet-h) + 16px); }

  /* top bar */
  #side { position:sticky; top:0; z-index:12; width:auto; display:flex; align-items:center; gap:10px; padding:8px 12px; padding-top:max(8px, env(safe-area-inset-top, 0px)); background:#140a04; }
  .logo { flex:none; margin:0; font-size:16px; line-height:1.05; max-width:84px; }
  .sq { flex:1 1 auto; min-width:0; margin:0; }
  .sq input { height:40px; padding:0 14px; border-radius:20px; font-size:16px; }
  #menu-btn { display:grid; place-items:center; flex:none; width:44px; height:44px; border:1px solid var(--brass); border-radius:12px; background:none; color:var(--brass); font-size:22px; cursor:pointer; }
  #sidemenu { display:none; position:absolute; top:calc(100% + 6px); right:10px; width:min(300px, calc(100vw - 20px)); padding:14px 18px; background:#2a1a0e; border:1px solid var(--brass); border-radius:14px; box-shadow:0 14px 40px #000a; }
  #side.open #sidemenu { display:block; }
  #side a { font-size:19px; margin:12px 0; }
  .who { margin-top:0; font-size:15px; }
  .kbdhint { display:none; }

  /* chapter picker: translation on its own row, then book + chapter + arrows */
  #desk { display:block; padding:10px 10px 0; }
  .pick { flex-wrap:wrap; gap:8px; margin-bottom:10px; }
  .pick select[name=t] { flex:1 1 100%; }
  .pick select[name=b] { flex:1 1 0; }
  .pick select { min-width:0; height:44px; font-size:16px; text-overflow:ellipsis; }
  .pick input { flex:none; width:56px; height:44px; font-size:16px; text-align:center; }
  .pick a { text-decoration:none; flex:none; width:44px; height:44px; display:grid; place-items:center; border:1px solid var(--brass); border-radius:8px; }
  .pick .lbl { display:none; } .pick .arr { display:inline; font-size:28px; line-height:1; }

  /* reading text: one column, left aligned (justified text gaps badly on a narrow screen) */
  #page { columns:auto; column-width:auto; padding:22px 18px 28px; border-radius:12px; text-align:left; hyphens:manual; font-size:18px; line-height:1.75; box-shadow:0 6px 20px #0007; }
  #page h1 { font-size:22px; margin-bottom:14px; }
  .v { scroll-margin-top:90px; }

  /* the tabs become a bottom sheet */
  #tabs { position:fixed; left:0; right:0; bottom:0; top:auto; z-index:15; align-self:auto; display:flex; flex-direction:column; height:var(--sheet-h); overflow:hidden;
          border-radius:18px 18px 0 0; box-shadow:0 -10px 34px #000a; font-size:16px; transition:height .26s cubic-bezier(.2,.8,.2,1); }
  .grab { display:block; position:relative; flex:none; height:22px; background:var(--leather); border-radius:18px 18px 0 0; touch-action:none; cursor:grab; }
  .grab::after { content:''; position:absolute; left:50%; top:8px; width:42px; height:5px; margin-left:-21px; border-radius:3px; background:#d9c7a3; opacity:.85; }
  .tabbar { flex:none; }
  .tabbar button { min-height:48px; font-size:15px; padding:0 4px; }
  .tabbar button[data-count]::after { margin-left:4px; min-width:1.35em; padding:0 .3em; font-size:11px; }
  .panel { flex:1 1 auto; min-height:0; max-height:none; overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
           padding:16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); }
  body[data-sheet="peek"] .panel { visibility:hidden; }
  .notes textarea { font-size:16px; }

  /* highlight / note / bookmark toolbar: docked just above the sheet */
  #bar { position:fixed !important; top:auto !important; left:10px !important; right:10px !important; bottom:calc(var(--sheet-h) + 10px) !important;
         flex-wrap:wrap; justify-content:center; gap:8px; padding:8px; z-index:14; }
  body[data-sheet="full"] #bar { display:none !important; }
  .bar-label, .bar-sep { display:none; }
  #bar .sw { width:36px; height:36px; }
  #bar button:not(.sw) { min-height:40px; padding:0 10px; font-size:14px; }

  /* quick search / sign-in / search pages */
  #spot { padding-top:12vh; } #spot form { width:92vw; }
  #spot-hint { min-height:2.4em; }
  #help > div { padding:18px 18px; }
  .plain { margin:12px auto; padding:18px 16px; max-width:none; width:calc(100% - 24px); }
  .plain input, .plain select { font-size:16px; }
  .find input[name=q] { flex:1 1 100%; } .auth { max-width:none; }
}

/* Greek / Hebrew word search */
.orig { font-weight:600; color:var(--leather); unicode-bidi:isolate; }
.orig.big { font-size:26px; }
.wordcard { margin:0 0 14px; padding:12px 16px; background:#f4ecd8; border-left:4px solid var(--brass); border-radius:4px; }
.wordcard details { margin-top:6px; font-size:15px; color:#4b3f2f; }
.choices { padding-left:20px; } .choices li { margin:0 0 8px; }
.suggest { margin:0 0 14px; padding:8px 12px; background:#f4ecd8; border-radius:4px; }
.allv { font-size:13px; margin-left:4px; color:var(--leather); white-space:nowrap; }

/* ---- settings dialog ---- */
#settings { position:fixed; inset:0; z-index:20; display:flex; justify-content:center; align-items:center; background:rgba(20,10,4,.55); backdrop-filter:blur(3px); }
#settings form { width:min(440px, 92vw); background:var(--paper); border:1px solid var(--brass); border-radius:12px; padding:20px 26px 22px; box-shadow:0 18px 50px #000a; }
#settings h2 { margin:0 0 14px; font-weight:400; letter-spacing:.04em; }
#settings label { display:block; font-weight:600; color:var(--leather); margin-bottom:4px; }
#settings select { width:100%; font:inherit; font-size:16px; padding:7px 10px; border-radius:4px; border:1px solid var(--brass); background:#fff; }
.set-note { margin:10px 0 0; font-size:13px; color:#6b5b45; line-height:1.5; }
#set-msg { margin:10px 0 0; min-height:1.5em; font-size:14px; color:var(--leather); }
.set-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:8px; }
.set-actions button { font:inherit; font-size:15px; min-height:40px; padding:0 18px; border-radius:4px; cursor:pointer; border:1px solid var(--leather); background:none; color:var(--leather); }
.set-actions button[type=submit] { background:var(--leather); color:#f6ecd8; }
.set-actions button:disabled { opacity:.6; cursor:default; }
#settings form { max-height:92vh; max-height:92dvh; overflow-y:auto; }
#settings .chk { display:flex; gap:10px; align-items:flex-start; font-weight:400; color:var(--ink); margin:14px 0 0; cursor:pointer; }
#settings .chk input { flex:none; width:18px; height:18px; margin:4px 0 0; accent-color:var(--leather); }
#settings .chk small { color:#6b5b45; font-size:13px; }
#settings fieldset { margin:18px 0 0; padding:2px 14px 12px; border:1px solid #d9c9a6; border-radius:6px; }
#settings legend { padding:0 6px; font-weight:600; color:var(--leather); }

/* ---- speaker buttons (public/assets/speak.js sets <html data-say="grc heb"> for the languages this device can speak) ---- */
.say { display:none; vertical-align:middle; align-items:center; justify-content:center; min-width:28px; min-height:28px; padding:2px 4px; margin:0 2px;
       font:inherit; line-height:1; color:var(--brass); background:none; border:0; border-radius:50%; cursor:pointer; }
html[data-say~=grc] .say[data-lang=grc], html[data-say~=heb] .say[data-lang=heb] { display:inline-flex; }
.say:hover, .say:focus-visible, .say.on { color:var(--leather); background:#c9a96133; }
@media (pointer: coarse) { .say { min-width:36px; min-height:36px; } }
.say-note { display:none; margin:6px 0 10px; font-size:13px; color:#6b5b45; line-height:1.4; }
html[data-say] .say-note { display:block; }

/* ---- one-time hint on phones: how to open the verse toolbar ---- */
#toast { position:fixed; left:12px; right:12px; bottom:calc(var(--sheet-h, 56px) + 14px); z-index:14; padding:12px 14px; font-size:15px; line-height:1.4;
         color:#f1e6d0; background:#140a04ee; border:1px solid var(--brass); border-radius:8px; box-shadow:0 6px 16px #0009; }

/* ---- pinned navigation (Settings > Pin the navigation controls); app.js sets --side-h and --pick-h ---- */
body.pin-nav .pick { position:sticky; z-index:11; background:#140a04; box-shadow:0 6px 16px #0008; }
body.pin-nav .v { scroll-margin-top:calc(var(--side-h, 0px) + var(--pick-h, 0px) + 16px); }
@media (min-width: 901px) {
  body.pin-nav .pick { top:0; margin:-24px -24px 16px; padding:14px 24px; border-radius:0 0 10px 10px; }
  body.pin-nav #tabs { top:calc(var(--pick-h, 0px) + 16px); }
}
@media (max-width: 900px) {
  body.pin-nav .pick { top:var(--side-h, 56px); margin:0 -10px 10px; padding:8px 10px; }
}
