/* =========================================================
   «МОЙ ХРАМ» — вариант A «Ночная классика»
   тёмно-синий · золото · засечки PT Serif
   ========================================================= */
:root {
  --navy: #0E2A52;
  --navy-deep: #0A1F3E;
  --card: #163A6B;
  --card-2: #1B4579;
  --line: rgba(212, 168, 87, 0.28);
  --gold: #D4A857;
  --gold-soft: #E3C27F;
  --cream: #E8E0CC;
  --muted: #A9B4C7;
  --danger: #E58F7A;
  --radius: 14px;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
  --sans: "PT Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--navy);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--cream); }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; }

/* ---------- каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(10, 31, 62, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .back { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; color: var(--gold); }
.topbar .back[hidden] { display: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
.brand .t1 { font-family: var(--serif); letter-spacing: .18em; font-size: 14px; color: var(--gold); }
.brand .t2 { font-size: 11px; color: var(--muted); }
.topbar .title { font-family: var(--serif); font-size: 18px; flex: 1; }
.cart-btn { position: relative; margin-left: auto; width: 40px; height: 40px; display: grid; place-items: center; color: var(--gold); }
.cart-btn .badge {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--gold); color: var(--navy);
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.cart-btn .badge[hidden] { display: none; }

.desk-nav { display: none; }

main { max-width: 1080px; margin: 0 auto; padding: 16px 16px 96px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* нижнее меню (мобильное) */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--navy-deep);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 7px; font-size: 11px; color: var(--muted);
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--gold); }

/* ---------- общие элементы ---------- */
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.label {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 8px;
}
.muted { color: var(--muted); font-size: 14px; }
.ornament { text-align: center; color: var(--gold); letter-spacing: .5em; margin: 14px 0; font-size: 13px; }
.ornament::before, .ornament::after { content: ""; display: inline-block; width: 60px; height: 1px; background: var(--line); vertical-align: middle; margin: 0 10px; }
.section-title { font-size: 26px; margin: 4px 0 4px; }
.section-sub { color: var(--muted); margin-bottom: 16px; font-size: 14px; }
.note {
  border-left: 3px solid var(--gold);
  background: rgba(212,168,87,0.08);
  padding: 10px 12px; border-radius: 0 10px 10px 0;
  font-family: var(--serif); font-style: italic; font-size: 14px;
  margin-bottom: 14px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px; border-radius: 12px;
  background: var(--gold); color: var(--navy); font-weight: 700;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold); font-weight: 400; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  width: 100%; text-align: left;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--card-2); }
.list-item .ico {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center; color: var(--gold);
}
.list-item .ico svg { width: 18px; height: 18px; }
.list-item .txt { flex: 1; min-width: 0; }
.list-item .txt b { display: block; font-family: var(--serif); font-weight: 400; font-size: 16px; }
.list-item .txt span { font-size: 13px; color: var(--muted); }
.list-item .chev { color: var(--muted); }
.list-item .price { color: var(--gold); font-family: var(--serif); white-space: nowrap; }

