/* ============================================
   ОБЩЕМОСКОВСКИЙ КРЕСТНЫЙ ХОД — ПЕСНОПЕНИЯ
   Дизайн: molitva.app × Paula Scher
   (Monumental Typography, Collapsible Search & Filters, Parallel View)
   ============================================ */

:root {
  --bg-deep: #0b0b16;
  --bg-surface: #121222;
  --bg-card: #18182d;
  --bg-card-hover: #22223d;
  --bg-card-active: #292949;

  --accent: #c9a84c;
  --accent-light: #e6c86e;
  --accent-dim: #997b30;
  --accent-glow: rgba(201, 168, 76, 0.16);
  --accent-glow-strong: rgba(201, 168, 76, 0.3);

  --text-primary: #eeebe6;
  --text-secondary: #a8a7be;
  --text-muted: #6e6d85;

  --border: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-accent: rgba(201, 168, 76, 0.28);
  --border-accent-strong: rgba(201, 168, 76, 0.6);

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --detail-font-size: 1.125rem;
}

/* --- Resets --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

/* Utilities */
::selection {
  background-color: var(--accent);
  color: var(--bg-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Screens */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen--active {
  display: block;
  animation: screenIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ============================================
   HEADER & PAULA SCHER TYPOGRAPHY
   ============================================ */

.header {
  position: relative;
  background: linear-gradient(180deg, rgba(11, 11, 22, 0.98) 0%, rgba(14, 14, 28, 0.94) 80%, rgba(11, 11, 22, 0.7) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: calc(var(--safe-top) + 20px) 20px 14px;
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.header__title-block {
  margin-bottom: 18px;
  padding-left: 2px;
}

.header__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 6px;
}

.header__badge-count {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(201, 168, 76, 0.1);
  color: var(--accent);
  border: 1px solid var(--border-accent);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.header__title {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 8vw, 4.2rem);
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
  line-height: 0.96;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  /* Paula Scher: bold, graphic presence */
}

.header__subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.86rem, 2.3vw, 1rem);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 600px;
}

/* ============================================
   TRIGGER BAR (COMPACT TOGGLE & TOC)
   ============================================ */

.search-filter-trigger-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-filter-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-filter-toggle-btn:hover {
  background: var(--bg-card);
  border-color: var(--border-accent);
}

.search-filter-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-filter-toggle-btn[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.toggle-btn-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.toggle-icon-search {
  color: var(--accent);
  flex-shrink: 0;
}

.toggle-label {
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.active-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--bg-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

.toggle-btn-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.toggle-chevron {
  transition: transform var(--transition);
}

.quick-toc-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 76, 0.08);
  border: 1.5px solid var(--border-accent);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-toc-btn:hover {
  background: rgba(201, 168, 76, 0.18);
  transform: translateY(-1px);
}

/* ============================================
   COLLAPSIBLE SEARCH & FILTER PANEL (DROPS DOWN)
   ============================================ */

.search-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  padding: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: panelDrop 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelDrop {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-filter-panel[hidden] {
  display: none !important;
}

/* Search input inside panel */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-container:focus-within .search-icon {
  color: var(--accent);
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 44px 13px 48px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.96rem;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.search-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .filters-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .filters-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.filter-select {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.filter-select:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select option {
  background: #18182d;
  color: #eeebe6;
  padding: 8px;
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
  transition: transform var(--transition-fast);
}

/* Panel Footer */
.filter-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.filter-panel-summary {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.filter-panel-summary strong {
  color: var(--accent-light);
  font-size: 0.94rem;
}

.filter-panel-actions {
  display: flex;
  gap: 8px;
}

.panel-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.panel-btn--reset {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.panel-btn--reset:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.panel-btn--apply {
  background: var(--accent);
  border: none;
  color: var(--bg-deep);
}

.panel-btn--apply:hover {
  background: var(--accent-light);
}

/* ============================================
   ACTIVE FILTERS BAR (SHOWN UNDER TOGGLE)
   ============================================ */

.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.active-filters-label {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.active-filters-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  border: 1px solid var(--border-accent);
}

.active-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 2px;
}

.active-tag button:hover {
  color: #ff6b6b;
}

/* ============================================
   FEATURED LITURGICAL HERO BANNER: МОЛИТВОСЛОВ
   ============================================ */

.featured-book-banner {
  position: relative;
  max-width: 860px;
  margin: 18px auto 0;
  padding: 0 20px;
  cursor: pointer;
}

.featured-book__inner {
  position: relative;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.16) 0%, rgba(26, 26, 48, 0.96) 50%, rgba(16, 16, 32, 0.98) 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 168, 76, 0.25);
  overflow: hidden;
  transition: all var(--transition);
}

.featured-book-banner:hover .featured-book__inner {
  transform: translateY(-2px);
  border-color: var(--accent-light);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5), 0 0 24px var(--accent-glow-strong);
}

.featured-book__glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.featured-book__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.featured-book__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--bg-deep);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.cross-icon {
  font-size: 0.9em;
}

.featured-book__tag {
  font-size: 0.72rem;
  color: var(--accent-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.featured-book__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4.5vw, 1.95rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.featured-book-banner:hover .featured-book__title {
  color: var(--accent-light);
}

.featured-book__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  max-width: 680px;
}

.featured-book__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(201, 168, 76, 0.2);
}

.featured-book__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
}

.featured-book-banner:hover .featured-book__btn {
  color: var(--accent-light);
  transform: translateX(3px);
}

.featured-book__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Featured card in hymn list */
.hymn-card--featured {
  border: 2px solid var(--accent) !important;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.14) 0%, rgba(26, 26, 48, 0.98) 100%) !important;
  padding: 20px !important;
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.15) !important;
}

