/* Refined forest green theme */
:root {
  --brand-50:  #eef3ef;
  --brand-100: #d5e3d9;
  --brand-400: #5f9176;
  --brand-500: #3f6b52;
  --brand-600: #345a45;
  --brand-700: #2a4838;

  --bg: #f9f8f5;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #3f3f46;
  --text-muted: #71717a;
  --accent: var(--brand-500);
  --accent-hover: var(--brand-600);
  --accent-soft: var(--brand-50);
  --accent-ring: rgba(63, 107, 82, 0.22);
  --heart: #ef4444;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;
  --font-ui: 'DM Sans', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  --font-scripture: 'Literata', 'Noto Serif KR', 'Batang', 'Georgia', serif;
  --nav-h: 72px;
  --dock-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition: 0.2s ease;

  --hl-sky: #e3ede6;
  --hl-orange: #faf0e4;
  --hl-violet: #ede8f0;

  --reader-scale: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--reader-scale));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--dock-h) + 24px + var(--safe-bottom));
}

/* Main */
.main {
  flex: 1;
  padding: 12px 20px 20px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 20px 10px;
  background: var(--bg);
}

.lang-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 42px;
  padding: 0 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.version-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px;
  margin: 0;
  transition: color var(--transition), transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.version-info-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.version-info-btn:hover {
  color: var(--brand-600);
}

.version-info-btn:active {
  transform: scale(0.96);
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 42px;
  padding: 0 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.lang-option {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  height: 34px;
  min-width: 44px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), transform 0.15s ease;
}

.lang-option:hover {
  color: var(--text-secondary);
  background: var(--brand-50);
}

.lang-option:active { transform: scale(0.96); }

.lang-option.active {
  background: var(--brand-500);
  color: #fff;
}

.lang-option.active:hover {
  background: var(--brand-600);
  color: #fff;
}

.font-size-btn {
  width: 38px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.15s ease;
}

.font-size-btn:hover:not(:disabled) {
  background: var(--brand-50);
  color: var(--brand-700);
}

.font-size-btn:active:not(:disabled) { transform: scale(0.92); }

.font-size-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.font-size-indicator {
  font-family: var(--font-scripture);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  width: 22px;
  text-align: center;
  user-select: none;
}

.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-title {
  margin: 0 0 6px;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

#view-saved .view-title,
#view-journal .view-title {
  text-align: center;
  margin-bottom: 24px;
}

/* Search overlay — pill + live preview */
.search-overlay {
  border: none;
  padding: 20px;
  margin: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  transform: none;
}

.search-overlay[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-overlay::backdrop {
  background: rgba(17, 24, 39, 0.3);
  backdrop-filter: blur(8px);
}

.search-panel {
  width: min(480px, calc(100vw - 32px));
  max-height: min(85dvh, 640px);
  display: flex;
  flex-direction: column;
}

.search-overlay .search-bar {
  width: 100%;
  padding: 10px 14px 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

.search-clear {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: #f3f4f6;
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background var(--transition), color var(--transition);
}

.search-clear.hidden { display: none; }

.search-clear:hover {
  background: var(--brand-50);
  color: var(--text);
}

.search-preview {
  margin-top: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  max-height: min(50dvh, 380px);
  -webkit-overflow-scrolling: touch;
}

.search-preview.hidden { display: none; }

.search-preview-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: background var(--transition);
}

.search-preview-item:last-child { border-bottom: none; }

.search-preview-item:hover,
.search-preview-item:focus-visible {
  background: var(--brand-50);
  outline: none;
}

.search-preview-item--jump {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-preview-jump-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-600);
  flex-shrink: 0;
}

.search-preview-jump-ref {
  font-family: var(--font-scripture);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.search-preview-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.search-preview-hint,
.search-preview-empty,
.search-preview-loading {
  padding: 16px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-overlay .search-result-ref {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-600);
  margin-bottom: 4px;
}

.search-overlay .search-result-text {
  font-family: var(--font-scripture);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition);
}

.search-bar:focus-within {
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-md);
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-right: 10px;
}

.search-input {
  flex: 1;
  font-family: inherit;
  font-size: 16px;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--text-muted); }

/* Reader header */
.reader { margin-top: 4px; }

.reader-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 28px;
  width: 100%;
}

