:root {
  --blue: #006184;
  --blue-deep: #004b66;
  --blue-soft: #e6f2f7;
  --paper: #ffffff;
  --page: #f2f2f7;
  --ink: #1c1c1e;
  --ink-soft: #6c6c70;
  --line: #e5e5ea;
  --danger: #c62828;
  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-read: "Source Serif 4", "New York", "Iowan Old Style", Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  overflow-x: clip;
  max-width: 100%;
}
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
a { color: var(--blue); }
img { max-width: 100%; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: 100%;
  background: var(--blue);
  color: #fff;
  padding: 10px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.header-back {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  margin-left: -6px;
}
.header-back img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  display: block;
}
.app-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--blue-deep);
  border: 1px solid rgba(255,255,255,.18);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.app-icon img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
  display: block;
}
.header-text { min-width: 0; flex: 1; }
.app-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .sub {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: .9;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 16px calc(110px + var(--safe-b));
}
@media (min-width: 720px) {
  .wrap { max-width: 720px; }
}

.hero-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 100%;
}
.hero-card .kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.hero-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero-card .meta {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}
.hero-card .meta strong { color: var(--ink); font-weight: 600; }

.meeting-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.meeting-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.meeting-row:last-child { border-bottom: 0; }
.meeting-row .info { flex: 1; min-width: 0; }
.meeting-row .date {
  display: block;
  font-size: 17px;
  font-weight: 600;
}
.meeting-row .type {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--ink-soft);
}
.meeting-row .who {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-soft);
}
.meeting-row .chev {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .4;
  filter: invert(40%);
}

.section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 12px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
.section.is-now {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 0;
}
.section-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.section-body { padding: 8px 16px 16px; }
.section h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}
.script {
  margin: 0;
  font-family: var(--font-read);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  max-width: 68ch;
  overflow-wrap: anywhere;
}
@media (min-width: 768px) {
  .script { font-size: 28px; line-height: 1.4; }
}

.ann-list { list-style: none; margin: 0; padding: 0; }
.ann-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 0 0 8px;
  background: var(--paper);
}
.ann-open {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.ann-open .title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ann-open .chev {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .4;
  filter: invert(40%);
}
.ann-empty {
  padding: 8px 0 4px;
  color: var(--ink-soft);
  font-size: 15px;
}
.ann-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.hymn-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
  max-width: 100%;
}
.hymn-open {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.hymn-open:disabled { opacity: 1; cursor: default; }
.hymn-open .num {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
}
.hymn-open .title {
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.hymn-open .hint {
  font-size: 13px;
  color: var(--ink-soft);
}
.hymn-open .tbd {
  font-style: italic;
  color: var(--ink-soft);
  font-weight: 500;
}
.icon-btn {
  width: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.icon-btn img {
  width: 20px;
  height: 20px;
  display: block;
  filter: invert(28%) sepia(67%) saturate(1200%) hue-rotate(166deg) brightness(90%);
}
.icon-btn.ghost {
  background: transparent;
  border-left: 0;
}
.icon-btn.danger img {
  filter: invert(22%) sepia(80%) saturate(2500%) hue-rotate(348deg) brightness(90%);
}

.blank-field {
  min-height: var(--tap);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fafafa;
  width: 100%;
  max-width: 100%;
}
.blank-field strong { color: var(--ink); font-weight: 600; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 0 8px;
  min-height: var(--tap);
}
.list .topic {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  color: var(--ink-soft);
}

.now-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + var(--safe-b));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.now-bar .label { min-width: 0; flex: 1; }
.now-bar .label span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.now-bar .label strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-row { display: flex; gap: 8px; flex-shrink: 0; }
.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 16px;
  border-radius: 980px;
  border: 0;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:disabled { opacity: .35; cursor: default; }
.btn-secondary {
  background: var(--blue-soft);
  color: var(--blue);
}
.btn-secondary:disabled { opacity: .35; cursor: default; }
.btn-danger {
  background: #fdecea;
  color: var(--danger);
}

/* Sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  width: 100%;
  max-width: 100%;
  height: min(88vh, 820px);
  max-height: min(88vh, 820px);
  background: var(--page);
  border-radius: 16px 16px 0 0;
  transform: translateY(110%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  overflow: hidden;
}
.sheet.open { transform: translateY(0); }
.sheet-grab {
  width: 36px; height: 5px;
  border-radius: 99px;
  background: #c7c7cc;
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.sheet-top {
  padding: 8px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.sheet-top h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  flex: 1;
  min-width: 0;
}
.sheet-top-spacer {
  display: inline-block;
  min-width: 88px;
  text-align: right;
}
#sheet-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-search {
  margin: 0 16px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  min-height: var(--tap);
  flex-shrink: 0;
}
.sheet-search img {
  width: 18px; height: 18px;
  opacity: .45;
}
.sheet-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  min-height: var(--tap);
  font-size: 17px;
}
.sheet-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.sheet-group {
  position: sticky;
  top: 0;
  background: var(--page);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.sheet-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}
.sheet-item .n {
  width: 52px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--blue);
}
.sheet-item .t { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.sheet-item .b { font-size: 12px; color: var(--ink-soft); }

.segmented {
  display: flex;
  margin: 0 16px 12px;
  padding: 3px;
  background: #e5e5ea;
  border-radius: 10px;
  flex-shrink: 0;
}
.segmented button {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.segmented button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.picker-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.picker-pane[hidden] { display: none !important; }

.wheel-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 16px 8px;
}
.wheel-books {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.wheel-books button {
  flex: 1;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 980px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.wheel-books button.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}
.wheel-columns {
  position: relative;
  flex: 1;
  min-height: 180px;
  max-height: 260px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.wheel-fade-t,
.wheel-fade-b {
  position: absolute;
  left: 0; right: 0;
  height: 56px;
  z-index: 2;
  pointer-events: none;
}
.wheel-fade-t {
  top: 0;
  background: linear-gradient(to bottom, #fff 20%, rgba(255,255,255,0));
}
.wheel-fade-b {
  bottom: 0;
  background: linear-gradient(to top, #fff 20%, rgba(255,255,255,0));
}
.wheel-center {
  position: absolute;
  left: 8px; right: 8px;
  top: 50%;
  height: 40px;
  margin-top: -20px;
  border-radius: 8px;
  background: var(--blue-soft);
  z-index: 0;
  pointer-events: none;
}
.wheel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-pad {
  height: calc(50% - 20px);
  flex-shrink: 0;
  scroll-snap-align: none;
}
.wheel-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  scroll-snap-align: center;
}
.wheel-item.is-sel { color: var(--ink); }
.wheel-selected {
  flex-shrink: 0;
  text-align: center;
  padding: 12px 8px 4px;
}
.wheel-selected .num {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
}
.wheel-selected .title {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
}

.preview-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}
.preview-actions .btn { flex: 1; }

.edit-pad {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.edit-field {
  width: 100%;
  max-width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-read);
  font-size: 18px;
  resize: vertical;
}
.edit-input {
  width: 100%;
  max-width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.reader {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 20px;
}
.reader h3 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
}
.reader .script { font-size: 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: rgba(28,28,30,.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
