/* ========================================
   Ora — App de prière & vie spirituelle
   Design system contemplatif
   ======================================== */

:root {
  --color-primary: #1a472a;
  --color-primary-light: #2d6a3f;
  --color-bg: #fafaf5;
  --color-surface: #ffffff;
  --color-text: #2c1810;
  --color-text-secondary: #6b5b4f;
  --color-border: #e8e0d0;
  --color-accent: #c9b037;
  --liturgical-color: #4a7c59;
  --nav-height: 64px;
  --header-height: 56px;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --font-prayer: 'EB Garamond', Georgia, serif;
  --font-ui: 'Inter', system-ui, sans-serif;
  --gradient-bg: none;
}

/* Theme: Dark */
.dark {
  --color-primary: #0f2b1a;
  --color-primary-light: #1a472a;
  --color-bg: #1a1a1a;
  --color-surface: #252525;
  --color-text: #e8e0d0;
  --color-text-secondary: #a89888;
  --color-border: #3a3a3a;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Theme: Sepia */
.sepia {
  --color-bg: #f4eddd;
  --color-surface: #faf6ee;
  --color-text: #4a3728;
  --color-text-secondary: #7a6a58;
  --color-border: #d4c8b0;
}

/* Theme: Liturgical */
.liturgical {
  --color-primary: var(--liturgical-color);
}

/* Theme: Night (OLED) */
.night {
  --color-bg: #000;
  --color-surface: #0a0a0a;
  --color-text: #d4a855;
  --color-text-secondary: #8a7a55;
  --color-border: #1a1a1a;
  --color-primary: #1a1a1a;
}

.night .autoscroll-bar {
  background: rgba(10, 10, 10, 0.92);
}

.night .autoscroll-start {
  background: rgba(10, 10, 10, 0.92);
}

/* ========================================
   Liturgical season gradients
   ======================================== */
.season-advent { --gradient-bg: linear-gradient(180deg, #1a1a3e 0%, #2d1b4e 100%); }
.season-christmas { --gradient-bg: linear-gradient(180deg, #faf8f0 0%, #f0e6c8 100%); }
.season-lent { --gradient-bg: linear-gradient(180deg, #f5f0e8 0%, #e8ddd0 100%); }
.season-easter { --gradient-bg: linear-gradient(180deg, #fefcf0 0%, #f8f0d8 100%); }
.season-ordinary { --gradient-bg: linear-gradient(180deg, #fafaf5 0%, #f0efe8 100%); }
.season-easter_triduum { --gradient-bg: linear-gradient(180deg, #1a1a1a 0%, #2a1a1a 100%); }

/* Adapt text for dark season backgrounds (not when dark/night theme) */
.season-advent:not(.dark):not(.night) {
  --color-text: #e0dce8;
  --color-text-secondary: #a09ab0;
}
.season-easter_triduum:not(.dark):not(.night) {
  --color-text: #e8e0d0;
  --color-text-secondary: #a89888;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-primary);
  color: white;
  padding: 12px 16px;
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.app-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-style: italic;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header-date {
  font-size: 0.8rem;
  opacity: 0.85;
  text-transform: capitalize;
}

/* Main */
.app-main {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  background: var(--gradient-bg, var(--color-bg));
  min-height: calc(100dvh - var(--header-height) - var(--nav-height));
}

.view {
  animation: fadeIn 0.25s ease;
  transition: opacity 0.25s, transform 0.25s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Today Card */
.today-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.today-season {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.today-celebration {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.today-saint {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 8px;
}

.today-color-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  color: white;
  font-size: 0.75rem;
  text-transform: capitalize;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.action-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}

.action-card:active { transform: scale(0.97); }
.action-icon { font-size: 1.8rem; }
.action-label { font-size: 0.85rem; font-weight: 600; }
.action-hint { font-size: 0.75rem; color: var(--color-text-secondary); }

/* Plan de vie */
.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.plan-quick {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.plan-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: opacity 0.2s;
}

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

.plan-item-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.plan-item-row:last-child { border-bottom: none; }
.plan-item-row.completed { opacity: 0.5; }
.plan-item-row.completed .plan-name { text-decoration: line-through; }

.norm-go-btn {
  background: none;
  border: none;
  color: var(--liturgical-color);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.norm-go-btn:hover { opacity: 1; }
.plan-item.completed { opacity: 0.5; }
.plan-item.completed .plan-name { text-decoration: line-through; }

.plan-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--liturgical-color);
}

.plan-icon { font-size: 1.2rem; }
.plan-name { font-size: 0.9rem; }

.plan-progress { margin-top: 12px; display: flex; align-items: center; gap: 10px; }

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--liturgical-color);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-weight: 600;
  min-width: 30px;
}

/* View header */
.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.view-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.back-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px 8px;
}

/* Hours grid */
.hours-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.hour-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.hour-card.current {
  border-color: var(--liturgical-color);
  background: color-mix(in srgb, var(--liturgical-color) 8%, var(--color-surface));
}

.hour-icon { font-size: 1.5rem; }
.hour-name { font-size: 0.85rem; font-weight: 600; }
.hour-time { font-size: 0.75rem; color: var(--color-text-secondary); }

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.setting-item label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.setting-item select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active { opacity: 0.8; }

.hint {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 8px;
  text-align: center;
}

/* Placeholder */
.placeholder-content {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.bottom-nav button {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.bottom-nav button.active {
  color: var(--liturgical-color);
}

.nav-icon {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label { font-size: 0.65rem; font-weight: 600; }

/* Breviary sections */
.breviary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.breviary-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-small {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--color-text);
  white-space: nowrap;
}

.btn-small:disabled {
  opacity: 0.4;
  cursor: default;
}

.breviary-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.breviary-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease both;
}

.breviary-section:nth-child(1) { animation-delay: 0s; }
.breviary-section:nth-child(2) { animation-delay: 0.04s; }
.breviary-section:nth-child(3) { animation-delay: 0.08s; }
.breviary-section:nth-child(4) { animation-delay: 0.12s; }
.breviary-section:nth-child(5) { animation-delay: 0.16s; }
.breviary-section:nth-child(6) { animation-delay: 0.2s; }
.breviary-section:nth-child(7) { animation-delay: 0.24s; }
.breviary-section:nth-child(8) { animation-delay: 0.28s; }
.breviary-section:nth-child(9) { animation-delay: 0.32s; }
.breviary-section:nth-child(10) { animation-delay: 0.36s; }
.breviary-section:nth-child(n+11) { animation-delay: 0.4s; }

.section-title-bar {
  margin-bottom: 8px;
}

.section-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--liturgical-color);
}

.section-rubric {
  font-size: 0.85rem;
  color: #b22222;
  font-style: italic;
  margin-bottom: 8px;
  font-variant: small-caps;
  letter-spacing: 0.03em;
}

.section-content {
  font-family: var(--font-prayer);
  font-size: 1.05rem;
  line-height: 1.75;
}

.section-content .versicle-mark {
  font-weight: 700;
  color: var(--liturgical-color);
}

.section-reference {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 8px;
  font-style: italic;
}

.section-opening { border-left: 3px solid var(--liturgical-color); }
.section-hymn { border-left: 3px solid #c9b037; }
.section-psalm { border-left: 3px solid var(--color-primary); }
.section-reading { border-left: 3px solid #b22222; }
.section-responsory { border-left: 3px solid #6b3fa0; }
.section-canticle { border-left: 3px solid #c9b037; }
.section-intercessions { border-left: 3px solid var(--liturgical-color); }
.section-collect { border-left: 3px solid var(--color-primary); }
.section-antiphon { border-left: 3px solid var(--liturgical-color); }

/* Antiphons: tinted background + slide-in */
.section-antiphon {
  background: color-mix(in srgb, var(--liturgical-color) 6%, var(--color-surface));
  animation: slideInLeft 0.35s ease both;
}

/* Psalm: poetic indent */
.section-psalm .section-content {
  padding-left: 1em;
}

/* Versicle marks: V/ bold liturgical, R/ normal */
.section-content .versicle-v {
  font-weight: 700;
  color: var(--liturgical-color);
}
.section-content .versicle-r {
  font-weight: 400;
}

/* Prayer list */
.prayer-category {
  margin-bottom: 20px;
}

.prayer-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--color-surface);
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 14px 16px;
  cursor: pointer;
  color: var(--color-text);
  font-size: 0.9rem;
  text-align: left;
}

.prayer-list-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.prayer-list-item:last-child { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.prayer-list-item:only-child { border-radius: var(--radius); }

.prayer-list-item .arrow {
  color: var(--color-text-secondary);
  font-size: 1.2rem;
}

.prayer-text {
  font-family: var(--font-prayer);
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  line-height: 1.8;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.prayer-latin {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  font-style: italic;
  opacity: 0.85;
  line-height: 1.8;
}

.prayer-latin h4 {
  font-style: normal;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.action-card.wide {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
}

/* Readings (Mass) */
.readings-list {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.reading-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

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

.reading-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reading-ref {
  font-size: 0.9rem;
  font-weight: 500;
}

.mass-saint {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}

.saint-bio {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-top: 8px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tabs button {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: background 0.2s, color 0.2s;
}

.tabs button.active {
  background: var(--liturgical-color);
  color: white;
}

/* Journal */
.journal-input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  line-height: 1.6;
  margin-bottom: 12px;
}

.journal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn.active {
  background: var(--liturgical-color);
  color: white;
  border-color: var(--liturgical-color);
}

/* Norm editing */
.norm-edit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.norm-edit-item:last-child { border-bottom: none; }

.norm-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.norm-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--liturgical-color);
}

.norm-delete {
  background: none;
  border: none;
  color: #b22222;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
}

.norm-delete:hover { opacity: 1; }

.add-norm-form {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

/* Exam */
.exam-intro {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
}

.exam-intro p {
  margin-bottom: 20px;
  font-style: italic;
  line-height: 1.6;
}

.exam-progress {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 16px;
}

.exam-question {
  font-family: var(--font-prayer);
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.7;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-nav {
  display: flex;
  gap: 12px;
}

.exam-nav .btn-primary { flex: 2; }
.exam-nav .btn-small { flex: 1; }

/* Editorial */
.editorial-card {
  margin-top: 20px;
}

.editorial-quote {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--color-accent);
}

.editorial-quote blockquote {
  font-family: var(--font-prayer);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 8px;
}

.editorial-quote cite {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-align: right;
}

.editorial-meditation {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.meditation-text {
  font-family: var(--font-prayer);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
}

/* TTS controls */
.tts-controls {
  margin-bottom: 16px;
}

.btn-tts {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-tts:active { opacity: 0.8; }

.tts-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.btn-tts-small {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.btn-tts-small:active { background: var(--color-border); }

.tts-info {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.breviary-section.tts-active {
  outline: 2px solid var(--liturgical-color);
  outline-offset: 2px;
  transition: outline 0.3s;
}

/* Meditation timer */
.meditation-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.meditation-duration {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.meditation-duration label {
  font-size: 0.9rem;
  font-weight: 600;
}

.meditation-duration select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
}

.meditation-active {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 40px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.meditation-timer {
  font-size: 3.5rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  animation: pulse 2s ease-in-out infinite;
}

.meditation-hint {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 20px;
}

/* ========================================
   Auto-scroll control bar
   ======================================== */

.autoscroll-bar {
  position: fixed;
  bottom: calc(var(--nav-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 150;
  max-width: calc(100% - 32px);
  width: auto;
}

.dark .autoscroll-bar {
  background: rgba(37, 37, 37, 0.88);
}

.as-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  flex-shrink: 0;
}

.as-btn:active { background: var(--color-border); }

.as-stop {
  font-size: 1.2rem;
  font-weight: 700;
  color: #b22222;
}

.as-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.as-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
}

.as-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--liturgical-color);
  cursor: pointer;
}

.as-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--liturgical-color);
  cursor: pointer;
  border: none;
}

.as-speed-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 34px;
  text-align: center;
}

.as-progress-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 28px;
  text-align: right;
}

/* Auto-scroll start button */
.autoscroll-start {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  cursor: pointer;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text);
  transition: transform 0.2s;
}

.dark .autoscroll-start {
  background: rgba(37, 37, 37, 0.88);
}

.autoscroll-start:active { transform: scale(0.9); }

.as-start-icon {
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ========================================
   Account section in Settings
   ======================================== */

.account-section {
  margin-top: 8px;
}

.account-stats {
  padding: 12px !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--liturgical-color);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setting-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: inherit;
}

.setting-input:focus {
  outline: none;
  border-color: var(--liturgical-color);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:active { background: var(--color-border); }

.btn-danger {
  width: 100%;
  padding: 12px;
  background: #b22222;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:active { opacity: 0.8; }

/* ========================================
   Feedback widget
   ======================================== */

.feedback-widget {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  z-index: 140;
}

.feedback-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.feedback-trigger:active { transform: scale(0.9); }

.feedback-popup {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 160;
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.feedback-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.feedback-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 0 4px;
}

.feedback-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.feedback-star {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-border);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.feedback-star.active {
  color: #c9b037;
}

.feedback-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.feedback-textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--color-bg);
  color: var(--color-text);
  resize: vertical;
  margin-bottom: 10px;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--liturgical-color);
}

.feedback-submit {
  font-size: 0.85rem;
  padding: 10px;
}

.feedback-thanks {
  text-align: center;
  padding: 20px 0;
  color: var(--liturgical-color);
  font-weight: 600;
}

/* AELF credit */
.aelf-credit {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  margin-top: 20px;
  padding: 8px;
  opacity: 0.7;
}

.aelf-credit a {
  color: var(--liturgical-color);
  text-decoration: none;
  font-weight: 600;
}

/* Mass readings (full text from AELF) */
.mass-readings-full {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mass-reading-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.reading-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.reading-intro {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 10px;
}

.reading-body {
  font-family: var(--font-prayer);
  font-size: 1.05rem;
  line-height: 1.75;
}

.reading-refrain {
  margin-top: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--liturgical-color) 8%, var(--color-surface));
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive */
@media (min-width: 768px) {
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .hours-grid { grid-template-columns: repeat(4, 1fr); }
}