.location-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 6px;
  max-width: 100%;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.location-btn:hover {
  box-shadow: var(--shadow-md);
  background: #fff;
}

.location-btn:active { transform: scale(0.98); }

#location-label {
  font-family: var(--font-scripture);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(280px, 70vw);
}

.location-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition);
}

.location-btn:hover .location-icon { color: var(--brand-500); }

.ref-nav-card {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.ref-group {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
}

.ref-group.hidden { display: none; }

.ref-divider {
  width: 1px;
  align-self: center;
  height: 32px;
  background: var(--border-strong);
  margin: 0 4px;
  flex-shrink: 0;
}

.ref-picker {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  padding: 8px 4px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
  font-size: 0.9375rem;
  line-height: 1;
}

.ref-picker:hover { background: var(--brand-50); }

.ref-label {
  font-size: inherit;
  font-weight: 700;
  color: var(--brand-600);
  flex-shrink: 0;
  letter-spacing: 0.01em;
  user-select: none;
  line-height: inherit;
}

.ref-label-en { margin-right: 3px; }

.ref-label-ko { margin-right: 2px; }

html[lang="en"] .ref-label-ko { display: none; }

html[lang="ko"] .ref-label-en { display: none; }

.ref-value {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: inherit;
  flex-shrink: 0;
}

.ref-meta {
  font-size: inherit;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  line-height: inherit;
}

.ref-step {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.ref-step:hover:not(:disabled) {
  color: var(--brand-600);
  background: var(--brand-50);
}

.ref-step:disabled {
  opacity: 0.22;
  cursor: default;
}

.ref-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-left: 1px;
  align-self: center;
}

.ref-select-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
}

.passage {
  font-family: var(--font-scripture);
  font-size: 1.1875rem;
  line-height: 1.9;
  color: var(--text);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-y;
  transition: opacity 0.18s ease;
}

.passage.passage-switching {
  opacity: 0.45;
}

.chapter-nav {
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-family: var(--font-ui);
}

.chapter-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition), box-shadow var(--transition), transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chapter-nav-btn:not([disabled]):active {
  transform: scale(0.98);
}

.chapter-nav-btn[disabled] {
  opacity: 0.32;
  cursor: default;
  box-shadow: none;
}

.chapter-nav-next:not([disabled]) {
  background: var(--brand-500);
  color: #fff;
}

.chapter-nav-next:not([disabled]):hover {
  background: var(--brand-600);
}

.chapter-nav-prev:not([disabled]):hover {
  background: var(--brand-50);
}

.chapter-nav-label {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
}

.chapter-nav-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.verse-text {
  flex: 1;
  letter-spacing: 0.015em;
}

html[lang="ko"] .passage { line-height: 2; }
html[lang="ko"] .verse-text { letter-spacing: -0.01em; }

