/* Головний шрифт — AG Opus (кирилична Optima). Лише звичайне накреслення, без жирного й курсиву.
   Літер з наголосами (á, ñ, ¿) у шрифті немає — їх підставляє системний Optima. */
@font-face {
  font-family: 'AG Opus';
  src: url('fonts/agopus-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
/* Святилище — приглушений храм: базальт, світло лампи, лазурит */
:root {
  --basalt: #13110e;
  --soot: #1c1915;
  --soot-2: #25211c;
  --line: #3a332a;
  --papyrus: #ddd2bc;
  --ash: #948876;
  --gold: #b39258;
  --gold-dim: #7d6740;
  --lapis: #5b70a0;
  --danger: #b0624a;
  --display: 'AG Opus', Optima, 'Optima Nova', Candara, 'Segoe UI', sans-serif;
  --read-font: 'Literata', Georgia, serif;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --read-size: 18px;
  --nav-h: 62px;
  --player-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--r-base, var(--basalt));
  color: var(--papyrus);
  transition: background-color .4s;
  font-family: var(--display);
  font-size: 17px;
  font-synthesis: none;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-style: normal;
}
/* Світло лампи зверху і камінь із зерном */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--r-glow, #b39258) 24%, transparent), transparent 62%),
    radial-gradient(140% 90% at 50% 120%, rgba(0,0,0,.55), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .8 0 0 0 0 .7 0 0 0 0 .55 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
em, i, cite, blockquote { font-style: normal; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 0) 16px calc(var(--nav-h) + var(--player-h) + var(--safe-b) + 32px);
}
body.reading #app { padding-bottom: calc(var(--player-h) + var(--safe-b) + 48px); }

/* ---------- Загальне ---------- */
.sym { display: block; width: 100%; height: 100%; }
.meander {
  height: 10px; margin: 28px auto; width: min(240px, 70%); color: var(--gold-dim); opacity: .8;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10'%3E%3Cpath d='M0 9h10V1H3v5h4V4' fill='none' stroke='%237d6740' stroke-width='1'/%3E%3C/svg%3E") repeat-x center / 12px 10px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  background: transparent; border: 1px solid var(--gold-dim); border-radius: 999px; white-space: nowrap;
  color: var(--papyrus); font-family: var(--display); font-size: 18px; letter-spacing: .02em;
  cursor: pointer; text-decoration: none;
}
.btn:active { background: rgba(179,146,88,.12); }
.btn.solid { background: var(--gold); color: #17130d; border-color: var(--gold); }
.btn.solid:active { background: #9c7e4a; }
.btn.quiet { border-color: var(--line); color: var(--ash); }
.btn.danger { border-color: rgba(176,98,74,.6); color: #d9937c; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 16px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--ash);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { background: rgba(255,255,255,.05); }
.muted { color: var(--ash); }
.center { text-align: center; }

/* ---------- Завантаження ---------- */
.boot { min-height: 80dvh; display: grid; place-items: center; }
.boot-flame {
  width: 10px; height: 18px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #f1d6a0, var(--gold) 60%, transparent 70%);
  animation: breathe 2.4s ease-in-out infinite;
}

/* ---------- Вхід ---------- */
.gate { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
.gate-emblem { width: 120px; height: 120px; margin: 0 auto 8px; color: var(--gold); }
.gate h1 {
  font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1.05;
  text-align: center; margin: 8px 0 6px; letter-spacing: .04em;
}
.gate .lead { text-align: center; color: var(--ash); margin: 0 0 8px; }
.gate form { display: grid; gap: 16px; width: 100%; max-width: 360px; margin: 0 auto; }
.field { display: grid; gap: 6px; }
.field label { color: var(--ash); font-size: 16px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: rgba(0,0,0,.35); color: var(--papyrus);
  border: 1px solid var(--line); border-radius: 14px;
  font-family: var(--display); font-size: 17px; font-weight: 400;
}
.field textarea { min-height: 50dvh; line-height: 1.5; resize: vertical; font-size: 17px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold-dim); }
.form-error { color: #d9937c; min-height: 1.5em; margin: 0; text-align: center; font-size: 17px; }
.gate small { display: block; text-align: center; color: var(--ash); margin-top: 24px; font-size: 15px; }

/* ---------- Каталог ---------- */
.hall-head { text-align: center; padding: 40px 0 0; }
.hall-head .emblem { width: 72px; height: 72px; margin: 0 auto; color: var(--gold); }
.hall-head h1 { font-family: var(--display); font-weight: 400; font-size: 38px; margin: 10px 0 2px; letter-spacing: .04em; }
.hall-head p { margin: 0; color: var(--ash); }

.group h2 {
  font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--gold);
  letter-spacing: .08em; margin: 28px 0 4px; padding-left: 2px;
}
.stele-list { list-style: none; margin: 0; padding: 0; }
.stele a {
  display: grid; grid-template-columns: 58px 1fr; gap: 16px; align-items: center;
  padding: 14px 4px; text-decoration: none;
  border-bottom: 1px solid rgba(58,51,42,.7);
}
.stele:first-child a { border-top: 1px solid rgba(58,51,42,.7); }
.stele a:active { background: rgba(179,146,88,.06); }
.medal {
  width: 58px; height: 58px; border-radius: 50%; padding: 10px;
  border: 1px solid var(--line); color: var(--gold);
  background: radial-gradient(circle at 50% 35%, rgba(179,146,88,.12), transparent 70%);
  overflow: hidden;
}
.medal img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.medal.has-img { padding: 0; }
.stele h3 { font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1.15; margin: 0; }
.stele p { margin: 3px 0 0; color: var(--ash); font-size: 15px; line-height: 1.4; }
.stele .draft { color: var(--danger); font-size: 14px; }

/* ---------- Читання ---------- */
.reader-bar {
  position: sticky; top: 0; z-index: 5; transition: background-color .2s;
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 -16px; padding: calc(env(safe-area-inset-top, 0px) + 4px) 8px 4px;
  background: linear-gradient(var(--basalt) 60%, rgba(19,17,14,0));
}
.reader-bar .back { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px 0 4px; min-height: 44px; background: none; border: 0; color: var(--ash); font-family: var(--display); font-size: 17px; cursor: pointer; }
.reader-bar .back svg { width: 22px; height: 22px; }
.reader-bar .bar-title { flex: 1; text-align: center; font-family: var(--display); font-size: 16px; color: var(--ash); opacity: 0; transition: opacity .3s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.reader-bar.scrolled .bar-title { opacity: 1; }
.reader-bar .tools { display: flex; }
.icon-btn.on { color: var(--gold); }

.sanctum { text-align: center; padding: 20px 0 0; }
.sanctum .glyph { position: relative; width: 150px; height: 150px; margin: 0 auto; color: var(--gold); }
.sanctum .glyph::before {
  content: ''; position: absolute; inset: -30%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(179,146,88,.22), transparent 62%);
  animation: breathe 6s ease-in-out infinite;
}
.sanctum .glyph.photo { width: 180px; height: 180px; }
.sanctum .glyph.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 1px solid var(--gold-dim); filter: sepia(.25) brightness(.85); }
.sanctum h1 { font-family: var(--display); font-weight: 400; font-size: 36px; line-height: 1.1; margin: 22px 0 6px; letter-spacing: .02em; text-wrap: balance; }
.sanctum .sub { color: var(--ash); margin: 0; }

.scripture { font-family: var(--read-font); font-size: var(--read-size); line-height: 1.72; hyphens: manual; -webkit-hyphens: manual; }
.scripture p { margin: 0 0 1em; }
.scripture h2 { font-family: var(--display); font-weight: 400; font-size: 1.3em; color: var(--gold); text-align: center; margin: 1.8em 0 .8em; }
.scripture strong { font-weight: 600; color: #f1e8d6; }
.scripture ul { list-style: none; margin: 0 0 1.2em; padding: 0; }
.scripture li { position: relative; padding-left: 1.3em; margin-bottom: .7em; }
.scripture li::before { content: ''; position: absolute; left: .2em; top: .62em; width: .38em; height: .38em; border: 1px solid var(--gold); transform: rotate(45deg); }
.scripture .verse { text-align: center; margin: 0 0 1.3em; line-height: 1.55; text-wrap: balance; }
.scripture.verse-mode { text-align: center; hyphens: manual; -webkit-hyphens: manual; }
.scripture .verse { hyphens: manual; -webkit-hyphens: manual; }
.scripture.verse-mode p { text-wrap: balance; margin-bottom: 1.4em; }
.scripture .note { color: var(--ash); text-align: center; font-size: .85em; }

/* Пігулки розділів: прилипають під верхньою панеллю */
.section-pills {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 52px); z-index: 4;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -8px -16px 20px; padding: 10px 16px 12px;
  background: linear-gradient(var(--basalt) 78%, rgba(19,17,14,0));
}
.section-pills::-webkit-scrollbar { display: none; }
.scripture.tabbed { min-height: 60dvh; }

.passage-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.passage-nav a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 20px; text-decoration: none; min-height: 72px; }
.passage-nav a span { display: block; color: var(--ash); font-size: 15px; }
.passage-nav a b { font-family: var(--display); font-weight: 400; font-size: 18px; line-height: 1.2; }
.passage-nav .next { text-align: right; grid-column: 2; }

.size-pop {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 52px); right: 12px; z-index: 6;
  display: flex; gap: 6px; padding: 6px; background: var(--soot-2); border: 1px solid var(--line); border-radius: 999px;
}
.size-pop button { width: 52px; height: 44px; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--papyrus); font-family: var(--display); cursor: pointer; }