/* ---------- главная ---------- */
.hero { text-align: center; padding: 8px 0 4px; }
.hero .logo { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; box-shadow: 0 0 40px rgba(244,160,40,.35); }
.hero h1 { letter-spacing: .22em; color: var(--gold); font-size: 22px; }
.hero p { color: var(--muted); font-size: 13px; }
.quote { margin-top: 16px; border: 1px solid var(--line); background: rgba(22,58,107,.6); }
.quote blockquote { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.5; }
.quote cite { display: block; text-align: right; color: var(--gold); font-size: 13px; margin-top: 8px; font-style: normal; }
.today { text-align: center; margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.today b { color: var(--gold-soft); font-weight: 400; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.tile {
  background: var(--card); border-radius: var(--radius); padding: 16px 14px;
  min-height: 104px; display: flex; flex-direction: column; justify-content: space-between;
  text-align: left; border: 1px solid rgba(255,255,255,0.05);
}
.tile:hover { background: var(--card-2); }
.tile svg { width: 24px; height: 24px; color: var(--gold); }
.tile span { font-size: 15px; line-height: 1.25; }
.home-grid { display: grid; gap: 12px; }
.gospel h3 { font-size: 18px; margin-bottom: 6px; }
.gospel p { font-family: var(--serif); font-size: 15px; }
.more { display: inline-block; margin-top: 10px; color: var(--gold); font-size: 14px; }

/* ---------- о храме ---------- */
.photo-ph {
  aspect-ratio: 16/10; border: 1px dashed var(--line); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 12px, transparent 12px 24px);
  margin-bottom: 16px; text-align: center; padding: 10px;
}
.prose p { font-family: var(--serif); font-size: 16px; margin-bottom: 12px; }
.facts { display: grid; gap: 10px; margin-top: 12px; }
.fact { display: flex; gap: 10px; font-size: 14px; }
.fact b { color: var(--gold); font-weight: 400; min-width: 130px; }

.main-photo { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); margin-bottom: 16px; display: block; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.g-item { aspect-ratio: 1; overflow: hidden; border-radius: 8px; padding: 0; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.g-item:hover img { transform: scale(1.04); }
.carousel { position: fixed; inset: 0; z-index: 90; background: #050C1A; }
.c-track {
  display: flex; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.c-track::-webkit-scrollbar { display: none; }
.c-slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; padding: 56px 12px; scroll-snap-align: center; }
.c-slide img { max-width: 100%; max-height: 100%; border-radius: 8px; user-select: none; -webkit-user-drag: none; }
.c-count {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  color: var(--cream); font-size: 14px; letter-spacing: .08em; opacity: .85;
}
.c-close { position: absolute; top: 8px; right: 14px; font-size: 34px; color: var(--cream); padding: 4px 8px; }
.c-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(232, 224, 204, .12); color: var(--cream); font-size: 28px; line-height: 1;
  display: none;
}
.c-prev { left: 16px; } .c-next { right: 16px; }
@media (hover: hover) and (pointer: fine) { .c-nav { display: grid; place-items: center; } }

/* ---------- расписание ---------- */
.day { margin-bottom: 10px; }
.day h3 { font-size: 16px; color: var(--gold-soft); margin-bottom: 6px; }
.svc { display: flex; gap: 14px; padding: 4px 0; font-size: 15px; }
.svc time { color: var(--gold); font-family: var(--serif); min-width: 48px; }

/* ---------- формы треб ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  flex: 1 1 auto; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); font-size: 14px;
}
.seg button.on { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }
.field { margin-top: 16px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--navy-deep); border: 1px solid rgba(255,255,255,0.1);
  outline: none;
}
.input:focus { border-color: var(--gold); }
.names { display: grid; gap: 8px; }
.name-row { display: flex; align-items: center; gap: 8px; }
.name-row .n { width: 18px; color: var(--muted); font-size: 13px; text-align: right; }
.name-row .del { color: var(--muted); padding: 6px; font-size: 18px; }
.add-name { color: var(--gold); font-size: 14px; margin-top: 8px; }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 12px; }
.sum-line b { font-family: var(--serif); font-size: 24px; color: var(--gold); font-weight: 400; }
.err { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* ---------- корзина ---------- */
.cart-item { display: flex; justify-content: space-between; gap: 10px; }
.cart-item h3 { font-size: 16px; }
.cart-item .meta { color: var(--muted); font-size: 13px; }
.cart-item .names-l { font-size: 13px; margin-top: 4px; }
.cart-item .p { font-family: var(--serif); color: var(--gold); white-space: nowrap; }
.cart-item .rm { color: var(--muted); font-size: 13px; margin-top: 6px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 4px; border-top: 1px solid var(--line); margin-top: 12px; }
.total b { font-family: var(--serif); font-size: 26px; color: var(--gold); font-weight: 400; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* ---------- таинства ---------- */
.sac { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sac:last-child { border-bottom: 0; }
.sac span { color: var(--muted); font-size: 13px; display: block; }

/* ---------- молитвы ---------- */
.search { margin-bottom: 12px; }
.prayer-text h3 { font-size: 20px; margin: 18px 0 8px; color: var(--gold-soft); }
.prayer-text p { font-family: var(--serif); font-size: 18px; line-height: 1.65; margin-bottom: 12px; }

/* ---------- помощник ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.msg { max-width: 86%; padding: 12px 14px; border-radius: 14px; font-size: 15px; }
.msg.bot { background: var(--card); border-top-left-radius: 4px; }
.msg.me { background: var(--gold); color: var(--navy); align-self: flex-end; border-top-right-radius: 4px; }
.hints { display: grid; gap: 8px; margin: 14px 0; }
.hint { text-align: left; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; display: flex; justify-content: space-between; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer button { flex: none; width: 46px; border-radius: 50%; background: var(--gold); color: var(--navy); font-size: 18px; }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- пожертвование ---------- */
.qr-ph {
  width: 180px; height: 180px; margin: 10px auto; border-radius: 12px;
  background: var(--cream); color: var(--navy); display: grid; place-items: center;
  font-size: 12px; text-align: center; padding: 14px;
}

/* ---------- всплывающее сообщение ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--cream); color: var(--navy); padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.35);
  max-width: calc(100% - 32px); text-align: center;
}

/* ---------- заставка ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  transition: opacity .5s;
}
.splash h1 { letter-spacing: .3em; color: var(--gold); font-size: 22px; }
.splash img { width: 160px; height: 160px; border-radius: 50%; box-shadow: 0 0 80px rgba(244,160,40,.45); }
.splash.hide { opacity: 0; pointer-events: none; }

/* =========================================================
   ДЕСКТОП
   ========================================================= */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .topbar { padding: 14px 32px; }
  .topbar .title, .topbar .back { display: none !important; }
  .desk-nav { display: flex; gap: 22px; margin-left: 32px; }
  .desk-nav a { color: var(--cream); font-size: 14px; opacity: .8; }
  .desk-nav a.active, .desk-nav a:hover { color: var(--gold); opacity: 1; }
  main { padding: 32px 32px 64px; }
  .home-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .hero { padding-top: 20px; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .narrow { max-width: 640px; margin: 0 auto; }
  .prayer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .prayer-grid .list-item { background: var(--card); border-radius: var(--radius); border: 0; min-height: 96px; }
  .toast { bottom: 32px; }
}

/* ---------- окно «Установить приложение» ---------- */
.install {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 12px;
  background: var(--cream); color: var(--navy);
  padding: 12px 40px 12px 12px; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  animation: fade .3s ease;
}
.install img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.install .i-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; }
.install .i-txt b { font-family: var(--serif); font-size: 16px; }
.install .i-go {
  align-self: flex-start; margin-top: 6px; padding: 8px 18px; border-radius: 10px;
  background: var(--navy); color: var(--gold); font-weight: 700; font-size: 14px;
}
.install .i-x { position: absolute; top: 6px; right: 10px; font-size: 22px; color: var(--navy); opacity: .6; }
.install .i-share { width: 16px; height: 16px; vertical-align: -3px; }
@media (min-width: 900px) {
  .install { left: auto; right: 24px; bottom: 24px; width: 360px; }
}

/* карточка «О храме» на главной */
.about-card { display: flex; gap: 14px; align-items: center; padding: 10px; margin-bottom: 12px; }
.about-card img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.about-card b { display: block; font-weight: 400; font-size: 16px; line-height: 1.3; }
.about-card .label { margin-bottom: 2px; }
.about-card .more { margin-top: 4px; }