.passage.verse-selecting {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.verse {
  display: flex;
  gap: 14px;
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), box-shadow var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

@media (hover: hover) and (pointer: fine) {
  .verse:hover { background: var(--brand-50); }
}

.verse.focused {
  background: var(--brand-50);
  box-shadow: inset 3px 0 0 var(--brand-500);
  scroll-margin-top: 72px;
  scroll-margin-bottom: 140px;
}

.verse.focused .verse-num {
  color: var(--brand-600);
  font-weight: 700;
}

.verse.selected {
  background: var(--brand-50);
  box-shadow:
    inset 3px 0 0 var(--brand-600),
    inset 0 0 0 2px rgba(63, 107, 82, 0.28);
}

.verse[data-highlight="yellow"] { background: var(--hl-orange); }
.verse[data-highlight="pink"] { background: var(--hl-violet); }
.verse[data-highlight="blue"] { background: var(--hl-sky); }

.verse[data-highlight].focused {
  box-shadow: inset 3px 0 0 var(--brand-600);
}

.verse[data-highlight].selected {
  box-shadow:
    inset 3px 0 0 var(--brand-600),
    inset 0 0 0 2px rgba(63, 107, 82, 0.28);
}

.verse.saved-mark .verse-num::after {
  content: '♥';
  display: block;
  font-size: 0.65rem;
  color: var(--heart);
  line-height: 1;
  margin-top: 2px;
}

.verse-num {
  flex-shrink: 0;
  width: 24px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  padding-top: 6px;
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* Verse toolbar */
.verse-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 12px;
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 25;
  animation: verseToolbarIn 0.2s ease;
  min-width: min(300px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  pointer-events: auto;
}

.verse-ref-label {
  font-family: var(--font-scripture);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 2px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.verse-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.verse-toolbar.hidden { display: none; }

@keyframes verseToolbarIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.verse-toolbar.verse-toolbar--above {
  animation-name: verseToolbarInAbove;
}

@keyframes verseToolbarInAbove {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toolbar-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: #f3f4f6;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.toolbar-btn svg { width: 18px; height: 18px; }
.toolbar-btn.saved {
  color: var(--heart);
}

.toolbar-btn.saved svg {
  fill: var(--heart);
  stroke: var(--heart);
}

#verse-save:hover {
  background: #fee2e2;
  color: var(--heart);
}

#verse-copy:hover,
#verse-copy.copied {
  background: var(--brand-50);
  color: var(--brand-600);
}

.toolbar-clear {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.toolbar-clear:hover {
  background: #f3f4f6;
  color: var(--text);
}

.highlight-colors {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-dot {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}

.color-dot:hover { transform: scale(1.1); }
.color-dot.active {
  border-color: var(--text);
  transform: scale(1.08);
}

.color-dot[data-color="yellow"] { background: var(--hl-orange); }
.color-dot[data-color="pink"] { background: var(--hl-violet); }
.color-dot[data-color="blue"] { background: var(--hl-sky); }

.loading, .error-msg {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.error-msg { color: var(--heart); }

/* Cards */
.saved-list, .journal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-card {
  padding: 20px;
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.saved-card.active {
  box-shadow: var(--shadow-md);
  background: #fff;
}

.saved-card:hover, .journal-card:hover {
  box-shadow: var(--shadow-md);
}

.saved-ref {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-600);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.saved-text {
  font-family: var(--font-scripture);
  font-size: 1.0625rem;
  line-height: 1.7;
  margin-bottom: 14px;
  color: var(--text);
}

.saved-text-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-verse-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.saved-verse-num {
  flex-shrink: 0;
  min-width: 1.5em;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-600);
  padding-top: 0.2em;
  font-variant-numeric: tabular-nums;
}

.saved-verse-text {
  flex: 1;
  min-width: 0;
}

.saved-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 40px;
}

.saved-card-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.saved-card.active .saved-card-actions {
  display: flex;
}

.saved-action-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: #f3f4f6;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.saved-action-btn svg {
  width: 18px;
  height: 18px;
}

.saved-action-btn.copy-btn:hover,
.saved-action-btn.copy-btn.copied {
  background: var(--brand-50);
  color: var(--brand-600);
}

.saved-action-btn.del-btn:hover {
  background: #fef2f2;
  color: var(--heart);
}

.journal-card {
  padding: 20px;
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  cursor: pointer;
}

.journal-card:hover {
  box-shadow: var(--shadow-md);
}

.journal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  margin-top: 14px;
}

.journal-card-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.journal-card.active .journal-card-actions {
  display: flex;
}

.journal-card.editing {
  cursor: default;
}

.journal-card.editing .journal-card-actions {
  display: flex;
}

.journal-edit-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.7;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
  outline: none;
}

.journal-edit-input:focus {
  outline: none;
}

.saved-action-btn.edit-btn:hover,
.saved-action-btn.save-btn:hover {
  background: var(--brand-50);
  color: var(--brand-600);
}

.saved-action-btn.cancel-btn:hover {
  background: #f3f4f6;
  color: var(--text-secondary);
}

.card-actions { display: flex; gap: 6px; }

.text-btn {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius);
  background: #f3f4f6;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.text-btn:hover {
  background: var(--brand-50);
  color: var(--brand-600);
}

.text-btn.danger:hover {
  background: #fef2f2;
  color: var(--heart);
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  border-radius: var(--radius-xl);
  color: var(--brand-400);
}

.empty-state-icon svg { width: 24px; height: 24px; }

/* Journal */
.journal-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.65;
  padding: 18px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  resize: vertical;
  min-height: 140px;
  margin-bottom: 12px;
  color: var(--text);
  transition: box-shadow var(--transition);
}

.journal-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-sm);
}

.journal-input::placeholder { color: var(--text-muted); }

.primary-btn {
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand-500);
  color: #fff;
  cursor: pointer;
  margin-bottom: 28px;
  transition: background var(--transition), transform var(--transition);
}