/* ---------- Бібліотека ---------- */
.page-head { padding: 36px 0 8px; text-align: center; }
.page-head h1 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 0; }
.page-head p { color: var(--ash); margin: 4px 0 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { text-decoration: none; display: inline-flex; align-items: center; flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); background: none; border-radius: 19px; color: var(--ash); font-family: var(--display); font-size: 16px; cursor: pointer; }
.chip.on { border-color: var(--gold); color: var(--papyrus); background: rgba(179,146,88,.1); }
.quote { margin: 0; padding: 26px 4px; border-bottom: 1px solid rgba(58,51,42,.7); }
.quote p { font-size: 19px; line-height: 1.6; margin: 0; }
.quote p::before { content: '«'; color: var(--gold); }
.quote p::after { content: '»'; color: var(--gold); }
.quote footer { margin-top: 8px; color: var(--ash); font-size: 16px; }
.quote footer .theme { color: var(--gold-dim); }

/* ---------- Музика ---------- */
.tracks { list-style: none; padding: 0; margin: 16px 0 0; }
.track { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid rgba(58,51,42,.7); cursor: pointer; }
.track .pb { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ash); background: none; cursor: pointer; }
.track .pb svg { width: 20px; height: 20px; }
.track.current .pb { border-color: var(--lapis); color: #aab9dc; }
.track h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 20px; }
.track p { margin: 0; color: var(--ash); font-size: 16px; }

