:root {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --bg-light: #f8fafc;
  --bg-dark: #0f172a;
  --text-light: #1e293b;
  --text-dark: #e2e8f0;
  --card-light: rgba(255, 255, 255, 0.85);
  --card-dark: rgba(30, 41, 59, 0.85);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg-light);
  color: var(--text-light);
  transition: background 0.4s, color 0.4s;
  min-height: 100vh;
}

.dark-mode {
  background: var(--bg-dark);
  color: var(--text-dark);
}

.hero {
  position: relative;
  height: 60vh;
  min-height: 450px;
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80') center/cover;
  opacity: 0.35;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 20px;
  animation: fadeUp 1.2s ease-out;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3.5rem, 8vw, 7rem);
  margin: 0;
  text-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.hero p {
  font-size: 1.5rem;
  margin-top: 1rem;
  opacity: 0.9;
}

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

.container {
  max-width: 1100px;
  margin: -100px auto 60px;
  padding: 0 20px;
}

.glass {
  background: var(--card-light);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.18);
  transition: transform 0.3s;
}

.dark-mode .glass {
  background: var(--card-dark);
}

.auth-card, .controls {
  margin-bottom: 2rem;
}

input, select {
  padding: 1rem;
  margin: 0.5rem;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.4);
  color: inherit;
  font-size: 1.1rem;
  min-width: 220px;
}

button {
  padding: 1rem 2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(109,40,217,0.3);
}

#loading {
  text-align: center;
  padding: 4rem 0;
  font-size: 1.3rem;
  animation: pulse 2s infinite;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(109,40,217,0.2);
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.results {
  display: grid;
  gap: 1.5rem;
}

.highlight {
  background: rgba(109, 40, 217, 0.2);
  padding: 0 4px;
  border-radius: 6px;
}

.verse-card {
  background: var(--card-light);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.8rem;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.4s ease;
  animation: slideUp 0.6s ease-out;
}

.dark-mode .verse-card {
  background: var(--card-dark);
}

.verse-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.verse-card strong {
  color: var(--primary);
  font-size: 1.4rem;
  display: block;
  margin-bottom: 0.8rem;
}

.easy-explain {
  margin-top: 0.8rem;
  padding: 0.7rem;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.12);
  font-size: 0.95rem;
}

.topic-explain {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(109, 40, 217, 0.12);
  font-weight: 600;
  text-align: center;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.context-block,
.chapter-block {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(109, 40, 217, 0.08);
  max-height: 280px;
  overflow: auto;
}

.chapter-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.context-line {
  padding: 0.3rem 0;
}

.guidance {
  margin-top: 1.2rem;
  padding: 1rem;
  background: rgba(109,40,217,0.08);
  border-radius: 10px;
  font-style: italic;
}

.context-note {
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.study-tools,
.sermon-builder {
  margin-top: 2.5rem;
}

.section-note {
  color: #64748b;
  margin: 0.5rem 0 1.5rem;
}

.study-grid,
.sermon-grid {
  display: grid;
  gap: 1.5rem;
}

.study-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.study-card {
  background: rgba(255, 255, 255, 0.6);
  padding: 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
}

.list {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255,255,255,0.6);
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.empty {
  color: #94a3b8;
  text-align: center;
}

.prompts {
  margin: 0;
  padding-left: 1.2rem;
}

.sermon-grid input,
.sermon-grid textarea {
  width: 100%;
  margin: 0.3rem 0 0.8rem;
}

.sermon-full {
  grid-column: 1 / -1;
}

.sermon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.chapter-reader,
.pastor-resources {
  margin-top: 2.5rem;
}

.reader-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.reader-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chapter-output {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  max-height: 420px;
  overflow: auto;
}

.template-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.template-card {
  background: rgba(255,255,255,0.6);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  display: grid;
  gap: 0.6rem;
}

.dark-mode .guidance {
  background: rgba(165,180,252,0.1);
}

.dark-mode .study-card,
.dark-mode .list-item,
.dark-mode .context-block,
.dark-mode .chapter-block,
.dark-mode .chapter-output,
.dark-mode .template-card {
  background: rgba(30, 41, 59, 0.6);
}

.coloring-stories {
  margin-top: 2.5rem;
}

.coloring-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.coloring-canvas-wrap {
  margin-top: 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.6);
  padding: 1rem;
  overflow: auto;
}

#coloring-canvas {
  display: block;
  width: 100%;
  max-width: 900px;
  background: #fff;
  border-radius: 12px;
}

.dark-mode .coloring-canvas-wrap {
  background: rgba(30, 41, 59, 0.6);
}

.dashboard,
.church-center {
  margin-top: 2.5rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-content {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1.2rem;
}

.dashboard-card {
  background: rgba(255,255,255,0.6);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  display: grid;
  gap: 0.6rem;
}

.church-search {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.featured-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.featured-item {
  background: rgba(255,255,255,0.6);
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  display: grid;
  gap: 0.4rem;
}

.church-admin {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.2);
}

.dark-mode .dashboard-card,
.dark-mode .church-center,
.dark-mode .church-admin,
.dark-mode .featured-item {
  background: rgba(30, 41, 59, 0.6);
}

footer {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

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

@media (max-width: 768px) {
  .hero { height: 45vh; min-height: 300px; }
  h1 { font-size: 2.8rem; }
  .container { margin-top: -60px; }
}