/* Written to work on older iOS Safari: no flex `gap`, no :has, no modern color functions. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #FFFFFF;
  color: #1B1F2A;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
button { font-family: inherit; }

.app { max-width: 460px; margin: 0 auto; padding: 18px 14px 0; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.title { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.count { font-size: 13px; font-weight: 600; color: #5C6576; }

.sticky {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 5;
  background: #FFFFFF; padding: 6px 0 10px; margin-bottom: 2px;
}
.verse-card {
  border: 1px solid #D5DCE6; border-radius: 14px; padding: 12px 16px;
  background: #F5F7FB; box-shadow: 0 4px 12px rgba(27, 31, 42, 0.06);
}
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: #5C6576; margin-bottom: 6px; }
.verse { margin: 0; font-size: 16px; line-height: 1.5; font-family: Georgia, "Times New Roman", serif; }

.chips { margin: 0 0 8px; min-height: 4px; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 6px 10px;
  border-radius: 999px; margin: 0 6px 6px 0;
}
.chip-later { background: #F2A03D; color: #1B1F2A; }
.chip-earlier { background: #2F5BD3; color: #FFFFFF; }
.chip-right { background: #1E8A5A; color: #FFFFFF; }

/* Chapter grid: a 48px margin column for book names + 10 chapter columns */
.row { display: flex; align-items: stretch; margin-bottom: 3px; }
.margin {
  width: 52px; flex: none; padding-right: 6px; position: relative;
  font-size: 9.5px; line-height: 11px; font-weight: 700; color: #5C6576; text-align: right;
}
.margin .lbl { position: absolute; right: 6px; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); white-space: nowrap; }
.margin .lbl.stack { top: 2px; -webkit-transform: none; transform: none; }
.cells { flex: 1; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-column-gap: 3px; column-gap: 3px; }
.cell {
  height: 26px; padding: 0; margin: 0; border-radius: 5px;
  border: 1px solid #D5DCE6; background: #FFFFFF; color: #1B1F2A;
  font-size: 12px; font-weight: 500; cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent; -webkit-appearance: none; appearance: none;
}
.cell.tint { background: #E9EEF6; }
.cell.first { font-weight: 800; box-shadow: inset 3px 0 0 #1B1F2A; }
.cell.later { background: #F2A03D; border-color: #F2A03D; color: #1B1F2A; box-shadow: none; }
.cell.earlier { background: #2F5BD3; border-color: #2F5BD3; color: #FFFFFF; box-shadow: none; }
.cell.right { background: #1E8A5A; border-color: #1E8A5A; color: #FFFFFF; box-shadow: none; }
.cell.sel { background: #1B1F2A; border-color: #1B1F2A; color: #FFFFFF; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3.5px #1B1F2A; z-index: 1; }
.cell[disabled] { cursor: default; }
.cell.blank { visibility: hidden; }

.legend { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: #5C6576; }
.lg { display: inline-block; margin: 0 12px 6px 0; white-space: nowrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.sw-start { background: #E9EEF6; border: 1px solid #D5DCE6; box-shadow: inset 3px 0 0 #1B1F2A; }
.sw-later { background: #F2A03D; }
.sw-earlier { background: #2F5BD3; }

.result {
  margin-top: 14px; border: 1px solid #D5DCE6; border-radius: 14px; padding: 16px; text-align: center;
}
.result-head { font-size: 13px; font-weight: 700; color: #5C6576; text-transform: uppercase; letter-spacing: 0.8px; }
.result-ref { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.result-guesses { font-size: 15px; font-weight: 600; color: #5C6576; margin-bottom: 8px; }
.read-link { display: inline-block; font-size: 14px; font-weight: 600; color: #2F5BD3; margin-bottom: 14px; }
.result-actions .btn { margin: 0 4px; }
.toast { font-size: 13px; color: #1E8A5A; font-weight: 600; min-height: 18px; margin-top: 10px; }

.btn {
  height: 48px; padding: 0 22px; border-radius: 12px; font-size: 16px; font-weight: 700;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
.btn-dark { background: #1B1F2A; color: #FFFFFF; border: none; }
.btn-light { background: #FFFFFF; color: #1B1F2A; border: 1px solid #D5DCE6; }
.btn[disabled] { opacity: 0.35; cursor: default; }

.spacer { height: 190px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #FFFFFF; border-top: 1px solid #D5DCE6;
  padding: 12px 16px; padding-bottom: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.bar-main { display: flex; justify-content: space-between; align-items: center; }
.bar > * { }
.pick-label { font-size: 11px; font-weight: 600; color: #5C6576; }
.pick-name { font-size: 20px; font-weight: 800; }
.bar.done .bar-main { display: none; }

@media (min-width: 520px) {
  .bar { left: 50%; right: auto; width: 460px; margin-left: -230px; }
}

.top-right { white-space: nowrap; }
.link-btn {
  background: none; border: 1px solid #D5DCE6; border-radius: 999px; padding: 6px 12px; margin-left: 10px;
  font-size: 13px; font-weight: 700; color: #1B1F2A; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.archive .eyebrow { margin: 4px 0 10px; }
.arch-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  min-height: 56px; padding: 10px 14px; margin-bottom: 8px; text-align: left;
  border: 1px solid #D5DCE6; border-radius: 12px; background: #FFFFFF; color: #1B1F2A;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
.arch-item.today { border-color: #1B1F2A; }
.arch-no { font-size: 16px; font-weight: 800; }
.arch-date { font-size: 12px; color: #5C6576; margin-top: 2px; }
.arch-status { font-size: 13px; font-weight: 700; color: #5C6576; }
.arch-status.won { color: #1E8A5A; }
.arch-status.lost { color: #1B1F2A; }

.arch-right { text-align: right; white-space: nowrap; }
.sq-row { display: inline-block; vertical-align: middle; margin-right: 8px; }
.sq { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-left: 3px; vertical-align: middle; }
.sq-later { background: #F2A03D; }
.sq-earlier { background: #2F5BD3; }
.sq-right { background: #1E8A5A; }
.arch-status { vertical-align: middle; }
.sw-right { background: #1E8A5A; }
.cell.first.later, .cell.first.earlier, .cell.first.right { box-shadow: inset 3px 0 0 #1B1F2A; }
.lg { margin-right: 14px; }

.slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-column-gap: 3px; column-gap: 3px; margin: 0 -4px 8px; }
.slot {
  height: 26px; border-radius: 6px; border: 1.5px dashed #C3CBD8; background: #FFFFFF; color: #1B1F2A;
  display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 3px;
  font-size: 9px; line-height: 12px; font-weight: 700; white-space: nowrap; letter-spacing: -0.1px;
}
.slot.filled { justify-content: space-between; }
.slot-name { -webkit-box-flex: 1; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.slot-chn { flex: none; margin-left: 2px; text-align: right; }
.slot.next { border-style: solid; border-color: #1B1F2A; }
.slot.later, .slot.earlier, .slot.right { border-style: solid; }
.slot.later { background: #F2A03D; border-color: #F2A03D; color: #1B1F2A; }
.slot.earlier { background: #2F5BD3; border-color: #2F5BD3; color: #FFFFFF; }
.slot.right { background: #1E8A5A; border-color: #1E8A5A; color: #FFFFFF; }
.slot-num { color: #9AA3B2; }
.slot.next .slot-num { color: #1B1F2A; }
.bar.off { display: none; }

.help-btn { width: 32px; height: 32px; padding: 0; margin-left: 8px; font-size: 15px; }
.modal-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(27, 31, 42, 0.5); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px 14px;
}
.modal {
  position: relative; max-width: 420px; margin: 0 auto; background: #FFFFFF; border-radius: 16px;
  padding: 22px 20px 20px; box-shadow: 0 12px 40px rgba(27, 31, 42, 0.25);
}
.modal h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.modal-x {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: none; background: none;
  font-size: 26px; color: #5C6576; cursor: pointer;
}
.modal-lead { margin: 0 0 12px; font-size: 16px; line-height: 1.45; }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 15px; line-height: 1.45; }
.steps li { margin-bottom: 8px; }
.ex { border: 1px solid #D5DCE6; border-radius: 12px; padding: 10px; margin-bottom: 14px; }
.ex-row { display: flex; align-items: center; font-size: 14px; line-height: 1.35; margin-bottom: 8px; }
.ex-row:last-child { margin-bottom: 0; }
.ex-cell {
  flex: none; width: 74px; margin-right: 10px; padding: 6px 0; border-radius: 6px; text-align: center;
  font-size: 12px; font-weight: 700;
}
.ex-early { background: #F2A03D; color: #1B1F2A; }
.ex-late { background: #2F5BD3; color: #FFFFFF; }
.ex-right { background: #1E8A5A; color: #FFFFFF; }
.modal-note { margin: 0 0 16px; font-size: 14px; color: #5C6576; line-height: 1.45; }
.modal-go { width: 100%; }

/* Pinned verse shrinks to two lines while scrolling the grid; tap to expand */
.more { display: none; }
.verse-card.compact { padding: 8px 12px; cursor: pointer; }
.verse-card.compact .eyebrow { display: none; }
.verse-card.compact .verse {
  font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.verse-card.compact .more { display: block; font-size: 11px; font-weight: 700; color: #2F5BD3; margin-top: 3px; }
.verse-card.opened { cursor: pointer; }

/* Book-per-row grid */
.row.book-first { margin-top: 7px; }
.row.book-first:first-child { margin-top: 0; }
.cell.named { grid-column: span 2; font-size: 11px; font-weight: 700; }
.cells.singles { display: flex; align-items: center; }
.cells.singles .cell { flex: 0 0 calc((100% - 27px) / 10); -webkit-box-flex: 0; }
.slabel {
  font-size: 9.5px; line-height: 11px; font-weight: 700; color: #5C6576; white-space: nowrap;
  margin: 0 5px 0 12px;
}
.slabel:first-child { margin-left: 0; }
@media (max-width: 359px) {
  .slabel { font-size: 9px; margin: 0 3px 0 6px; }
}
html { overflow-anchor: none; }

/* ---- Book shelf + chapter pad on one screen (test) ---- */
.shelf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-gap: 5px; gap: 5px; padding-top: 10px; }
.book {
  position: relative; height: 56px; padding: 19px 3px 4px; text-align: center; overflow: visible;
  border: 1px solid #D5DCE6; border-radius: 9px; background: #FFFFFF; color: #1B1F2A;
  cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.book.open { background: #1B1F2A; border-color: #1B1F2A; color: #FFFFFF; }
.book.open .book-count { color: #C3CBD8; }
.book-name { display: block; font-size: 13px; font-weight: 800; line-height: 15px; white-space: nowrap; }
.book-count { display: block; font-size: 11px; font-weight: 600; color: #5C6576; margin-top: 2px; }

.ribbons { position: absolute; top: -1px; right: 3px; white-space: nowrap; line-height: 0; }
.rib {
  display: inline-block; min-width: 16px; height: 19px; padding: 2px 2px 0; margin-left: 1px;
  font-size: 10px; font-weight: 800; line-height: 11px; text-align: center; vertical-align: top;
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
}
.rib-later { background: #F2A03D; color: #1B1F2A; }
.rib-earlier { background: #2F5BD3; color: #FFFFFF; }
.rib-right { background: #1E8A5A; color: #FFFFFF; }

.pad-head { margin: 12px 0 8px; min-height: 22px; }
.pad-hint { display: block; padding: 18px 0; text-align: center; font-size: 15px; font-weight: 600; color: #5C6576;
  border: 1.5px dashed #C3CBD8; border-radius: 10px; }
.pad-title { font-size: 14px; color: #5C6576; }
.pad-title b { color: #1B1F2A; font-size: 16px; }
.pad { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-gap: 5px; gap: 5px; }
.pad .cell { height: 34px; font-size: 15px; border-radius: 8px; }
@media (max-width: 359px) {
  .shelf { grid-gap: 4px; gap: 4px; }
  .book { padding-left: 1px; padding-right: 1px; }
  .book-name { font-size: 11px; letter-spacing: -0.2px; }
  .book-count { font-size: 10px; }
}

/* ---- Fit everything on one screen ---- */
.verse { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.verse.verse-full { display: block; -webkit-line-clamp: none; overflow: visible; margin-top: 4px; margin-bottom: 16px; font-size: 17px; }
.more-btn {
  display: inline-block; margin-top: 6px; padding: 6px 0; border: none; background: none;
  font-size: 14px; font-weight: 700; color: #2F5BD3; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.more-btn[hidden] { display: none; }
.verse-card { padding-bottom: 10px; }
.sticky { position: static; padding: 4px 0 2px; }
.book { height: 52px; padding-top: 17px; }
.shelf { padding-top: 8px; }
.pad-head { margin: 10px 0 6px; }
.spacer { height: 0; }
.app { padding-bottom: 0; }

/* one-screen layout, round 2 */
.app { padding-top: 10px; }
.top { margin-bottom: 8px; }
.count { font-size: 13px; }
.verse-card .eyebrow { display: none; }
.verse-card { padding: 10px 14px 6px; }
.verse { font-size: 15px; line-height: 21px; }
.more-btn { margin-top: 2px; padding: 4px 0; }
.book { height: 46px; padding: 15px 2px 3px; }
.book-name { font-size: 13px; line-height: 14px; }
.book-count { font-size: 11px; line-height: 12px; margin-top: 1px; }
.ribbons { top: -1px; }
.rib { height: 16px; min-width: 15px; padding-top: 1px; font-size: 9.5px; }
.pad-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; min-height: 40px; }
.pad-hint { width: 100%; padding: 14px 0; }
.go-btn { height: 40px; padding: 0 16px; font-size: 15px; border-radius: 10px; white-space: nowrap; }
.go-btn[disabled] { opacity: 0.35; }
.pad { grid-gap: 4px; gap: 4px; }
.bar { padding-top: 8px; padding-bottom: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.bar .legend { margin-bottom: 6px; }
.bar .slots { margin-bottom: 0; }
.bar-main { display: none; }
@media (max-width: 359px) { .count { display: none; } }

/* ---- Test layout: books as a vertical list on the left (?layout=side) ---- */
.picker.side { display: flex; align-items: flex-start; padding-top: 6px; }
.side-books { width: 128px; flex: none; margin-right: 8px; }
.side-chapters { flex: 1; min-width: 0; }
.side .shelf { display: block; padding-top: 0; }
.side .book {
  display: flex; align-items: center; width: 100%; height: 30px; margin-bottom: 2px; padding: 0 8px; text-align: left;
  border-radius: 7px;
}
.side .book-name { flex: 1; font-size: 13px; line-height: 15px; overflow: hidden; text-overflow: ellipsis; }
.side .book-count { margin: 0 0 0 4px; font-size: 11px; }
.side .ribbons { position: static; display: flex; margin-left: 3px; }
.side .rib { height: 18px; min-width: 16px; padding-top: 2px; }
.side .pad-head { margin: 0 0 6px; min-height: 24px; }
.side .pad-title b { font-size: 15px; }
.side .pad-title { font-size: 12px; }
.side .pad-hint { padding: 30px 6px; font-size: 14px; }
.side .go-btn { display: block; width: 100%; margin-top: 8px; height: 44px; }

/* vertical list: small chapter count right after the name, bookmarks on the right */
.side .book-name { flex: none; }
.side .book-count { margin: 1px 0 0 5px; font-size: 10px; font-weight: 600; color: #8A93A3; }
.side .book.open .book-count { color: #AEB6C4; }
.side .ribbons { margin-left: auto; padding-left: 4px; }
.side .rib { min-width: 20px; height: 20px; padding-top: 2px; font-size: 10.5px; margin-left: 2px; }

/* vertical layout: full verse always shown, no guess-history row */
.verse { display: block; -webkit-line-clamp: none; overflow: visible; }
.more-btn { display: none !important; }
.verse-card { padding: 10px 14px 10px; }
.bar .slots { display: none; }
.bar .legend { margin-bottom: 0; }
/* tighter spacing so the longest puzzle verses fit */
.app { padding-top: 6px; }
.top { margin-bottom: 4px; }
.sticky { padding: 2px 0 0; }
.verse-card { padding: 8px 12px; }
.picker.side { padding-top: 6px; }
.bar { padding-top: 6px; padding-bottom: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.side .go-btn { height: 42px; margin-top: 6px; }

/* one-chapter books paired two per row in the vertical list */
.book-pair { display: flex; width: 100%; margin-bottom: 2px; }
.side .book.mini { flex: 1; width: auto; height: 100%; margin: 0; padding: 0 4px; justify-content: center; text-align: center; }
.side .book.mini + .book.mini { margin-left: 3px; }
.side .book.mini .book-name { font-size: 12.5px; }
.side .book.mini.later { background: #F2A03D; border-color: #F2A03D; color: #1B1F2A; }
.side .book.mini.earlier { background: #2F5BD3; border-color: #2F5BD3; color: #FFFFFF; }
.side .book.mini.right { background: #1E8A5A; border-color: #1E8A5A; color: #FFFFFF; }
.side .book.mini.open { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3.5px #1B1F2A; }
.side .book.mini.open:not(.later):not(.earlier):not(.right) { box-shadow: none; }
.side .go-btn { height: 40px; margin-top: 5px; }

/* ---- Fixed layout + excerpt / expandable verse ---- */
.sticky { position: relative; z-index: 30; }
.verse-card { overflow: hidden; box-sizing: border-box; padding: 9px 12px; }
.verse-card .verse { font-size: 15px; line-height: 21px; }
.expand-btn {
  display: block; margin: 2px 0 0 auto; padding: 2px 0; border: none; background: none;
  font-size: 13px; font-weight: 700; color: #2F5BD3; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.expand-btn[hidden] { display: none; }
.verse-card.expanded {
  position: absolute; left: 0; right: 0; top: 2px; height: auto !important; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(27, 31, 42, 0.25); background: #FFFFFF; cursor: pointer;
}
.verse-card.expanded .verse { font-size: 16px; line-height: 24px; }
.verse-dim { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(27, 31, 42, 0.35); }
.verse-dim[hidden] { display: none; }
/* fixed sizes */
.side .book, .side .book-pair { height: 28px; }
.side .pad .cell { height: 34px; }
.side .pad-head { min-height: 40px; margin: 0 0 6px; display: flex; align-items: center; justify-content: space-between; }
.side .pad-title b { font-size: 17px; }
.side .go-btn { display: inline-block; width: auto; margin: 0; height: 40px; padding: 0 12px; font-size: 14px; }

/* 5-line verse box; "Show full verse" sits over a fade in the bottom corner */
.verse-card { position: relative; padding: 9px 12px; }
.verse-card:not(.expanded) .verse { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.verse-card:not(.expanded) .expand-btn {
  position: absolute; right: 8px; bottom: 7px; margin: 0; padding: 2px 4px 2px 40px;
  background: linear-gradient(to right, rgba(245, 247, 251, 0), #F5F7FB 38px);
  line-height: 19px;
}
.verse-card.expanded .expand-btn { margin-top: 6px; }

/* Guess button in the bottom bar (vertical layout) */
.bar-guess { display: block; width: 100%; height: 48px; margin: 0 0 8px; font-size: 17px; }
.bar-guess[hidden] { display: none; }
.bar-guess[disabled] { opacity: 1; background: #E3E8EF; color: #5C6576; }
.side .pad-head { min-height: 28px; margin: 0 0 6px; }

/* ===================================================================
   Book theme: warm paper pages, navy covers with gold lettering, serif
   headings. Feedback colors (orange / blue / green) are unchanged.
   =================================================================== */
body { background: #FBF8F1; color: #2A2418; }
.title { font-family: Georgia, "Times New Roman", serif; font-weight: 700; color: #1F2A44; letter-spacing: 0.2px; }
.count { color: #6B6150; }
.link-btn { background: #FFFDF8; border-color: #E2D6BD; color: #1F2A44; font-family: Georgia, "Times New Roman", serif; }

/* the verse reads like a page: cream paper with a thin printed rule inside the edge */
.verse-card {
  background: #FFFDF8; border: 1px solid #E2D6BD;
  box-shadow: inset 0 0 0 4px #FFFDF8, inset 0 0 0 5px #EFE6D3, 0 2px 6px rgba(60, 45, 20, 0.06);
}
.verse-card .verse { color: #2A2418; }
.verse-card:not(.expanded) .expand-btn { background: linear-gradient(to right, rgba(255, 253, 248, 0), #FFFDF8 38px); }
.verse-card.expanded { background: #FFFDF8; }

/* book list: each book is a spine with a navy band; the open book is a navy cover with gold lettering */
.side .book:not(.later):not(.earlier):not(.right) { background: #FFFDF8; border-color: #E2D6BD; color: #2A2418; }
.side .book:not(.mini):not(.open) { box-shadow: inset 4px 0 0 #1F2A44; padding-left: 11px; }
.side .book-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: 0.1px; }
.side .book-count { color: #7D725C; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; }
.side .book.open:not(.later):not(.earlier):not(.right) { background: #1F2A44; border-color: #1F2A44; color: #E8D49A; box-shadow: inset 4px 0 0 #C9A24A; }
.side .book.open .book-count { color: #C9B57E; }
.side .book.mini.open:not(.later):not(.earlier):not(.right) { box-shadow: none; }

/* chapter squares: plain paper tiles; the picked chapter is navy with a gold ring */
.pad-title b { font-family: Georgia, "Times New Roman", serif; color: #1F2A44; }
.side .pad .cell:not(.later):not(.earlier):not(.right):not(.sel) { background: #FFFDF8; border-color: #E2D6BD; color: #2A2418; }
.side .pad .cell.sel { background: #1F2A44; border-color: #1F2A44; color: #FFFFFF; box-shadow: 0 0 0 2px #FBF8F1, 0 0 0 4px #C9A24A; }

/* bottom bar and buttons */
.bar { background: #FBF8F1; border-top-color: #E2D6BD; }
.bar-guess { background: #1F2A44; color: #FFFFFF; font-family: Georgia, "Times New Roman", serif; letter-spacing: 0.3px; box-shadow: inset 0 0 0 1px #C9A24A; }
.bar-guess[disabled] { background: #EDE5D3; color: #6B6150; box-shadow: none; }
.legend { color: #6B6150; }
.btn-dark { background: #1F2A44; }
.btn-light { background: #FFFDF8; border-color: #E2D6BD; color: #1F2A44; }

/* results, archive and pop-ups on the same paper */
.result, .arch-item { background: #FFFDF8; border-color: #E2D6BD; }
.arch-item.today { border-color: #1F2A44; }
.result-ref, .arch-no { font-family: Georgia, "Times New Roman", serif; color: #1F2A44; }
.modal { background: #FFFDF8; }
.modal h2 { font-family: Georgia, "Times New Roman", serif; color: #1F2A44; }
.ex { border-color: #E2D6BD; }

/* How to play fits on one screen */
.modal-bg { padding: 12px; }
.modal { padding: 16px 16px 14px; }
.modal h2 { font-size: 21px; margin-bottom: 6px; }
.modal-lead { font-size: 15px; margin-bottom: 8px; }
.steps { font-size: 14.5px; line-height: 1.4; margin-bottom: 8px; }
.steps li { margin-bottom: 6px; }
.ex { padding: 8px; margin-bottom: 10px; }
.ex-row { margin-bottom: 6px; font-size: 14px; }
.ex-cell { padding: 5px 0; }
.modal-note { font-size: 13.5px; margin-bottom: 12px; }
.modal-go { height: 46px; }

/* ---- No page scrolling: the game lives in a stage that is scaled to fit the window ---- */
html, body { height: 100%; overflow: hidden; }
#stage { position: absolute; top: 0; left: 0; overflow: hidden; -webkit-transform-origin: 0 0; transform-origin: 0 0; }
#stage .app { max-width: none; }
#stage .bar { position: absolute; left: 0; right: 0; width: auto; margin-left: 0; bottom: 0; }
.spacer { display: none; }
.archive { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* results pop-up */
.result-modal { text-align: center; }
.result-modal .result { border: none; padding: 6px 0 0; margin: 0; background: transparent; }
/* picked chapter: plain navy, no ring */
.side .pad .cell.sel { box-shadow: none; }

/* title opens the archive */
.title-btn { padding: 0; border: none; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; font: inherit; color: inherit; letter-spacing: inherit; }
/* results pop-up sits in the middle of the window */
#resultModal:not([hidden]) { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; }
#resultModal .modal { width: 100%; margin: 0; }
/* full-verse view darkens the whole window: one dim for the game, one for the page around it */
#stage { background: #FBF8F1; }
.page-dim { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 0; background: rgba(27, 31, 42, 0.35); }
.page-dim[hidden] { display: none; }

/* missed puzzle: the answer is revealed with a dashed green outline, never a solid green "correct" */
.side .pad .cell.reveal, .side .book.mini.reveal {
  background: #FFFDF8; color: #17734A; border: 2px dashed #1E8A5A; font-weight: 800; box-shadow: none;
}
.side .book.reveal:not(.mini) { border: 2px dashed #1E8A5A; }
.answer-tag {
  margin-left: 4px; padding: 1px 5px; border-radius: 4px; background: #E3F2EA; color: #17734A;
  font-size: 10px; font-weight: 800; letter-spacing: 0.3px; text-transform: uppercase; white-space: nowrap;
}
.side .book.open.reveal .answer-tag { background: #2B6B4E; color: #FFFFFF; }

/* revealed answer must win over the paper styling above */
.side .pad .cell.reveal, .side .book.mini.reveal {
  background: #FFFDF8 !important; color: #17734A !important; border: 2px dashed #1E8A5A !important; box-shadow: none !important;
}
.side .book.reveal:not(.mini) { border: 2px dashed #1E8A5A !important; }
.side .book.open.reveal:not(.mini) { border-color: #4CC38A !important; }
.answer-tag { display: none; }

/* ---- End of game: the answer's book and chapter light up green ---- */
.side .book.answer:not(.mini), .side .book.answer.open:not(.mini) {
  background: #1E8A5A !important; border-color: #1E8A5A !important; color: #FFFFFF !important;
  box-shadow: inset 4px 0 0 #145E3D !important;
}
.side .book.answer .book-count { display: none; }
.side .book.mini.right { background: #1E8A5A !important; border-color: #1E8A5A !important; color: #FFFFFF !important; }
.side .pad .cell.right { background: #1E8A5A !important; border-color: #1E8A5A !important; color: #FFFFFF !important; }
/* a win glows briefly; the victory bookmark is a touch bigger and outlined in white so it stands out on green */
@keyframes bomdle-glow {
  0% { box-shadow: inset 4px 0 0 #145E3D, 0 0 0 0 rgba(30, 138, 90, 0.6); }
  70% { box-shadow: inset 4px 0 0 #145E3D, 0 0 0 9px rgba(30, 138, 90, 0); }
  100% { box-shadow: inset 4px 0 0 #145E3D, 0 0 0 0 rgba(30, 138, 90, 0); }
}
@keyframes bomdle-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.side .book.answer.won:not(.mini) { animation: bomdle-glow 1.1s ease-out 0.1s 2; }
.side .book.mini.won, .side .pad .cell.won { animation: bomdle-pop 0.5s ease-out 0.1s 1; }
.side .rib-right { box-shadow: 0 0 0 1.5px #FFFFFF; }
/* three bookmarks fit: slimmer ribbons, a little more room for the list */
.side-books { width: 136px; }
.side .rib { min-width: 17px; padding-left: 1px; padding-right: 1px; margin-left: 1px; font-size: 10px; }
.side .ribbons { padding-left: 2px; }
/* the victory bookmark on the green answer book: cream ribbon with green lettering, a little taller */
.side .book.answer .rib-right { background: #FFFDF8; color: #17734A; box-shadow: none; height: 23px; font-weight: 900; }
/* victory bookmark: a gold ribbon, taller than the others, with a shimmer when you win */
.side .book.answer .rib-right {
  background: linear-gradient(135deg, #F6D77A 0%, #E2B23C 45%, #FBE7A6 60%, #D49B22 100%);
  background-size: 200% 200%;
  color: #3D2A05; height: 26px; min-width: 19px; font-weight: 900; box-shadow: none;
}
@keyframes bomdle-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.side .book.answer.won .rib-right { animation: bomdle-shimmer 1.2s ease-in-out 0.2s 2; }
.side .book.answer .rib-right {
  background: linear-gradient(135deg, #FFF3B0 0%, #FFD23F 40%, #FFF6C8 58%, #F4B400 100%);
  background-size: 200% 200%; color: #4A3500; box-shadow: inset 0 0 0 1px rgba(90, 60, 0, 0.45);
}

/* answer book shows the answer chapter next to the name, e.g. "Mosiah 2" */
.answer-ch { margin-left: 5px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 700; color: #FFFFFF; }

/* ---- End of game, take 3: no green book; a horizontal answer bookmark + a green bookmark on a win ---- */
.side .book.has-answer { position: relative; }
.answer-tab {
  position: absolute; left: -13px; top: 50%; margin-top: -10px; height: 20px; min-width: 24px; padding: 0 5px 0 4px;
  background: #1E8A5A; color: #FFFFFF; font-size: 11px; font-weight: 800; line-height: 20px; text-align: right;
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 6px 50%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 6px 50%);
  z-index: 2;
}
.side .book.has-answer.won .answer-tab { animation: bomdle-tab 1.1s ease-out 0.15s 2; }
@keyframes bomdle-tab { 0% { filter: brightness(1); } 35% { filter: brightness(1.45); } 100% { filter: brightness(1); } }
/* the victory bookmark is plain green again, outlined so it reads on any book */
.side .rib-right { background: #1E8A5A; color: #FFFFFF; box-shadow: none; height: 22px; }
.side .book.has-answer.won .rib-right { animation: bomdle-pop 0.5s ease-out 0.15s 1; }
.answer-tab { left: -14px; padding: 0 4px 0 7px; min-width: 22px; }
.side .book.has-answer:not(.mini) { padding-left: 17px !important; }
.answer-tab { left: -16px; }
.side .book.has-answer:not(.mini) { padding-left: 14px !important; }
.answer-tab { left: -14px; }
.side .book.has-answer:not(.mini) { padding-left: 14px !important; padding-right: 4px !important; }
.side .book.has-answer .rib { margin-left: 0; } .side .book.has-answer .ribbons { padding-left: 1px; }

/* ---- Answer marker: a brown leather/satin ribbon with a forked tail and stitching ---- */
.answer-tab {
  left: -14px; top: 50%; margin-top: -11px; height: 22px; min-width: 26px; padding: 0 6px 0 10px;
  background: linear-gradient(to bottom, #9A6038 0%, #7A4426 45%, #5E321B 55%, #7A4426 100%);
  color: #FBEBD0; font-family: Georgia, "Times New Roman", serif; font-size: 13px; font-weight: 700;
  line-height: 22px; text-align: right; letter-spacing: 0.2px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 7px 50%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 7px 50%);
}
/* fine stitching just inside the ribbon's top and bottom edges */
.answer-tab::after {
  content: ""; position: absolute; left: 6px; right: 2px; top: 3px; bottom: 3px;
  border-top: 1px dashed rgba(251, 235, 208, 0.55); border-bottom: 1px dashed rgba(251, 235, 208, 0.55);
  pointer-events: none;
}
.side .book.has-answer.won .answer-tab { animation: bomdle-tab 1.1s ease-out 0.15s 2; }
.answer-tab { padding: 0 5px 0 9px; font-size: 12.5px; }

/* "See results" matches the brown leather answer tab */
.bar-guess.results-btn {
  position: relative; color: #FBEBD0; box-shadow: none;
  background: linear-gradient(to bottom, #9A6038 0%, #7A4426 45%, #5E321B 55%, #7A4426 100%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.bar-guess.results-btn::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 5px; bottom: 5px; border-radius: 8px;
  border: 1px dashed rgba(251, 235, 208, 0.5); pointer-events: none;
}

/* win celebration overlay */
.celebrate { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; }
/* no double-tap zoom: taps register immediately and never zoom the page */
html, body, button, a { touch-action: manipulation; }

/* results: the guesses in the order they were made */
.result-path { list-style: none; margin: 4px 0 12px; padding: 0; text-align: center; }
.path-step {
  display: inline-block; margin: 0 3px 6px; padding: 4px 9px 4px 4px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 18px; white-space: nowrap;
}
.path-n {
  display: inline-block; width: 18px; height: 18px; margin-right: 5px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.85); color: #1B1F2A; font-size: 11px; line-height: 18px; text-align: center;
}
.path-later { background: #F2A03D; color: #1B1F2A; }
.path-earlier { background: #2F5BD3; color: #FFFFFF; }
.path-right { background: #1E8A5A; color: #FFFFFF; }
