@font-face {
  font-family: "MyBible Serif";
  src: url("korean-serif.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --canvas: #f8f4e8;
  --paper: #fffdf5;
  --ink: #232c25;
  --muted: #526157;
  --line: #ded2b7;
  --green: #1e4836;
  --green-light: #dce9d6;
  --gold: #866728;
  --selection: #244c39;
  --on-selection: #fff9e9;
  --shadow: 0 2px 8px #57452712;
  --heading: "MyBible Serif", "Noto Serif KR", Batang, serif;
  --menu-font: Gulim, "굴림", "Nanum Gothic", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --read: 20px;
  --menu-growth: 0px;
  --menu-text: clamp(17px, calc(4.5vw + var(--menu-growth)), 23px);
  --menu-compact: clamp(15px, calc(4vw + var(--menu-growth)), 21px);
  --leading: 1.65;
  --letter-spacing: 0em;
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
:root[data-theme="light"] {
  --canvas: #fff;
  --paper: #fff;
}
:root:is([data-theme="dark"], [data-theme="black"]) {
  color-scheme: dark;
  --canvas: #15231d;
  --paper: #203229;
  --ink: #f4f0e5;
  --muted: #b8c7bb;
  --line: #465748;
  --green: #b8d5b9;
  --green-light: #2d4436;
  --gold: #d2b67b;
  --selection: #bdd5b8;
  --on-selection: #183324;
  --shadow: 0 2px 8px #080f0c33;
}
:root[data-size="1"] { --read: 14px; }
:root[data-size="2"] { --read: 16px; }
:root[data-size="3"] { --read: 18px; }
:root[data-size="4"] { --read: 20px; }
:root[data-size="5"] { --read: 22px; }
:root[data-size="6"] { --read: 24px; }
:root[data-size="7"] { --read: 26px; }
:root[data-size="8"] { --read: 28px; }
:root[data-size="9"] { --read: 30px; }
:root[data-size="10"] { --read: 32px; }
:root[data-typeface="serif"] .read-text {
  font-family: "MyBible Serif", "Noto Serif KR", Batang, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, select, input, textarea { font: inherit; }
button, select { color: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.shell {
  width: 100%; height: 100%; overflow: hidden;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  min-height: 52px; padding: 2px 8px; border-bottom: 1px solid var(--line);
  background: var(--paper);
}
h1 {
  margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 19px; color: var(--green);
}
.top-actions { display: flex; }
.bible-mode-menu { position: relative; z-index: 30; flex: none; }
.bible-mode-menu > summary {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 84px; min-height: 40px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
  color: var(--ink); cursor: pointer; font-size: clamp(11px, 3vw, 13px);
  font-weight: 700; line-height: 1.15; list-style: none; white-space: nowrap;
}
.bible-mode-menu > summary::-webkit-details-marker { display: none; }
.bible-mode-menu > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.bible-mode-menu > summary svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.bible-mode-popover {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 80;
  width: min(300px, calc(100vw - 16px)); padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}
.bible-mode-choice-group { margin: 0; }
#bible-mode-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
#bible-mode-choices .settings-choice-option { min-height: 44px; padding: 3px 5px; }
@media (max-width: 480px) {
  .bible-mode-popover {
    position: fixed; top: 58px; left: 8px; right: 8px; width: auto;
  }
}
.app-exit-button {
  flex: none; margin-inline-start: 8px; min-width: 44px; min-height: 44px; padding-inline: 7px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
  color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.app-exit-button:has(svg) {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
}
.app-exit-button svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-button {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 16px; background: transparent; color: var(--green); font-size: 24px;
}
.icon-button svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65;
  stroke-linecap: round; stroke-linejoin: round;
}
.outline {
  min-height: 48px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); padding: 6px 12px; font-weight: 650;
}
main { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; padding: 0 14px 16px; overscroll-behavior: contain; }
#panel { max-width: 42rem; margin-inline: auto; }
.notice { color: var(--muted); font-size: 12px; flex: none; }
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 13px; }
.search input, select {
  width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink); padding: 8px 11px;
}

.primary { min-height: 48px; border: 0; background: var(--selection); color: var(--on-selection); border-radius: 14px; padding: 8px 16px; font-weight: 700; }
.picker { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 9px; margin-bottom: 14px; }
.picker label { color: var(--muted); font-size: 13px; font-weight: 650; }
.picker select { display: block; margin-top: 4px; font-weight: 500; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 16px; margin: 10px 0; }
.card h2 { margin: 0 0 10px; color: var(--green); font-size: 20px; }
.card h2:last-child { margin-bottom: 0; }
main:has(.bible-passage), main:has(.worship-detail) { padding-inline: clamp(12px, 3.5vw, 24px); }
.verse {
  padding-block: .22em;
  scroll-margin: 12px;
}
.verse:target, .verse.active { background: var(--green-light); }
.number {
  display: inline-block;
  padding: 0; border: 0; background: transparent;
  color: var(--gold); font-size: 1.1em; font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: start;
  white-space: nowrap;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.bulletin-replace-confirmation { padding-block: 8px; }
#screen:not(.hide-verse-marks) .number[aria-pressed="true"] { font-weight: 900; text-decoration: underline; }
.read-text { font-size: var(--read); line-height: var(--leading); letter-spacing: var(--letter-spacing); margin: 0; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
:root[data-weight="bold"] .read-text { font-weight: 700; }
.verse-text {
  text-align: justify;
  text-align-last: start;
  word-break: normal;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}
.chapter-nav { display: flex; justify-content: space-between; gap: 10px; }
button:disabled { opacity: .5; cursor: default; }
.entry {
  display: block; width: 100%; min-height: 48px; text-align: left; border: 0;
  border-bottom: 1px solid var(--line); background: transparent; color: var(--green); font-weight: 700;
  margin: 0; padding: 10px 12px;
}
.entry:active { background: var(--green-light); }
.entry small { display: block; margin-top: 4px; color: var(--muted); font-weight: 450; overflow-wrap: anywhere; }
.worship-row { margin: 6px 0; padding: 9px 11px; }
.worship-row.people { background: var(--green-light); border-radius: 8px; }
.worship-row strong { display: block; color: var(--green); font-size: 13px; margin-bottom: 4px; }
.lyric + .lyric { margin-top: 12px; }
.lyric strong { display: block; color: var(--gold); margin-bottom: 4px; }
.status, .empty { color: var(--muted); font-size: 14px; }
.status { margin: 8px 12px; }
.bottom {
  flex-shrink: 0; width: 100%;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px 8px;
  border-top: 1px solid var(--line); background: var(--paper);
}
.bottom button {
  border: 0; background: transparent; border-radius: 18px; min-height: 48px;
  display: grid; justify-items: center; align-content: center; gap: 2px;
  min-width: 0; padding: 2px 0; color: var(--muted);
}
.bottom button[aria-current] { background: var(--selection); color: var(--on-selection); font-weight: 750; }
.bottom svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }



:root.keyboard-open .bottom { display: none; }
dialog {
  width: min(420px, calc(100% - 32px)); padding: 18px; border: 1px solid var(--line);
  border-radius: 16px; color: var(--ink); background: var(--paper); max-height: calc(100% - 24px);
}
dialog::backdrop { background: #15231db3; }
dialog h2 { color: var(--green); margin: 0 0 12px; }
dialog textarea {
  display: block; width: 100%; min-height: 100px; resize: vertical; margin: 7px 0;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px;
  color: var(--ink); background: var(--canvas);
}
.note-actions { display: flex; justify-content: space-between; gap: 8px; }
.note-actions .primary { min-height: 44px; }
.reading-card {
  padding: 4px 0 12px; margin: 0; border: 0; background: transparent;
}
.reading-card h2 { margin-top: 8px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dialog-header h2 { margin: 0; font-size: 19px; }
#search-dialog { width: min(520px, calc(100% - 24px)); }
#bible-picker, #search-dialog, #service-dialog, #bulletin-dialog {
  width: min(560px, 100%); max-width: 100%; max-height: calc(100% - 12px);
  margin: auto auto 0; border-radius: 24px 24px 0 0;
}
.setting-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 8px; align-items: center; padding: 6px 0;
}
.settings-choice-group {
  grid-column: 1 / -1; min-inline-size: 0; margin: 2px 0;
  padding: 0; border: 0;
}
.settings-choice-group legend { padding: 0; margin-bottom: 2px; font-weight: 600; }
.settings-choice-options {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5rem), 1fr));
  gap: 4px;
}
.settings-choice-option {
  position: relative; display: grid; place-items: center; min-width: 0;
  min-height: 44px; padding: 3px 4px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); cursor: pointer;
  text-align: center; font-size: .875rem; line-height: 1.25;
  word-break: keep-all; overflow-wrap: anywhere;
}
.settings-choice-option input {
  position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0;
}
.settings-choice-option:has(input:checked) {
  border-color: var(--gold); background: var(--green-light); color: var(--green);
  box-shadow: inset 0 0 0 1px var(--gold); font-weight: 700;
}
.settings-choice-option:has(input:focus-visible) { outline: 2px solid currentColor; outline-offset: -2px; }
.settings-choice-option:has(input:disabled) { opacity: .5; cursor: default; }
.size-stepper { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.size-stepper button { min-width: 40px; padding: 2px 7px; font-size: 21px; }
.size-stepper output { white-space: nowrap; font-size: 14px; font-variant-numeric: tabular-nums; }
.size-preview { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }

#bible-picker-button {
  display: flex; align-items: center; gap: 4px; width: 100%; min-height: 48px;
  padding: 0; border: 0; background: transparent; color: inherit; text-align: left;
  font-weight: inherit;
}
#chapter-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bible-picker-button svg {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
}
:is(.bible-detail, .reading-tools-active) .topbar { gap: 4px; padding-inline: 6px; }
.bible-detail .top-actions { flex: none; }
:is(.bible-detail, .reading-tools-active) .top-actions .icon-button { width: clamp(32px, 9vw, 44px); }
:is(.bible-detail, .reading-tools-active) .app-exit-button { margin-inline-start: 6px; }
.bible-detail #bible-picker-button { gap: 2px; }
.bible-detail #bible-picker-button svg { width: 12px; height: 12px; }
.bible-detail #chapter-title {
  min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.2;
}
@media (max-width: 520px) {
  .bible-detail #demo-notice { display: none; }
}
#bible-picker { padding: 8px 12px 14px; }
#bible-picker.chapter-selection {
  inset: 0;
  width: min(560px, calc(100% - 24px));
  max-height: calc(82% - 12px);
  margin: 18vh auto auto;
  border-radius: 16px;
}
.picker-header { gap: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.picker-header h2 { flex: 1; font-size: clamp(18px, 5vw, 24px); }
.picker-header .icon-button { width: 40px; height: 44px; flex: none; }
.picker-options { display: flex; gap: 3px; flex: none; }
.picker-options button {
  min-height: 38px; padding: 3px 7px; border-radius: 9px; font-size: .8125rem; white-space: nowrap;
}
.picker-options [aria-pressed="true"] {
  background: var(--green-light); color: var(--green);
}
.picker-section-header { display: flex; align-items: flex-start; gap: 10px; min-height: 34px; margin-bottom: 5px; }
#picker-books-view h3 { margin: 10px 0 5px; color: var(--green); }
#picker-books-view .picker-section-header h3 { flex: none; margin: 1px 0 0; white-space: nowrap; }
#picker-books-view h3 small { color: var(--muted); font-size: .6875rem; white-space: nowrap; }
.book-grid button[data-picker-color] { background: var(--book-fill); color: var(--book-ink); }
.book-grid button[aria-current="true"] { outline: 2px solid currentColor; outline-offset: -3px; }
.book-grid button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
.book-grid button { min-height: 44px; padding: 2px; font-size: 1.125rem; line-height: 1.2; overflow-wrap: anywhere; }
#picker-books-view.detailed .book-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  container-type: inline-size;
}
#picker-books-view.detailed .book-grid button {
  display: grid; place-items: center; min-width: 0; min-height: 55px;
}
.book-name {
  display: block; font-size: 15px;
  font-size: min(18px, calc((100cqw - 36px) / 4 / var(--book-line-length)));
  line-height: 1.17; font-weight: 750; white-space: nowrap;
}
.book-name > span { display: block; }
#picker-books-back { margin-bottom: 10px; }
.chapter-grid button { padding-inline: 4px; white-space: nowrap; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px; }
[data-picker-color="gold"] { --book-fill: #f2dfac; --book-ink: #594019; }
[data-picker-color="leaf"] { --book-fill: #e0ebc9; --book-ink: #354628; }
[data-picker-color="violet"] { --book-fill: #eadcf6; --book-ink: #4d3468; }
[data-picker-color="rose"] { --book-fill: #f3d9e3; --book-ink: #653347; }
[data-picker-color="teal"] { --book-fill: #ccebe3; --book-ink: #174842; }
[data-picker-color="blue"] { --book-fill: #d8e6fa; --book-ink: #28466e; }
[data-picker-color="indigo"] { --book-fill: #e1e1fa; --book-ink: #414272; }
[data-picker-color="rust"] { --book-fill: #f2ded4; --book-ink: #633c2e; }
[data-picker-color="olive"] { --book-fill: #e5ecc4; --book-ink: #464e21; }
[data-picker-color="neutral"] { --book-fill: #e1e8e4; --book-ink: #334840; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="gold"] { --book-fill: #544222; --book-ink: #ffe5a3; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="leaf"] { --book-fill: #344b2a; --book-ink: #ddf1bc; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="violet"] { --book-fill: #48365f; --book-ink: #eadbff; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="rose"] { --book-fill: #572f40; --book-ink: #ffdae5; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="teal"] { --book-fill: #224d49; --book-ink: #bceee1; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="blue"] { --book-fill: #293f63; --book-ink: #d1e1ff; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="indigo"] { --book-fill: #383b69; --book-ink: #e2e3ff; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="rust"] { --book-fill: #59382c; --book-ink: #ffded0; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="olive"] { --book-fill: #444c2b; --book-ink: #e5efbb; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-picker-color="neutral"] { --book-fill: #303c39; --book-ink: #dce8e1; }
.chapter-grid button[aria-current] { background: var(--green-light); }
.highlight-controls {
  display: grid; grid-template-columns: repeat(8, minmax(36px, 1fr));
  padding: 2px 4px; overflow-x: auto;
  flex-shrink: 0; background: var(--paper); border-bottom: 1px solid var(--line);
}
:root { --highlight: #ffe18a; --highlight-ink: #352601; }
:root:is([data-theme="dark"], [data-theme="black"]) { --highlight: #66501c; --highlight-ink: #fff3c6; }
.verse .read-text mark {
  padding: 1px 2px; border-radius: 3px; color: var(--highlight-ink); background: var(--highlight);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
#screen:not(.hide-verse-marks) .verse.is-highlighted .number { color: var(--highlight-ink); background: var(--highlight); }
.highlight-mode .verse-text { touch-action: none; }
.verse mark.highlight-text { background: transparent; color: inherit; padding: 0; }
#screen:not(.hide-verse-marks) .verse.is-highlighted mark.highlight-text { background: var(--highlight); color: var(--highlight-ink); }

[data-highlight-color="green"] { --highlight: #c2efa1; --highlight-ink: #213711; }
[data-highlight-color="blue"] { --highlight: #b2e0ff; --highlight-ink: #102e48; }
[data-highlight-color="pink"] { --highlight: #ffc8db; --highlight-ink: #50162b; }
[data-highlight-color="purple"] { --highlight: #e2caff; --highlight-ink: #3c2156; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="green"] { --highlight: #395825; --highlight-ink: #e6ffd2; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="blue"] { --highlight: #254d6d; --highlight-ink: #dbf3ff; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="pink"] { --highlight: #692c44; --highlight-ink: #ffe4ed; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="purple"] { --highlight: #52336f; --highlight-ink: #f4e5ff; }
[data-highlight-color="orange"] { --highlight: #ffc397; --highlight-ink: #462306; }
[data-highlight-color="red"] { --highlight: #ffa9a9; --highlight-ink: #501b1b; }
[data-highlight-color="teal"] { --highlight: #9cebdd; --highlight-ink: #103e37; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="orange"] { --highlight: #75421f; --highlight-ink: #ffe9d6; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="red"] { --highlight: #792f34; --highlight-ink: #ffe5e5; }
:root:is([data-theme="dark"], [data-theme="black"]) [data-highlight-color="teal"] { --highlight: #1e5a53; --highlight-ink: #defdf5; }
.highlight-color {
  display: grid; place-items: center; min-height: 44px;
  padding: 0; border: 0; border-radius: 8px; background: transparent;
}
.highlight-color::before {
  content: ""; grid-area: 1 / 1; width: 23px; height: 23px; border-radius: 50%;
  background: var(--highlight); border: 1px solid var(--muted);
}
.highlight-color[aria-pressed="true"]::before { outline: 2px solid var(--ink); outline-offset: 2px; }
.highlight-color[aria-pressed="true"]::after {
  content: ""; grid-area: 1 / 1; width: 5px; height: 9px;
  border: solid var(--highlight-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-1px);
}

.spacing-setting { padding-block: 6px; }
.spacing-setting label { display: flex; justify-content: space-between; gap: 8px; }
.spacing-setting output { color: var(--green); font-variant-numeric: tabular-nums; }
.spacing-setting input { width: 100%; margin: 0; min-height: 32px; accent-color: var(--green); }

.worship-detail { max-width: 48rem; margin-inline: auto; }
.worship-back { margin-bottom: 14px; }
.worship-detail .worship-row { padding: .22em 0; margin: 0; }
.worship-detail .people, .worship-detail .together { padding-inline: 8px; }
.worship-detail .read-text { line-height: var(--leading); word-break: normal; text-align: justify; text-align-last: start; }
.worship-detail .people { border-inline-start: 3px solid var(--green); }
.worship-detail .together { border-inline-start: 3px solid var(--gold); }
.worship-detail .worship-row strong { font-size: max(14px, .78em); }
.responsive-decalogue .worship-row :is(strong, .liturgy-reading) { font-weight: 400; }
.responsive-decalogue .worship-row.people :is(strong, .liturgy-reading) { font-weight: 700; }
.worship-detail .notice { margin-bottom: 10px; }
.worship-list { padding-block: 8px; }
.worship-list > .entry:first-child { background: var(--green-light); border-radius: 14px; margin-bottom: 6px; }
.worship-detail.card { padding-inline: 0; border: 0; background: transparent; }



.saved-filters, .saved-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.saved-filters { margin: 10px 0; }
.saved-filters [aria-pressed="true"] { background: var(--green-light); color: var(--green); }
.saved-entry {
  margin-bottom: 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
}
.saved-entry .entry {
  padding: 0 0 12px; border: 0; color: var(--green);
  font: 700 21px / 1.35 var(--menu-font); overflow-wrap: anywhere;
}
.saved-entry .entry small {
  color: var(--ink); font: 400 22px / 1.42 var(--menu-font);
}
.saved-actions .outline { min-height: 44px; padding: 4px 10px; font-size: 14px; }
.saved-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; color: var(--ink); }
.saved-note::before { content: "메모"; display: block; color: var(--green); font-weight: 700; }

#search-dialog.hymn-catalog[open] {
  display: flex; flex-direction: column;
  height: min(720px, calc(100% - 24px)); overflow: hidden;
}
.hymn-catalog #search-content {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.hymn-ranges {
  display: flex; flex: none; gap: 4px; overflow-x: auto; padding: 2px 2px 6px;
  overscroll-behavior-x: contain;
}
.hymn-ranges button { flex: 0 0 auto; }
.hymn-ranges [aria-pressed="true"] { background: var(--green-light); color: var(--green); }
.hymn-catalog .search { flex: none; margin: 4px 0; }
.hymn-count { flex: none; margin: 4px 0; }
.hymn-count:empty { display: none; }
.hymn-results {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
  border-top: 1px solid var(--line); padding-top: 4px; touch-action: pan-y;
}
/* The catalog has its own readable, persistent pinch-to-zoom size.
   Wrapping is allowed so long hymn titles remain visible even when enlarged. */
.hymn-catalog { --hymn-catalog-font-size: 24px; }
.hymn-catalog .dialog-header { flex: none; }
.hymn-catalog .hymn-ranges button {
  font-family: var(--menu-font);
  font-size: clamp(14px, 4.2vw, 18px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; min-width: 40px; padding-inline: 3px;
}
.hymn-catalog .search input, .hymn-catalog .search .primary {
  font-family: var(--menu-font);
  font-size: clamp(18px, calc(var(--hymn-catalog-font-size) * .88), 26px);
}
.hymn-catalog .hymn-results .entry {
  display: block; width: 100%; min-height: 64px;
  padding: 13px 12px; text-align: left;
  font: 700 var(--hymn-catalog-font-size) / 1.38 var(--menu-font);
  white-space: normal; word-break: keep-all; overflow-wrap: anywhere;
}
.hymn-catalog .hymn-results .entry small {
  font-size: .84em; line-height: 1.35; font-weight: 500;
}

.hymn-detail .topbar { min-height: 48px; gap: 2px; padding: 0 4px; }
.hymn-detail h1 { font-size: clamp(13px, 3.5vw, 18px); }
.hymn-detail .app-exit-button { margin-inline-start: 4px; }
.hymn-detail #bible-picker-button { display: none; }
.hymn-detail #section-title { display:flex; align-items:center; }
#hymn-search-button {
  display: inline-flex; align-items: center; gap: 3px; width: auto; min-width: 44px; height: 44px;
  flex: none; padding: 0 4px; border: 0; background: transparent; color: inherit;
  font-size: inherit; font-weight: inherit; white-space: nowrap;
}
#hymn-search-button svg { width: 22px; height: 22px; flex: none; }
#hymn-header-actions { display: flex; align-items: center; gap: 2px; margin-inline-end: 14px; }
.hymn-view-switch[aria-pressed="true"] { background: var(--selection); color: var(--on-selection); border-color: var(--selection); }
.hymn-view-switch {
  flex: none; min-width: 44px; min-height: 44px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  color: var(--green); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.hymn-icon { width: 44px; height: 44px; border-radius: 10px; }
.hymn-icon svg { width: 19px; height: 19px; }
.hymn-icon.hymn-accompaniment path { fill: currentColor; }
.hymn-icon:disabled { opacity: .35; cursor: default; }
.hymn-detail main { padding: 0; background: var(--paper); touch-action: pan-y; }
.hymn-detail #panel { max-width: none; }
.hymn-detail main:has(.hymn-sheet) { touch-action: none; overflow-x: auto; }
.hymn-lyrics {
  max-width: 40rem; margin-inline: auto; padding: clamp(16px, 5vw, 34px);
}
.hymn-lyrics-title { margin: 2px 0 24px; }
.hymn-lyrics .read-text { font-size: calc(var(--read) * 1.25); }
.hymn-lyrics .lyric + .lyric { margin-top: 1.15rem; }
.hymn-sheet { background: var(--paper); touch-action: none; user-select: none; -webkit-user-select: none; }
.hymn-sheet img { -webkit-touch-callout: none; }
.hymn-score { display: block; width: 100%; height: auto; }
.hymn-score-frame { position: relative; }
.hymn-image-measure {
  position: absolute; pointer-events: none; border: 2px solid var(--green);
  background: color-mix(in srgb, var(--green) 15%, transparent); border-radius: 3px;
}
.hymn-stanzas { margin: 0 0 8px; }
.hymn-sheet .hymn-stanzas { margin: 0; padding: 6px 12px; background: var(--paper); }
#hymn-player {
  flex: none; border-bottom: 1px solid var(--line); background: var(--paper);
}
.accompaniment-player {
  display: flex; align-items: center; width: 100%; min-width: 0;
  min-height: 42px; padding: 1px 5px; gap: clamp(2px, 1vw, 8px);
  flex-wrap: wrap;
}
.hymn-transport { display: flex; flex: 1; min-width: 0; gap: 3px; align-items: center; }
.hymn-transport .hymn-icon {
  flex: none; width: 36px; height: 38px; border-radius: 7px; color: var(--green);
}
.hymn-transport input {
  flex: 1; width: 100%; min-width: 0; height: 34px; margin: 0 2px;
  accent-color: var(--green);
}
.hymn-tools {
  display: flex; align-items: center; flex: none;
  padding-inline-start: 5px; border-inline-start: 1px solid var(--line);
}
.hymn-tempo-stepper { display: flex; align-items: center; gap: 3px; }
.hymn-tempo-stepper [data-tempo-step] {
  width: clamp(32px, 9vw, 40px); height: 36px; border: 0;
  font-size: 21px; border-radius: 7px; padding: 0;
}
[data-tempo-step] { touch-action: none; user-select: none; -webkit-touch-callout: none; }
.hymn-bpm {
  display: grid; align-content: center; min-width: 47px; height: 36px;
  padding: 0 2px; border: 0; background: transparent;
  color: var(--green); font-variant-numeric: tabular-nums;
}
.hymn-bpm strong { font-size: clamp(15px, 4vw, 19px); line-height: 1.05; }
.hymn-bpm small { font-size: 9px; line-height: 1.1; }
.hymn-accompaniment-status { flex-basis: 100%; }
@media (max-width: 350px) {
  .hymn-transport .hymn-icon { width: 32px; }
  .hymn-bpm { min-width: 39px; }
  .hymn-tempo-stepper [data-tempo-step] { width: 31px; }
}
.hymn-accompaniment-status { margin: 0 12px 6px; }
.accompaniment-sound { display: flex; align-items: center; gap: 8px; margin-block-end: 4px; }
.accompaniment-sound span { flex: none; font-size: .85rem; }
.accompaniment-tempo { width: 4em; min-width: 0; min-height: 40px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.accompaniment-tempo-controls { flex-wrap: nowrap; gap: clamp(3px, 1.5vw, 8px); }
.accompaniment-tempo-controls button { flex: none; width: 44px; min-height: 44px; padding: 0; }
.accompaniment-tempo-controls span { white-space: nowrap; }
.focus-exit {
  min-height: 44px; padding: 4px 12px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--paper); color: var(--green); font-size: 13px;
}
.focus-mode .bottom, .focus-mode .topbar > :not(.focus-exit, .app-exit-button) { display: none; }
.focus-mode .topbar { justify-content: flex-end; min-height: 46px; }
.service-controls { display: flex; flex: none; justify-content: center; gap: 6px; padding: 4px 8px; background: var(--paper); border-top: 1px solid var(--line); }
.service-controls { align-items: center; }
.service-controls > button { flex: none; padding-inline: 8px; }
.service-current-order {
  flex: 1; min-width: 0; font-weight: 700; color: var(--green);
  line-height: 1.2; overflow-wrap: anywhere;
}
.service-position { flex: none; white-space: nowrap; font-size: .85rem; color: var(--muted); }
.service-list { padding-inline-start: 24px; }
.service-list li { margin-bottom: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: var(--shadow); }
.service-column-headings { margin: 14px 12px 0 36px; font-size: .85rem; color: var(--muted); }
.service-list .entry { align-items: start; overflow-wrap: anywhere; }
.service-entry-detail { color: var(--ink); font-weight: 500; }
.service-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.service-feedback:empty { display: none; }
.service-order-tools { margin-block: 8px; }
.service-feedback span { flex-basis: 100%; }
.bulletin-preview { padding-inline-start: 24px; }
.bulletin-preview li { margin-block: 8px; overflow-wrap: anywhere; }
.bulletin-columns { display: grid; grid-template-columns: minmax(5.5em, 1fr) minmax(0, 2.5fr); gap: 8px; }
.bulletin-columns span { white-space: pre-wrap; }
.bulletin-preview small { display: block; color: var(--muted); }
.service-note { padding-block: 16px; }
#service-button { margin-top: 10px; }

@media (max-width: 400px) {
  .topbar .notice { display: none; }
}
@media (max-height: 320px) and (orientation: landscape) {
  #search-dialog.hymn-catalog[open] { overflow-y: auto; }
  .hymn-catalog #search-content { min-height: 180px; }
}

/* Paper and forest themes share the same navigation and reading controls. */
.topbar h1, .dialog-header h2, #picker-books-view h3,
.card h2, .saved-entry .entry strong, .service-list .entry strong,
.worship-list .entry strong {
  font-family: var(--heading);
}
.topbar .icon-button, .dialog-header .icon-button { color: var(--gold); }
:is(.bible-detail, .reading-tools-active) .topbar, .picker-header, #settings .dialog-header {
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -1px var(--canvas);
}
#settings .dialog-header { padding-bottom: 5px; }
#settings .dialog-header h2 { font-size: 23px; }
#settings .setting-row, #settings .spacing-setting, .setting-theme {
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}
.setting-theme > span { display: block; color: var(--green); font-weight: 700; margin-bottom: 7px; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.theme-options button {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 0; padding-inline: 3px; font-size: .75rem;
}
.theme-options button::before {
  content: ""; flex: none; width: 13px; height: 13px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--theme-swatch);
}
[data-theme-option="light"] { --theme-swatch: #fff; }
[data-theme-option="paper"] { --theme-swatch: #f3ead4; }
[data-theme-option="dark"] { --theme-swatch: #203229; }
.theme-options [aria-pressed="true"] {
  border-color: var(--gold); background: var(--green-light); color: var(--green);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.size-preview {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 10px; text-align: center; color: var(--green); background: var(--canvas);
}
.picker-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-block: 8px; }
.picker-toolbar .picker-options {
  min-width: 0; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas);
}
.picker-toolbar button { flex: 1; padding-inline: 4px; }
.picker-toolbar [aria-pressed="true"], .saved-filters [aria-pressed="true"],
.hymn-ranges [aria-pressed="true"] { background: var(--selection); color: var(--on-selection); }
#picker-books-view section {
  border: 1px solid var(--line); border-radius: 12px; margin-block: 8px; padding: 6px;
}
#picker-books-view section > h3 { margin: 0 0 5px; }
#picker-books-view h3 small { color: var(--gold); }
.worship-list .entry {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  margin-block: 6px; box-shadow: var(--shadow);
}
.hymn-detail main:not(:has(.hymn-sheet)) { background: var(--canvas); }
#hymn-player, .service-controls { box-shadow: inset 0 1px var(--canvas); }

#picker-books-view:not(.detailed) .book-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.picker-header, #settings .dialog-header { position: relative; }
.picker-header::after, #settings .dialog-header::after {
  content: ""; position: absolute; inset-inline-start: calc(50% - 3px); bottom: -4px;
  width: 6px; height: 6px; background: var(--paper);
  border: 1px solid var(--gold); transform: rotate(45deg); pointer-events: none;
}

/* Menu growth is independent of subsequent decreases in reading size. */
.topbar h1, .dialog-header h2, #picker-books-view h3,
.bottom button, .hymn-view-switch,
.picker-options button, .saved-filters button, .book-grid button,
.worship-list .entry, .app-exit-button, .theme-options button {
  font-family: var(--menu-font);
}
.topbar h1 { font-size: clamp(20px, calc(5vw + var(--menu-growth)), 28px); }
.hymn-detail h1 { font-size: clamp(17px, calc(4.6vw + var(--menu-growth)), 24px); }
.bottom button { font-size: clamp(11px, 3.2vw, 14px); font-weight: 700; white-space: nowrap; }
.hymn-view-switch, .app-exit-button, .focus-exit { font-size: var(--menu-compact); }
.hymn-view-switch { padding-inline: 4px; }
.app-exit-button { padding-inline: 5px; }
.picker-options button { font-size: var(--menu-compact); }
.picker-toolbar button { min-width: 0; padding-inline: 2px; }
.theme-options button {
  font-size: clamp(14px, calc(3.8vw + var(--menu-growth)), min(19px, 4.9vw));
  white-space: nowrap;
}
.saved-filters button, .saved-actions .outline, .worship-list .entry,
.service-controls button:not(.icon-button), #service-button {
  font-size: var(--menu-text); white-space: nowrap;
}
.service-current-order { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#picker-books-view:not(.detailed) .book-grid button {
  min-height: 38px; border-radius: 6px; white-space: nowrap;
  font-size: min(clamp(19px, calc(5.5vw + var(--menu-growth)), 25px), calc((min(100vw, 560px) - 96px) / 12));
}
.topbar .mark-toggle { color: var(--muted); }
.mark-toggle .mark-slash { display: none; }
.mark-toggle[aria-pressed="false"] .mark-slash { display: initial; }
.topbar .mark-toggle[aria-pressed="true"] { color: var(--green); background: var(--green-light); }
.mark-toggle[aria-pressed="true"] .mark-fill { fill: #e3b548; }
#hide-marks-button[aria-pressed="true"] .mark-fill:nth-child(2) { fill: #83b292; }
#hide-marks-button[aria-pressed="true"] .mark-fill:nth-child(3) { fill: #a2bee0; }

.picker-legend {
  display: flex; flex: 1; flex-wrap: wrap; gap: 3px 4px;
  min-width: 0; margin: 2px 0 0; padding: 0; list-style: none;
}
.picker-legend li {
  padding: 1px 4px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--book-fill); color: var(--book-ink);
  font-size: 12px; line-height: 1.25; font-weight: 700; white-space: nowrap;
}
#picker-author-note { margin: 4px 6px; }

/* Liturgical texts (Apostles' Creed, Lord's Prayer, Ten Commandments, responsive
   readings and service notes) stay Gothic regardless of the Bible typeface setting. */
:root.worship-tab #panel .worship-detail,
:root.worship-tab #panel .worship-detail h2,
:root.worship-tab #panel .worship-row,
:root.worship-tab #panel .worship-row strong,
:root.worship-tab #panel .read-text,
:root.worship-tab #panel .worship-list,
:root.worship-tab #panel .service-note,
:root.worship-tab #chapter-title {
  font-family: var(--menu-font);
}
:root.worship-tab[data-typeface="serif"] #panel .read-text {
  font-family: var(--menu-font);
}

/* Worship order editor. */
.bulletin-editor {
  list-style: decimal; padding-inline-start: 28px; margin: 8px 0 12px;
}
.bulletin-edit-row {
  margin-block: 9px; padding: 9px; border: 1px solid var(--line);
  background: var(--canvas); border-radius: 12px;
}
.bulletin-edit-fields { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 8px; }
.bulletin-edit-fields label { color: var(--muted); min-width: 0; font-size: 12px; font-weight: 650; }
.bulletin-edit-fields input, .bulletin-edit-fields textarea {
  display: block; width: 100%; min-width: 0; margin-top: 4px;
  padding: 8px 9px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.bulletin-edit-fields input { min-height: 44px; }
.bulletin-edit-fields textarea { min-height: 56px; resize: vertical; }
.bulletin-delete { min-height: 34px; padding: 3px 10px; margin-top: 6px; font-size: 13px; }
@media(max-width: 355px) { .bulletin-edit-fields { grid-template-columns: minmax(0, 1fr); } }

/* Compact view captions and balanced service navigation. */
.hymn-view-switch { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.hymn-view-label { font-size: 10px; line-height: 1.1; }
.service-controls .service-current-order { font-size: 1.12rem; }
.service-controls > .icon-button svg { width: 25px; height: 25px; }
.service-controls button:not(.icon-button) { font-size: 1rem; min-height: 40px; padding: 4px 8px; }
.service-position { font-size: 1.1rem; font-weight: 700; }

:root[data-theme="black"] {
  color-scheme: dark;
  --canvas: #000;
  --paper: #000;
  --ink: #f5f5f5;
  --muted: #c0c0c0;
  --line: #444;
  --green: #ddd;
  --green-light: #252525;
  --gold: #e0c080;
  --selection: #dedede;
  --on-selection: #000;
  --shadow: none;
}
[data-theme-option="black"] { --theme-swatch: #000; }
.theme-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.service-list li { display: list-item; position: relative; }
.service-list .entry { width: calc(100% - 58px); }
.service-list .service-delete {
  position: absolute; top: 8px; right: 8px;
  min-height: 36px; padding: 4px 8px; font-size: 14px;
}

/* Service names and details share one readable typeface. */
#service-dialog, #bulletin-dialog,
#service-dialog button, #service-dialog .entry strong,
#bulletin-dialog input, #bulletin-dialog textarea {
  font-family: Gulim, "굴림", "Noto Sans KR", sans-serif;
}
.service-list li { padding: 12px; margin-bottom: 12px; }
.service-list .entry {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; padding: 0; border: 0; border-radius: 0;
  text-align: start; line-height: 1.5;
}
.service-list .entry strong {
  display: block; width: calc(100% - 60px);
  font-size: max(20px, 1.05rem); line-height: 1.4;
  color: var(--green); font-weight: 700;
}
.service-list .service-entry-detail {
  width: 100%; font-size: max(21px, 1.1rem);
  line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere;
}
.service-entry-detail small { font-size: 14px; margin-top: 4px; }
.service-list .service-delete { top: 10px; right: 10px; }
.service-column-headings { display: none; }
.bulletin-edit-fields label { font-size: 16px; }
.bulletin-edit-fields input, .bulletin-edit-fields textarea {
  font-size: 20px; line-height: 1.5; padding: 10px;
}

.service-list .service-delete, .bulletin-delete {
  width: 40px; height: 40px; min-height: 40px;
  padding: 0; border: 0; background: transparent;
  color: var(--muted); font-size: 28px; line-height: 1;
}
.bulletin-edit-row { position: relative; padding-top: 48px; }
.bulletin-delete { position: absolute; top: 4px; right: 4px; margin: 0; }

/* Keep the service details side by side beneath a discreet delete control. */
.service-list li { padding: 24px 12px 12px; }
.service-list .entry {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: start; gap: 12px;
}
.service-list .entry strong { width: 100%; }
.service-list .service-delete {
  top: 0; right: 0; width: 32px; height: 32px; min-height: 32px;
  font-size: 16px; color: var(--muted);
}

/* Compact order cards while keeping choir names on a comfortable line. */
.service-list li { padding: 19px 10px 7px; margin-bottom: 8px; }
.service-list .entry {
  grid-template-columns: minmax(0, .8fr) minmax(0, 2.2fr);
  gap: 8px; min-height: 0; line-height: 1.35;
}
.service-list .entry strong { font-size: 18px; line-height: 1.35; }
.service-list .service-entry-detail {
  font-size: 19px; line-height: 1.4;
}

.topbar .hymn-view-switch { color: var(--ink); }
.topbar .hymn-view-switch[aria-pressed="true"] { color: var(--on-selection); }

.service-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
.service-heading { display: flex; align-items: center; min-width: 0; gap: 4px; }
.service-navigation { display: flex; align-items: center; gap: 5px; }
.service-heading .service-current-order { font-size: 16px; }
.service-heading .icon-button { flex: none; width: 30px; min-width: 30px; }
.worship-portrait-progress .app-exit-button { display: none; }
.worship-portrait-progress .service-current-order { overflow-wrap: anywhere; }
.worship-portrait-progress .service-stage-exit { flex: none; }
#picker-query { min-width: 0; width: 100%; flex: 1; font-size: 16px; padding: 8px; }
.picker-header #picker-title { flex: none; font-size: 18px; }

.service-heading .service-current-order {
  white-space: normal; overflow: visible; text-overflow: clip;
  overflow-wrap: anywhere; line-height: 1.2;
}
#picker-title:focus { outline: none; }

/* Compact reading settings with full theme previews. */
:root[data-theme="gray"] { --canvas:#edf0f2; --paper:#f3f5f6; --ink:#26323b; --muted:#53616b; --line:#bdc7cd; --green:#344d5a; --green-light:#dce4e9; --gold:#776137; }
:root[data-theme="sage"] { --canvas:#e5efdf; --paper:#edf5e7; --ink:#263c29; --muted:#52694c; --line:#bacbb0; --green:#315835; --green-light:#cfdfc5; --gold:#74602f; }
#settings .font-settings { display:grid; grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr); gap:9px; align-items:center; }
#settings select { min-width:0; }
#settings .theme-options { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
#settings .theme-options button { background:var(--preview-bg); color:var(--preview-ink); min-height:48px; font-size:14px; position:relative; padding:8px 2px; }
#settings .theme-options button::before { display:none; }
#settings .theme-options button[aria-pressed="true"] { outline:2px solid var(--gold); outline-offset:-2px; box-shadow:none; }
#settings .theme-options button[aria-pressed="true"]::after { content:'✓'; position:absolute; right:4px; top:0; font-size:12px; }
[data-theme-option="system"] { --preview-bg:#dfe5e3; --preview-ink:#243832; }
[data-theme-option="light"] { --preview-bg:#fff; --preview-ink:#232c25; }
[data-theme-option="paper"] { --preview-bg:#fffdf5; --preview-ink:#232c25; }
[data-theme-option="dark"] { --preview-bg:#203229; --preview-ink:#f4f0e5; }
[data-theme-option="black"] { --preview-bg:#000; --preview-ink:#f5f5f5; }
[data-theme-option="gray"] { --preview-bg:#f3f5f6; --preview-ink:#26323b; }
[data-theme-option="sage"] { --preview-bg:#edf5e7; --preview-ink:#263c29; }
#settings .spacing-setting { display:grid; grid-template-columns:64px minmax(0,1fr) 80px; align-items:center; gap:8px; }
#settings .spacing-setting label { white-space:nowrap; }
#settings .spacing-setting output { text-align:right; font-size:14px; }
#settings .setting-row:has(#bookmark-colors) { display:grid; grid-template-columns:1fr; gap:5px; }
#bookmark-colors { display:flex; gap:4px; justify-content:space-between; }
#bookmark-colors button { min-width:0; width:36px; min-height:40px; padding:3px; border:1px solid transparent; background:transparent; border-radius:9px; }
#bookmark-colors svg { width:24px; height:30px; }
.bookmark-shape { fill:var(--bookmark-paint); }
.bookmark-check { display:none; stroke:white; stroke-width:2.5; fill:none; }
#bookmark-colors [aria-pressed="true"] { border-color:var(--gold); }
#bookmark-colors [aria-pressed="true"] .bookmark-check { display:block; }
#settings .style-setting h3 { margin:12px 0 8px; font-size:17px; }
#playback-styles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
#playback-styles button { min-width:0; font-size:13px; padding:10px 4px; min-height:42px; }
#playback-styles button:last-child { grid-column:1/-1; }
#playback-styles [aria-pressed="true"] { border-color:var(--gold); background:var(--green-light); box-shadow:inset 0 0 0 1px var(--gold); }
#playback-styles [aria-pressed="true"]::before { content:'✓ '; }
#settings .notice { font-size:12px; text-align:center; }
/* Distinct neutral themes keep bookmark colours separate. */
:root { --score-accent:#14823c; }
:root[data-theme="light"] { --score-accent:#14823c; }
:root[data-theme="paper"] { --canvas:#dfc9a0; --paper:#ead6b0; --ink:#48351e; --muted:#715936; --line:#b4996e; --green:#594422; --green-light:#d6bb88; --gold:#785514; --score-accent:#a7570b; }
:root[data-theme="dark"] { --canvas:#101827; --paper:#19243a; --ink:#eef3ff; --muted:#b5c1db; --line:#46536a; --green:#d5e3ff; --green-light:#2a3851; --gold:#d8bd7c; --score-accent:#67e68c; }
:root[data-theme="gray"] { color-scheme:dark; --canvas:#34383f; --paper:#454b54; --ink:#fff; --muted:#d7dce3; --line:#777e88; --green:#f0f4ff; --green-light:#5b626e; --gold:#f1ce88; --selection:#ecedf0; --on-selection:#30343b; --score-accent:#84e9ff; }
:root[data-theme="sage"] { color-scheme:dark; --canvas:#35271f; --paper:#503b2f; --ink:#fff3e4; --muted:#e0c9b4; --line:#8a6e59; --green:#ffdfb7; --green-light:#6a503e; --gold:#ffd78d; --selection:#efceb2; --on-selection:#35271f; --score-accent:#ffc35f; }
:root[data-theme="black"] { --score-accent:#50bbff; }
[data-theme-option="paper"] { --preview-bg:#ead6b0; --preview-ink:#48351e; }
[data-theme-option="dark"] { --preview-bg:#19243a; --preview-ink:#eef3ff; }
[data-theme-option="gray"] { --preview-bg:#454b54; --preview-ink:#fff; }
[data-theme-option="sage"] { --preview-bg:#503b2f; --preview-ink:#fff3e4; }
#settings .settings-preview { margin-top:18px; }
#settings .settings-preview > span { font-size:14px; color:var(--muted); }
#settings .size-preview { font-size:var(--read); line-height:var(--leading); letter-spacing:var(--letter-spacing); text-align:left; background:var(--paper); color:var(--ink); padding:14px; }
#playback-styles button { display:flex; align-items:center; justify-content:center; gap:6px; }
#playback-styles svg { width:23px; height:23px; flex:none; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.score-mode-switch,.score-toolbar { display:flex; gap:7px; align-items:center; flex-wrap:wrap; padding:6px 0; }
.score-mode-switch button,.score-toolbar button { font-size:13px; min-height:36px; }
.score-mode-switch [aria-pressed="true"],.score-toolbar [aria-pressed="true"] { border-color:var(--gold); background:var(--green-light); }
.score-toolbar { position:sticky; top:0; z-index:3; background:var(--paper); }
.score-toolbar span { font-size:12px; color:var(--muted); }
.hymn-sheet:has(.dynamic-score-sheet) { background:var(--paper) !important; color:var(--ink); padding:8px; }
.dynamic-score-sheet { position:relative; width:100%; margin-inline:auto; color:var(--ink); background:var(--paper); }
.dynamic-score-sheet svg { position:relative; z-index:1; display:block; width:100%; height:auto; fill:currentColor; stroke:currentColor; stroke-width:0; overflow:visible; }
.dynamic-score-sheet svg text { font-family:Gulim,'Noto Sans KR',sans-serif; }
.dynamic-score-sheet .score-note-active,.dynamic-score-sheet .score-note-active * { color:var(--score-accent); fill:var(--score-accent); stroke:var(--score-accent); }
.score-highlight-band { position:absolute; z-index:0; pointer-events:none; border-radius:5px; background:var(--score-accent); opacity:.18; }
.dynamic-score-title { margin:6px 10px 4px; color:var(--ink); }
.dynamic-score-name { margin:0; }
.hymn-lyrics-title, .dynamic-score-name { text-align:center; font-family:var(--menu-font); font-size:clamp(28px,calc(8.2vw - 2px),36px); line-height:1.3; font-weight:800; white-space:nowrap; }
.dynamic-original-lyrics { padding:14px 8px; background:var(--paper); color:var(--ink); }
.dynamic-original-lyrics p { white-space:pre-line; }
.dynamic-score-sheet svg { color:inherit; }
@font-face { font-family:'Leipzig'; src:url('score-music.woff2') format('woff2'); font-display:swap; }
.dynamic-score-sheet .syl text, .dynamic-score-sheet .syl tspan, .dynamic-original-lyrics .read-text { font-family:'Noto Sans KR','Malgun Gothic',Gulim,sans-serif; font-weight:700; }
:root[data-theme="paper"] { --score-accent:#914300; }
.dynamic-original-lyrics h3 { font-size:18px; margin:12px 0; }
.dynamic-original-lyrics h4 { font-size:16px; color:var(--gold); margin:18px 0 6px; }
.dynamic-score-sheet .label, .dynamic-score-sheet .labelAbbr, .dynamic-score-sheet .grpSym { display:none; }
.dynamic-score-sheet .score-note-active .verse, .dynamic-score-sheet .score-note-active .verse * { color:var(--ink); fill:var(--ink); stroke:var(--ink); }
.dynamic-score-sheet .score-note-active .score-lyric-active, .dynamic-score-sheet .score-note-active .score-lyric-active * { color:var(--score-accent); fill:var(--score-accent); stroke:var(--score-accent); }
.lyric-playing { color:var(--score-accent); font-weight:800; background:color-mix(in srgb,var(--score-accent) 16%,transparent); border-radius:3px; }
.lyric-sync-note { font-size:12px; color:var(--muted); }

/* Verovio layout anchors are not printed music symbols. */
.dynamic-score-sheet .placeholder { display:none; }

.dynamic-original-lyrics .lyric-verse-playing .read-text { color:var(--score-accent); font-weight:700; }
.dynamic-score-sheet .score-lyric-active, .dynamic-score-sheet .score-lyric-active * { color:var(--score-accent); fill:var(--score-accent); stroke:var(--score-accent); }

/* PWA responsive shell, install controls, and portable reader additions. */
:root:is([data-theme="dark"],[data-theme="black"],[data-theme="gray"],[data-theme="sage"]) .hymn-score { filter: invert(1); }
.pwa-settings { border-top:1px solid var(--line); margin-top:18px; padding-top:14px; }
.pwa-settings h3 { margin:0 0 8px; color:var(--green); }
.pwa-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; margin-block:8px 12px; }
.pwa-actions .outline,.pwa-import-label { display:grid; place-items:center; text-align:center; min-height:44px; padding:7px; font-size:14px; }
.pwa-voice-setting { display:block; margin-top:8px; font-size:13px; color:var(--muted); }
#pwa-download-progress { width:100%; height:12px; margin-block:8px; accent-color:var(--green); }
#pwa-speech-button[aria-pressed="true"] { color:var(--on-selection); background:var(--selection); }
.verse.speech-active { outline:2px solid var(--gold); outline-offset:2px; border-radius:5px; }
.verse.speech-selected { outline:2px dashed var(--selection); outline-offset:2px; border-radius:5px; }
.pwa-speech-player { flex:none; display:flex; align-items:center; gap:8px; min-height:54px; padding:6px 10px; border-top:1px solid var(--line); background:var(--paper); }
.pwa-speech-detail { flex:1; min-width:0; }
.pwa-speech-detail output { display:block; font-size:.75rem; }
.pwa-speech-player span { display:block; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; font-weight:700; color:var(--green); }
.pwa-speech-player button { min-height:40px; padding:5px 12px; border:1px solid var(--line); border-radius:10px; background:var(--canvas); white-space:nowrap; }
.pwa-speech-player select { min-height:40px; max-width:90px; padding:4px 6px; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--canvas); }
@media(max-width:400px){.pwa-speech-player{gap:4px;padding-inline:6px}.pwa-speech-player span{font-size:12px}.pwa-speech-player select{max-width:72px;font-size:12px;padding-inline:3px}.pwa-speech-player button{padding-inline:7px;font-size:12px}}
html,body { min-height:100%; }
@media (min-width:760px) {
  body { display:flex; justify-content:center; }
  .shell { max-width:1120px; box-shadow:0 0 30px #0002; }
  #panel { max-width:min(72rem,94%); }
  .bottom { max-width:1120px; margin-inline:auto; width:100%; }
  main { padding-inline:clamp(22px,5vw,64px); }
}
@media (orientation:landscape) and (max-height:520px) {
  .topbar { min-height:44px; }
  .bottom button { min-height:42px; }
}



#settings { width: min(100%, 560px); margin: 0 auto; padding: 4px 12px 20px; }
.app-ended { min-height: 100%; display: grid; align-content: center; justify-items: center; padding: 24px; text-align: center; }
.app-ended h1 { white-space: normal; margin-bottom: 8px; }

.comparison-content { max-height: calc(100% - 52px); overflow: auto; padding: 8px 16px; }

.worship-draft-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.worship-draft-table th { text-align: left; }
.worship-draft-table th:first-child { width: 29%; }
.worship-draft-table td { padding-block: .25rem; }
.worship-draft-table textarea { width: 100%; min-width: 0; resize: vertical; }
#bulletin-link-original { margin-block: .75rem; }
#bulletin-link-raw { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }

.worship-source-line { white-space: break-spaces; }
#bulletin-list-heading h3 { display: flex; align-items: baseline; gap: .55em; }
#bulletin-service-date, .service-date { color: var(--muted); font-size: .78em; font-weight: 500; }
.service-date { display: block; margin-top: .2rem; }

.worship-source-preview { margin-block: .75rem; }
.worship-source-raw { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.worship-draft-table textarea {
  padding: .5rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: .5rem;
}

#bulletin-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 12px);
  overflow: hidden;
  padding-bottom: 0;
}
#bulletin-dialog .dialog-header { flex: none; margin-bottom: 0; }
#bulletin-status { flex: none; margin-block: .25rem; }
#bulletin-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.bulletin-footer {
  flex: none;
  padding-block: .5rem max(.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.bulletin-footer .service-actions { margin: 0; }
.bulletin-footer button { min-height: 42px; padding-inline: .65rem; }
.worship-draft-table textarea { min-height: 4.25rem; line-height: 1.35; }
.worship-draft-table th[scope="row"] { color: var(--green); white-space: nowrap; }
.worship-compact-stage .service-controls.in-topbar {
  flex: none; padding: 0; margin-inline-start: auto;
  border: 0; box-shadow: none; background: transparent;
}
.worship-compact-stage .service-controls .service-heading { gap: .5rem; }
.worship-compact-stage .service-position { min-width: 3.4em; }
.worship-compact-note #section-title { display: none; }
.worship-compact-stage .service-note { padding-block: clamp(.5rem, 3vh, 1rem); }
.worship-compact-stage .service-note .read-text { margin-block: 0; line-height: 1.55; }
.worship-compact-stage #panel > .notice { margin-block: .2rem .5rem; }
@media (orientation: landscape) and (min-width: 640px) and (max-height: 520px) {
  #service-dialog.today-worship-dialog { width: min(720px, 100%); }
  #service-dialog.today-worship-dialog .service-list .entry {
    display: grid;
    grid-template-columns: minmax(6.5rem, .8fr) minmax(0, 2fr);
    align-items: start;
  }
  #service-dialog.today-worship-dialog .service-list .entry strong { width: auto; }
}

.worship-draft-table textarea,
.worship-fixed-columns :is(.service-entry-detail, textarea) {
  text-align: center;
  font-weight: 700;
}
.worship-draft-table th[scope="row"] {
  font-size: 1.0625rem;
}
.bulletin-edit-fields.worship-fixed-columns { grid-template-columns: minmax(7.5rem, 1fr) minmax(0, 1.6fr); }
.bulletin-edit-fields.worship-fixed-columns input[readonly] { font-size: 20px; padding-inline: .5rem; }
.service-list .entry.worship-fixed-columns {
  display: grid;
  grid-template-columns: minmax(6rem, .8fr) minmax(0, 2fr);
  align-items: start;
}
.service-list .worship-fixed-columns > strong {
  width: auto;
  white-space: nowrap;
  font-size: max(21px, 1.1rem);
}


.service-controls.with-stage-strip {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: 0;
}
.worship-compact-stage .service-controls.in-topbar.with-stage-strip {
  flex: 1 1 19rem;
}
.with-stage-strip .service-current-order {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.service-stage-strip {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.service-stage-strip button:not(.icon-button) {
  flex: none;
  min-height: 40px;
  padding: 2px .5rem;
  font-size: .6875rem;
  white-space: nowrap;
}
.service-stage-strip .service-stage-exit { flex: none; }
.service-stage-strip [aria-current="step"] {
  color: var(--on-selection);
  background: var(--selection);
  border-color: var(--selection);
}

.service-stage-strip { scrollbar-width: thin; }
.worship-compact-stage .service-stage-strip button:not(.icon-button) { min-height: 32px; }


.bulletin-editor:has(> .bulletin-fixed-row) { padding-inline-start: 0; }
.bulletin-edit-row.bulletin-fixed-row {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  margin-block: .375rem;
  padding-block: .375rem;
  column-gap: .25rem;
  align-items: start;
}
.bulletin-row-number {
  padding-block-start: .375rem;
  line-height: 1.625rem;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.bulletin-fixed-row .bulletin-field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

#bulletin-scroll:has(.bulletin-fixed-row):not(:has(#bulletin-link-preview:not([hidden]))) {
  scrollbar-width: thin;
}
.bulletin-fixed-row :is(input[readonly], textarea) {
  box-sizing: border-box;
  margin-top: 0;
  min-height: 38px;
  padding-block: 5px;
  line-height: 26px;
}
@supports (field-sizing: content) {
  .bulletin-fixed-row textarea {
    field-sizing: content;
    resize: none;
  }
}



.pwa-voice-pack { grid-column: 1 / -1; padding: .75rem; border: 1px solid currentColor; border-radius: .6rem; min-width: 0; line-height: 1.45; }
.pwa-voice-pack p { margin: .35rem 0; font-size: .9rem; }
.pwa-voice-pack a { color: inherit; text-decoration: underline; }
.pwa-voice-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.pwa-voice-actions button, #pwa-voice { min-height: 44px; }
.pwa-voice-pack :is(output,progress):not([hidden]) { display: block; max-width: 100%; }
.pwa-voice-pack output:empty { display: none; }
.pwa-voice-pack output:not(:empty) { margin-top: .35rem; }

.pwa-update-banner {
  position: fixed;
  z-index: 2000;
  inset: auto 1rem 5rem;
  margin-inline: auto;
  width: fit-content;
  padding: .65rem 1rem;
  border-radius: .5rem;
  color: white;
  background: #1e4836;
}

#settings :is(.settings-choice-group, .web-playback-settings, .web-soundfont, .pwa-voice-pack) {
  margin: 8px 0; min-inline-size: 0; padding: 0; border: 0;
}
#settings :is(legend,h3,.pwa-voice-pack > strong) {
  padding: 0; margin: 0 0 6px; font-size: 1rem; font-weight: 700;
}
#settings .web-soundfont :is(p,label,progress) { margin: 0; text-align: start; }
#settings .web-soundfont { display: grid; gap: 6px; }
#settings :is(input[type="file"], progress) { max-width: 100%; min-width: 0; }
#settings .setting-row:has(#bookmark-colors) { grid-template-columns: minmax(0,1fr); }
#bookmark-colors { flex-wrap: wrap; }
#settings :is(.web-settings-actions, .pwa-voice-actions) {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,8rem),1fr)); gap: 4px;
}
#settings :is(.web-settings-actions, .pwa-voice-actions) > :is(label,button) {
  min-width: 0; min-height: 44px; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); text-align: center; font-size: .875rem;
  line-height: 1.25; overflow-wrap: anywhere; word-break: keep-all;
}
#settings .web-settings-actions > label { display: flex; justify-content: center; align-items: center; gap: 5px; cursor: pointer; }
#settings .web-settings-actions > label:has(input:checked),
#settings .soundfont-options > button[aria-pressed="true"] {
  border-color: var(--gold); background: var(--green-light); color: var(--green); font-weight: 700;
}
#settings .web-settings-actions > label:has(input:focus-visible) { outline: 2px solid currentColor; }
.bible-detail .top-actions #pwa-speech-button {
  flex-shrink: 0;
  width: clamp(64px, 18vw, 88px);
}
#pwa-speech-player { flex-wrap: nowrap; gap: 6px; }
#pwa-speech-player .pwa-speech-detail { flex: 1 1 0; min-width: 0; }
#pwa-speech-player select { flex: none; width: auto; max-width: none; padding-inline: 6px; font: 600 13px system-ui, "Noto Sans KR", sans-serif; }
#pwa-speech-player button { flex: none; }
.web-chapter-continue {
  --chapter-continue-bg: var(--paper);
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 44px;
  border: 1px solid #6a7772;
  border-radius: 10px;
  background: var(--chapter-continue-bg);
  color: var(--ink);
  cursor: pointer;
}
.web-chapter-continue input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.web-chapter-continue svg { pointer-events: none; }
.web-chapter-continue .chapter-continue-book { width: 32px; height: 25px; }
.web-chapter-continue .chapter-continue-check {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
}
.web-chapter-continue:has(input:checked) {
  --chapter-continue-bg: var(--selection);
  border-color: currentColor;
  color: var(--on-selection);
}
.web-chapter-continue:has(input:checked) .chapter-continue-check { display: block; }
.web-chapter-continue:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
@media (forced-colors: active) {
  .web-chapter-continue {
    --chapter-continue-bg: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    forced-color-adjust: none;
  }
  .web-chapter-continue:has(input:checked) {
    --chapter-continue-bg: Highlight;
    color: HighlightText;
  }
  .web-chapter-continue .chapter-continue-check path { stroke: Highlight; }
  .web-chapter-continue:has(input:focus-visible) { outline-color: Highlight; }
}

#playback-settings {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 16px;
  overscroll-behavior: contain;
}
.playback-settings-header {
  max-width: 42rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#playback-settings > #settings {
  max-width: 42rem;
  margin-inline: auto;
}
.edition-options{display:grid;gap:.6rem;margin:.8rem 0}.edition-option{display:flex;align-items:flex-start;gap:.7rem;padding:.75rem;border:1px solid var(--line,#d7d3c6);border-radius:.8rem;background:var(--surface,#fff)}.edition-option input{margin-top:.25rem;accent-color:#1e4836}.edition-option strong,.edition-option small{display:block}.edition-option small{margin-top:.2rem;opacity:.75;line-height:1.35}.edition-view-group{display:grid;gap:.45rem;margin:.55rem 0 1rem;padding:0;border:0}.edition-view-group legend{font-weight:700;padding:0 0 .25rem}.edition-pack-group{border-top:1px solid var(--line,#d7d3c6);padding-top:.75rem}.verse-alternate{border-inline-start:3px solid #738b78;margin:.35rem 0 .55rem 2rem;padding:.2rem .7rem}.edition-text{margin:.15rem 0 .35rem;font-family:system-ui,sans-serif}