/* Міні-плеєр */
.player {
  position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(var(--nav-h) + var(--safe-b));
  display: grid; grid-template-columns: 44px 1fr 44px 44px; align-items: center; gap: 6px;
  padding: 6px 10px; background: rgba(28,25,21,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.reading .player { bottom: var(--safe-b); }
.player .t { min-width: 0; }
.player .t b { display: block; font-family: var(--display); font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .t span { display: block; height: 2px; background: var(--line); margin-top: 6px; position: relative; overflow: hidden; }
.player .t span i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--lapis); }
.player .icon-btn { color: var(--papyrus); }
.player .play { color: #aab9dc; }

/* Нижня навігація */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: rgba(19,17,14,.97); border-top: 1px solid var(--line);
}
body.reading .tabs { display: none; }
.tabs a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ash); font-family: var(--display); font-size: 14px;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--gold); }

.toast {
  border-radius: 999px;
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-b) + 16px);
  max-width: calc(100% - 32px); padding: 12px 18px; background: var(--soot-2); border: 1px solid var(--gold-dim);
  font-size: 17px;
}

/* ---------- Адмін ---------- */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 12px 16px; scrollbar-width: none; position: sticky; top: 0; background: var(--basalt); z-index: 4; }
.admin-tabs::-webkit-scrollbar { display: none; }
.panel { margin-top: 8px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 20px 0 10px; }
.card-form { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(28,25,21,.6); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--papyrus); }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid rgba(58,51,42,.7); }
.list .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.list .head b { font-family: var(--display); font-weight: 400; font-size: 20px; }
.list .meta { color: var(--ash); font-size: 15px; }
.list .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge { font-size: 14px; padding: 2px 8px; border: 1px solid var(--line); color: var(--ash); white-space: nowrap; }
.badge.ok { border-color: rgba(91,112,160,.7); color: #aab9dc; }
.badge.off { border-color: rgba(176,98,74,.6); color: #d9937c; }
.badge.gold { border-color: var(--gold-dim); color: var(--gold); }
.sym-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.sym-pick button { aspect-ratio: 1; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: none; color: var(--ash); cursor: pointer; }
.sym-pick button.on { border-color: var(--gold); color: var(--gold); background: rgba(179,146,88,.08); }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 16px; padding: 10px 12px; border: 1px dashed var(--gold-dim); word-break: break-all; }

@keyframes breathe { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
.sym .flame { animation: flicker 3.2s ease-in-out infinite; transform-origin: 76px 44px; }
@keyframes flicker { 0%, 100% { transform: scaleY(1); } 40% { transform: scaleY(1.08) skewX(-2deg); } 70% { transform: scaleY(.95) skewX(2deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
@media (min-width: 720px) {
  .sanctum .glyph { width: 180px; height: 180px; }
  .sanctum h1 { font-size: 44px; }
  .hall-head { padding-top: 64px; }
}


/* ================= Версія 2: храми ================= */
.ph { display: block; }
.btn .ph { width: 20px; height: 20px; flex: none; }
.secret { border-radius: 14px; }

/* Кольори кімнати: акценти переходять у палітру храму */
body[data-room] {
  --gold: var(--r-accent);
  --gold-dim: color-mix(in srgb, var(--r-accent) 50%, transparent);
  --line: color-mix(in srgb, var(--r-accent) 24%, transparent);
  --ash: color-mix(in srgb, var(--r-soft) 45%, #9a8f80);
}
body[data-room] .reader-bar { background: linear-gradient(var(--r-base) 60%, transparent); }
body[data-room] .section-pills { background: linear-gradient(var(--r-base) 78%, transparent); }
body[data-room] .tabs, body[data-room] .player { background: color-mix(in srgb, var(--r-base) 94%, transparent); }
body[data-room] .medal { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--r-glow) 30%, transparent), transparent 70%); }

/* Головна: три храми */
.rooms-head { text-align: center; padding: 28px 0 18px; }
.rooms-head .emblem { width: 52px; height: 52px; margin: 0 auto; color: var(--gold); }
.rooms-head h1 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 6px 0 0; letter-spacing: .04em; }
.rooms-head p { margin: 2px 0 0; color: var(--ash); }

.rooms { display: flex; gap: 8px; height: min(66dvh, 580px); min-height: 420px; }
.room-card {
  position: relative; overflow: hidden; isolation: isolate;
  flex: 0 0 54px; border-radius: 28px;
  background: var(--r-base);
  border: 1px solid color-mix(in srgb, var(--r-accent) 30%, transparent);
  transition: flex-grow .6s cubic-bezier(.2,.75,.2,1), flex-basis .6s cubic-bezier(.2,.75,.2,1);
}
.room-card.open { flex: 1 1 0; }
.room-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; z-index: -2;
  filter: grayscale(.3) sepia(.15) brightness(.62) contrast(1.05);
  transform: scale(1.04); transition: transform 1.2s ease, filter .6s;
}
.room-card:not(.open) .room-img { filter: grayscale(.8) brightness(.35); }
.room-card.open .room-img { transform: scale(1); }
.room-veil {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, var(--r-base) 12%, color-mix(in srgb, var(--r-base) 75%, transparent) 42%, transparent 70%),
    linear-gradient(to bottom, color-mix(in srgb, var(--r-glow) 45%, transparent), transparent 40%);
}
.room-strip {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 20px 0; background: none; border: 0; color: var(--r-accent); cursor: pointer;
  transition: opacity .3s;
}
.room-num { font-family: var(--display); font-size: 22px; }
.room-deity-v { font-family: var(--display); font-size: 18px; letter-spacing: .14em; writing-mode: vertical-rl; transform: rotate(180deg); color: var(--papyrus); opacity: .85; }
.room-card.open .room-strip { opacity: 0; pointer-events: none; }
.room-body {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 20px 22px;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .35s ease .15s, transform .45s ease .15s;
}
.room-card.open .room-body { opacity: 1; transform: none; pointer-events: auto; }
.room-sym { width: 46px; height: 46px; color: var(--r-accent); margin-bottom: 10px; }
.room-title { margin: 0; font-family: var(--display); font-size: 16px; letter-spacing: .12em; color: var(--r-accent); }
.room-body h2 { margin: 2px 0 6px; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1; }
.room-desc { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: color-mix(in srgb, var(--r-soft) 55%, var(--papyrus)); }
.room-enter {
  max-width: 100%; border-color: color-mix(in srgb, var(--r-accent) 70%, transparent);
  background: color-mix(in srgb, var(--r-glow) 35%, transparent); color: var(--papyrus); font-size: 17px; padding: 0 20px;
}
.room-enter:active { background: color-mix(in srgb, var(--r-glow) 55%, transparent); }
.room-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.room-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .3s, width .3s; }
.room-dots span.on { width: 18px; border-radius: 3px; background: var(--gold); }

