/* Disorder Game Studio — оформление сайта. Тёмная тема в цветах студии: фиолетовый, пурпурный, бирюзовый. */
:root {
  --bg: #0b0814;
  --bg-2: #110c1e;
  --surface: #161027;
  --surface-2: #1d1631;
  --border: #2a2142;
  --border-2: #3a2e5c;
  --text: #ece8ff;
  --dim: #b3a9d6;
  --muted: #8478ad;
  --violet: #8b5cf6;
  --violet-light: #c4b5fd;
  --magenta: #d946ef;
  --cyan: #22d3ee;
  --accent: var(--violet);
  --radius: 18px;
  --wrap: 1180px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }  /* якорь не под шапкой */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
  overflow-x: hidden;
}
img, video { max-width: 100%; height: auto; display: block; }
/* Элементы сетки не должны раздвигать страницу шире экрана из-за больших картинок */
.p-hero .wrap > *, .p-body > *, .about > *, .spotlight > * { min-width: 0; }
a { color: var(--violet-light); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; top: 8px; background: #6d28d9; color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- шапка */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 8, 20, .78);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(58, 46, 92, .55);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand svg { height: 26px; width: auto; filter: drop-shadow(-1.5px 0 rgba(217, 70, 239, .85)) drop-shadow(1.5px 0 rgba(34, 211, 238, .7)); }
.brand span { font-size: 11px; letter-spacing: .32em; color: var(--dim); font-weight: 600; }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a { color: var(--dim); text-decoration: none; font-size: 15px; font-weight: 600; }
.nav a:hover { color: #fff; }
.lang {
  border: 1px solid var(--border-2); border-radius: 999px; padding: 4px 12px; font-size: 13px !important;
  color: var(--violet-light) !important; letter-spacing: .06em;
}
.lang:hover { border-color: var(--violet); }
@media (max-width: 720px) {
  .nav { gap: 16px; }
  .nav .more-link { display: none; }
  .brand span { display: none; }
}

/* ---------- кнопки, метки */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px; border-radius: 12px; font-weight: 700; font-size: 16px;
  text-decoration: none; color: #fff; border: 1px solid var(--border-2); background: var(--surface-2);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--violet); color: #fff; }
.btn.primary {  /* потемнее фирменного градиента — белый текст читается с контрастом выше 4,5 */
  background: linear-gradient(135deg, #6d28d9, #a21caf); border-color: transparent;
  box-shadow: 0 8px 28px rgba(139, 92, 246, .35);
}
.btn.primary:hover { box-shadow: 0 10px 34px rgba(217, 70, 239, .45); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  background: rgba(139, 92, 246, .14); color: var(--violet-light); border: 1px solid rgba(139, 92, 246, .35);
}
.pill.soon { background: rgba(232, 97, 60, .14); color: #ffb39b; border-color: rgba(232, 97, 60, .4); }
.pill.play { background: rgba(34, 211, 238, .12); color: #9eeefb; border-color: rgba(34, 211, 238, .35); }
.pill.free { background: rgba(52, 211, 153, .12); color: #9ff0cd; border-color: rgba(52, 211, 153, .35); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* ---------- главная: первый экран */
.hero {  /* невысокий: главный проект должен показаться уже на первом экране */
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(40px, 7vw, 76px) 0 clamp(28px, 4vw, 44px);
  text-align: center;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(600px 400px at 30% 30%, rgba(124, 58, 237, .35), transparent 70%),
    radial-gradient(520px 380px at 75% 65%, rgba(217, 70, 239, .22), transparent 70%),
    radial-gradient(400px 300px at 60% 10%, rgba(34, 211, 238, .12), transparent 70%);
}
.hero::after { /* полосы развёртки, как в заставке */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px);
}
.hero-logo { width: min(520px, 80vw); margin: 0 auto; color: #fff; }
.hero-logo svg {
  width: 100%; height: auto;
  filter: drop-shadow(-4px 0 rgba(217, 70, 239, .85)) drop-shadow(4px 0 rgba(34, 211, 238, .75)) drop-shadow(0 0 40px rgba(139, 92, 246, .45));
  animation: glitch 6s steps(1) infinite;
}
@keyframes glitch {
  0%, 91%, 100% { transform: none; }
  92% { transform: translate(-3px, 1px) skewX(-4deg); }
  93% { transform: translate(4px, -1px); clip-path: inset(30% 0 40% 0); }
  94% { transform: translate(-2px, 0) skewX(3deg); clip-path: none; }
  95% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo svg { animation: none; }
  html { scroll-behavior: auto; }
  .btn, .card, .card .thumb img, .spotlight, .social { transition: none; }
  .btn:hover, .card:hover, .spotlight:hover, .social:hover, .card:hover .thumb img { transform: none; }
}
.hero-sub { margin-top: 14px; font-size: clamp(13px, 1.6vw, 16px); letter-spacing: .6em; color: var(--dim); font-weight: 600; padding-left: .6em; }
.hero h1 { margin: 24px auto 0; max-width: 760px; font-size: clamp(21px, 2.6vw, 29px); font-weight: 700; color: var(--text); }
.hero h1 strong { color: #fff; }
.hero .lead { max-width: 640px; margin: 16px auto 0; color: var(--dim); font-size: 18px; }
.hero .buttons { justify-content: center; }

/* ---------- секции */
.section { padding: clamp(56px, 8vw, 96px) 0; }
#projects { padding-top: 12px; }  /* сразу под первым экраном — главный проект виден без прокрутки */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head p { color: var(--dim); margin: 0; max-width: 560px; }

/* Главный проект — большая карточка */
.spotlight {
  position: relative; display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; overflow: hidden;
  border-radius: 24px; border: 1px solid var(--border-2); background: var(--surface); text-decoration: none; color: inherit;
  transition: border-color .2s ease, transform .2s ease;
}
.spotlight:hover { border-color: var(--accent); transform: translateY(-3px); color: inherit; }
.spotlight .art { position: relative; min-height: 320px; }
.spotlight .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spotlight .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 55%, var(--surface)); }
.spotlight .body { padding: clamp(26px, 4vw, 44px); display: flex; flex-direction: column; justify-content: center; }
.spotlight .spot-title { font-size: clamp(26px, 3vw, 36px); font-weight: 800; margin: 14px 0 10px; }
.spotlight p { color: var(--dim); }
.spotlight .more { color: var(--violet-light); font-weight: 700; margin-top: 8px; }
@media (max-width: 860px) {
  .spotlight { grid-template-columns: 1fr; }
  .spotlight .art { min-height: 220px; }
  .spotlight .art::after { background: linear-gradient(180deg, transparent 50%, var(--surface)); }
}

/* Сетка проектов */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  --accent: var(--violet);
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: inherit;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 40px -12px var(--accent); color: inherit; }
.card .thumb { aspect-ratio: 126 / 100; overflow: hidden; background: var(--bg-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.04); }
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 4px 0 0; font-size: 21px; }
.card p { color: var(--dim); font-size: 15px; margin: 0; }
.card .meta { margin-top: auto; padding-top: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* О студии */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.about p { color: var(--dim); font-size: 18px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; }
.fact b { display: block; font-size: 30px; font-weight: 800; color: #fff; line-height: 1.1; }
.fact span { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* Сообщество */
.community { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.social {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700;
  transition: border-color .15s ease, transform .15s ease;
}
.social:hover { border-color: var(--violet); transform: translateY(-2px); color: #fff; }
.social svg { width: 26px; height: 26px; color: var(--violet-light); flex-shrink: 0; }
.social small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }

/* ---------- страница проекта */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 18px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--border-2); }
.crumbs a { color: var(--dim); text-decoration: none; }
.crumbs a:hover { color: #fff; }

.p-hero { position: relative; isolation: isolate; overflow: hidden; padding: 34px 0 64px; }
.p-hero .bg { position: absolute; inset: 0; z-index: -2; }
.p-hero .bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(3px) saturate(1.1); transform: scale(1.04); }
.p-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(11, 8, 20, .97) 0%, rgba(11, 8, 20, .88) 45%, rgba(11, 8, 20, .55) 100%),
              linear-gradient(0deg, var(--bg) 0%, transparent 40%);
}
.p-hero .wrap { display: grid; grid-template-columns: 1.2fr .9fr; gap: 48px; align-items: center; }
.p-hero .eyebrow { color: var(--dim); text-shadow: 0 1px 8px rgba(0, 0, 0, .8); }
.p-hero h1 { font-size: clamp(34px, 5vw, 58px); font-weight: 800; margin: 14px 0 16px; text-shadow: 0 2px 24px rgba(0, 0, 0, .5); }
.p-hero .tagline { font-size: clamp(18px, 2vw, 22px); color: var(--text); max-width: 620px; }
.p-hero .cover img { border-radius: 20px; border: 1px solid var(--border-2); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 60px -20px var(--accent); }
.note { color: var(--dim); font-size: 14px; margin-top: 14px; max-width: 560px; text-shadow: 0 1px 8px rgba(0, 0, 0, .8); }
@media (max-width: 860px) {
  .p-hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .p-hero .cover { max-width: 460px; }
}

/* «Коротко» в разметке идёт первым (на телефоне — сразу под заголовком), на широком экране — колонкой справа */
.p-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.p-body > article { grid-column: 1; grid-row: 1; }
.p-body > .side { grid-column: 2; grid-row: 1; }
.p-body article p { color: var(--dim); font-size: 18px; }
.features { list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: 10px; }
.features li {
  position: relative; padding: 12px 16px 12px 44px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 16px;
}
.features li::before {
  content: ""; position: absolute; left: 17px; top: 19px; width: 10px; height: 10px; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); transform: rotate(45deg);
}
.side { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.side h2 { font-size: 18px; margin-bottom: 14px; }
.side dl { margin: 0; display: grid; gap: 12px; }
.side dt { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.side dd { margin: 2px 0 0; color: var(--text); font-size: 15px; }
.side .links { display: grid; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.side .links a { font-size: 15px; font-weight: 600; }
@media (max-width: 960px) {
  .p-body { grid-template-columns: 1fr; gap: 28px; }
  .p-body > article, .p-body > .side { grid-column: 1; grid-row: auto; }
  .side { position: static; }
}

.block { margin-top: 44px; }
.block > h2 { font-size: 28px; }
.video { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-2); background: #000; }
.video video { width: 100%; height: auto; }
.video figcaption, .gallery figcaption { color: var(--muted); font-size: 14px; padding-top: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.gallery.portrait { grid-template-columns: repeat(auto-fill, minmax(180px, 220px)); }
.gallery figure { margin: 0; }
.gallery a { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); transition: border-color .15s ease; }
.gallery a:hover { border-color: var(--accent); }
.gallery img { width: 100%; height: auto; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.lightbox::backdrop { background: rgba(5, 3, 10, .92); }
.lightbox img { max-width: 94vw; max-height: 86vh; border-radius: 12px; margin: 0 auto; }
.lightbox p { color: var(--dim); text-align: center; margin: 12px 0 0; }
.lightbox button {
  position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border-2); background: rgba(22, 16, 39, .8); color: #fff; font-size: 22px; cursor: pointer;
}
.lightbox .prev { left: 16px; } .lightbox .next { right: 16px; }
.lightbox .close { top: 30px; right: 16px; transform: none; }

/* ---------- подвал */
.site-footer { border-top: 1px solid var(--border); padding: 36px 0 44px; margin-top: 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px 36px; justify-content: space-between; align-items: flex-start; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--dim); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.motto { color: var(--violet-light); font-weight: 700; }

/* ---------- интерактив (site.js) */
.pixel-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; mix-blend-mode: screen; }
.hero-logo .l, .brand .l { transform-box: fill-box; transform-origin: center; }
/* Буквы разлетаются за рамку рисунка — не обрезаем их (по умолчанию SVG обрезает всё за своей рамкой) */
.hero-logo svg, .brand svg { overflow: visible; }

/* Самолётик Telegram и его дымный след */
.plane-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 95; overflow: visible; }
.plane-fx .smoke { transition: opacity 1.4s ease; }
.plane-fx .smoke.fade { opacity: 0; }
a .tg-hidden { opacity: 0; transition: opacity .25s ease; }
.brand .l { transition: transform .08s steps(2); }
.hero-logo { cursor: pointer; }
.hero-logo svg.burst { animation: burst .7s steps(1); }
@keyframes burst {
  0% { transform: translate(-6px, 2px) skewX(-8deg); clip-path: inset(10% 0 55% 0); }
  15% { transform: translate(8px, -3px); clip-path: inset(50% 0 20% 0); }
  30% { transform: translate(-4px, 0) skewX(6deg); clip-path: inset(0 0 70% 0); filter: hue-rotate(90deg) drop-shadow(-6px 0 #d946ef) drop-shadow(6px 0 #22d3ee); }
  45% { transform: translate(3px, 2px); clip-path: inset(65% 0 0 0); }
  60% { transform: none; clip-path: none; filter: hue-rotate(-60deg) drop-shadow(-8px 0 #d946ef) drop-shadow(8px 0 #22d3ee); }
  100% { transform: none; clip-path: none; }
}

/* Наклон карточек и блик под курсором */
.card, .spotlight { position: relative; }
.card.tilt, .spotlight.tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
  transition: transform .08s linear, border-color .2s ease, box-shadow .2s ease;
}
.card::after, .spotlight::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .10), transparent 45%);
  transition: opacity .25s ease;
}
.card.tilt::after, .spotlight.tilt::after { opacity: 1; }

/* Плавное появление блоков (класс ставит site.js, без JavaScript всё видно сразу) */
.reveal { opacity: 0; translate: 0 18px; transition: opacity .6s ease var(--d, 0ms), translate .6s ease var(--d, 0ms); }
.reveal.in { opacity: 1; translate: 0 0; }

/* Плашка достижения — как оверлей GameShelf */
.ach-stack {  /* плашки стопкой: новая сверху */
  position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end;
  gap: 12px; pointer-events: none;
}
body.snake-on .ach-stack { top: 20px; bottom: auto; }  /* пока идёт змейка — сверху, поле не закрываем */
.ach-toast {
  position: relative; display: flex; gap: 14px; align-items: center; pointer-events: none;  /* щелчки — к кнопкам под ней */
  width: min(380px, calc(100vw - 40px)); padding: 14px 18px 14px 14px; border-radius: 16px;
  background: linear-gradient(135deg, #221a3a, #150f28) padding-box,
              linear-gradient(90deg, #fbbf24, #d946ef) border-box;
  border: 2px solid transparent; box-shadow: 0 18px 50px -10px rgba(0, 0, 0, .7), 0 0 30px -8px rgba(217, 70, 239, .5);
  transform: translateX(calc(100% + 40px)); transition: transform .45s cubic-bezier(.2, .9, .2, 1.1);
}
.ach-toast.show { transform: none; }
.ach-icon { width: 54px; height: 54px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; color: #fbbf24;
  background: linear-gradient(135deg, rgba(251, 191, 36, .25), rgba(217, 70, 239, .2)); }
.ach-icon svg { width: 30px; height: 30px; }
.ach-toast small { display: block; color: #fbbf24; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ach-toast b { display: block; color: #fff; font-size: 17px; margin: 2px 0; }
.ach-toast span { display: block; color: var(--dim); font-size: 13px; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .ach-toast { transition: none; } }

/* Сбой всего экрана (код Konami) */
body.screen-glitch main { animation: screen-glitch .9s steps(1); }
@keyframes screen-glitch {
  0% { transform: translate(-10px, 0) skewX(-3deg); filter: hue-rotate(80deg) saturate(2); }
  20% { transform: translate(12px, -4px); clip-path: inset(20% 0 30% 0); }
  40% { transform: translate(-6px, 3px) skewX(4deg); filter: hue-rotate(-90deg) contrast(1.4); clip-path: none; }
  60% { transform: translate(4px, 0); filter: invert(.12) hue-rotate(40deg); }
  80% { transform: none; filter: none; }
}

/* ---------- эффекты карточек проектов (при каждом наведении, site.js) */
.card .thumb { position: relative; }
.fx-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
canvas.fx-layer { width: 100%; height: 100%; }
.fx-out { opacity: 0 !important; transition: opacity .6s ease !important; }

/* HoITS: реткон — горящий шов проходит по кадру, и квартира становится другой */
.fx-retcon { opacity: 0; transition: opacity .3s ease; }
.fx-retcon.go { opacity: 1; }
.fx-retcon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fx-retcon .after { clip-path: inset(0 100% 0 0); }
.fx-retcon.go .after { animation: retcon-sweep 1.2s .5s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes retcon-sweep { to { clip-path: inset(0 0 0 0); } }
.fx-retcon i {
  position: absolute; top: -10%; bottom: -10%; left: 0; width: 3px; opacity: 0;
  background: #ffd9b0; box-shadow: 0 0 10px 3px #ff6a2b, 0 0 34px 12px rgba(255, 106, 43, .55);
}
.fx-retcon.go i { animation: retcon-seam 1.2s .5s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes retcon-seam { 0% { left: 0; opacity: 1; } 96% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
.fx-retcon b {
  position: absolute; left: 50%; top: 10%; transform: translateX(-50%); white-space: nowrap; opacity: 0;
  font: 800 12px/1 var(--font); letter-spacing: .26em; text-transform: uppercase; color: #ffd2b0;
  background: rgba(12, 6, 4, .78); padding: 9px 14px; border: 1px solid rgba(255, 140, 80, .65);
}
.fx-retcon.go b { animation: retcon-label .8s 1.7s steps(1) forwards, retcon-label-out .3s 2.9s ease forwards; }
@keyframes retcon-label-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes retcon-label { 0% { opacity: 1; } 15% { opacity: 0; } 30% { opacity: 1; } 45% { opacity: .25; } 60%, 100% { opacity: 1; } }

/* Бог бюрократии: печать с размаху */
.fx-stamp { display: grid; place-items: center; }
.fx-stamp span {
  font: 900 clamp(22px, 3.2vw, 34px)/1 var(--font); letter-spacing: .14em; text-transform: uppercase;
  color: #c4161c; border: 5px double #c4161c; border-radius: 8px; padding: 10px 20px 8px;
  background: rgba(255, 240, 230, .08); mix-blend-mode: multiply; opacity: 0;
  transform: rotate(-20deg) scale(2.4); filter: drop-shadow(0 0 1px rgba(196, 22, 28, .6));
}
.fx-stamp.no span { color: #7f1d1d; border-color: #7f1d1d; }
.fx-stamp.go span { animation: stamp-down .3s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes stamp-down { to { opacity: .9; transform: rotate(-13deg) scale(1); } }
.fx-shake { animation: card-shake .35s ease; }
@keyframes card-shake { 20% { translate: -3px 2px; } 40% { translate: 3px -2px; } 60% { translate: -2px 1px; } 80% { translate: 1px 0; } }

/* Уборка в галерее пазлов: карточка рассыпается на кусочки и собирается обратно */
.fx-puzzle { background: #0d0a16; }
.fx-puzzle div {
  position: absolute; background-repeat: no-repeat; border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(255, 255, 255, .08), 0 6px 14px rgba(0, 0, 0, .5);
  animation: puzzle-fly 1.9s cubic-bezier(.5, 0, .3, 1) var(--d) both;
}
@keyframes puzzle-fly {
  0% { transform: none; }
  40%, 55% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.86); }
  100% { transform: none; }
}

/* Музыкальное лото: ноты разлетаются вверх */
.fx-notes span {
  position: absolute; bottom: 0; font-weight: 900; line-height: 1; opacity: 0;
  text-shadow: 0 0 12px currentColor; animation: note-up var(--t) ease-out var(--d) forwards;
}
@keyframes note-up {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--sway), var(--rise, -200px)) rotate(var(--rot)); }  /* --rise — от высоты карточки */
}

/* GameShelf: часы набегают, выскакивает плашка достижения */
.fx-shelf .hours {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; align-items: center; padding: 6px 11px;
  border-radius: 999px; background: rgba(10, 8, 20, .85); border: 1px solid rgba(52, 211, 153, .6); color: #a7f3d0;
  font: 700 13px/1 var(--font); animation: fx-pop .3s ease both;
}
.fx-shelf .ach {
  position: absolute; right: 10px; top: 10px; display: flex; gap: 10px; align-items: center; max-width: 82%;
  padding: 9px 12px 9px 9px; border-radius: 12px; border: 2px solid transparent;
  background: linear-gradient(135deg, #221a3a, #150f28) padding-box, linear-gradient(90deg, #fbbf24, #d946ef) border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6); animation: fx-slide .45s cubic-bezier(.2, .9, .2, 1.1) .5s both;
}
.fx-shelf .ach svg { width: 30px; height: 30px; color: #fbbf24; flex-shrink: 0; }
.fx-shelf .ach small { display: block; color: #fbbf24; font: 800 9px/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; }
.fx-shelf .ach strong { display: block; color: #fff; font: 700 13px/1.25 var(--font); }
@keyframes fx-pop { from { opacity: 0; transform: scale(.6); } }
@keyframes fx-slide { from { opacity: 0; transform: translateX(120%); } }

/* Во время эффекта карточки — без увеличения картинки и блика (иначе в конце всё «прыгает») */
.card.fx-busy .thumb img { transform: none !important; }
.card.fx-busy::after, .spotlight.fx-busy::after { opacity: 0 !important; }
/* Градиент, уводящий картинку главного проекта в фон карточки, остаётся поверх слоя эффекта */
.spotlight .art::after { z-index: 4; }
.fx-shelf .hours em { font-style: normal; font-variant-numeric: tabular-nums; }
/* Логотип прокручен за экран — его «сбой» не пересчитывается впустую */
.hero-logo svg.idle { animation-play-state: paused; }

/* ---------- пасхалки (site.js) */
/* Кнопка списка достижений в подвале */
.ach-open {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--dim); font: 600 14px/1 var(--font);
  transition: border-color .2s ease, color .2s ease;
}
.ach-open[hidden] { display: none; }
.ach-open:hover, .ach-open:focus-visible { border-color: #fbbf24; color: #fff; }
.ach-open svg { width: 18px; height: 18px; color: #fbbf24; }
.ach-open b { color: #fbbf24; font-variant-numeric: tabular-nums; }

.ach-panel {
  width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px));
  max-height: min(720px, calc(100dvh - 48px));  /* на телефоне — без учёта панелей браузера */
  padding: 0; border-radius: 20px; color: var(--text); overflow: auto; overscroll-behavior: contain;
  background: linear-gradient(160deg, #1d1533, #120d22) padding-box, linear-gradient(90deg, #fbbf24, #d946ef) border-box;
  border: 2px solid transparent; box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .8);
}
.ach-body { padding: 22px 22px 18px; }  /* поля внутри: щелчок по ним не считается щелчком мимо окна */
.ach-panel::backdrop { background: rgba(6, 4, 12, .72); backdrop-filter: blur(3px); }
.ach-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ach-head h2 { margin: 0; font-size: 22px; }
.ach-head h2 small { color: #fbbf24; font-size: 16px; margin-left: 6px; }
.ach-close {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-2); background: transparent;
  color: var(--dim); font-size: 16px; cursor: pointer;
}
.ach-close:hover, .ach-close:focus-visible { color: #fff; border-color: var(--violet); }
.ach-lead { margin: 6px 0 16px; color: var(--muted); font-size: 14px; }
.ach-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ach-panel li {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border);
}
.ach-panel li.open { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .06); }
.ach-ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--muted); background: var(--surface-2); }
.ach-ic svg { width: 24px; height: 24px; }
.ach-panel li.open .ach-ic { color: #fbbf24; background: linear-gradient(135deg, rgba(251, 191, 36, .25), rgba(217, 70, 239, .2)); }
.ach-panel li b { display: block; font-size: 15px; color: #fff; }
.ach-panel li.locked b { color: var(--muted); letter-spacing: .2em; }
.ach-panel li small { display: block; font-size: 13px; line-height: 1.4; color: var(--dim); }
.ach-panel li.locked small { font-style: italic; color: var(--muted); }

/* Ночная сова: после 23:00 */
.night-owl {
  position: fixed; left: 20px; bottom: 20px; z-index: 150; display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 40px); padding: 10px 10px 10px 14px; border-radius: 999px; color: var(--text); font-size: 15px;
  background: rgba(22, 16, 39, .94); border: 1px solid var(--border-2); box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .7);
  transform: translateY(calc(100% + 40px)); transition: transform .5s cubic-bezier(.2, .9, .2, 1.1);
}
.night-owl.show { transform: none; }
.night-owl svg { width: 22px; height: 22px; color: #fde68a; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(253, 230, 138, .6)); }
.night-owl button {
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--dim); cursor: pointer;
}
.night-owl button:hover, .night-owl button:focus-visible { color: #fff; }
@media (max-width: 760px) {  /* внизу на узком экране — плашка достижения: сова уходит наверх, под шапку */
  .night-owl { top: 76px; bottom: auto; transform: translateY(calc(-100% - 100px)); }
}
@media (prefers-reduced-motion: reduce) { .night-owl { transition: none; } }

/* Заставка как у DVD-плеера */
body.saver-on .pixel-fx { z-index: 310; }  /* вспышка в углу — поверх заставки */
.dvd-saver { position: fixed; inset: 0; z-index: 300; background: #000; cursor: none; animation: dvd-in .8s ease both; }
@keyframes dvd-in { from { opacity: 0; } }
.dvd-logo { position: absolute; left: 0; top: 0; width: 240px; will-change: transform; }
.dvd-logo svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 12px currentColor); }
.dvd-saver.corner .dvd-logo svg { animation: dvd-corner .9s ease; }
@keyframes dvd-corner { 0%, 40% { filter: drop-shadow(0 0 30px currentColor) brightness(1.8); transform: scale(1.12); } }
.dvd-saver p {
  position: absolute; left: 0; right: 0; bottom: 24px; margin: 0; text-align: center;
  color: rgba(255, 255, 255, .28); font-size: 13px; letter-spacing: .12em;
}

/* «Полный беспорядок»: слово disorder с клавиатуры */
.chaos-mode :is(.card, .spotlight, .fact, .social, .btn, main h2, .features li, .side, .gallery figure) {
  translate: var(--cx, 0) var(--cy, 0) !important; rotate: var(--cr, 0deg);
  transition: translate .45s cubic-bezier(.3, 1.6, .5, 1), rotate .45s cubic-bezier(.3, 1.6, .5, 1) !important;
}
/* Конец хаоса: блоки плавно возвращаются на места */
.chaos-out :is(.card, .spotlight, .fact, .social, .btn, main h2, .features li, .side, .gallery figure) {
  transition: translate .6s ease, rotate .6s ease !important;
}
.chaos-mode main { animation: chaos-hue 1.4s linear infinite; }
@keyframes chaos-hue { to { filter: hue-rotate(360deg); } }

/* Discord: окошко чата над ссылкой, сообщения по очереди */
.chat-fx {
  position: fixed; z-index: 95; width: 200px; translate: -50% -100%; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; animation: chat-out .4s ease 2.2s forwards;
}
.chat-fx span {
  align-self: flex-start; max-width: 100%; white-space: nowrap; opacity: 0; transform: translateY(8px) scale(.85);
  transform-origin: left bottom; padding: 6px 12px; border-radius: 14px 14px 14px 4px; background: #5865f2; color: #fff;
  font: 700 13px/1.2 var(--font); box-shadow: 0 8px 20px -6px rgba(88, 101, 242, .8);
  animation: chat-pop .3s cubic-bezier(.3, 1.5, .5, 1) var(--d) forwards;
}
.chat-fx.below { translate: -50% 0; }
.chat-fx span.alt {
  align-self: flex-end; transform-origin: right bottom; background: #2b2d31; border: 1px solid #4e5058;
  border-radius: 14px 14px 4px 14px; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .8);
}
@keyframes chat-pop { to { opacity: 1; transform: none; } }
@keyframes chat-out { to { opacity: 0; transform: translateY(-10px); } }

/* GitHub: волна зелёных квадратиков, как график коммитов */
.commits-fx {
  position: fixed; z-index: 95; display: grid; grid-template-rows: repeat(7, 10px); grid-auto-flow: column;
  grid-auto-columns: 10px; gap: 3px; padding: 8px; border-radius: 8px; pointer-events: none;
  background: rgba(13, 17, 23, .92); border: 1px solid #30363d; animation: commits-out .4s ease 2s forwards;
}
.commits-fx i { border-radius: 2px; opacity: 0; transform: scale(.2); animation: commit-pop .3s cubic-bezier(.3, 1.6, .5, 1) var(--d) forwards; }
@keyframes commit-pop { to { opacity: 1; transform: none; } }
@keyframes commits-out { to { opacity: 0; transform: translateY(-8px); } }

/* Змейка на странице 404 */
.snake-box { margin: 44px auto 0; max-width: 560px; }
.snake-box h2 { font-size: 20px; margin: 0 0 12px; }
.snake-box h2 span { color: var(--muted); font-weight: 600; }
#snake {  /* content-box: рамка не входит в размер — буфер холста совпадает с видимой областью */
  display: block; box-sizing: content-box; width: calc(100% - 2px); border-radius: 14px; border: 1px solid var(--border-2); background: #0d0a18;
  cursor: pointer; touch-action: manipulation; box-shadow: 0 0 40px -12px rgba(139, 92, 246, .5);
}
#snake.playing { touch-action: none; }  /* пока не играют, свайп по полю листает страницу */
.snake-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.snake-bar b { color: #f0abfc; font-variant-numeric: tabular-nums; }
#snake:focus-visible { outline: 2px solid var(--violet-light); outline-offset: 3px; }