.hymn-card--featured .hymn-card__title {
  color: var(--accent-light) !important;
  font-size: clamp(1.2rem, 3.2vw, 1.45rem) !important;
}

/* ============================================
   LITURGICAL FORMATTING FOR МОЛИТВОСЛОВ
   ============================================ */

.liturgical-anchors-bar {
  position: sticky;
  top: 56px;
  z-index: 80;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  background: rgba(11, 11, 22, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin-bottom: 24px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-accent);
}

.liturgical-anchors-bar::-webkit-scrollbar {
  display: none;
}

.liturgical-anchor-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.liturgical-anchor-chip:hover {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}

.liturgical-part-header {
  margin: 36px 0 16px;
  padding: 14px 18px;
  background: rgba(201, 168, 76, 0.09);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.liturgical-part-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 800;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.liturgical-subheading {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin: 24px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-accent);
}

.rubric {
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.03em;
  display: inline-block;
  margin-right: 4px;
}

.rubric--priest {
  color: #ff6b6b; /* киноварь священника */
}

.rubric--deacon {
  color: #df9eff; /* диакон */
}

.rubric--choir {
  color: var(--accent-light); /* хор и народ */
}

.rubric--exclamation {
  color: #ffa94d;
}

.rubric--verse {
  color: var(--accent-dim);
  font-style: italic;
}

.saint-entry {
  padding: 7px 12px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-xs);
  border-left: 2px solid var(--border-accent);
  font-size: 0.95em;
  line-height: 1.6;
}

.saint-date {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(201, 168, 76, 0.16);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}

/* ============================================
   HYMN LIST & CARDS (EDITORIAL REDESIGN)
   ============================================ */

.hymn-list {
  padding: 20px 20px 140px;
  max-width: 860px;
  margin: 0 auto;
}

.section-group {
  margin-bottom: 38px;
}

.section-header-wrap {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg-deep);
  padding: 14px 0 10px;
  border-bottom: 2px solid var(--border-accent);
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  font-family: var(--font-display);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.2;
}

.section-count {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Hymn Card */
.hymn-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 16px 20px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  text-align: left;
  width: 100%;
}

.hymn-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.4);
  transition: all var(--transition-fast);
}

