/* Оформление сайта: главная (site/home.js), страница результата и страница 404 (site/resultpage.js), экран владельца (site/ownerpage.js).
   Мир — альбом наклеек: разворот плотного печатного синего на тёмном столе, карточки года — вкладыши в окошках.
   Горячий оранжевый — только активному: кнопке и рамке пустого окошка с командой.
   Шрифты — /karusel/fonts/fonts.css; картинки — файлами с сайта: страница запрещает встроенное (PAGE_CSP в server.js). */

@property --peel { syntax: '<length>'; inherits: true; initial-value: 0px; }

:root {
  --blue: #1447d4;        /* плашка страницы */
  --table: #07164f;       /* стол под альбомом — тот же тон, глубже */
  --ink: #0a1338;         /* печатная тёмная краска */
  --tint: #cbd9ff;        /* вторичный текст на синем: белила с подмесом плашки */
  --paper: #f3f6fd;       /* подложка активного окошка */
  --slot: #c3cadb;        /* серая заглушка окошка */
  --slot-num: #a3acc3;    /* номер на заглушке */
  --hot: #f65c16;         /* оранжевый клодика: только активному */
  --hot-up: #ff7636;

  --display: 'Sofia Sans Extra Condensed', 'Arial Narrow', sans-serif;
  --text: 'Onest', system-ui, sans-serif;
  --mono: 'Martian Mono', ui-monospace, monospace;

  --ease: cubic-bezier(.16, 1, .3, 1);

  --table-gap: 16px;
  --pad-out: 32px;
  --pad-in: 30px;
  --gap: 24px;

  --shadow-sticker: 1px 2px 2px rgba(6, 14, 60, .32), 4px 10px 18px -6px rgba(6, 14, 60, .55);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--table);
  color: #fff;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #5b84ff var(--table);
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--table); }
::-webkit-scrollbar-thumb { background: #3f6cf0; border: 3px solid var(--table); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #5b84ff; }

::selection { background: #fff; color: var(--blue); }
.mine ::selection, .chip ::selection { background: var(--ink); color: #fff; }

body {
  margin: 0;
  font: 400 1rem/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--hot);
}

p, h1, h2, figure, ol { margin: 0; }
img { max-width: 100%; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 3px; }
.mine :focus-visible, .chip :focus-visible { outline-color: var(--ink); }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ───────── альбом и разворот ───────── */

.album {
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--table-gap);
  display: grid;
  gap: var(--table-gap);
}

.spread {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  padding: 20px 0 14px;
  border-radius: 10px;
  background-color: var(--blue);
  /* приводные метки и обрезные уголки, под ними — растр в две сдвинутые сетки */
  background-image:
    url(marks/reg.svg), url(marks/reg.svg),
    url(marks/crop-tl.svg), url(marks/crop-tr.svg), url(marks/crop-bl.svg), url(marks/crop-br.svg),
    radial-gradient(circle, rgba(255, 255, 255, .095) 1.05px, transparent 1.55px),
    radial-gradient(circle, rgba(255, 255, 255, .095) 1.05px, transparent 1.55px);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
  background-position:
    center 5px, center calc(100% - 5px),
    7px 7px, calc(100% - 7px) 7px, 7px calc(100% - 7px), calc(100% - 7px) calc(100% - 7px),
    0 0, 4.5px 4.5px;
  background-size: 18px 18px, 18px 18px, 14px 14px, 14px 14px, 14px 14px, 14px 14px, 9px 9px, 9px 9px;
  box-shadow: 0 2px 3px rgba(0, 2, 30, .5), 0 26px 44px -20px rgba(0, 2, 30, .8);
}

/* сгиб разворота */
.spread::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0; bottom: 0; left: 50%;
  width: 150px;
  translate: -50% 0;
  background: linear-gradient(90deg,
    transparent 0,
    rgba(4, 14, 74, .16) 30%,
    rgba(4, 14, 74, .5) 49.4%,
    rgba(3, 10, 56, .72) 50%,
    rgba(255, 255, 255, .1) 50.7%,
    rgba(4, 14, 74, .2) 56%,
    transparent 100%);
  pointer-events: none;
}

