/* alchemy.kluk.one. Colours match the game's cartoon-v1 art: sky blue, navy outlines, sunny yellow. */
@font-face {
  font-family: 'Nunito'; src: url('/fonts/nunito.woff2') format('woff2');
  font-weight: 600 900; font-display: swap;
}
:root {
  --navy: #10284F;      /* text and outlines */
  --sky: #6CC8F5;       /* page background */
  --deep: #1B5CAE;      /* screenshots band, white text on it */
  --sun: #FFC933;
  --white: #FFFFFF;
  --ice: #E4F4FF;       /* empty shelf cells */
  --ice-ink: #2A5590;
  --line: 4px solid var(--navy);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  font-family: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body { margin: 0; background: var(--sky); color: var(--navy); font-size: 18px; line-height: 1.45; font-weight: 700; overflow-x: hidden; overflow-x: clip; }
/* Without JS: no demo (it needs JS) and no language switch. */
html:not(.js) .demo-sec, html:not(.js) .langs { display: none; }
html:not(.js) .feats { padding-top: 110px; } /* the first card's icon disc clears the hero card and its shadow */
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 900; line-height: 1.1; }
/* no lone last words; browsers without text-wrap just wrap normally */
p, li { text-wrap: pretty; }
h1, h2, h3, .sub, .feat p, .feat li, .done p, .get-t { text-wrap: balance; }
.l { display: none; }
html[lang="ru"] .l[lang="ru"], html[lang="en"] .l[lang="en"] { display: revert; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--white); border: var(--line); border-radius: 12px; padding: 8px 14px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; box-shadow: 0 0 0 8px var(--navy); }

