:root {
  --bg: #0d1f28;
  --surface: #152a35;
  --surface-2: #1b3a4b;
  --ink: #e8eef2;
  --muted: #b0c0c8;
  --gold: #e8d9a8;
  --gold-deep: #d4b56a;
  --outline: #3a5560;
  --danger: #e57373;
  --nav: rgba(13, 31, 40, 0.94);
  --radius: 16px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}
body { padding-bottom: 84px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.app-bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(13, 31, 40, 0.55), rgba(13, 31, 40, 0.72)),
    url("/icons/home_fundo.jpg") center top / cover no-repeat;
  z-index: 0;
  pointer-events: none;
}
.app-shell {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 8px 0 20px;
  min-height: 100dvh;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 12px 8px 16px;
  gap: 8px;
}
.logo {
  height: 52px;
  width: auto;
  max-width: 78%;
  object-fit: contain;
  object-position: left center;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }

.pad { padding: 0 20px; }

.verse-hero {
  margin: 0 20px;
  height: 168px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #123043 center / cover no-repeat;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.verse-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.25), rgba(0,0,0,.55));
}
.verse-hero-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.verse-hero p {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.verse-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 600;
}
.verse-hero-meta svg { width: 20px; height: 20px; }

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 20px;
}
.action-card {
  border: 0;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.action-card svg { width: 22px; height: 22px; color: var(--gold); }
.action-card span { font-weight: 600; font-size: 0.95rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 20px 10px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}
.link-gold {
  background: none;
  border: 0;
  color: var(--gold-deep);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.row-card {
  margin: 0 20px 10px;
  width: calc(100% - 40px);
  border: 0;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
}
.row-card img,
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
.row-card .txt strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}
.row-card .txt small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
}

.page-title {
  margin: 8px 20px 6px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}
.page-sub {
  margin: 0 20px 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  margin: 0 16px 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(21, 42, 53, 0.88);
  border: 1px solid rgba(58, 85, 96, 0.55);
  backdrop-filter: blur(8px);
}
.panel h3 { margin: 0 0 8px; font-size: 1.05rem; }

.btn {
  border: 0;
  border-radius: 999px;
  background: var(--gold-deep);
  color: #0d1f28;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn.ghost {
  background: transparent;
  color: #fff;
  border: 0;
  padding: 8px 4px;
}
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: rgba(13, 31, 40, 0.75);
  padding: 12px 14px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--gold-deep); }

.list { display: grid; gap: 8px; }
.list-item {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.list-item small { color: var(--muted); }
.list-item.danger strong { color: var(--danger); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--outline);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}
.chip.active {
  background: var(--gold-deep);
  color: #0d1f28;
  border-color: transparent;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.chapter-btn {
  border: 1px solid var(--outline);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border-radius: 12px;
  padding: 12px 0;
  cursor: pointer;
}

.verse-line {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(58, 85, 96, 0.35);
  cursor: pointer;
}
.verse-line .n { color: var(--gold-deep); font-weight: 700; font-size: 0.85rem; }
.verse-line .t { line-height: 1.5; color: #fff; }

.reader-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 20px 24px;
}

.auth-wrap {
  padding: 28px 20px 20px;
  min-height: 80dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-logo {
  width: min(280px, 80%);
  margin: 0 auto 18px;
  display: block;
}
.auth-card {
  background: rgba(21, 42, 53, 0.9);
  border: 1px solid rgba(58, 85, 96, 0.6);
  border-radius: 18px;
  padding: 18px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--nav);
  border-top: 1px solid rgba(58, 85, 96, 0.55);
  backdrop-filter: blur(12px);
}
.nav-btn {
  border: 0;
  background: transparent;
  color: #8eb6c8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--gold); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 40;
  background: #1c303b;
  border: 1px solid var(--outline);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  max-width: 90vw;
}

.muted { color: var(--muted); }
.ref { color: var(--gold); font-weight: 600; }
.eyebrow {
  color: var(--gold-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.graph-frame-wrap {
  margin: 0 16px 16px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(58, 85, 96, 0.55);
  background: #0b1c2c;
  height: min(58vh, 520px);
}
.graph-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0b1c2c;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 12px 8px;
}
.study-cover {
  width: 100%;
  border-radius: 14px;
  margin: 10px 0;
  display: block;
}
.study-body { line-height: 1.55; color: var(--ink); white-space: pre-wrap; }
.teacher-answer { margin-top: 4px; }
.teacher-answer .study-body { white-space: normal; }
textarea#teacherQ {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px;
}

@media (min-width: 760px) {
  .app-shell { padding-top: 16px; }
  .chapter-grid { grid-template-columns: repeat(8, 1fr); }
}
