/* Базару Джексон, король базара. Клетчатая сумка, красная куртка, жёлтый ценник. */

/* ---------- Шрифты (лежат локально, лицензия OFL) ---------- */

@font-face {
  font-family: "Sofia Sans Extra Condensed";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("../fonts/sofia-sans-extra-condensed-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Sofia Sans Extra Condensed";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("../fonts/sofia-sans-extra-condensed-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("../fonts/sofia-sans-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("../fonts/sofia-sans-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("../fonts/sofia-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/shantell-sans-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/shantell-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */

:root {
  /* зависят от темы */
  --bg: #fafaf6;
  --surface: #ffffff;
  --ink: #17140f;
  --muted: #5b564d;
  --red-text: #c41820;
  --footer-bg: #17140f;
  --footer-fg: #f4f1e8;
  --backdrop: rgb(23 20 15 / 0.62);

  /* цвета рынка: клетчатая сумка, красная куртка, жёлтый ценник. От темы не зависят */
  --blue: #1c45b4;
  --red: #e2262d;
  --yellow: #ffe000;
  --black: #17140f;
  --white: #ffffff;
  --tile-a: #ffe000;
  --tile-b: #cdd9f8;
  --tile-c: #f9cdd0;

  --plaid-stripes: rgb(28 69 180 / 0.8) 0 14px, transparent 14px 20px, rgb(28 69 180 / 0.8) 20px 24px,
    transparent 24px 46px, rgb(226 38 45 / 0.82) 46px 50px, transparent 50px 72px;
  --plaid: repeating-linear-gradient(90deg, var(--plaid-stripes)), repeating-linear-gradient(0deg, var(--plaid-stripes)), #fdfdfa;

  --font-display: "Sofia Sans Extra Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Sofia Sans", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Shantell Sans", "Comic Sans MS", cursive;

  /* скругления: кнопки и поля 12px, карточки 18px, вывески 28px */
  --r-control: 12px;
  --r-card: 18px;
  --r-panel: 28px;
  --header-h: 64px;
  --gutter: clamp(16px, 4vw, 40px);

  /* слои */
  --z-header: 20;
  --z-banner: 30;
  --z-walker: 40;
  --z-toast: 60;

  color-scheme: light;
}

/* ночной рынок */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120e;
    --surface: #211e18;
    --ink: #f4f1e8;
    --muted: #b5afa2;
    --red-text: #ff6b70;
    --footer-bg: #211e18;
    --backdrop: rgb(0 0 0 / 0.72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14120e;
  --surface: #211e18;
  --ink: #f4f1e8;
  --muted: #b5afa2;
  --red-text: #ff6b70;
  --footer-bg: #211e18;
  --backdrop: rgb(0 0 0 / 0.72);
  color-scheme: dark;
}

/* ---------- База ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.125rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

::selection {
  background: var(--yellow);
  color: var(--black);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.block--red :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--yellow);
}
.block--yellow :focus-visible {
  outline-color: var(--black);
}

.sprite {
  position: absolute;
}

/* повёрнутые ценники и наклейка не должны раздвигать страницу вбок */
main {
  overflow-x: clip;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 1240px);
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: calc(var(--z-header) + 1);
  padding: 10px 14px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--bg);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-block;
  padding: 0.85em 1.3em;
  border: 3px solid var(--ink);
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--bg);
  font: 800 1.125rem/1 var(--font-body);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(2px);
}
.btn[disabled] {
  cursor: progress;
  opacity: 0.7;
}
.btn--red {
  background: var(--red);
  color: var(--white);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--black {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}
.btn--white {
  border-color: var(--black);
  background: var(--white);
  color: var(--black);
}
.btn--outline {
  border-color: var(--black);
  background: transparent;
  color: var(--black);
}
.btn--outline[aria-pressed="true"] {
  background: var(--black);
  color: var(--yellow);
}

.tool {
  padding: 0.55em 0.8em;
  border: 3px solid var(--ink);
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink);
  font: 700 0.9375rem/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.tool[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* ---------- Шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 3px solid var(--ink);
  background: var(--bg);
}

.header-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 900 1.75rem/1 var(--font-display);
  letter-spacing: 0.01em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-hat {
  --hat-band: var(--red);
  width: 46px;
  height: 32px;
  rotate: -8deg;
  transition: rotate 0.2s;
}
.brand:hover .brand-hat {
  rotate: 6deg;
}
.brand.is-hatless .brand-hat {
  animation: hat-off 0.9s ease-in forwards;
}
@keyframes hat-off {
  to {
    opacity: 0;
    transform: translate(-30px, -90px) rotate(-200deg);
  }
}

.header-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.site-nav {
  display: flex;
  gap: 20px;
}
.site-nav a {
  padding: 6px 0;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover {
  border-bottom-color: var(--red);
}

.header-tools {
  display: flex;
  gap: 8px;
}

.menu-toggle {
  display: none;
  margin-left: auto;
}

.bag-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.5em 0.7em;
  border: 3px solid var(--black);
  border-radius: var(--r-control);
  background: var(--yellow);
  color: var(--black);
  font: 800 1rem/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.bag-count {
  min-width: 1.6em;
  padding: 0.2em 0.4em;
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  text-align: center;
}
.bag-button.is-bumped {
  animation: bag-bump 0.3s ease-out;
}
@keyframes bag-bump {
  40% {
    transform: scale(1.14) rotate(-3deg);
  }
}

@media (max-width: 1139px) {
  .menu-toggle {
    display: inline-block;
  }
  .header-panel {
    position: absolute;
    top: 100%;
    left: calc(-1 * clamp(16px, 4vw, 40px));
    right: calc(-1 * clamp(16px, 4vw, 40px));
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin: 0;
    padding: 12px clamp(16px, 4vw, 40px) 20px;
    border-bottom: 3px solid var(--ink);
    background: var(--bg);
  }
  .header-panel.is-open {
    display: flex;
  }
  .site-nav {
    flex-direction: column;
    gap: 0;
  }
  .site-nav a {
    padding: 10px 0;
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .header-row {
    gap: 8px;
  }
  .brand {
    gap: 6px;
    font-size: 1.3125rem;
  }
  .brand-hat {
    width: 34px;
    height: 24px;
  }
  .tool,
  .bag-button {
    padding-inline: 0.55em;
    font-size: 0.875rem;
  }
}

/* ---------- Первый экран ---------- */

.hero {
  padding-block: clamp(24px, 4vw, 48px) clamp(36px, 5vw, 64px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.hero-title {
  margin: 0;
  font: 900 clamp(4.75rem, min(14vw, 25vh), 12.5rem) / 0.8 var(--font-display);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.hero-title span {
  display: block;
}

.hero-sub {
  max-width: 30ch;
  margin: 0.9em 0 1.2em;
  font-size: 1.375rem;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: end;
  width: 100%;
  max-width: min(520px, 62vh);
  aspect-ratio: 1;
  border: 3px solid var(--black);
  border-radius: var(--r-panel);
  background: var(--plaid);
}

.king-button {
  display: grid;
  place-items: center;
  width: 80%;
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--black);
  border-radius: 50%;
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
}
.king-button svg {
  width: 96%;
  height: 96%;
  margin-top: 4%;
}
.king-button.is-bouncing svg {
  animation: king-bounce 0.45s ease-out;
}
@keyframes king-bounce {
  30% {
    transform: translateY(10px) scale(1.04, 0.94);
  }
  60% {
    transform: translateY(-8px) scale(0.98, 1.03);
  }
}

.sticker {
  position: absolute;
  right: -12px;
  bottom: 4%;
  display: grid;
  place-items: center;
  width: clamp(112px, 33%, 172px);
  aspect-ratio: 1;
  margin: 0;
  background: var(--yellow);
  color: var(--black);
  font: 800 clamp(0.9375rem, 1.9vw, 1.375rem) / 1 var(--font-hand);
  rotate: 12deg;
  clip-path: polygon(50% 0%, 59.3% 9.1%, 71.7% 5%, 76.2% 17.2%, 89.1% 18.8%, 87.8% 31.8%, 98.7% 38.9%, 92% 50%, 98.7% 61.1%, 87.8% 68.2%, 89.1% 81.2%, 76.2% 82.8%, 71.7% 95%, 59.3% 90.9%, 50% 100%, 40.7% 90.9%, 28.3% 95%, 23.8% 82.8%, 10.9% 81.2%, 12.2% 68.2%, 1.3% 61.1%, 8% 50%, 1.3% 38.9%, 12.2% 31.8%, 10.9% 18.8%, 23.8% 17.2%, 28.3% 5%, 40.7% 9.1%);
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-title {
    font-size: clamp(4.5rem, 24vw, 9.5rem);
  }
  .hero-art {
    justify-self: center;
    max-width: 440px;
  }
}

/* ---------- Лента ---------- */

.ticker {
  overflow: hidden;
  border-block: 3px solid var(--black);
  background: var(--blue);
  color: var(--white);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 46s linear infinite;
}
.ticker:hover .ticker-track {
  animation-play-state: paused;
}
.ticker-list {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 12px 0;
  list-style: none;
  font: 800 1.625rem/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ticker-list[hidden] {
  display: none;
}
.ticker-list li {
  display: flex;
  align-items: center;
}
.ticker-list li::after {
  content: "";
  width: 11px;
  height: 11px;
  margin-inline: 26px;
  background: var(--yellow);
  rotate: 45deg;
}
@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Разделы ---------- */

.section,
.block {
  padding-block: clamp(56px, 8vw, 104px);
}
.block--red {
  background: var(--red);
  color: var(--white);
}
.block--yellow {
  background: var(--yellow);
  color: var(--black);
}

.section-title {
  margin: 0 0 0.22em;
  font: 900 clamp(2.75rem, 7vw, 5.5rem) / 0.9 var(--font-display);
  letter-spacing: -0.005em;
  text-transform: uppercase;
}

.lead {
  max-width: 50ch;
  margin: 0;
  font-size: 1.3125rem;
  line-height: 1.45;
}

/* ---------- Прилавок ---------- */

.shop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
}
.raid-button[disabled] {
  cursor: default;
}

.stall {
  position: relative;
  margin-top: 40px;
}

.products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 14px;
  border: 3px solid var(--ink);
  border-radius: var(--r-card);
  background: var(--surface);
  /* при шухере карточки по очереди улетают в сумку и так же возвращаются */
  transition: transform 0.5s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.5s;
  transition-delay: calc(var(--n, 0) * 35ms);
}
.stall.is-raided .product {
  opacity: 0;
  transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.05) rotate(24deg);
}

.raid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.raid[hidden] {
  display: none;
}
.raid-inner {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 4px 0 24px;
  text-align: center;
  pointer-events: auto;
  animation: raid-in 0.4s 0.45s ease-out both;
}
@keyframes raid-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.raid-king {
  --hat-drop: 15px;
  width: clamp(120px, 16vw, 168px);
  height: auto;
  border: 3px solid var(--black);
  border-radius: 50%;
  background: var(--white);
}
.raid-title {
  margin: 0;
  font: 900 clamp(3rem, 8vw, 5.5rem) / 0.85 var(--font-display);
  text-transform: uppercase;
}
.raid-text {
  max-width: 28ch;
  margin: 0;
  font: 600 1.375rem/1.3 var(--font-hand);
}

.product-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--tile-a);
}
.product:nth-child(3n + 2) .product-tile {
  background: var(--tile-b);
}
.product:nth-child(3n) .product-tile {
  background: var(--tile-c);
}

.product-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(3.25rem, 6vw, 4.75rem);
  line-height: 1;
  transition: transform 0.2s;
}
.product:hover .product-emoji {
  transform: rotate(-8deg) scale(1.1);
}

/* ярлык как на рыночном ценнике: это часть товара, а не украшение */
.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 0.36em 0.55em 0.28em;
  border-radius: 6px;
  background: var(--black);
  color: var(--white);
  font: 800 0.9375rem/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  rotate: -4deg;
}