/* ===== top bar: solid white pills over the art ===== */
.top { position: absolute; z-index: 10; inset: 12px 16px auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand, .langs { background: var(--white); border: 3px solid var(--navy); border-radius: 999px; box-shadow: 0 4px 0 var(--navy); }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; text-decoration: none; font-weight: 900; font-size: 18px; }
.brand img { border-radius: 10px; }
.langs { display: flex; padding: 3px; gap: 2px; }
.langs button { font: inherit; font-weight: 900; font-size: 15px; color: var(--navy); background: none; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.langs button[aria-pressed="true"] { background: var(--navy); color: var(--white); }

/* ===== hero ===== */
.hero { position: relative; }
.hero-art img { width: 100%; height: min(56.25vw, 82vh, 780px); min-height: 420px; object-fit: cover; object-position: 50% 40%;
  /* the art dissolves into the page sky, so no icon ends in a hard cut */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, rgba(0, 0, 0, .6) 75%, transparent 97%); mask-image: linear-gradient(to bottom, #000 55%, rgba(0, 0, 0, .6) 75%, transparent 97%); }
.hero-card {
  position: relative; z-index: 2; width: min(560px, calc(100% - 32px)); margin: -150px auto 0;
  background: var(--white); border: var(--line); border-radius: 36px; box-shadow: 0 10px 0 var(--navy);
  padding: 0 24px 28px; text-align: center;
}
.hero-icon { width: 124px; height: 124px; margin: -64px auto 10px; border-radius: 30px; border: 5px solid var(--white); box-shadow: 0 0 0 4px var(--navy), 0 8px 0 4px var(--navy); background: var(--white); }
.hero h1 { font-size: clamp(46px, 11vw, 80px); letter-spacing: -.01em; text-shadow: 0 5px 0 var(--sun); }
.sub { margin: 10px 0 20px; font-size: clamp(19px, 4.6vw, 24px); font-weight: 800; }
.badge { display: inline-block; border-radius: 12px; transition: transform .2s var(--pop); }
.badge img { height: 50px; width: auto; }
@media (hover: hover) { .badge:hover { transform: translateY(-3px) rotate(-2deg); } }

/* ===== sections ===== */
section h2 { font-size: clamp(28px, 6vw, 44px); text-align: center; margin: 0 auto 26px; max-width: 18ch; }
.demo-sec { padding: 72px 16px 64px; }
.js-reveal .reveal { opacity: 0; transform: translateY(18px) scale(.98); transition: opacity .45s ease-out, transform .55s var(--pop); }
.js-reveal .reveal.in { opacity: 1; transform: none; }

/* ===== demo board ===== */
.board {
  position: relative; max-width: 760px; margin: 0 auto; background: var(--white); border: var(--line); border-radius: 36px;
  box-shadow: 0 10px 0 var(--navy); padding: 22px clamp(12px, 3vw, 28px) 26px;
}
.count { position: absolute; top: -22px; right: 22px; background: var(--sun); border: 3px solid var(--navy); border-radius: 999px; padding: 4px 16px; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 var(--navy); }
.count b { font-weight: 900; font-variant-numeric: tabular-nums; display: inline-block; }
.count b.bump { animation: bump .5s var(--pop); }
.mixer { position: relative; display: flex; justify-content: center; align-items: center; gap: clamp(10px, 4vw, 28px); --pt: 26px; --slot: clamp(96px, 26vw, 124px); padding: var(--pt) 0 52px; }
.slot {
  width: var(--slot); aspect-ratio: 1; border-radius: 28px; border: 4px dashed #4E8FD6; background: var(--ice);
  display: grid; place-items: center; padding: 0; cursor: pointer; color: var(--navy); font: inherit;
  animation: breathe 2.4s ease-in-out infinite;
}
.slot:disabled { cursor: default; }
.slot.full { border: var(--line); background: var(--white); box-shadow: 0 6px 0 var(--navy); animation: none; }
.slot.pop img { animation: pop .38s var(--pop); }
.slot img { width: 76%; height: auto; }
.slot.hot, .card.hot { border-style: solid; border-color: var(--navy); background: var(--sun); transform: scale(1.06); }
.plus { font-size: clamp(40px, 9vw, 56px); font-weight: 900; line-height: 1; color: var(--navy); }
.mixer.no .slot { animation: shake .45s ease-in-out; }
.mixer.merge .slot[data-slot="0"] img { animation: in-r .26s ease-in forwards; }
.mixer.merge .slot[data-slot="1"] img { animation: in-l .26s ease-in forwards; }
.mixer.merge .slot.full { border: 4px dashed #4E8FD6; background: var(--ice); box-shadow: none; transition: background .2s, box-shadow .2s; }
.mixer.merge .plus { animation: spin .26s ease-in forwards; }
/* centred on the slots (not on the mixer box), so the name pill keeps a gap above the shelf */
.result { position: absolute; left: 50%; top: calc(var(--pt) + var(--slot) / 2); width: 0; height: 0; display: grid; place-items: center; pointer-events: none; visibility: hidden; }
.result.show { visibility: visible; }
.result img { position: absolute; max-width: none; width: clamp(120px, 32vw, 150px); height: auto; transform: translateY(-14px); filter: drop-shadow(0 6px 0 rgba(16, 40, 79, .35)); }
.result .nm { position: absolute; top: 52px; z-index: 1; white-space: nowrap; background: var(--navy); color: var(--white); border-radius: 999px; padding: 4px 16px; font-weight: 900; font-size: 18px; }
.result .ph { position: absolute; width: 104px; height: 104px; transform: translateY(-14px); border-radius: 26px; background: var(--white); border: 4px solid var(--navy); box-shadow: 0 6px 0 var(--navy); }
.result.show img, .result.show .ph { animation: burst .6s var(--pop) both; }
/* bonus (a real recipe outside the 20): sun-yellow pill with a star, then it floats up off the board */
.result.bonus .nm { background: var(--sun); color: var(--navy); box-shadow: 0 0 0 3px var(--navy); display: flex; align-items: center; gap: 6px; }
.result.bonus .nm::before { content: ''; width: 18px; height: 18px; flex: none; background: var(--navy); clip-path: polygon(50% 0, 62% 35%, 99% 36%, 69% 58%, 80% 95%, 50% 73%, 20% 95%, 31% 58%, 1% 36%, 38% 35%); }
.result.bonus::before { background: repeating-conic-gradient(rgba(108, 200, 245, .85) 0 6deg, transparent 6deg 18deg); }
.result.away img, .result.away .ph, .result.show.away .nm { animation: away .52s ease-in forwards; }
/* a counted element flies into its shelf cell */
.result.fly img, .result.fly .ph { animation: fly .5s cubic-bezier(.55, 0, .7, .4) forwards; }
.result.show.fly .nm { animation: fade .2s ease-in forwards; }
.result.show .nm { animation: rise .45s .15s var(--pop) both; }
/* rays and sparkles behind the new element */
.result::before, .result::after { content: ''; position: absolute; border-radius: 50%; }
.result::before { width: 300px; height: 300px; background: repeating-conic-gradient(rgba(255, 201, 51, .9) 0 10deg, transparent 10deg 30deg); -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%); transform: translateY(-14px) scale(0); }
.result::after { width: 12px; height: 12px; background: transparent; transform: translateY(-14px); }
.result.show::before { animation: rays 1.25s ease-out both; }
.result.new.show::after { animation: sparks .8s ease-out both; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 8px; min-height: 108px;
  font: inherit; font-size: 14px; font-weight: 800; line-height: 1.15; color: var(--navy); text-align: center;
  background: var(--white); border: 3px solid var(--navy); border-radius: 20px; box-shadow: 0 4px 0 var(--navy);
  cursor: grab; touch-action: pan-y; /* vertical swipes scroll the page, sideways ones drag */ user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .18s var(--pop), box-shadow .18s;
}
.card img { width: 60px; height: 60px; pointer-events: none; }
.card .nm { overflow-wrap: normal; word-break: normal; hyphens: manual; max-width: 100%; }
@media (hover: hover) { .card[data-id]:hover { transform: translateY(-3px) rotate(-2deg); } }
.card[data-id]:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--navy); }
.card.lifted { opacity: .35; }
.card.new { animation: arrive .6s var(--pop), glow 1.4s ease-out; }
.card.again { animation: bump .5s var(--pop); }
.card.ghost { justify-content: center; background: var(--ice); border: 3px dashed #4E8FD6; box-shadow: none; color: var(--ice-ink); font-size: 30px; font-weight: 900; cursor: default; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; width: 88px; height: 88px; display: grid; place-items: center; pointer-events: none; background: var(--white); border: 3px solid var(--navy); border-radius: 22px; box-shadow: 0 10px 0 var(--navy); rotate: -6deg; }
.done { text-align: center; margin-top: 22px; }
.done p { margin: 0 0 12px; font-size: 20px; font-weight: 900; }
.board.won { animation: bump .6s var(--pop); }

/* ===== features ===== */
.feats { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 48px 28px; max-width: 640px; margin: 0 auto; padding: 24px 16px 80px; }
@media (min-width: 960px) {
  .feats { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1080px; }
  .feats { align-items: stretch; } /* the three cards end on one line */
  .feat-wide { grid-column: 1 / -1; }
  .feat-wide ul { columns: 2; column-gap: 32px; }
  .feat-wide li { break-inside: avoid; }
}
.feat { background: var(--white); border: var(--line); border-radius: 30px; box-shadow: 0 8px 0 var(--navy); padding: 22px 24px 24px; }
.feat img { width: 96px; height: 96px; margin: -60px 0 6px; background: var(--c); border: var(--line); border-radius: 50%; padding: 8px; }
.feat:nth-child(odd) { rotate: -1deg; }
.feat:nth-child(even) { rotate: 1deg; }
.feat-wide.feat { rotate: .4deg; }
.feat h3 { font-size: 24px; margin: 4px 0 8px; }
.feat p { margin: 0; }
.feat ul { margin: 0; padding: 0; list-style: none; }
.feat li { padding: 4px 0 4px 22px; position: relative; }
.feat li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--sun); border: 2px solid var(--navy); }
.feat b { font-weight: 900; }