.hymn-card:hover, .hymn-card:focus-visible {
  transform: translateX(4px);
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.hymn-card:hover::before, .hymn-card:focus-visible::before {
  opacity: 1;
  transform: scaleY(1);
}

.hymn-card:active {
  transform: scale(0.99) translateX(4px);
}

/* Card Header */
.hymn-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hymn-card__index {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dim);
  letter-spacing: 0.06em;
}

/* Card Title */
.hymn-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.06rem, 2.5vw, 1.26rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.32;
  letter-spacing: 0.01em;
  transition: color var(--transition-fast);
}

.hymn-card:hover .hymn-card__title {
  color: var(--accent-light);
}

/* Badges / Tags */
.hymn-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}

.hymn-tag {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}

.hymn-tag--glas {
  background: rgba(201, 168, 76, 0.12);
  color: var(--accent);
  border-color: var(--border-accent);
}

.hymn-tag--dual {
  background: rgba(201, 168, 76, 0.18);
  color: var(--accent-light);
  border-color: var(--border-accent-strong);
}

.hymn-tag--cs {
  color: var(--text-muted);
}

/* Lyric Snippet */
.hymn-card__snippet {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 2px;
  border-top: 1px solid var(--border-subtle);
}

.hymn-card__snippet mark {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 500;
}

/* Stagger animations for cards */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.hymn-card {
  animation: cardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.hymn-card:nth-child(1) { animation-delay: 0.02s; }
.hymn-card:nth-child(2) { animation-delay: 0.05s; }
.hymn-card:nth-child(3) { animation-delay: 0.08s; }
.hymn-card:nth-child(4) { animation-delay: 0.11s; }
.hymn-card:nth-child(5) { animation-delay: 0.14s; }
.hymn-card:nth-child(6) { animation-delay: 0.17s; }
.hymn-card:nth-child(7) { animation-delay: 0.20s; }
.hymn-card:nth-child(8) { animation-delay: 0.23s; }

/* Search Results State */
.hymn-list--searching .section-group {
  display: none;
}
.hymn-list--searching .search-results {
  display: block;
}

.search-results {
  display: none;
}

.search-summary-count {
  font-size: 0.86rem;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.search-empty__icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: block;
}

/* ============================================
   FLOATING QUICK NAVIGATION BAR ON SCROLL
   ============================================ */

.floating-nav {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  background: rgba(18, 18, 34, 0.88);
  border: 1px solid var(--border-accent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 168, 76, 0.15);
  animation: floatIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 90vw;
}

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

.floating-nav[hidden] {
  display: none !important;
}

.floating-nav__pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  max-width: 240px;
}

.floating-nav__pill:hover {
  color: #fff;
}

.floating-nav__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-nav__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floating-nav__btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.floating-nav__btn:hover {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}

/* ============================================
   MODALS / BOTTOM SHEETS: ОГЛАВЛЕНИЕ
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 22px calc(var(--safe-bottom) + 24px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
  .modal-sheet {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--border-accent);
    padding: 28px;
    max-height: 80vh;
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* TOC Items List */
.toc-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.92rem;
}

.toc-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  color: var(--accent-light);
  transform: translateX(3px);
}

.toc-item__title {
  font-weight: 500;
  line-height: 1.35;
}