/* Сторінка храму */
.room-hero { text-align: center; padding-top: 8px; }
.room-hero-img {
  display: block; width: min(100%, 300px); height: min(52dvh, 420px); margin: 0 auto; padding: 0; cursor: zoom-in;
  border: 1px solid color-mix(in srgb, var(--r-accent) 45%, transparent);
  border-radius: 999px 999px 26px 26px; overflow: hidden; background: #000;
  box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--r-glow) 70%, transparent);
}
.room-hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; filter: sepia(.12) brightness(.9); }
.room-hero-sym { width: 140px; height: 140px; margin: 20px auto 0; color: var(--gold); }
.room-hero-text .room-title { margin-top: 22px; }
.room-hero h1 { font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1; margin: 4px 0 10px; }
.room-hero .room-desc { max-width: 34ch; margin: 0 auto; }
.room-sec { margin-top: 8px; }
.sec-h { font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--gold); letter-spacing: .08em; margin: 26px 0 6px; }
.stele-list.prime .medal { width: 66px; height: 66px; }
.stele-list.prime a { grid-template-columns: 66px 1fr; }
.stele-list.prime h3 { font-size: 26px; }

.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.gal-item { aspect-ratio: 3 / 4; padding: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #000; cursor: zoom-in; }
.gal-item:first-child { border-radius: 999px 999px 18px 18px; }
.gal-item img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.15) brightness(.85); transition: filter .3s; }
.gal-item:active img { filter: none; }