/* ===== screenshots ===== */
.shots-sec { background: var(--deep); color: var(--white); padding: 70px 0 60px; border-block: var(--line); }
.shots { display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px max(16px, calc(50% - 660px)) 22px; scrollbar-width: thin; scrollbar-color: var(--sun) transparent; }
.shots::-webkit-scrollbar { height: 8px; }
.shots::-webkit-scrollbar-thumb { background: var(--sun); border-radius: 8px; }
.phone { flex: 0 0 auto; width: 240px; margin: 0; scroll-snap-align: center; padding: 10px; background: var(--navy); border-radius: 30px; box-shadow: 0 8px 0 #0A1A36; }
html[lang="ru"] .phone.l[lang="ru"], html[lang="en"] .phone.l[lang="en"] { display: block; }
.phone img { width: 100%; height: auto; aspect-ratio: 330 / 717; border-radius: 6px; background: #2E6BC0; }
.phone:nth-child(odd) { rotate: -1.5deg; }
.phone:nth-child(even) { rotate: 1.5deg; translate: 0 14px; }

/* ===== get ===== */
.get { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 70px 16px 80px; }
.get img:first-child { border-radius: 24px; border: var(--line); box-shadow: 0 6px 0 var(--navy); }
.get-t { margin: 0; font-size: clamp(24px, 5vw, 34px); font-weight: 900; }

/* ===== footer ===== */
.foot { background: var(--navy); color: var(--white); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 26px max(16px, calc(50% - 540px)) calc(26px + env(safe-area-inset-bottom)); font-size: 16px; }
.foot-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 18px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot nav a { text-underline-offset: 3px; }
.foot :focus-visible { box-shadow: none; }

/* ===== motion ===== */
@keyframes pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
@keyframes breathe { 50% { transform: scale(1.04); border-color: var(--navy); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-3deg); } 40% { transform: translateX(7px) rotate(2deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes in-r { to { transform: translateX(70%) scale(.2); opacity: 0; } }
@keyframes in-l { to { transform: translateX(-70%) scale(.2); opacity: 0; } }
@keyframes spin { to { transform: rotate(180deg) scale(0); } }
@keyframes burst { 0% { transform: translateY(-14px) scale(.1) rotate(-25deg); } 100% { transform: translateY(-14px) scale(1) rotate(0); } }
@keyframes rise { 0% { opacity: 0; transform: translateY(14px) scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes rays { 0% { transform: translateY(-14px) scale(0) rotate(0); opacity: 1; } 60% { opacity: 1; } 100% { transform: translateY(-14px) scale(1.1) rotate(60deg); opacity: 0; } }
@keyframes sparks {
  0% { box-shadow: 0 0 var(--sun), 0 0 #FF7A59, 0 0 #3DBE5A, 0 0 var(--sun), 0 0 #FF7A59, 0 0 #3DBE5A, 0 0 var(--sun), 0 0 #4E8FD6; }
  100% { box-shadow: 120px -60px 0 -6px var(--sun), -120px -50px 0 -6px #FF7A59, 90px 70px 0 -6px #3DBE5A, -90px 80px 0 -6px var(--sun), 0 -130px 0 -6px #FF7A59, 150px 10px 0 -6px #3DBE5A, -150px 0 0 -6px var(--sun), 30px 120px 0 -6px #4E8FD6; }
}
@keyframes glow { 0%, 30% { background: var(--sun); } 100% { background: var(--white); } }
@keyframes arrive { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes away { to { translate: 0 -170px; scale: .7; opacity: 0; } }
@keyframes fly { 85% { opacity: 1; } to { translate: var(--dx) var(--dy); scale: var(--k); opacity: 0; } }
@keyframes fade { to { opacity: 0; } }
@keyframes bump { 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .slot { animation: none; }
  .mixer.no .slot { border-color: #C4301F; border-style: solid; }
  .result::before, .result::after { display: none; }
}

@media (max-aspect-ratio: 1/1) {
  .hero-art img { height: min(118vw, 74vh, 640px); min-height: 380px; object-position: 50% 30%; }
  .hero-card { margin-top: -110px; }
}
@media (max-width: 560px) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .card { min-height: 84px; padding: 6px 2px; font-size: 12px; border-radius: 16px; }
  .card img { width: 46px; height: 46px; }
  .card.ghost { font-size: 24px; }
  .mixer { --pt: 22px; }
}
@media (max-width: 380px) {
  .shelf { gap: 6px; }
  .card { font-size: 11px; padding: 6px 1px; }
  .card img { width: 40px; height: 40px; }
  body { font-size: 17px; }
  .hero-card { padding: 0 14px 22px; }
  .brand { font-size: 16px; }
}