.toc-item__count {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(201, 168, 76, 0.12);
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================
   DETAIL SCREEN (PRESERVED BEAUTY + IMPROVEMENTS)
   ============================================ */

.detail-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-top) + 12px) 20px 12px;
  background: rgba(11, 11, 22, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  background: none;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px 6px 0;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.back-btn:hover {
  color: var(--accent-light);
  transform: translateX(-2px);
}

/* Language switch tabs: ЦСЯ | Рус | Параллельно */
.lang-tabs {
  display: flex;
  flex-direction: row;
  gap: 3px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.lang-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.lang-tab:hover:not(.lang-tab--active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.lang-tab--active {
  background: var(--accent);
  color: var(--bg-deep);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

/* Font Size Controls */
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.font-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.font-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Detail Content */
.detail-content {
  padding: 32px 20px 140px;
  max-width: 760px;
  margin: 0 auto;
}

.meta-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.meta-badge {
  display: inline-block;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.detail-title {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 24px;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.detail-text {
  font-family: var(--font-body);
  font-size: var(--detail-font-size);
  line-height: 1.95;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.detail-text mark {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Paula Scher Drop-Cap */
.detail-text--has-dropcap::first-letter {
  font-family: var(--font-display);
  font-size: 3.4em;
  font-weight: 900;
  color: var(--accent);
  float: left;
  line-height: 0.8;
  margin-right: 12px;
  margin-top: 6px;
}

/* ============================================
   PARALLEL VIEW: ЦСЯ & РУССКИЙ
   ============================================ */

.parallel-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 6px;
}

.parallel-column {
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.parallel-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-accent);
}

.parallel-text {
  font-family: var(--font-body);
  font-size: var(--detail-font-size);
  line-height: 1.9;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Detail Navigation (Prev / Next) */
.detail-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px calc(var(--safe-bottom) + 14px);
  background: linear-gradient(to top, var(--bg-deep) 70%, transparent);
  pointer-events: none;
  z-index: 90;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent-light);
  transform: translateY(-2px);
}

.nav-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.detail-counter {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================
   RESPONSIVE / MEDIA QUERIES
   ============================================ */

@media (min-width: 768px) {
  .header {
    padding: calc(var(--safe-top) + 32px) 40px 18px;
  }

  .hymn-list {
    padding: 28px 40px 140px;
  }

  .detail-header {
    padding: calc(var(--safe-top) + 18px) 40px 14px;
  }

  .detail-content {
    padding: 44px 40px 140px;
    max-width: 860px;
  }

  .parallel-view {
    flex-direction: row;
    gap: 20px;
  }

  .parallel-column {
    flex: 1;
    min-width: 0;
  }

  .detail-nav {
    padding: 20px 40px calc(var(--safe-bottom) + 20px);
    max-width: 860px;
    margin: 0 auto;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .header, .search-filter-trigger-bar, .search-filter-panel, .floating-nav, .active-filters-bar, .detail-header, .detail-nav, .modal-overlay {
    display: none !important;
  }
  .hymn-list, .detail-content {
    padding: 0;
    max-width: none;
  }
  .hymn-card {
    break-inside: avoid;
    border: 1px solid #ddd;
    background: none;
    color: #000;
  }
  .detail-title {
    color: #000;
  }
  .detail-text {
    color: #000;
  }
}

/* ============================================
   PWA INSTALL TOOLTIP (molitva.app style)
   ============================================ */

.pwa-install-tooltip {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  width: calc(100% - 32px);
  max-width: 480px;
  background: rgba(18, 18, 36, 0.96);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px var(--accent-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: tooltipSlideUp 0.36s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

@keyframes tooltipSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(120%);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.pwa-install-tooltip[hidden] {
  display: none !important;
}

.pwa-tooltip-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.pwa-tooltip-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 2;
}

.pwa-tooltip-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.pwa-tooltip-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.pwa-tooltip-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.pwa-tooltip-body {
  flex: 1;
  padding-right: 20px;
}

.pwa-tooltip-title {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  margin-bottom: 6px;
}

.pwa-tooltip-title strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
}

.pwa-tooltip-title span {
  font-size: 0.8rem;
  color: var(--accent-light);
}

.pwa-tooltip-guide {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.ios-instruction {
  margin-top: 4px;
}

.ios-inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
  vertical-align: middle;
}

.pwa-tooltip-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.pwa-install-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  border: none;
  color: var(--bg-deep);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(201, 168, 76, 0.35);
}

.pwa-install-action-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

/* Header install button */
.header-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 76, 0.12);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-install-btn:hover {
  background: var(--accent);
  color: var(--bg-deep);
  transform: translateY(-1px);
}

.header-install-btn[hidden] {
  display: none !important;
}
