/* Спільний вигляд статичних сторінок: about, film, privacy, rules, 404. Один файл замість п'яти копій
   у <style> — браузер кешує його раз. Шрифти — ті самі self-hosted OFL, що й у грі (src/ui/fonts.css,
   ліцензії в /fonts/LICENSE-*.txt): Cormorant SC — заголовки, PT Serif — текст, Marck Script — рукопис.
   Шляхи абсолютні: 404 віддається з будь-якої адреси. */
@font-face {
  font-family: 'Cormorant SC'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/cormorant-sc-600-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Cormorant SC'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/cormorant-sc-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/pt-serif-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/pt-serif-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Marck Script'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/marck-script-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Marck Script'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/marck-script-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --font-head: 'Cormorant SC', 'PT Serif', Georgia, serif;
  --font-text: 'PT Serif', Georgia, 'Times New Roman', serif;
  --font-hand: 'Marck Script', 'PT Serif', Georgia, serif;
  --font-ui: system-ui, sans-serif;
  --bg: #05080a; --ink: #d8e6df; --head: #cfe8dc; --bright: #eef8f3;
  --link: #a9dcc6; --line: rgba(180, 230, 210, .14); --warm: #f0c48a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-text); font-size: 17px; line-height: 1.68;
  background-image: radial-gradient(ellipse 90% 420px at 50% 0, rgba(24, 48, 42, .38), rgba(5, 8, 10, 0));
  background-repeat: no-repeat;
}
.page {
  max-width: 760px; margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
}
a { color: var(--link); text-decoration-color: rgba(169, 220, 198, .35); text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover, a:focus-visible { color: #e2f7ee; text-decoration-color: currentColor; }
:focus-visible { outline: 1px solid rgba(200, 240, 220, .7); outline-offset: 3px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font: .9rem/1.5 var(--font-ui); }
.top .back { margin-right: auto; text-decoration: none; letter-spacing: .04em; }
.top a[aria-current] { color: var(--ink); text-decoration: none; opacity: .55; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; color: var(--head); }
h1 {
  margin: 34px 0 4px; font-size: clamp(2.1rem, 7vw, 3rem); line-height: 1.15;
  letter-spacing: .06em; text-shadow: 0 0 24px rgba(140, 255, 200, .18);
}
.meta { margin: 0 0 26px; font: .85rem/1.5 var(--font-ui); opacity: .55; }
h2 {
  margin: 2.2em 0 .6em; padding-top: 1.1em; border-top: 1px solid var(--line);
  font-size: 1.55rem; line-height: 1.3; letter-spacing: .03em;
}
h3 { margin: 1.5em 0 .4em; font-size: 1.22rem; letter-spacing: .02em; }
p { margin: .7em 0; }
ul, ol { margin: .6em 0; padding-left: 1.3em; }
li { margin: .35em 0; }
li::marker { color: rgba(169, 220, 198, .55); }
strong { font-weight: normal; color: var(--bright); }
.lead { font-size: 1.1rem; opacity: .92; }
.hand { font-family: var(--font-hand); font-size: 1.35em; line-height: 1.4; color: #e6dcc4; }
.note {
  margin: 1.2em 0; padding: 14px 18px; border: 1px solid rgba(180, 230, 210, .2); border-radius: 6px;
  background: rgba(10, 22, 20, .45);
}
.note.warm { border-color: rgba(232, 196, 140, .32); background: rgba(40, 28, 14, .3); }
.note > :first-child { margin-top: 0; } .note > :last-child { margin-bottom: 0; }
dl.card { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.card dt { opacity: .6; font: .9rem/1.68 var(--font-ui); }
dl.card dd { margin: 0; }
table { width: 100%; border-collapse: collapse; margin: .8em 0; font-size: .96rem; }
th, td { padding: 9px 12px 9px 0; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(180, 230, 210, .1); }
th { font: .8rem/1.4 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; opacity: .55; font-weight: normal; }
td:first-child { color: var(--head); }
code { font: .86em ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--head); }
kbd { font: .85em var(--font-ui); padding: 1px 6px; border: 1px solid rgba(180, 230, 210, .3); border-radius: 4px; white-space: nowrap; }
footer {
  margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; font: .9rem/1.5 var(--font-ui);
}
footer .links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-right: auto; }
.drdev-brand { display: inline-flex; align-items: center; gap: 8px; opacity: .55; text-decoration: none; color: var(--head); font: 12px var(--font-ui); }
.drdev-brand:hover { opacity: .9; }

/* ——— «Про цвинтар»: лічильники з /api/stats ——— */
.stats { margin: 1.6em 0 .4em; }
.stats .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
.stats .tiles li { margin: 0; padding: 12px 10px 10px; text-align: center; border: 1px solid rgba(180, 230, 210, .16); border-radius: 6px; background: rgba(10, 22, 20, .4); }
.stats .num { display: block; font: 600 1.9rem/1.1 var(--font-head); color: var(--head); font-variant-numeric: lining-nums tabular-nums; }
.stats .tiles li.warm .num { color: var(--warm); text-shadow: 0 0 18px rgba(240, 170, 90, .25); }
.stats .lbl { display: block; margin-top: 4px; font: .78rem/1.35 var(--font-ui); opacity: .6; }
.stats .say { margin: .7em 0 0; min-height: 1.5em; font: .88rem/1.5 var(--font-ui); opacity: .6; }
.stats[data-state="wait"] .tiles { opacity: .35; }
.stats[data-state="asleep"] .tiles { display: none; }

/* ——— галерея: на телефоні одна колонка, на ширшому — дві ——— */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 1em 0; }
.gallery figure { margin: 0; }
.gallery a { display: block; line-height: 0; border: 1px solid rgba(180, 230, 210, .14); border-radius: 4px; overflow: hidden; background: #0a1210; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; transition: filter .3s; filter: brightness(.94); }
.gallery a:hover img, .gallery a:focus-visible img { filter: brightness(1.08); }
.gallery figcaption { margin-top: 6px; font: .82rem/1.45 var(--font-ui); opacity: .6; }

/* ——— фільм: плеєр ширший за колонку тексту; рамка й тло тримають місце, поки постер і відео не прийшли ——— */
.film { margin: 1.6em 0 1.2em; }
.film video {
  display: block; width: 100%; height: auto; aspect-ratio: 1920 / 804;
  border: 1px solid rgba(180, 230, 210, .14); border-radius: 4px;
  background: #070c0b radial-gradient(ellipse 70% 90% at 50% 100%, rgba(24, 48, 42, .55), rgba(5, 8, 10, 0));
}
/* кнопка «грати» поверх постера на всю площу кадру (вмикає film.js; з першим відтворенням зникає) */
.film-frame { position: relative; }
.film-play {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 4px;
  display: grid; place-items: center; cursor: pointer; background: rgba(5, 8, 10, .18); color: inherit;
}
.film-play[hidden] { display: none; }
/* знак: темний диск зі світлим обідком — видно і на темному, і на світлому постері; не менше 72 px на ПК і 56 на телефоні */
.film-play span {
  position: relative; width: clamp(56px, 8vw, 96px); aspect-ratio: 1; border-radius: 50%;
  background: rgba(5, 8, 10, .68); border: 2px solid rgba(238, 248, 243, .9);
  box-shadow: 0 0 0 7px rgba(5, 8, 10, .28), 0 8px 28px rgba(0, 0, 0, .55);
}
.film-play span::before {
  content: ''; position: absolute; left: 53%; top: 50%; transform: translate(-50%, -50%);
  border-style: solid; border-color: transparent transparent transparent #eef8f3;
  border-width: clamp(11px, 1.6vw, 19px) 0 clamp(11px, 1.6vw, 19px) clamp(18px, 2.6vw, 31px);
}
.film-play:hover, .film-play:focus-visible { background: rgba(5, 8, 10, .08); }
.film-play:hover span, .film-play:focus-visible span { background: rgba(24, 48, 42, .85); border-color: #fff; }
.film-play:focus-visible { outline: 2px solid rgba(200, 240, 220, .9); outline-offset: -2px; }
.film figcaption { margin-top: 8px; font: .85rem/1.5 var(--font-ui); opacity: .6; }
.film-fail { margin: 10px 0 0; padding: 10px 14px; border: 1px solid rgba(232, 196, 140, .32); border-radius: 6px; background: rgba(40, 28, 14, .3); }
@media (min-width: 900px) {
  .film { width: min(1080px, calc(100vw - 48px)); margin-left: 50%; transform: translateX(-50%); }
}

/* ——— FAQ ——— */
details { margin: .5em 0; border-bottom: 1px solid rgba(180, 230, 210, .1); }
summary { padding: 10px 0; cursor: pointer; color: var(--head); list-style-position: outside; }
summary::marker { color: rgba(169, 220, 198, .55); }
details[open] summary { color: var(--bright); }
details > :not(summary) { margin-left: 0; }
details > :last-child { margin-bottom: 1em; }

/* ——— 404 ——— */
.lost { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lost main { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px 0; }
.lost .stone {
  width: 150px; height: 190px; margin: 0 auto 10px; padding-top: 44px; border: 1px solid rgba(180, 230, 210, .2);
  border-radius: 75px 75px 4px 4px; background: linear-gradient(rgba(34, 44, 42, .55), rgba(12, 18, 17, .7));
  font: 600 2.6rem/1 var(--font-head); color: rgba(207, 232, 220, .55); letter-spacing: .06em;
}
.lost .stone small { display: block; margin-top: 16px; font: 1rem/1.3 var(--font-hand); letter-spacing: 0; color: rgba(230, 220, 196, .6); }
.lost .stone small + small { margin-top: 3px; }
.lost h1 { margin-top: 18px; }
/* 404 двомовна (мови адреси nginx не знає): у заголовку другий рядок — українською, тихіше; під англійським текстом —
   той самий текст українською за тонкою рискою */
.lost h1 span[lang] { display: block; margin-top: .4em; font-size: .56em; letter-spacing: .04em; opacity: .72; text-shadow: none; }
.lost .also { margin-top: 1.8em; padding-top: 1.2em; border-top: 1px solid var(--line); }
/* кнопки-посилання «на цвинтар»: 404 і сторінка фільму */
.go { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 1.4em; }
.go a {
  padding: 11px 24px; border: 1px solid rgba(180, 230, 210, .35); border-radius: 999px; text-decoration: none;
  font: .85rem/1.2 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.go a:hover, .go a:focus-visible { border-color: rgba(200, 240, 220, .7); background: rgba(40, 70, 62, .3); }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  dl.card { grid-template-columns: 1fr; gap: 0; }
  dl.card dd { margin-bottom: 10px; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { padding: 10px 0; border-bottom: 1px solid rgba(180, 230, 210, .1); }
  td { padding: 2px 0; border: 0; }
  .top .back { flex-basis: 100%; }
  .stats .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .gallery img { transition: none; } }
