/* ==========================================================================
   Оформление сайта. Mobile-first: базовые стили = смартфон (320px+),
   дальше расширение медиазапросами (480 / 768 / 1920), ландшафт, узкие экраны,
   prefers-reduced-motion. Все шрифты — системные (без внешних запросов).
   ========================================================================== */

/* ---------- Токены ---------- */
:root {
  --brand: #7B68EE;          /* основной цвет (переопределяется из js/settings.js) */
  --brand-2: #FF6B9D;        /* второй цвет для градиентов/плашек */
  --brand-light: #C4B5F0;
  --brand-soft: #B8A9E8;

  --glow-a: rgba(123, 104, 238, .30);
  --glow-b: rgba(184, 169, 232, .50);

  --shade-mid: rgba(10, 10, 25, .50);
  --shade-end: rgba(15, 12, 35, .70);

  --text: #ffffff;
  --muted: rgba(255, 255, 255, .85);
  --dim-accent: #B8A9E8;
  --glass: rgba(20, 18, 35, .55);
  --glass-line: rgba(255, 255, 255, .10);

  --font-heading: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --cta-width: 280px;
  --pill-radius: 50px;
  --panel-radius: 24px;
  --gap: 14px;

  --backdrop: url("../img/background.jpg");
  --backdrop-pos: center 30%;   /* переопределяется из js/settings.js → backgroundPosition */
}

/* ---------- Сброс ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }

body {
  font-family: var(--font-body);
  background: #1a1a1a;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

/* ---------- Каркас ---------- */
.shell {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(80px + env(safe-area-inset-top)) 16px
           calc(16px + env(safe-area-inset-bottom));
}

.shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--backdrop);
  background-size: cover;
  background-position: var(--backdrop-pos);
  background-color: #1a1a1a;
  z-index: -2;
  animation: bgPulse 12s ease-in-out infinite;
  will-change: transform;
}

.shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,.30) 0%, var(--shade-mid) 50%, var(--shade-end) 100%);
}

@keyframes bgPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

/* ---------- Профиль ---------- */
.card {
  margin-top: auto;
  padding-top: 20px;
  text-align: center;
  color: var(--text);
  width: 100%;
  max-width: var(--cta-width);
}

.face {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
  object-fit: cover;
  border: 2px solid var(--glass-line);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

h1 {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: 2px;
  text-shadow: 0 2px 20px var(--glow-b);
  overflow-wrap: anywhere;
}

.tagline {
  font-size: 16px;
  font-weight: 300;
  font-style: italic;
  margin-bottom: 25px;
  opacity: .9;
  letter-spacing: 1px;
  overflow-wrap: anywhere;
}

/* ---------- Кнопки-«пилюли» ---------- */
.links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
}

.cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  width: var(--cta-width);
  max-width: 100%;
  padding: 16px 24px;
  border-radius: var(--pill-radius);
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, rgba(255,255,255,.15), rgba(255,255,255,.05));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,.15), inset 0 1px rgba(255,255,255,.2);
  transition: transform .4s cubic-bezier(.25,.46,.45,.94), background .4s ease, box-shadow .4s ease;
  min-height: 52px;
}

.cta:hover {
  background: linear-gradient(135deg, rgba(255,255,255,.25), rgba(255,255,255,.10));
  transform: translateY(-3px);
  box-shadow: 0 8px 30px var(--glow-a), 0 0 20px var(--glow-b), inset 0 1px rgba(255,255,255,.3);
}
.cta:active { transform: translateY(-1px); }
.cta:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 3px; }

.cta-icon { width: 32px; height: 32px; margin-right: 12px; flex-shrink: 0; }
.cta-icon svg { width: 100%; height: 100%; display: block; }
/* Кнопка без иконки (showIcons: false) — той же высоты, что с иконкой */
.cta.plain { min-height: 64px; }

/* Главная кнопка: акцентный градиент + свечение */
.links .cta:first-child {
  border: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
  animation: glowPulse 3s ease-in-out infinite;
}
.links .cta:first-child.nudge { animation: nudge .6s ease-in-out; }

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 4px 20px var(--glow-a), 0 0 30px var(--glow-b); }
  50%      { box-shadow: 0 6px 30px var(--glow-a), 0 0 50px var(--glow-b); }
}
@keyframes nudge {
  0%, 100% { transform: translate(0); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-4px); }
  20%, 40%, 60%, 80%     { transform: translate(4px); }
}