.product-name {
  margin: 0 0 4px;
  font: 800 1.25rem/1.15 var(--font-body);
}
.product-price {
  margin: 0 0 6px;
  color: var(--red-text);
  font: 800 1.75rem/1.1 var(--font-hand);
}
.product-note {
  flex: 1;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}
.product-btn {
  width: 100%;
}

@media (max-width: 1040px) {
  .products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .product {
    padding: 8px 8px 10px;
    border-radius: 14px;
  }
  .product-name {
    font-size: 1.0625rem;
  }
  .product-price {
    font-size: 1.375rem;
  }
  .product-note {
    font-size: 0.9375rem;
  }
  .product-btn {
    padding: 0.75em 0.4em;
    font-size: 1rem;
  }
}

/* ---------- Книга отзывов ---------- */

.reviews {
  padding-top: 0;
}

/* листы из тетради в линейку с красными полями, листаются вбок */
.reviews-row {
  display: flex;
  gap: 24px;
  margin: 28px calc(-1 * var(--gutter)) 0;
  padding: 14px var(--gutter) 26px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
}
.review {
  --tilt: -1.2deg;
  position: relative;
  display: flex;
  flex: 0 0 min(330px, 82vw);
  flex-direction: column;
  padding: 12px 18px 16px 56px;
  border: 3px solid var(--black);
  border-radius: 6px;
  background: repeating-linear-gradient(#fdfdfa 0 calc(2rem - 1px), #b4c4f0 calc(2rem - 1px) 2rem) 0 12px;
  color: var(--black);
  font: 600 1.1875rem/2rem var(--font-hand);
  rotate: var(--tilt);
  scroll-snap-align: start;
}
.review:nth-child(3n + 2) {
  --tilt: 1deg;
}
.review:nth-child(3n) {
  --tilt: -0.4deg;
}
.review::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 40px;
  width: 2px;
  background: var(--red);
  opacity: 0.55;
}
.review-text {
  flex: 1;
  margin: 0 0 2rem;
  color: var(--blue);
}
.review-author {
  margin: 0;
  font-size: 1rem;
}
.review-rating {
  margin: 0;
  line-height: 2rem;
}
.review-rating i {
  display: inline-block;
  width: 10px;
  height: 18px;
  margin-right: 6px;
  border: 2px solid var(--black);
  border-radius: 50%;
  vertical-align: middle;
  rotate: 18deg;
}
.review-rating i.on {
  background: var(--black);
}