/* растр сгущается к нижнему обрезу — как растяжка в печати */
.spread::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 0; right: 0; bottom: 0;
  height: 190px;
  border-radius: 0 0 10px 10px;
  background:
    radial-gradient(circle, rgba(4, 14, 74, .34) 2.3px, transparent 2.9px) 0 0 / 9px 9px,
    radial-gradient(circle, rgba(4, 14, 74, .34) 2.3px, transparent 2.9px) 4.5px 4.5px / 9px 9px;
  -webkit-mask-image: linear-gradient(to top, #000, transparent);
  mask-image: linear-gradient(to top, #000, transparent);
  pointer-events: none;
}

.page {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}
.page--l { padding: 0 var(--pad-in) 0 var(--pad-out); }
.page--r { padding: 0 var(--pad-out) 0 var(--pad-in); }

/* верхняя строка: только навигация */
.runhead {
  grid-column: 1 / -1;
  min-height: 28px;
  padding: 0 var(--pad-out);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.runhead__home, .langs a {
  font: 700 1.25rem/1 var(--display);
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
}
.runhead__home { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; }
.runhead__home:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.runhead__home svg { flex: none; }
.langs { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.langs a { padding: 5px 8px 4px; border-radius: 3px; }
.langs a[aria-current] { background: #fff; color: var(--blue); }
.langs a:not([aria-current]):hover { box-shadow: inset 0 0 0 2px #fff; }

/* шапка разворота: одна строка через сгиб */
.masthead {
  grid-column: 1 / -1;
  margin: 6px 0 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  font: 900 min(9.7vw, 144px)/.8 var(--display);
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}
/* английская шапка главной длиннее русской: кегль чуть меньше, чтобы строка не вышла за поле страницы */
.home .masthead:lang(en) { font-size: min(9.3vw, 138px); }
.masthead > span:first-child { justify-self: end; padding-right: var(--pad-in); }
.masthead > span:last-child { justify-self: start; padding-left: var(--pad-in); }

.h2 {
  font: 900 min(5.5vw, 80px)/.86 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}

/* колонтитул */
.folios {
  grid-column: 1 / -1;
  padding: 18px var(--pad-out) 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font: 700 1.125rem/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tint);
}
.folio { display: inline-flex; align-items: flex-end; gap: 12px; }
.folio b { font-weight: 900; font-size: 1.875rem; line-height: .8; letter-spacing: 0; color: #fff; }
.folio--l::after {
  content: '';
  width: 70px; height: 9px; margin: 0 0 2px 4px;
  background: linear-gradient(90deg,
    #fff 0 20%, rgba(255, 255, 255, .72) 20% 40%, rgba(255, 255, 255, .46) 40% 60%,
    rgba(255, 255, 255, .24) 60% 80%, rgba(255, 255, 255, .1) 80%);
}

/* ───────── окошко и наклейка ───────── */

.slot { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.win {
  position: relative;
  padding: 6px;
  border: 2px solid #fff;
  border-radius: 6px;
  background: var(--slot);
  container-type: inline-size;
}
.win__num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 900 64cqw/1 var(--display);
  color: var(--slot-num);
  user-select: none;
}
/* в заглушке не номер, а «N%»: знаков больше, кегль меньше */
.win__num--long { font-size: 36cqw; }

.sticker {
  position: relative;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  rotate: var(--tilt, 0deg);
  box-shadow: var(--shadow-sticker);
}
.sticker > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border-radius: 2px;
}
/* карточка участника — живая рамка внутри наклейки: кадр в ней сжимает себя сам (card.js) */
.card {
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 2px;
  background: #0b0b14;
}
.card iframe { display: block; width: 100%; height: 100%; border: 0; }
/* окошко без наклейки (страница 404): одна серая заглушка с номером */
.win--empty { padding: 0; aspect-ratio: 9 / 16; }

/* фольга: перелив только по канту, карточка не тронута */
.sticker--foil {
  background:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0) 0 5px, rgba(255, 255, 255, .55) 5px 6px),
    linear-gradient(128deg,
      #f1eeff 0%, #7fe6ff 9%, #ffffff 17%, #ff93dd 27%, #fff4a0 38%, #8dffc6 49%,
      #ffffff 58%, #9fb2ff 68%, #ff9fd0 79%, #fff7b8 89%, #86ecff 100%);
}
.sticker--foil > img { outline: 1px solid rgba(10, 19, 56, .45); }

.cap {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 5px;
  align-items: center;
  padding: 0 2px;
}
.cap__n {
  grid-row: 1 / 3;
  font: 900 3rem/.8 var(--display);
  text-transform: uppercase;
  display: inline-flex;
  align-items: flex-start;
  gap: 2px;
}
.cap__n small { font-size: 1.125rem; line-height: 1; font-weight: 800; color: var(--tint); }
.cap__t { font: 600 .9375rem/1.2 var(--text); align-self: end; }
.cap .tag { align-self: start; }

.tag {
  justify-self: start;
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 600 .6875rem/1 var(--text);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tint);
}
.tag--author { background: #fff; border-color: #fff; color: var(--blue); }

/* ───────── пустое окошко: твоё ───────── */

.mine {
  position: relative;
  padding: 8px;
  border-radius: 6px;
  transition: --peel .5s var(--ease);
}
.mine:hover, .mine:focus-within { --peel: 48px; }

.mine__back {
  position: absolute; inset: 0;
  border: 3px dashed var(--hot);
  border-radius: 6px;
  background: var(--paper);
  clip-path: polygon(0 0, calc(100% - var(--peel)) 0, 100% var(--peel), 100% 100%, 0 100%);
}
/* приподнятый уголок подложки */
.mine__back::after {
  content: '';
  position: absolute; top: -3px; right: -3px;
  width: var(--peel); height: var(--peel);
  border-bottom-left-radius: 5px;
  background: linear-gradient(to bottom left, transparent 50%, #9eaac8 50%, #dfe6f6 70%, #f3f6fd 100%);
  filter: drop-shadow(-3px 4px 4px rgba(10, 19, 56, .38));
}

.mine__face {
  position: relative;
  margin: 8px;
  aspect-ratio: 9 / 16;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.mine__label {
  font: 900 2.25rem/.8 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 6px 0 0 6px;
}
.mine__ghost {
  margin: auto;
  width: 192px; height: 160px;
  max-width: none;
  image-rendering: pixelated;
  filter: brightness(0);
  opacity: .11;
  user-select: none;
}

.cmd { padding: 0 6px 6px; }
.cmd__line {
  display: block;
  padding: 0 0 12px;
  border-bottom: 2px solid var(--ink);
  font: 600 clamp(1.0625rem, 8.3cqw, 1.5rem)/1 var(--mono);
  white-space: nowrap;
}
.cmd__p { color: #5a658f; user-select: none; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: var(--hot);
  color: var(--ink);
  font: 600 .9375rem/1 var(--text);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(10, 19, 56, .3), 0 9px 14px -9px rgba(150, 46, 0, .85);
  transition: background-color .18s, translate .18s var(--ease), box-shadow .18s;
}
.btn:hover { background: var(--hot-up); translate: 0 -1px; box-shadow: 0 2px 3px rgba(10, 19, 56, .3), 0 12px 16px -9px rgba(150, 46, 0, .85); }
.btn:active { translate: 0 1px; box-shadow: 0 1px 1px rgba(10, 19, 56, .3); }
.btn.is-done, .btn.is-done:hover { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(10, 19, 56, .3); }
.btn svg { flex: none; display: none; }
.btn.is-done svg { display: block; }

/* наклейка-штамп «Скопировано» */
.stamp {
  position: absolute;
  left: 50%; top: 42%;
  width: max-content;
  translate: -50% -50%;
  rotate: -7deg;
  padding: 6px;
  background: #fff;
  border-radius: 5px;
  box-shadow: var(--shadow-sticker);
  visibility: hidden;
  pointer-events: none;
}
.stamp__in {
  display: grid; justify-items: center; gap: 8px;
  padding: 14px 16px 12px;
  border-radius: 3px;
  background: var(--ink);
  color: #fff;
  font: 900 2rem/.8 var(--display);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.stamp__in img { width: 96px; height: 80px; max-width: none; image-rendering: pixelated; }
.is-copied .stamp { visibility: visible; animation: slap .5s var(--ease) both; }
@keyframes slap {
  0% { opacity: 0; scale: 1.9; rotate: -19deg; box-shadow: 6px 46px 50px -8px rgba(6, 14, 60, .32); }
  28% { opacity: 1; }
  100% { opacity: 1; scale: 1; rotate: -7deg; box-shadow: var(--shadow-sticker); }
}

.fine { font: 400 .8125rem/1.45 var(--text); color: var(--tint); }

/* ───────── главная: первый разворот ───────── */

.home .page--l { grid-template-rows: auto 1fr auto; align-items: stretch; }
.lead { grid-column: 1; grid-row: 1; font: 400 1.3125rem/1.38 var(--text); text-wrap: pretty; }
.lead b { font-weight: 600; }
.facts { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; container-type: inline-size; }
.home .slot--mine { grid-column: 2; grid-row: 1 / 3; }
/* название разворота — тоновой плашкой, как год на обложке альбома */
.year { margin: auto 0; padding: 8px 0 4px; font: 900 59cqw/.74 var(--display); color: rgba(255, 255, 255, .2); user-select: none; }
.privacy { grid-column: 2; grid-row: 3; margin-top: 12px; padding: 0 2px; min-height: 48px; }

.works { padding-bottom: 14px; font: 600 .9375rem/1.3 var(--text); }
.count { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .5); display: grid; gap: 10px; }
.count__l { font: 400 .9375rem/1.2 var(--text); color: var(--tint); }
.count__n { font: 900 7rem/.74 var(--display); letter-spacing: .01em; }
.count__n.count__n--l { font-size: 5.25rem; }
.count__n.count__n--xl { font-size: 3.75rem; }

/* ───────── главная: шесть рангов ───────── */

.spread--ranks { --pad-out: 28px; --pad-in: 22px; --step: 40px; --base: 64px; padding-top: 34px; }
.ranks-head {
  grid-column: 1; grid-row: 1;
  align-self: start;
  padding: 0 var(--pad-in) 0 var(--pad-out);
  display: grid; gap: 14px;
}
.ranks-head p { font: 400 1.125rem/1.3 var(--text); }
.ranks {
  grid-column: 1 / -1; grid-row: 1;
  list-style: none;
  padding: 0 var(--pad-out);
  display: grid;
  grid-template-columns: repeat(3, 1fr) calc(2 * var(--pad-in) - 32px) repeat(3, 1fr);
  column-gap: 16px;
}
.rank {
  min-width: 0;
  display: flex; flex-direction: column;
  padding-top: calc(var(--base) + (5 - var(--i)) * var(--step));
}
.rank:nth-child(4) { grid-column: 5; }
.rank:nth-child(5) { grid-column: 6; }
.rank:nth-child(6) { grid-column: 7; }
.win--rank { padding: 4px; }
.sticker--rank { padding: 6px; }
.rank__art {
  aspect-ratio: 6 / 5;
  display: grid; place-items: center;
  border-radius: 2px;
  background: var(--ink);
}
.sticker--foil .rank__art { outline: 1px solid rgba(10, 19, 56, .45); }
.rank__art img { width: 144px; height: 120px; max-width: none; image-rendering: pixelated; }
.rank__name {
  margin-top: 12px;
  font: 900 2rem/.8 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
}
/* ступень лестницы: плашка, растущая к Мастеру */
.rank__bar {
  flex: 1;
  min-height: 62px;
  margin-top: 12px;
  padding: 0 10px 8px;
  display: flex; align-items: flex-end;
  border-top: 2px solid #fff;
  background: rgba(255, 255, 255, .13);
  font: 900 3.5rem/.74 var(--display);
  color: var(--tint);
}

/* ───────── главная: как получить и примеры ───────── */

.spread--how { padding-top: 34px; }
.how { display: block; }
.steps { list-style: none; padding: 0; margin-top: 26px; }
.steps > li {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  min-height: 132px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, .5);
}
.steps > li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .5); }
.steps__n { font: 900 6.5rem/.74 var(--display); }
.steps__t { font: 600 1.5rem/1.2 var(--text); }
.chip {
  position: relative;
  margin-top: 14px;
  padding: 7px 7px 7px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 2px dashed var(--hot);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.chip code { font: 600 1.0625rem/1 var(--mono); white-space: nowrap; }
.chip .btn { width: auto; min-height: 44px; margin: 0; }

/* ───────── выходные данные ───────── */

.imprint {
  padding: 10px 8px 22px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font: 400 .8125rem/1.45 var(--text);
  color: var(--tint);
}
.imprint__by { font: 400 .75rem/1.6 var(--mono); }
.imprint a { color: #fff; }

/* ───────── страница результата ───────── */

.result .masthead { font-size: min(7.4vw, 110px); }
.result .page--l { grid-template-rows: auto 1fr; align-items: stretch; }

.who { grid-column: 1; grid-row: 1; display: grid; gap: 12px; justify-items: start; container-type: inline-size; }
.who__n { font: 900 7.5rem/.74 var(--display); text-transform: uppercase; display: inline-flex; align-items: flex-start; gap: 8px; }
.who__n small { font-size: 2.5rem; line-height: .9; color: var(--tint); }
/* «топ N%» длиннее номера: кегль идёт от ширины колонки, чтобы и «топ 100%» не заходил под наклейку */
.who__n.who__n--top { font-size: min(7.5rem, 38cqw); }
.who__n--top small { font-size: .34em; }
.who__t { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 600 .9375rem/1.2 var(--text); }

.slot--card { grid-column: 2; grid-row: 1 / 3; }

/* переключатель шаблонов: закладки-корешки у края окошка */
.tpl {
  grid-column: 1; grid-row: 2;
  align-self: start;
  margin-top: 26px;
  margin-right: calc(-1 * var(--gap));
  display: grid; gap: 8px;
}
.tpl__b {
  appearance: none;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 7px 10px 7px 8px;
  border: 0;
  border-radius: 6px 0 0 6px;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  font: 600 .9375rem/1.2 var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color .18s;
}
/* белила гуще не делать: при .24 белый текст на кнопке теряет контраст 4,5:1 */
.tpl__b:hover { background: rgba(255, 255, 255, .2); }
.tpl__b[aria-pressed='true'] { background: #fff; color: var(--ink); cursor: default; }
.tpl__thumb {
  flex: none;
  width: 36px;
  padding: 2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 1px 2px 4px rgba(6, 14, 60, .45);
}
.tpl__b[aria-pressed='true'] .tpl__thumb { box-shadow: 1px 2px 4px rgba(6, 14, 60, .45), 0 0 0 1px var(--slot); }
.tpl__thumb img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; }

.tpl[hidden] { display: grid; visibility: hidden; }

/* отклеить — приклеить */
.sticker.is-leaving { transform-origin: 0 0; animation: peel .3s cubic-bezier(.5, 0, .9, .5) both; }
.sticker.is-landing { animation: land .44s var(--ease) both; }
@keyframes peel {
  55% { opacity: 1; }
  100% { opacity: 0; rotate: -10deg; translate: 14px -30px; scale: 1.03; box-shadow: 10px 44px 44px -12px rgba(6, 14, 60, .38); }
}
@keyframes land {
  0% { opacity: 0; rotate: 5deg; translate: 0 -24px; scale: 1.07; box-shadow: 10px 44px 44px -12px rgba(6, 14, 60, .38); }
  30% { opacity: 1; }
}

.result .page--r { align-items: stretch; align-content: start; }
.aside { display: grid; grid-template-rows: auto 1fr; gap: 22px; }
.more { align-self: end; }
.slot--card .cap__n { display: none; }
.next__pair { display: flex; align-items: flex-start; gap: 8px; }
.next__item { display: grid; gap: 8px; justify-items: start; }
.next__item .win { padding: 4px; container-type: normal; }
.next__item .sticker { padding: 5px; }
.next__art { width: 100px; height: 86px; display: grid; place-items: center; border-radius: 2px; background: var(--ink); }
.next__art img { width: 96px; height: 80px; max-width: none; image-rendering: pixelated; }
.next__hole { width: 110px; height: 96px; display: grid; place-items: center; }
.next__hole img { width: 96px; height: 80px; max-width: none; image-rendering: pixelated; filter: brightness(0); opacity: .2; }
.next__name { font: 900 1.5rem/.8 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.next__arrow { flex: none; width: 20px; margin-top: 44px; }
.next__text { margin-top: 16px; display: grid; gap: 6px; }
.next__text b { font: 600 1.25rem/1.25 var(--text); }
.next__text span { font: 400 .9375rem/1.45 var(--text); color: var(--tint); }
/* Высший ранг: следующей ступени нет, пары и строки «до ранга…» тоже. Наклейка занимает ширину колонки, чтобы та не
   зияла; спрайт 48×40 растёт только в целое число раз — ступени по ширине колонки. */
.next--top { container: next / inline-size; }
.next--top .next__pair, .next--top .next__item { display: grid; }
.next--top .next__art { width: 200px; height: 172px; }
.next--top .next__art img { width: 192px; height: 160px; }
.next--top .next__name { font-size: 2.75rem; }
@container next (min-width: 264px) {
  .next--top .next__art { width: 246px; height: 210px; }
  .next--top .next__art img { width: 240px; height: 200px; }
  .next--top .next__name { font-size: 3.25rem; }
}
@container next (min-width: 312px) {
  .next--top .next__art { width: 294px; height: 250px; }
  .next--top .next__art img { width: 288px; height: 240px; }
  .next--top .next__name { font-size: 3.75rem; }
}
@container next (min-width: 408px) {
  .next--top .next__art { width: 390px; height: 330px; }
  .next--top .next__art img { width: 384px; height: 320px; }
  .next--top .next__name { font-size: 4.5rem; }
}

.more { padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .5); display: grid; gap: 14px; justify-items: start; }
.more p { font: 400 .9375rem/1.5 var(--text); }
.more a { font-weight: 600; }
.more__links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.more__link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 600 1rem/1 var(--text); }

@media (max-width: 1339px) {
  .next__arrow { display: none; }
  .next__pair { gap: 10px; }
  .next__item .win { padding: 3px; }
  .next__item .sticker { padding: 4px; }
  .next__art { width: 96px; height: 84px; }
  .next__hole { width: 104px; height: 92px; }
}

@media (max-width: 1400px) {
  .tpl { margin-top: 18px; gap: 6px; }
  .tpl__b { min-height: 62px; padding-block: 4px; }
  .tpl__thumb { width: 30px; }
}

/* ───────── 1180–1259: клодик в два раза, не в три ───────── */

@media (max-width: 1259px) {
  .rank__art img { width: 96px; height: 80px; }
  .count__n { font-size: 5.5rem; }
  .who__n { font-size: 6rem; }
  .lead { font-size: 1.125rem; }
  .steps__t { font-size: 1.25rem; }
  .chip { flex-wrap: wrap; }
}

/* ───────── альбом сложен в одну страницу ───────── */

@media (max-width: 1179px) {
  :root { --table-gap: 8px; --pad-out: 16px; --pad-in: 16px; --gap: 16px; }

  .album { max-width: 560px; }
  .spread, .spread--ranks, .spread--how {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 16px;
    padding: 12px var(--pad-out) 12px;
    --pad-out: 16px; --pad-in: 16px;
  }
  .spread { background-position: 14px 5px, 14px calc(100% - 5px), 7px 7px, calc(100% - 7px) 7px, 7px calc(100% - 7px), calc(100% - 7px) calc(100% - 7px), 0 0, 4.5px 4.5px;
    background-size: 0 0, 0 0, 14px 14px, 14px 14px, 14px 14px, 14px 14px, 9px 9px, 9px 9px; }
  /* корешок слева вместо сгиба посередине */
  .spread::before {
    left: 0; width: 26px; translate: none;
    border-radius: 10px 0 0 10px;
    background: linear-gradient(90deg, rgba(3, 10, 56, .6), rgba(4, 14, 74, .22) 34%, transparent);
  }
  .spread::after { height: 130px; }

  .page { display: contents; }
  .spread .page > * { grid-column: auto; grid-row: auto; }
  .year { display: none; }
  .runhead, .folios { padding-inline: 0; }
  .folios { padding-top: 8px; order: 99; }
  .folio--r { display: none; }

  .masthead { display: block; margin: 0; font-size: min(19vw, 104px); }
  .masthead > span:first-child, .masthead > span:last-child { display: block; padding: 0; }
  .home .masthead:lang(en) { font-size: min(18vw, 98px); }

  .slot { width: 100%; max-width: 420px; justify-self: center; }

  /* главная */
  .lead { font-size: 1.0625rem; }
  .home .slot--mine {
    order: 3;
    width: clamp(232px, calc((100svh - 338px) * .5625), 100%);
  }
  .home .lead { order: 2; }
  .home .privacy { order: 4; margin-top: -4px; min-height: 0; text-align: center; text-wrap: balance; }
  .home .slot--n1 { order: 5; }
  .home .slot--n2 { order: 6; }
  .home .facts { order: 7; margin-top: 8px; }

  /* ранги: окошки по два */
  .spread--ranks { padding-top: 28px; }
  .ranks-head, .ranks { grid-column: 1; grid-row: auto; padding: 0; }
  .ranks { grid-template-columns: 1fr 1fr; gap: 20px 14px; margin-top: 6px; }
  .rank { padding-top: 0; }
  .rank:nth-child(n) { grid-column: auto; }
  .rank__art img { width: 96px; height: 80px; }
  .rank__bar { flex: none; min-height: 52px; font-size: 3rem; }
  .h2 { font-size: min(13.2vw, 72px); }

  /* как получить */
  .spread--how { padding-top: 28px; }
  .steps { margin-top: 20px; }
  .steps > li { grid-template-columns: 62px 1fr; min-height: 0; }
  .steps__n { font-size: 5rem; }
  .steps__t { font-size: 1.25rem; }
  .chip { flex-wrap: wrap; padding: 12px; }
  .chip .btn { width: 100%; }

  .imprint { padding: 8px 8px 20px; }

  /* результат: карточка, под ней сразу команда */
  .result .spread { grid-template-columns: minmax(0, 1fr) 72px; column-gap: 0; row-gap: 14px; }
  .result .spread > *, .result .spread .page > * { grid-column: 1 / -1; grid-row: auto; }
  .result .who { display: none; }
  .slot--card .cap__n { display: inline-flex; }
  .result .spread .page > .slot--card { order: 2; grid-column: 1; max-width: none; }
  .result .spread .page > .tpl { order: 3; grid-column: 2; align-self: start; margin: 12px 0 0; gap: 8px; }
  .tpl__b { min-height: 0; padding: 7px 8px 7px 6px; border-radius: 0 6px 6px 0; justify-content: center; }
  .tpl__thumb { width: 48px; }
  .tpl__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .result .masthead { order: 4; font-size: min(8.9vw, 50px); display: flex; gap: .22em; margin-top: 2px; }
  .result .slot--mine { order: 5; width: min(300px, 100%); }
  .result .mine__label { order: 0; }
  .result .cmd { order: 1; padding-top: 14px; }
  .result .mine__ghost { order: 2; }
  .result .stamp { top: 66%; }
  .result .aside { order: 6; margin-top: 8px; }
}

/* ───────── экран владельца: забрать карточку и показать ─────────
   Справа вместо окошка «Твоя» — что сделать с карточкой. Горячий оранжевый — только у «Скачать картинку»; остальные
   действия — плашки белилами, как закладки шаблонов. Пока сайт рисует картинку, кнопка гаснет до белил и говорит
   «рисуется»; отказ — белая плашка «повторить». Слайды карусели — наклейки в маленьких окошках: пока слайд не
   нарисован, в окошке серая заглушка с его номером, готовый ложится наклейкой (land). Состояния ставит owner.js. */

.own {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 26px;
  align-content: start;
}
.get { grid-column: 1; display: grid; gap: 12px; align-content: start; }
.share { grid-column: 2; display: grid; gap: 12px; justify-items: start; align-content: start; }
/* лента — во всю страницу; под ней рядом «открыть на телефоне» и дорога дальше: разворот не длиннее карточки */
.reel { grid-column: 1 / -1; }
.phone { grid-column: 1; }
.own .more { grid-column: 2; align-self: start; }
.reel, .phone { padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .5); }

.own__h {
  font: 900 2rem/.8 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.own__size { font: 400 .8125rem/1.45 var(--text); color: var(--tint); }
.own__fail { max-width: 36em; font: 600 .9375rem/1.4 var(--text); text-wrap: pretty; }
.own__fail[hidden] { display: none; }

/* главное действие: ссылка, одетая кнопкой */
a.btn { text-decoration: none; }
.btn--get { margin-top: 0; min-height: 56px; gap: 10px; font-size: 1.0625rem; }
.btn--get .i-down { display: block; }
/* скачано: 2,6 с белая галочка на `ink`, как «Скопировано» у команды (.btn.is-done) */
.btn--get.is-done .i-down { display: none; }
.btn--get.is-done .i-done { display: block; }
.btn--get[data-kind='busy'], .btn--get[data-kind='busy']:hover {
  background: rgba(255, 255, 255, .13);
  color: #fff;
  box-shadow: none;
  translate: none;
  cursor: progress;
}
.btn--get[data-kind='busy'] .i-down { opacity: .55; }
.btn--get[data-kind='retry'], .btn--get[data-kind='retry']:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow-sticker); }
.btn--get[data-kind='retry'] .i-down { display: none; }

/* второстепенные действия: плашка белилами, как закладка шаблона; после копирования — белая */
.act {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  font: 600 .9375rem/1 var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s, color .18s;
}
/* белила гуще .2 не делать: белый текст теряет контраст 4,5:1 (как у закладок) */
.act:hover { background: rgba(255, 255, 255, .2); }
.act[aria-disabled='true'], .act[aria-disabled='true']:hover { background: rgba(255, 255, 255, .07); cursor: progress; }
.act.is-done, .act.is-done:hover, .act[data-kind='retry'] { background: #fff; color: var(--ink); }
.act svg { flex: none; }
.act[data-kind='retry'] svg { display: none; }   /* «повторить» — не «вниз» */
.act--copy svg { display: none; }
.act--copy.is-done svg { display: block; }
.act--share { min-height: 48px; }
.act--share[hidden] { display: none; }
/* на телефоне «Скачать» кладёт файл в «Файлы»; в галерею и в сторис ведёт «Поделиться» */
.share__hint { display: none; font: 400 .8125rem/1.45 var(--text); color: var(--tint); }
.can-share .share__hint { display: block; }

/* поделиться: ссылка страницы результата, Telegram и X */
.share__url { max-width: 100%; font: 600 .9375rem/1.3 var(--text); overflow-wrap: anywhere; }
.share__out { display: flex; flex-wrap: wrap; gap: 0 20px; }
.share__to { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font: 600 1rem/1 var(--text); }
.share__to svg { flex: none; }
/* на телефоне со своим окном «Поделиться» заголовок повторял бы кнопку: остаётся для экранной читалки */
.can-share .share .own__h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* карусель: шесть окошек, слайды ложатся в них наклейками */
.reel { display: grid; gap: 16px; }
.reel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.reel__list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.reel__i { min-width: 0; display: grid; gap: 8px; align-content: start; }
.reel__i[hidden] { display: none; }
.win--slide { padding: 4px; }
.reel__i .sticker { padding: 4px; visibility: hidden; }
.reel__i .sticker img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 2px; }
.reel__i.is-in .sticker { visibility: visible; animation: land .44s var(--ease) both; }
.reel__cap { min-height: 24px; display: flex; align-items: center; font: 600 .8125rem/1.2 var(--text); }
.reel__get { padding: 4px 0; }
/* ссылка «скачать» — у готового слайда; «рисуется» — только у того, что сайт рисует сейчас (по одному), остальные
   окошки пока пустые; без сценария состояний нет — ссылка видна всегда */
.reel__busy, .reel__fail, .reel__wait { display: none; color: var(--tint); font-weight: 400; }
.reel__i:is([data-state='wait'], [data-state='busy'], [data-state='failed']) .reel__get { display: none; }
.reel__i[data-state='busy'] .reel__busy, .reel__i[data-state='failed'] .reel__fail { display: inline; }
/* пока на экране отказ, пустые окошки не немые: «ждёт» */
.has-fail .reel__i[data-state='wait'] .reel__wait { display: inline; }
.reel__note { font: 400 .8125rem/1.45 var(--text); color: var(--tint); }
.reel__note code { font: 400 .8125rem/1.45 var(--mono); color: #fff; white-space: nowrap; }
.reel__all { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }

/* открыть на телефоне: только на широком экране — на телефоне экран уже открыт */
.phone { display: grid; gap: 12px; }
.phone__note { max-width: 40em; font: 400 .9375rem/1.45 var(--text); color: var(--tint); }
.phone__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.phone__url { font: 600 .9375rem/1.3 var(--text); overflow-wrap: anywhere; }

/* готовая картинка карточки вместо рамки: на телефоне её ставит owner.js (долгое нажатие сохраняет картинку) */
.card__png { display: block; width: 100%; height: 100%; }
.card__png[hidden] { display: none; }
.card__png:not([hidden]) ~ iframe { display: none; }

/* без сценария: слайды не просятся — в окошках заглушки с номерами, под ними прямые ссылки; карточка — картинкой */
.no-js .owner .slot--live .sticker { display: block; }
.no-js .owner .slot--live .win { padding: 6px; aspect-ratio: auto; }
.no-js .owner .slot--live .cap__t { display: block; }
.no-js .owner .card iframe { display: none; }
.no-js .reel__i .sticker { display: none; }
.no-js .win--slide { aspect-ratio: 4 / 5; }

@media (max-width: 1179px) {
  /* телефон: карточка, «твоя карточка готова» и сразу главная кнопка — в первом экране; ниже поделиться и лента */
  .owner .own { display: contents; }
  .owner .spread .own > * { grid-column: 1 / -1; grid-row: auto; }
  .owner .masthead { order: 4; }
  .owner .get { order: 5; margin-top: -2px; }
  .owner .share { order: 6; margin-top: 10px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .5); }
  .owner .reel { order: 7; margin-top: 10px; }
  .owner .own .more { order: 8; margin-top: 10px; }
  .owner .phone { display: none; }
  .reel__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
  .win--slide { padding: 6px; }
  .reel__i .sticker { padding: 6px; }
  .reel__cap { font-size: .9375rem; min-height: 44px; }
  .reel__get { padding: 12px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}

/* ───────── без сценария: кнопок, которым он нужен, нет; текст, команда и счётчик на месте ───────── */

/* «Скачать картинку» на экране владельца — ссылка, а не кнопка сценария: без него она скачивает сама */
.no-js button.btn, .no-js .tpl, .no-js .act { display: none; }
/* карточку рисует сценарий: без него в окошке остаётся серая заглушка с номером участника, как у пустого места альбома */
.no-js .slot--live .sticker, .no-js .slot--live .cap__t { display: none; }
.no-js .slot--live .win { padding: 0; aspect-ratio: 9 / 16; }

/* ───────── страница 404: окошко без наклейки ───────── */

@media (max-width: 1179px) {
  /* на телефоне заглушка ниже карточки: команда остаётся в первом экране */
  .no-js .slot--live .win { aspect-ratio: 4 / 3; }
  .notfound .who { display: grid; order: 1; }
  .notfound .slot--card { display: none; }
}
/* на развороте текст справа стоит первым в колонке: линейке отделять его не от чего */
@media (min-width: 1180px) {
  .notfound .more { padding-top: 0; border-top: 0; }
}

/* ───────── углы наклона и ступени: вместо встроенных стилей ───────── */

.album--foot { padding-top: 0; padding-bottom: 0; }

.tilt-l1 { --tilt: -1.1deg; }
.tilt-r1 { --tilt: .9deg; }
.tilt-l2 { --tilt: -.8deg; }
.tilt-r2 { --tilt: 1.2deg; }
.tilt-l3 { --tilt: -1.4deg; }
.tilt-r3 { --tilt: 1.1deg; }

.rank:nth-child(1) { --i: 0; }
.rank:nth-child(2) { --i: 1; }
.rank:nth-child(3) { --i: 2; }
.rank:nth-child(4) { --i: 3; }
.rank:nth-child(5) { --i: 4; }
.rank:nth-child(6) { --i: 5; }