.loading { pointer-events: none; opacity: .7; }
.loading::after {
  content: "";
  position: absolute;
  right: 20px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gap { width: 100px; height: 20px; }

.badge {
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 5px 10px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 2px 10px var(--glow-a);
  animation: bob 3s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ---------- Режим «карточки с фото» ---------- */
.links.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}
.links.tiles .cta { grid-column: 1 / -1; justify-self: center; }

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  aspect-ratio: 1 / 1;
  box-shadow: 0 4px 20px rgba(0,0,0,.30);
  transition: transform .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover  { transform: translateY(-3px); }
.tile:active { transform: translateY(-1px); }
.tile img { width: 100%; height: 100%; object-fit: cover; }

.tile-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  line-height: 1.2;
}

.tile.tile-wide { grid-column: 1 / -1; aspect-ratio: 4 / 5; }
.tile.tile-wide .tile-caption { padding: 20px 18px; font-size: 18px; }
.tile .badge { top: 10px; right: 10px; }

.card.tiles {
  max-width: 380px;
  margin: auto;
  padding: 28px 18px 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid var(--glass-line);
  border-radius: var(--panel-radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.card.tiles .fineprint { padding: 14px 0 0; }
.shell.mode-tiles { justify-content: center; padding-top: 24px; padding-bottom: 24px; }

/* ---------- Подсказка и футер ---------- */
.more {
  display: flex;
  justify-content: center;
  padding: 20px 0 0;
  color: var(--dim-accent);
  font-size: 13px;
  letter-spacing: .5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .2s ease, opacity .3s ease;
}
.more:hover { color: #fff; }
.more[hidden] { display: none; }   /* иначе display: flex перебивает атрибут hidden */

.fineprint {
  padding: 24px 0 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: .5px;
  width: 100%;
}
.fineprint a { color: var(--brand-light); text-decoration: none; font-weight: 400; transition: color .3s ease; }
.fineprint a:hover { color: #fff; }

/* ---------- Уведомление-тост ---------- */
.notice {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 350px;
  background: rgba(255,255,255,.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,.30);
  display: flex;
  align-items: center;
  z-index: 1000;
  color: #333;
  cursor: pointer;
  transition: top .5s cubic-bezier(.68,-.55,.27,1.55);
}
.notice.show { top: calc(16px + env(safe-area-inset-top)); }
.notice.show.hide-down { top: 90px; opacity: 0; pointer-events: none; transition: top .5s ease-out, opacity .8s ease-out; }

.notice-avatar { position: relative; margin-right: 12px; flex-shrink: 0; }
.notice-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.notice-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  background: #2ecc71;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: dotPulse 1.5s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,204,113,.6); }
  50%      { box-shadow: 0 0 0 4px rgba(46,204,113,0); }
}

.notice-body { flex: 1; text-align: left; min-width: 0; }
.notice-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.notice-text  { font-size: 13px; color: #666; }
.notice-link  { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Age gate (18+) ---------- */
.agegate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 6, 18, .88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.agegate-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
  padding: 32px 24px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--panel-radius);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.agegate-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 16px;
}

.agegate-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.agegate-question { font-size: 15px; opacity: .85; margin-bottom: 22px; }

.agegate-actions { display: flex; flex-direction: column; gap: 12px; }

.agegate-enter,
.agegate-leave {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 14px 20px;
  border-radius: var(--pill-radius);
  cursor: pointer;
  letter-spacing: .5px;
  transition: transform .2s ease, background .2s ease;
}

.agegate-enter {
  color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
  box-shadow: 0 4px 20px var(--glow-a);
}
.agegate-enter:hover { transform: translateY(-2px); }

.agegate-leave {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--glass-line);
}
.agegate-leave:hover { border-color: var(--brand-light); color: #fff; }

.agegate-note { margin-top: 18px; font-size: 11px; opacity: .5; }
.agegate-nojs { font-size: 14px; color: var(--brand-light); }

body.locked { overflow: hidden; }

/* ---------- «Открыть в браузере» (встроенный браузер Instagram) ---------- */
.escape {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 1500;
  max-width: 440px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(20, 18, 35, .92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
}
.escape-text { margin: 0 0 10px; }
.escape-actions { display: flex; align-items: center; gap: 10px; }
.escape-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: var(--pill-radius);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.escape-close {
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.escape-btn:focus-visible, .escape-close:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; }
.escape-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
body.has-escape .shell { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }

/* ---------- «Открыть в браузере»: экран на весь экран (режим splash) ---------- */
.escape-splash {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 20px calc(36px + env(safe-area-inset-bottom));
  background-color: #111;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, .15) 0%, rgba(0, 0, 0, .35) 45%, rgba(0, 0, 0, .75) 100%), var(--backdrop);
  background-size: cover;
  background-position: var(--backdrop-pos, center 30%);
  color: #fff;
  text-align: center;
}
.escape-splash-inner { width: 100%; max-width: 360px; margin-bottom: 8vh; }
.escape-splash-face {
  width: 132px;
  height: 132px;
  margin: 0 auto 14px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
.escape-splash-name {
  font-family: var(--font-heading, Georgia, serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: .5px;
  margin: 0 0 22px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.escape-splash-btn {
  display: block;
  padding: 16px 22px;
  border-radius: var(--pill-radius, 50px);
  background: rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  transition: background .2s ease, opacity .2s ease;
}
.escape-splash-btn:hover { background: rgba(255, 255, 255, .24); }
.escape-splash-btn.is-opening { opacity: .65; }
.escape-splash-btn:focus-visible, .escape-splash-stay:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.escape-splash-hint { margin: 16px 0 0; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, .85); }
.escape-splash-stay {
  margin-top: 18px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .7);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
@media (max-height: 620px) and (orientation: landscape) {
  .escape-splash { align-items: center; }
  .escape-splash-inner { margin-bottom: 0; }
  .escape-splash-face { width: 84px; height: 84px; }
  .escape-splash-name { font-size: 24px; margin-bottom: 12px; }
}

/* ---------- «Открыть в браузере»: «Hold to open» (режим hold) ---------- */
.escape-hold {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: #f4f4f5;
  color: #111;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.escape-hold-inner { width: 100%; max-width: 360px; margin-top: -6vh; }
.escape-hold-face {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 50%;
  object-fit: cover;
  background: #dcdcdf;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.escape-hold-letter { display: grid; place-items: center; font-size: 34px; font-weight: 600; color: #555; }
.escape-hold-name { margin: 0 0 6px; font-family: inherit; font-size: 24px; font-weight: 700; letter-spacing: 0; text-shadow: none; }
.escape-hold-sub { margin: 0 0 22px; font-size: 15px; color: #555; }
.escape-hold-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  border-radius: 14px;
  background: #0b0b0b;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  -webkit-touch-callout: default;   /* нужно меню iOS по долгому нажатию */
  -webkit-user-select: none;
  user-select: none;
}
.escape-hold-btn:focus-visible, .escape-hold-stay:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
.escape-hold-caption { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: #666; }
.escape-hold-caption.is-nudge { color: #b42318; animation: holdNudge .5s ease; }
@keyframes holdNudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.escape-hold-stay {
  margin-top: 26px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: #777;
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .escape-hold-caption.is-nudge { animation: none; } }

/* ---------- Медиазапросы ---------- */
@media (min-width: 480px) {
  :root { --cta-width: 300px; --gap: 16px; }
  h1 { font-size: 46px; }
}

@media (min-width: 768px) {
  :root { --cta-width: 320px; }
  .card { padding-top: 32px; }
  .links.tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card.tiles { max-width: 560px; padding: 32px 22px 22px; }
  .tile.tile-wide { aspect-ratio: 16 / 10; }
}

@media (min-width: 1920px) {
  /* Колонка растёт вместе со шрифтами — иначе имя рвётся посередине («Murmuri / el») */
  :root { --cta-width: 400px; }
  h1 { font-size: 60px; letter-spacing: 4px; margin-bottom: 12px; }
  .tagline { font-size: 22px; margin-bottom: 35px; }
  .cta { padding: 20px 32px; font-size: 18px; letter-spacing: 2px; border-radius: 55px; }
  .links { gap: 18px; }
  .cta-icon { width: 40px; height: 40px; margin-right: 14px; }
  .cta.plain { min-height: 80px; }
  .face { width: 120px; height: 120px; }
  .notice { max-width: 440px; padding: 16px; border-radius: 14px; }
  .notice-avatar img { width: 48px; height: 48px; }
  .notice-title { font-size: 16px; }
  .notice-text, .notice-link { font-size: 15px; }
  .fineprint { font-size: 14px; }
  .more { font-size: 15px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .shell { padding-top: 24px; }
  .card { margin-top: 0; padding-top: 8px; }
  .face { width: 64px; height: 64px; margin-bottom: 8px; }
  h1 { font-size: 30px; margin-bottom: 4px; }
  .tagline { font-size: 13px; margin-bottom: 12px; }
  .more { padding-top: 8px; }
  .fineprint { padding: 10px 0 8px; }
}

@media (max-width: 359px) {
  :root { --cta-width: 100%; }
  .cta { padding: 14px 18px; font-size: 13px; letter-spacing: 1px; }
  .cta.plain { min-height: 60px; }
  h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .shell::before, .links .cta:first-child, .badge, .notice-dot { animation: none !important; }
  .notice { transition: opacity .3s ease; }
  * { transition-duration: .01ms !important; }
}

@media print {
  .shell::before, .shell::after { display: none; }
  body { background: #fff; color: #000; }
}