/* ---------- Проверка базара ---------- */

.ask-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.ask-form {
  margin-top: 28px;
}
.ask-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}
.ask-input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 3px solid var(--black);
  border-radius: var(--r-control);
  background: var(--white);
  color: var(--black);
  font: 600 1.5rem/1.4 var(--font-hand);
  resize: none;
}
.ask-input::placeholder {
  color: #6b665c;
  opacity: 1;
}
.ask-help {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 16px;
  font-size: 1rem;
  font-weight: 600;
}
.ask-error {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
}

.note {
  width: 100%;
  max-width: 520px;
  justify-self: end;
}
.note-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px solid var(--black);
  border-radius: var(--r-card);
  background: var(--plaid);
  overflow: hidden;
}
.note-empty {
  max-width: 72%;
  margin: 0;
  padding: 18px 22px;
  border: 3px dashed var(--black);
  border-radius: var(--r-control);
  background: var(--white);
  color: var(--black);
  font: 600 1.25rem/1.3 var(--font-hand);
  text-align: center;
}
.note-sheet {
  position: absolute;
  inset: 0;
}
.note-sheet[hidden] {
  display: none;
}
.note-sheet canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.note-sheet.is-hit {
  animation: sheet-hit 0.22s ease-out;
}
.note-stamp {
  transform-origin: var(--stamp-x, 72%) var(--stamp-y, 72%);
}
.note-stamp.is-waiting {
  opacity: 0;
}
.note-stamp.is-slamming {
  animation: stamp-slam 0.3s cubic-bezier(0.6, 0, 0.9, 0.4) both;
}
@keyframes stamp-slam {
  from {
    opacity: 0;
    transform: scale(2.6) rotate(-16deg);
  }
  55% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sheet-hit {
  30% {
    transform: translate(2px, 3px) rotate(0.4deg);
  }
  65% {
    transform: translate(-1px, -1px);
  }
}
.note-text {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-weight: 700;
}
.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.note-actions[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .ask-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .note {
    justify-self: center;
  }
}

/* ---------- Король ---------- */

.king-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.origin {
  margin-top: 28px;
  padding: 14px 18px;
  border: 3px solid var(--ink);
  border-radius: var(--r-card);
  background: var(--surface);
}
.origin summary {
  font-weight: 800;
  cursor: pointer;
}
.origin p {
  margin: 0.8em 0 0;
  font-size: 1.0625rem;
}
.origin .origin-sources {
  color: var(--muted);
  font-size: 1rem;
}

/* факты написаны маркером на ценниках */
.facts {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fact {
  --tilt: -1.6deg;
  position: relative;
  padding: 42px 22px 18px;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--black);
  rotate: var(--tilt);
}
.fact:nth-child(2) {
  --tilt: 1.3deg;
  margin-left: 9%;
}
.fact:nth-child(3) {
  --tilt: -0.7deg;
  margin-right: 6%;
}
.fact::before {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(50% - 9px);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
}
.fact-title {
  margin: 0 0 4px;
  color: #c41820;
  font: 800 1.875rem/1.1 var(--font-hand);
}
.fact p {
  margin: 0;
  font: 600 1.25rem/1.3 var(--font-hand);
}

@media (max-width: 860px) {
  .king-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Подсказки и приёмы ---------- */

.tip {
  max-width: 24ch;
  min-height: 3.6em;
  margin: 0.5em 0 0.7em;
  font: 700 clamp(1.75rem, 4.2vw, 3.25rem) / 1.2 var(--font-hand);
}

.moves-title {
  margin: 56px 0 14px;
  font: 900 2.25rem/1 var(--font-display);
  text-transform: uppercase;
}
.moves {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

main.is-leaning {
  animation: lean 2.4s cubic-bezier(0.5, 0, 0.3, 1);
}
@keyframes lean {
  0%,
  100% {
    transform: none;
  }
  28%,
  72% {
    transform: rotate(9deg);
  }
}

/* ---------- Точка ---------- */

.sign {
  margin-top: 36px;
  padding: clamp(14px, 3vw, 32px);
  border: 3px solid var(--black);
  border-radius: var(--r-panel);
  background: var(--plaid);
}
.sign-board {
  padding: clamp(20px, 4vw, 44px);
  border: 3px solid var(--black);
  border-radius: var(--r-card);
  background: var(--white);
  color: var(--black);
  text-align: center;
}
.sign-main {
  margin: 0;
  font: 900 clamp(3.25rem, 11vw, 9rem) / 0.85 var(--font-display);
  text-transform: uppercase;
}
.sign-sub {
  margin: 0.6em 0 0;
  font: 600 clamp(1.125rem, 2.4vw, 1.625rem) / 1.3 var(--font-hand);
}

.hours {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 32px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}

@media (max-width: 760px) {
  .hours {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Подвал ---------- */

.site-footer {
  padding-block: 56px 48px;
  background: var(--footer-bg);
  color: var(--footer-fg);
  font-size: 1rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
}
.footer-title {
  margin: 0 0 12px;
  font: 900 2rem/1 var(--font-display);
  text-transform: uppercase;
}
.footer-top {
  font-weight: 800;
}

.hints summary {
  width: max-content;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.hints-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding-left: 1.2em;
}
.hints-list .is-found {
  opacity: 0.55;
  text-decoration: line-through;
}

@media (max-width: 820px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* ---------- Клетчатая сумка и чек ---------- */

.bag {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden auto;
}
.bag::backdrop {
  background: var(--backdrop);
}
.bag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 3px solid var(--black);
  background: var(--plaid);
}
.bag-title {
  margin: 0;
  padding: 0.16em 0.4em 0.08em;
  border: 3px solid var(--black);
  border-radius: 10px;
  background: var(--white);
  color: var(--black);
  font: 900 clamp(1.5rem, 6vw, 2rem) / 1 var(--font-display);
  text-transform: uppercase;
  white-space: nowrap;
}
.bag-head .tool {
  border-color: var(--black);
  background: var(--white);
  color: var(--black);
}
.bag-view,
.receipt-view {
  padding: 18px;
}
.bag-view[hidden],
.receipt-view[hidden] {
  display: none;
}
.bag-empty {
  margin: 6px 0 20px;
  font: 600 1.375rem/1.3 var(--font-hand);
}
.bag-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bag-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
}
.bag-item-name {
  font-weight: 800;
}
.bag-item-sum {
  color: var(--red-text);
  font: 800 1.375rem/1 var(--font-hand);
  text-align: right;
}
.bag-qty {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.bag-qty button {
  width: 38px;
  height: 38px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 800 1.25rem/1 var(--font-body);
  cursor: pointer;
}
.bag-item-each {
  color: var(--muted);
  font-size: 1rem;
  text-align: right;
}
.bag-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 0;
  padding-top: 14px;
  border-top: 3px dashed var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
}
.bag-total[hidden] {
  display: none;
}
.bag-total strong {
  color: var(--red-text);
  font: 800 2rem/1 var(--font-hand);
}
.bag-buy {
  width: 100%;
}

/* щель кассы, из которой выезжает чек */
.receipt-slot {
  max-height: min(54dvh, 600px);
  padding: 0 14px 14px;
  border-top: 12px solid var(--black);
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 16%, var(--bg));
  overflow: hidden auto;
}
.receipt {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin-inline: auto;
}
.receipt.is-printing {
  animation: receipt-print 1.3s steps(16) both;
}
@keyframes receipt-print {
  from {
    clip-path: inset(100% 0 0 0);
    transform: translateY(-100%);
  }
  to {
    clip-path: inset(0);
    transform: none;
  }
}
.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.receipt-actions .btn {
  flex: 1 1 auto;
  padding-inline: 1em;
  font-size: 1.0625rem;
}

/* ---------- Доставка лунной походкой ---------- */

.delivery-view {
  padding: 18px;
}
.delivery-view[hidden] {
  display: none;
}
.delivery-title {
  margin: 0;
  font: 900 2.25rem/0.95 var(--font-display);
  text-transform: uppercase;
}
.delivery-order {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
}
.delivery-road {
  position: relative;
  height: 98px;
  margin-top: 16px;
  container-type: inline-size;
  overflow: hidden;
}
.delivery-road::before {
  content: "";
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
}
.delivery-point {
  position: absolute;
  top: 50px;
  left: calc(var(--at) * 1%);
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  translate: -50% 0;
}
.delivery-point::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}
.delivery-courier {
  position: absolute;
  top: 0;
  left: -25px;
  width: 50px;
  height: 50px;
  translate: calc(var(--p, 16) * 1cqw) 0;
  transition: translate 3.2s linear;
}
.delivery-courier.is-jumping {
  transition: none;
}
.delivery-courier svg {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid var(--black);
  border-radius: 50%;
  background: var(--white);
}
.delivery-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}
.delivery-stats dt {
  color: var(--muted);
  font-size: 0.9375rem;
}
.delivery-stats dd {
  margin: 0;
  color: var(--red-text);
  font: 800 1.75rem/1.1 var(--font-hand);
}
.delivery-log {
  display: grid;
  gap: 6px;
  min-height: 6.5em;
  max-height: 10.5em;
  margin: 0;
  padding-left: 1.5em;
  font-size: 1rem;
  line-height: 1.35;
  overflow-y: auto;
}
.delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.delivery-actions .btn {
  flex: 1 1 auto;
  padding-inline: 1em;
  font-size: 1.0625rem;
}

/* ---------- Баннер про семечки ---------- */

.seeds {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: var(--z-banner);
  width: min(420px, calc(100vw - 40px));
  padding: 16px 18px;
  border: 3px solid var(--black);
  border-radius: var(--r-card);
  background: var(--white);
  color: var(--black);
  animation: seeds-in 0.35s ease-out;
}
.seeds[hidden] {
  display: none;
}
.seeds-title {
  margin: 0 0 6px;
  font: 900 1.75rem/1 var(--font-display);
  text-transform: uppercase;
}
.seeds p {
  margin: 0 0 12px;
  font-size: 1rem;
}
.seeds-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.seeds .btn {
  padding: 0.7em 1.1em;
  font-size: 1rem;
}
@keyframes seeds-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* ---------- Лунная походка ---------- */

.walker {
  position: fixed;
  left: 0;
  bottom: 8px;
  z-index: var(--z-walker);
  width: clamp(110px, 15vw, 170px);
  visibility: hidden;
  pointer-events: none;
}
.walker svg {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--black);
  border-radius: 50%;
  background: var(--white);
}
.walker.is-walking {
  visibility: visible;
  animation: walker-glide 3.6s linear both;
}
.walker.is-walking svg {
  animation: walker-bob 0.3s ease-in-out infinite alternate;
}
@keyframes walker-glide {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-200px);
  }
}
@keyframes walker-bob {
  to {
    transform: translateY(-7px) rotate(-4deg);
  }
}

/* ---------- Уведомления ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--banner-h, 0px));
  z-index: var(--z-toast);
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  margin: 0;
  padding: 12px 16px;
  border: 3px solid var(--black);
  border-radius: var(--r-control);
  background: var(--yellow);
  color: var(--black);
  font-size: 1.0625rem;
  font-weight: 800;
  animation: toast-in 0.2s ease-out;
}
.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.25s;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Страница 404 ---------- */

.lost {
  display: grid;
  align-content: center;
  min-height: 100dvh;
  padding-block: 48px;
}
.lost-title {
  margin: 0;
  font: 900 clamp(5rem, 22vw, 16rem) / 0.8 var(--font-display);
  text-transform: uppercase;
}
.lost-text {
  max-width: 36ch;
  margin: 1em 0 1.4em;
  font-size: 1.375rem;
}

/* ---------- Без движения ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ticker {
    overflow-x: auto;
  }
  .ticker-track {
    animation: none;
  }
}