.primary-btn:hover { background: var(--brand-600); }
.primary-btn:active { transform: scale(0.98); }

.journal-date {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.journal-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* Modal */
dialog:not([open]) {
  display: none;
}

.version-overlay,
.book-overlay {
  border: none;
  padding: 20px;
  margin: 0;
  background: transparent;
  box-shadow: none;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  max-height: none;
}

.version-overlay[open],
.book-overlay[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-overlay::backdrop,
.book-overlay::backdrop {
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(4px);
}

.version-panel {
  width: min(440px, calc(100vw - 32px));
}

.book-panel {
  width: min(560px, calc(100vw - 24px));
  max-height: min(720px, calc(100dvh - 32px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  box-shadow: var(--shadow-lg);
  background: var(--bg-elevated);
}

.modal::backdrop {
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: #f3f4f6;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--brand-50);
  color: var(--text);
}

.version-modal {
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.version-modal-body {
  padding: 0 20px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.version-info-block {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.version-info-block:first-child {
  border-top: none;
  padding-top: 0;
}

.version-info-block h4 {
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--brand-600);
}

.version-info-block p {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.version-info-block p:last-child {
  margin-bottom: 0;
}

.version-info-source {
  margin-top: 12px !important;
  font-size: 0.8125rem !important;
  color: var(--text-muted) !important;
}

.version-info-link-wrap {
  margin-top: 10px !important;
}

.version-info-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-600);
  text-decoration: none;
}

.version-info-link:hover {
  text-decoration: underline;
}

.testament-tabs {
  display: flex;
  gap: 6px;
  background: #f3f4f6;
  margin: 0 20px 16px;
  border-radius: var(--radius-full);
  padding: 4px;
}

.tab {
  flex: 1;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.book-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.book-item {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 12px 10px;
  border: none;
  border-radius: var(--radius);
  background: #f9fafb;
  cursor: pointer;
  text-align: left;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.book-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}

/* Bottom nav — Instagram-style floating pill */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 0 20px calc(10px + var(--safe-bottom));
  pointer-events: none;
}

.bottom-nav-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  height: 56px;
  padding: 0 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  color: #a8a8a8;
  transition: color var(--transition), transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active { transform: scale(0.92); }

.nav-icon {
  width: 26px;
  height: 26px;
  display: block;
}

.nav-icon--filled { display: none; }

.nav-item[data-view="read"].active {
  color: var(--brand-600);
}

.nav-item[data-view="read"].active .nav-icon--outline {
  display: block;
  stroke-width: 2.5;
}

.nav-item[data-view="read"].active .nav-icon--filled {
  display: none;
}

.nav-item[data-view="saved"].active {
  color: var(--heart);
}

.nav-item[data-view="journal"].active {
  color: var(--brand-600);
}

.nav-item.active:not([data-view="read"]) .nav-icon--outline { display: none; }
.nav-item.active:not([data-view="read"]) .nav-icon--filled { display: block; }

#search-nav-btn.active {
  color: var(--brand-600);
}

#search-nav-btn.active .nav-icon {
  stroke-width: 2.5;
}

/* Mobile top controls */
@media (max-width: 599px) {
  .top-bar {
    padding: calc(8px + var(--safe-top)) 16px 8px;
  }

  .main {
    padding: 10px 16px 16px;
  }

  .lang-switch {
    height: 36px;
    padding: 0 2px;
    box-shadow: none;
    border: 1px solid var(--border);
  }

  .lang-option {
    height: 30px;
    min-width: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .version-info-icon {
    width: 16px;
    height: 16px;
  }

  .book-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .font-size-control {
    height: 36px;
    padding: 0 4px;
    gap: 0;
    box-shadow: none;
    border: 1px solid var(--border);
  }

  .font-size-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .font-size-indicator {
    font-size: 13px;
    min-width: 16px;
  }
}

/* Desktop */
@media (min-width: 600px) {
  .main { padding: 16px 32px 28px; }
  .top-bar { padding: calc(12px + var(--safe-top)) 32px 12px; }
  #location-label { font-size: 1.4375rem; }
  .passage { font-size: 1.3125rem; line-height: 1.9; }
  .verse-ref-label { font-size: 1.5rem; }
  .book-list { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav-pill { max-width: 400px; }
  .nav-icon { width: 24px; height: 24px; }
}