/* Перегляд зображення */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(6,6,9,.97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: calc(env(safe-area-inset-top, 0px) + 56px) 12px calc(env(safe-area-inset-bottom, 0px) + 56px);
  animation: lb-in .25s ease;
}
.lightbox figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-width: 100%; }
.lightbox img { max-width: 100%; max-height: 72dvh; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { text-align: center; max-width: 46ch; }
.lightbox figcaption span { display: block; font-size: 16px; }
.lightbox figcaption small { display: block; margin-top: 4px; color: var(--ash); font-size: 13px; }
.lightbox .icon-btn { position: absolute; z-index: 2; color: var(--papyrus); background: rgba(8,8,12,.62); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lb-close { top: calc(env(safe-area-inset-top, 0px) + 8px); right: 10px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 0; right: 0; margin: 0; text-align: center; color: var(--ash); font-size: 14px; pointer-events: none; }
@keyframes lb-in { from { opacity: 0; } }

/* Ізіда: сріблясті акценти ледь мерехтять */
[data-room="isis"] .room-title, body[data-room="isis"] .sec-h, body[data-room="isis"] .room-hero h1 {
  background: linear-gradient(100deg, #c9d6e8 20%, #ffffff 45%, #c9d6e8 70%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }

@media (min-width: 720px) {
  .rooms { gap: 12px; }
  .room-card { flex-basis: 72px; }
  .room-body { padding: 32px; }
  .room-body h2 { font-size: 52px; }
}

/* Адмінка галерей */
.gal-row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; }
.gal-row img { width: 72px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.admin-room h2 { color: var(--r-accent, var(--papyrus)); }


/* Шрифт для читання: Literata (типово) або Opus — перемикається в «Aa» */
html[data-read-font="opus"] { --read-font: 'AG Opus', Optima, 'Optima Nova', Candara, sans-serif; }
html[data-read-font="opus"] .scripture { line-height: 1.66; letter-spacing: .005em; }
html[data-read-font="opus"] .scripture strong { font-weight: 400; color: var(--gold); }

/* Нумерований список (Кодекс) */
.scripture ol { list-style: none; counter-reset: item; margin: 0 0 1.2em; padding: 0; }
.scripture ol li { counter-increment: item; position: relative; padding-left: 2em; margin-bottom: .75em; }
.scripture ol li::before {
  content: counter(item); position: absolute; left: 0; top: .1em;
  width: 1.45em; height: 1.45em; border-radius: 50%; border: 1px solid var(--gold-dim);
  display: grid; place-items: center; font-family: 'Literata', Georgia, serif; font-variant-numeric: lining-nums; font-size: .72em; line-height: 1; color: var(--gold);
}

/* Коли сторінку прокручено, верхня панель суцільна — без прозорого проміжку над пігулками */
.reader-bar.scrolled, body[data-room] .reader-bar.scrolled { background: var(--r-base, var(--basalt)); }
.section-pills, body[data-room] .section-pills { background: var(--r-base, var(--basalt)); margin-bottom: 26px; }
.section-pills::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 18px; pointer-events: none;
  background: linear-gradient(var(--r-base, var(--basalt)), transparent);
}

/* Перемикач мови */
.lang-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.lang-switch button { min-width: 44px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: var(--ash); font-family: var(--display); font-size: 15px; cursor: pointer; }
.lang-switch button.on { background: rgba(179,146,88,.18); color: var(--papyrus); }
.gate-lang { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 16px; }
.gate { position: relative; }

/* Обліковий запис */
.account { padding-top: 36px; }
.account-card { text-align: center; }
.account-initial {
  width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--gold-dim); color: var(--gold); font-family: var(--display); font-size: 38px;
  background: radial-gradient(circle at 50% 35%, rgba(179,146,88,.16), transparent 70%);
}
.account-card h1 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 0; }
.account dl { margin: 22px 0 0; display: grid; gap: 0; }
.account dl div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 2px; border-bottom: 1px solid rgba(58,51,42,.7); }
.account dt { color: var(--ash); }
.account dd { margin: 0; text-align: right; }
.account .setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid rgba(58,51,42,.7); flex-wrap: wrap; }
.account .setting span { color: var(--ash); }
.read-font-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.read-font-switch button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--ash); font-size: 16px; cursor: pointer; }
.read-font-switch button.on { background: rgba(179,146,88,.18); color: var(--papyrus); }
.read-font-switch [data-f="literata"] { font-family: 'Literata', serif; }
.read-font-switch [data-f="opus"] { font-family: 'AG Opus', Optima, sans-serif; }
.only-uk-note { text-align: center; color: var(--ash); font-size: 15px; margin: -6px 0 20px; }
