/* MargoStory — прототип игрового портала (25.10.2026). Только для локального просмотра. */
:root {
  --bg: #fff7ec;
  --bg-2: #ffefd9;
  --surface: #ffffff;
  --ink: #3a2b42;      /* тёплый тёмно-сливовый вместо почти чёрного */
  --ink-2: #76677e;
  --ink-soft: #57465f;
  --line: #f0e1cc;
  --plum: #5b2e55;
  --gold: #c08a2e;
  --lime: #a3e635;
  --lime-ink: #1d3000;
  --coral: #ff6b5a;
  --teal: #14b8a6;
  --grad-sun: linear-gradient(135deg, #ff8a5b 0%, #ffc24b 100%);
  --grad-sea: linear-gradient(135deg, #14b8a6 0%, #a3e635 100%);
  --grad-berry: linear-gradient(135deg, #5b2e55 0%, #ff6b5a 100%);
  --sh-1: 0 1px 2px rgba(42, 33, 51, .06), 0 6px 16px rgba(42, 33, 51, .06);
  --sh-2: 0 2px 4px rgba(42, 33, 51, .08), 0 20px 44px rgba(91, 46, 85, .18);
  --r-card: 20px;
  --r-media: 14px;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); overflow-x: hidden; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ---------- шапка ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 247, 236, .86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid rgba(240, 225, 204, .8); }
.top-row { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, var(--sh-1); }
.logo b { font: 800 21px/1 var(--font); letter-spacing: -.01em; color: var(--plum); }
.logo b span { color: var(--coral); }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s; }
.nav a:hover { background: var(--bg-2); color: var(--ink); }
.nav a[aria-current="page"] { background: #f1e3ef; color: var(--plum); }
.langs { display: flex; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.langs button { border: 0; background: none; padding: 6px 11px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--plum); color: #fff; }

/* ---------- общие элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s; }
.btn svg { width: 18px; height: 18px; flex: none; }
html[dir="rtl"] .btn svg.arrow { transform: scaleX(-1); }
.btn-lime { background: var(--lime); color: var(--lime-ink); box-shadow: 0 2px 0 #7fb81c, 0 10px 24px rgba(163, 230, 53, .35); }
.btn-lime:hover { transform: translateY(-2px); box-shadow: 0 4px 0 #7fb81c, 0 16px 30px rgba(163, 230, 53, .45); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line), var(--sh-1); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink), var(--sh-1); }
.kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--surface); box-shadow: var(--sh-1); font-weight: 600; font-size: 14px; color: var(--ink-2); }
html[dir="rtl"] .kicker { padding: 6px 8px 6px 12px; }
.kicker i { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(163, 230, 53, .25); }
.h1 { margin: 0; font: 800 clamp(30px, 3.8vw, 48px)/1.05 var(--font); letter-spacing: -.025em; color: var(--plum); }
.h1 em { font-style: normal; background: var(--grad-berry); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h2 { margin: 0; font: 800 clamp(26px, 3.2vw, 36px)/1.1 var(--font); letter-spacing: -.02em; }
.lead { margin: 8px 0 0; max-width: 32em; font-size: clamp(16px, 1.4vw, 18px); color: var(--ink-2); }
.sec { padding-block: clamp(36px, 6vw, 72px); }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: clamp(18px, 2.6vw, 28px); }
.sec-head p { margin: 6px 0 0; color: var(--ink-2); }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; color: var(--plum); white-space: nowrap; }
.more svg { width: 18px; height: 18px; transition: transform .2s; }
.more:hover svg { transform: translateX(3px); }
html[dir="rtl"] .more svg { transform: scaleX(-1); }
html[dir="rtl"] .more:hover svg { transform: scaleX(-1) translateX(3px); }

/* ---------- первый экран ---------- */
.hero { position: relative; isolation: isolate; overflow-x: clip; padding-block: clamp(18px, 2.6vw, 30px) clamp(28px, 4vw, 48px); }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
.hero::before { width: 520px; height: 520px; inset-inline-end: -120px; top: -160px; background: radial-gradient(circle, #ffc24b 0%, rgba(255, 194, 75, 0) 70%); }
.hero::after { width: 460px; height: 460px; inset-inline-start: -160px; bottom: -220px; background: radial-gradient(circle, #6ee7d8 0%, rgba(110, 231, 216, 0) 70%); }
.hero-inner > * { max-width: 780px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 24px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.hero-facts li { display: flex; align-items: center; gap: 7px; }
.hero-facts li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }

/* ---------- игровая карточка: картинка + одна строка ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: clamp(12px, 1.6vw, 20px); }
.gc { position: relative; display: flex; flex-direction: column; border-radius: 18px; background: var(--surface); box-shadow: var(--sh-1); transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; }
.gc[hidden] { display: none; }
.gc:hover, .gc.is-previewing, .gc:focus-within { transform: translateY(-4px); box-shadow: var(--sh-2); }
.gc-media { position: relative; display: block; margin: 6px 6px 0; aspect-ratio: 16 / 10; border-radius: 13px; overflow: hidden; background: #e9dccb; }
.gc-media img, .gc-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .35s ease; }
.gc:hover .gc-media img { transform: scale(1.04); }
.gc-media video { opacity: 0; }
.gc.is-previewing .gc-media video { opacity: 1; }
.gc-media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(42, 33, 51, .06); pointer-events: none; }
.gc-badge { position: absolute; z-index: 2; inset-inline-start: 8px; top: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(42, 33, 51, .62); color: #fff; transition: opacity .25s; }
.gc-badge svg { width: 11px; height: 11px; margin-inline-start: 1px; }
.gc.is-previewing .gc-badge { opacity: 0; }
.gc-bar { position: absolute; z-index: 2; inset-inline: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); opacity: 0; transition: opacity .25s; overflow: hidden; }
.gc-bar i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--lime); border-radius: inherit; }
html[dir="rtl"] .gc-bar i { transform-origin: right; }
.gc.is-previewing .gc-bar { opacity: 1; }
.gc-info, .gc-peek { position: absolute; z-index: 3; top: 12px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 1px 4px rgba(42, 33, 51, .18); cursor: pointer; transition: opacity .2s, transform .2s; }
.gc-info { inset-inline-end: 12px; }
.gc-info svg { width: 17px; height: 17px; }
.gc-info:hover, .gc-peek:hover { transform: scale(1.08); }
.gc-peek { inset-inline-start: 12px; display: none; }
.gc-peek svg { width: 15px; height: 15px; }
.gc-peek.is-on { display: grid; }
.gc-peek.is-on ~ .gc-media .gc-badge, .gc:has(.gc-peek.is-on) .gc-badge { display: none; }
.gc.is-previewing .gc-peek { background: var(--ink); color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .gc-info { opacity: 0; }
  .gc:hover .gc-info, .gc:focus-within .gc-info, .gc.is-previewing .gc-info { opacity: 1; }
}
.gc-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 8px 14px; }
html[dir="rtl"] .gc-row { padding: 6px 14px 8px 8px; }
.gc h3 { flex: 1; min-width: 0; margin: 0; font: 700 16px/1.2 var(--font); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc h3 a { text-decoration: none; }
.gc h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.gc-play { position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 11px; border-radius: 999px; background: var(--plum); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; transition: background .2s, color .2s, padding .25s; }
.gc-play svg { width: 14px; height: 14px; flex: none; }
.gc-play span { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .25s ease; }
.gc:hover .gc-play, .gc.is-previewing .gc-play, .gc:focus-within .gc-play { background: var(--lime); color: var(--lime-ink); padding: 0 14px; }
.gc:hover .gc-play span, .gc.is-previewing .gc-play span, .gc:focus-within .gc-play span { max-width: 120px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.tag.c-coral { background: #ffe6e1; color: #b8382a; }
.tag.c-teal { background: #d7f5f1; color: #0b7a6f; }
.tag.c-plum { background: #f1e3ef; color: var(--plum); }
.tag.c-gold { background: #faecd2; color: #8a5f12; }
.tag.c-lime { background: #ecf9d2; color: #3f6212; }
.tag.c-sky { background: #dceefe; color: #1d5f99; }
.tag.c-violet { background: #ece4fd; color: #5b3aa6; }
.gc-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- поиск ---------- */
.finder { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 16px 0 18px; }
.finder .filters { margin: 0; flex: 1 1 520px; }
[data-search] { flex: 0 1 260px; min-width: 200px; }
.search { position: relative; display: flex; align-items: center; width: 100%; }
.search svg { position: absolute; inset-inline-start: 13px; width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.search input { width: 100%; height: 42px; padding-inline: 40px 14px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font: 500 15px/1 var(--font); }
.search input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal); }
.empty { margin: 8px 0 0; padding: 22px; border-radius: 18px; background: var(--surface); color: var(--ink-2); text-align: center; }

/* ---------- окно «Как играть» ---------- */
dialog.rules { width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(42, 33, 51, .35); }
dialog.rules::backdrop { background: rgba(42, 33, 51, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.rules-in { position: relative; }
.rules-img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.rules-x { position: absolute; top: 12px; inset-inline-end: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--sh-1); }
.rules-body { padding: 18px 22px 22px; }
.rules-body h2 { margin: 10px 0 0; font: 800 26px/1.15 var(--font); }
.rules-goal { margin: 8px 0 0; color: var(--ink-2); font-size: 15.5px; }
.rules-body h3 { margin: 18px 0 6px; font: 700 15px/1.3 var(--font); }
.rules-body ul { margin: 0; padding-inline-start: 20px; color: var(--ink); font-size: 15px; }
.rules-body li + li { margin-top: 6px; }
.rules-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--bg); color: var(--ink-2); font-size: 14px; }
.rules-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* Пикс: картинка вписывается целиком на мягком фоне */
.gc.is-contain .gc-media { background: linear-gradient(160deg, #f3ecff 0%, #e6f7f4 100%); }
.gc.is-contain .gc-media img { object-fit: cover; object-position: 50% 42%; }

/* ---------- «Обо мне» и коллекция LEGO ---------- */
.about { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(20px, 4vw, 48px); align-items: center; padding: clamp(18px, 3vw, 32px); border-radius: 28px; background: var(--surface); box-shadow: var(--sh-1); }
.about-me { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: start; }
.about-me img { width: 96px; height: 96px; border-radius: 24px; object-fit: cover; box-shadow: var(--sh-1); }
.about-me h2 { margin: 2px 0 0; font: 800 clamp(22px, 2.4vw, 28px)/1.15 var(--font); }
.about-me p { margin: 8px 0 0; color: var(--ink-2); font-size: 15.5px; }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.about-actions .btn { min-height: 44px; font-size: 15px; }
.lego-wrap { position: relative; }
.lego-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.lego-head b { font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.lego-toggle { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink); cursor: pointer; }
.lego-toggle svg { width: 16px; height: 16px; }
.lego-toggle:hover { background: var(--bg-2); }
.lego-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; aspect-ratio: 16 / 9; }
.lego-tile { position: relative; overflow: hidden; border-radius: 16px; background: var(--bg-2); }
.lego-tile:first-child { grid-row: span 2; }
.lego-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.lego-tile img.is-on { opacity: 1; }

/* ---------- полоса «для печати» ---------- */
.print-strip { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: clamp(18px, 3vw, 28px); border-radius: 24px; background: var(--bg-2); }
.print-strip h2 { margin: 0; font: 700 22px/1.2 var(--font); }
.print-strip p { margin: 6px 0 0; color: var(--ink-2); }
.print-covers { display: flex; gap: 10px; }
.print-covers img { width: 64px; height: 88px; object-fit: cover; border-radius: 8px; box-shadow: var(--sh-1); background: #fff; }
.print-covers img:nth-child(odd) { transform: rotate(-4deg); }
.print-covers img:nth-child(even) { transform: rotate(3deg); }

/* ---------- каталог ---------- */
.page-head { padding-block: clamp(18px, 2.6vw, 30px) 0; }
/* в каталоге заголовок скромнее — первым экраном должны быть игры */
body[data-page="catalog"] .page-head .h1 { margin: 0; font-size: clamp(30px, 3.6vw, 42px); }
body[data-page="catalog"] .page-head .lead { margin-top: 6px; font-size: 16px; }
body[data-page="catalog"] .finder { margin-top: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 26px; }
.chip { --c: #84cc16; --ct: #effbd9; --cd: #3f6212;
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 13px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-soft); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .2s, box-shadow .2s, color .2s; }
.chip.c-coral { --c: #ff6b5a; --ct: #ffebe7; --cd: #b5372a; }
.chip.c-teal { --c: #14b8a6; --ct: #dcf6f2; --cd: #0b7266; }
.chip.c-gold { --c: #d39a2e; --ct: #fbefd8; --cd: #85590d; }
.chip.c-plum { --c: #8c4a84; --ct: #f4e6f2; --cd: #5b2e55; }
.chip.c-sky { --c: #3b8fd9; --ct: #e1effc; --cd: #1d5f99; }
.chip.c-lime { --c: #65a30d; --ct: #ecf8d6; --cd: #3f6212; }
.chip.c-violet { --c: #7c5ce0; --ct: #eee8fd; --cd: #5435b0; }
.chip small { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 700; text-align: center; }
.chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c); }
.chip:hover { box-shadow: inset 0 0 0 1.5px var(--c); color: var(--cd); }
.chip[aria-pressed="true"] { background: var(--ct); color: var(--cd); box-shadow: inset 0 0 0 2px var(--c); }
.chip[aria-pressed="true"] small { background: var(--c); color: #fff; }
.gc[hidden] { display: none; }

/* ---------- подвал ---------- */
.foot { margin-top: clamp(24px, 4vw, 48px); padding-block: 28px 64px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }
.proto-note { position: fixed; z-index: 30; inset-inline-end: 12px; bottom: 12px; padding: 6px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; opacity: .8; pointer-events: none; }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .about { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .langs { margin-inline-start: auto; }
  .top-row { min-height: 60px; }
  .logo img { width: 38px; height: 38px; }
  .logo b { font-size: 19px; }
  .about-me { grid-template-columns: 72px minmax(0, 1fr); }
  .about-me img { width: 72px; height: 72px; }
  .sec-head { flex-direction: column; align-items: flex-start; }
  .print-strip { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 100%; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .is-desktop-only { display: none !important; }
}
@media (max-width: 560px) {
  /* телефон: две колонки компактных карточек, чтобы сразу было видно много игр */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gc { border-radius: 15px; }
  .gc-media { margin: 5px 5px 0; border-radius: 11px; }
  .gc-row { min-height: 44px; gap: 6px; padding: 4px 5px 6px 10px; }
  html[dir="rtl"] .gc-row { padding: 4px 10px 6px 5px; }
  .gc h3 { font-size: 14px; }
  .gc-play { height: 34px; min-width: 34px; padding: 0 9px; }
  .gc-info, .gc-peek { top: 9px; width: 28px; height: 28px; }
  .gc-info { inset-inline-end: 9px; }
  .gc-peek { inset-inline-start: 9px; }
  [data-search] { flex-basis: 100%; }
  .lego-grid { gap: 6px; }
  .lego-tile { border-radius: 12px; }
}
@media (hover: none), (pointer: coarse) {
  .gc:hover { transform: none; box-shadow: var(--sh-1); }
  .gc:hover .gc-play { background: var(--plum); color: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
  .gc:hover, .gc.is-previewing, .cat:hover, .btn-lime:hover { transform: none; }
}
