:root {
  --blue: #3880ff;
  --blue-dark: #3171e0;
  --green: #2dd36f;
  --green-dark: #28ba62;
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #e4e7ee;
  --bg: #f4f5f8;
  --sidebar: 272px;
  --shadow: 0 8px 24px rgba(28, 36, 48, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

img, iframe, video, svg { max-width: 100%; }

a { color: var(--blue); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
}

body.menu-open .sidebar { transform: none; }

.brand {
  background: linear-gradient(160deg, #b9a4ef 0%, #7d62d6 48%, #8ea2f6 100%);
  padding: 18px 16px 14px;
}

.brand img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: 12px;
  background: #8d74dc;
}

.brand p {
  margin: 10px 0 0;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(40, 20, 80, 0.35);
}

.side-nav {
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 4px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #243041;
  font-weight: 600;
  padding: 12px 12px;
  border-radius: 8px;
}

.side-nav a svg { flex: 0 0 auto; color: #616e7e; }

.side-nav a.active,
.side-nav a:hover {
  background: rgba(56, 128, 255, 0.14);
  color: var(--blue-dark);
}

.side-nav a.active svg,
.side-nav a:hover svg { color: var(--blue); }

.side-nav .logout { margin-top: 8px; color: #8a3d4b; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 38, 0.4);
  z-index: 35;
}

.backdrop[hidden] { display: none; }

.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.icon-btn, .menu-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #243041;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover, .menu-btn:hover { background: #eef1f6; }

.questions-btn {
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.questions-btn:hover { background: var(--blue-dark); }

.content {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 32px;
  flex: 1;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.crumbs a { text-decoration: none; font-weight: 600; }

.hero, .panel {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 16px;
}

.hero h2 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 1.25rem;
}

.hero .sub { color: #243041; font-weight: 600; margin: 0 0 10px; }

.hero p:last-child { margin-bottom: 0; }

.videos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.video-card {
  background: var(--blue);
  color: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #10233f;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-card h3 {
  margin: 0;
  padding: 12px 14px 14px;
  font-size: 1rem;
  font-weight: 650;
}

.panel h2 { margin: 0 0 8px; color: var(--blue); font-size: 1.2rem; }

.panel h2 a { text-decoration: none; }

.events { list-style: none; margin: 0; padding: 0; }

.events li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.events li:last-child { border-bottom: 0; }

.events .year { font-weight: 800; padding-top: 12px; }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.card-media-link { display: block; color: inherit; }

.card-media {
  display: block;
  position: relative;
  background: #eceff6;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body { padding: 12px 14px 0; flex: 1; }

.card-body h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--blue);
}

.card-body h2 a { color: inherit; text-decoration: none; }

.desc {
  margin: 0;
  color: #3d4b5c;
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 14px;
  border: 0;
}

.btn:hover { background: var(--blue-dark); }

.play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
}

.play:hover { background: var(--green-dark); }

.play svg { width: 18px; height: 18px; margin-left: 2px; }

.play.sm { width: 34px; height: 34px; }

.play.sm svg { width: 14px; height: 14px; }

.sheet { display: flex; flex-direction: column; gap: 10px; }

.sheet-head, .sheet-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.sheet-head { font-weight: 800; color: #243041; }

.col-label {
  font-weight: 800;
  color: var(--blue-dark);
  font-size: 0.92rem;
}

.row-label {
  font-weight: 800;
  text-align: center;
  padding-top: 6px;
}

.cell { list-style: none; margin: 0; padding: 0; min-width: 0; }

.cell li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f2f6;
  min-width: 0;
}

.cell li:last-child { border-bottom: 0; }

.cell span { min-width: 0; overflow-wrap: anywhere; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 18px 12px 28px;
}

.popover {
  position: fixed;
  z-index: 70;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  min-width: min(280px, calc(100vw - 16px));
  padding: 6px;
}

.popover[hidden] { display: none; }

.popover button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.popover button:hover { background: #f3f5f9; }

.popover button svg { width: 22px; height: 22px; flex: 0 0 auto; }

.popover button[data-audio] svg { color: var(--green); }

.popover button[data-written] svg { color: #eb445a; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(209, 213, 219, 0.92);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 12px 28px;
  overflow: auto;
}

.modal[hidden] { display: none; }

.dialog {
  width: min(800px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.dialog-head {
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 12px 12px 16px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.05rem;
  flex: 1;
  min-width: 0;
}

.dialog-head button {
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font: inherit;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}

.dialog-body { padding: 16px 18px 22px; }

.dialog-body audio { width: 100%; margin: 8px 0 12px; }

.note { color: var(--muted); font-size: 0.92rem; }

.prayer-body p { margin: 0 0 0.7em; }

.missing {
  background: #fff7e8;
  border: 1px solid #f0d7a2;
  border-radius: 10px;
  padding: 12px 14px;
}

.q-list { list-style: none; margin: 0; padding: 0; }

.q-list > li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.q-list h3 { margin: 0 0 8px; font-size: 1.05rem; }

.q-list h4 { margin: 0 0 8px; font-size: 0.98rem; color: #334155; }

.chips, .q-items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.chips a, .chip {
  display: inline-flex;
  text-decoration: none;
  background: #e8f0ff;
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 0.92rem;
}

.q-items { display: block; }

.q-items li {
  padding: 4px 0 4px 14px;
  position: relative;
}

.q-items li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--blue);
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 14px;
  background:
    radial-gradient(900px 420px at 50% -10%, #d9ccfb, transparent 60%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-card .brand { padding-bottom: 18px; }

.login-card form { padding: 18px 18px 22px; }

.login-card h1 { margin: 0 0 6px; font-size: 1.35rem; }

.login-card p { margin: 0 0 14px; color: var(--muted); }

label { display: block; font-weight: 700; margin-bottom: 6px; }

input[type="password"] {
  width: 100%;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  padding: 12px 12px;
  font: inherit;
  margin-bottom: 12px;
}

input[type="password"]:focus {
  outline: 2px solid rgba(56, 128, 255, 0.35);
  border-color: var(--blue);
}

.submit {
  width: 100%;
  border: 0;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 800;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
}

.submit:hover { background: var(--blue-dark); }

.error {
  background: #fde8ea;
  color: #9f1239;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

@media (min-width: 700px) {
  .videos { grid-template-columns: 1fr 1fr; }
  .sheet-head, .sheet-row {
    grid-template-columns: 76px repeat(var(--cols, 2), minmax(0, 1fr));
    align-items: start;
  }
  .col-label { display: none; }
  .sheet-head .col-label, .sheet-head .row-label { display: block; }
}

@media (max-width: 699px) {
  .sheet-head { display: none; }
}

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

@media (min-width: 801px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--sidebar); }
  .menu-btn, .backdrop { display: none; }
  .content { width: min(1120px, calc(100% - 40px)); }
}

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

@media (min-width: 1400px) {
  .cards { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .content { width: min(1280px, calc(100% - 48px)); }
}
