/* До звезды: новогодняя игра для бренда. Тёмная комната с гирляндой
   (img/bg.webp, нарисован в ChatGPT), стеклянная коробка рисуется на
   canvas. Заголовки Unbounded, текст Golos. Цвет бренда через ?accent=,
   по умолчанию золото гирлянды. */

@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2122;
}
@font-face {
  font-family: "Unbounded"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2116;
}

:root {
  --accent: #f2c14e;        /* бренд; в демо золото гирлянды */
  --accent-ink: #1c1306;
  --bg: #07110e;
  --panel: rgba(9, 22, 18, .78);
  --panel-2: rgba(255, 255, 255, .06);
  --ink: #f7f0e3;
  --ink-2: rgba(247, 240, 227, .74);
  --ink-3: rgba(247, 240, 227, .46);
  --line: rgba(255, 255, 255, .13);
  --red: #e63946;
  --green: #3ad27a;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Golos Text", sans-serif;
  --r: 20px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
:root[data-accent="red"] { --accent: #ff4d5e; --accent-ink: #fff; }
:root[data-accent="green"] { --accent: #3ad27a; --accent-ink: #06210f; }
:root[data-accent="blue"] { --accent: #62a8ff; --accent-ink: #061a33; }
:root[data-accent="ink"] { --accent: #f7f0e3; --accent-ink: #1c1306; }

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font: 15px/1.45 var(--sans); color: var(--ink); background: var(--bg); overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--ink-2); }
/* иконки в кнопках; svg ёлки рисуется своими заливками */
button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* комната: картинка закрывает окно целиком, центр тёмный под игру */
.bg { position: fixed; inset: 0; z-index: 0; background: #07110e url(img/bg.webp) center top / cover no-repeat; }
.bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 17, 14, .1), rgba(7, 17, 14, .55) 60%, rgba(7, 17, 14, .8)); }

.app { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: calc(8px + var(--sat)) 12px calc(20px + var(--sab)); }

/* шапка бренда */
.top { display: flex; align-items: center; gap: 10px; padding: 6px 2px 8px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand__mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 800 15px var(--display); }
.brand__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.brand__sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.top__tools { margin-left: auto; display: flex; gap: 2px; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon:hover { background: var(--panel-2); color: var(--ink); }
.icon[aria-pressed="true"] { color: var(--accent); }
.embed .top { display: none; }
.embed .app { padding-top: calc(6px + var(--sat)); }
.embed .tools--embed { display: flex; justify-content: flex-end; margin: -4px 0 4px; }
.tools--embed { display: none; }

/* заголовок и счёт */
.title { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; margin: 2px 2px 10px; }
.title h1 { margin: 0; font: 800 24px/1.1 var(--display); letter-spacing: -.01em; }
.title span { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.embed .title h1 { font-size: 21px; }

.hud { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin: 0 0 10px; }
.hud__score b { display: block; font: 800 30px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hud__score span, .hud__best span, .hud__next span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 4px; }
.hud__best b { display: block; font: 700 17px/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.tries { display: inline-flex; gap: 4px; margin-top: 5px; }
.tries i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .95; }
.tries i.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); opacity: .6; }
.hud__next { text-align: center; }
.next { width: 52px; height: 52px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto; }
.next img, .next .ball { width: 36px; height: 36px; object-fit: contain; transition: transform .35s var(--ease); }
.next.is-new img, .next.is-new .ball { animation: nextpop .4s var(--ease); }
@keyframes nextpop { 0% { transform: scale(.4) rotate(-20deg); } 100% { transform: none; } }
.ball { border-radius: 50%; display: inline-block; }

/* сцена */
.stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { display: block; width: 100%; height: auto; aspect-ratio: 100 / 150; border-radius: 6px 6px 22px 22px; cursor: crosshair; }
.stage.is-shake canvas { animation: shake .35s; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translate(-3px, 1px); } 50% { transform: translate(3px, -1px); } 75% { transform: translate(-2px, 0); } }

/* всплывающие подписи над слиянием */
.pop { position: absolute; transform: translate(-50%, -50%); pointer-events: none; font: 800 14px/1 var(--display); color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .7), 0 0 18px rgba(242, 193, 78, .5); white-space: nowrap; animation: pop 1.1s var(--ease) forwards; }
.pop small { display: block; text-align: center; font: 700 12px/1 var(--sans); color: var(--accent); margin-top: 4px; }
.pop--big { font-size: 20px; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -120%) scale(1); } }
.combo { position: absolute; right: 10px; top: 10px; pointer-events: none; padding: 6px 12px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 800 13px/1 var(--display); animation: combo .5s var(--ease); }
@keyframes combo { 0% { transform: scale(.5); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* баннер звезды */
.banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); pointer-events: none; text-align: center;
  animation: banner 3.2s var(--ease) forwards; }
.banner b { display: block; font: 800 30px/1.05 var(--display); color: #fff; text-shadow: 0 0 30px rgba(255, 210, 90, .9), 0 4px 20px rgba(0, 0, 0, .6); }
.banner span { display: block; margin-top: 8px; font: 600 14px var(--sans); color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.7); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 20% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }

/* подсказка под коробкой */
.hint { margin: 10px 4px 0; text-align: center; color: var(--ink-2); font-size: 14px; min-height: 20px; }
.hint kbd { font: 600 12px var(--sans); padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }

/* оверлеи: старт, итог */
.over { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; border-radius: 6px 6px 22px 22px;
  background: rgba(7, 17, 14, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .35s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: rise .45s var(--ease); }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.card__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 8px; }
.card h2 { margin: 0 0 6px; font: 800 24px/1.1 var(--display); letter-spacing: -.01em; }
.card h2 small { display: block; font: 500 14px/1.4 var(--sans); color: var(--ink-2); margin-top: 6px; }
.card p { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.card p b { color: var(--ink); }
.card .row { display: grid; gap: 8px; margin-top: 16px; }
.card .row--2 { grid-template-columns: 1fr 1fr; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px; border-radius: 14px;
  font-weight: 700; font-size: 15px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); text-decoration: none; transition: transform .15s var(--ease), background .15s; }
.btn:hover { background: rgba(255, 255, 255, .11); }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn--primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn--ghost { background: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }

/* итог: цепочка дня */
.reach { display: flex; align-items: center; gap: 3px; margin: 14px 0 4px; }
.reach i { flex: 1; height: 7px; border-radius: 4px; background: var(--panel-2); }
.reach i.on { background: var(--accent); }
.reach i.star { background: #ff4d5e; box-shadow: 0 0 10px #ff4d5e; }
.reach__cap { font-size: 12px; color: var(--ink-3); margin: 0 0 4px; }
.promo { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--accent); background: rgba(242, 193, 78, .08); }
.promo b { font: 800 18px/1 var(--display); letter-spacing: .1em; color: var(--accent); display: block; margin-top: 4px; }
.promo span { font-size: 12px; color: var(--ink-2); }
.promo--locked { border-style: solid; border-color: var(--line); background: transparent; }
.promo--locked b { color: var(--ink-3); letter-spacing: .06em; font-size: 14px; }

/* панели: правила, ёлка, поделиться */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; background: rgba(3, 9, 7, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s; }
.sheet__in { max-width: 480px; width: 100%; margin: 0 auto; max-height: 88vh; overflow: auto; background: #0d1c17; border: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(22px + var(--sab)); animation: up .35s var(--ease); }
@keyframes up { from { transform: translateY(40px); } to { transform: none; } }
.sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet__head h2 { margin: 0; font: 800 20px/1.1 var(--display); flex: 1; }
.sheet p { color: var(--ink-2); margin: 8px 0; font-size: 14px; }
.chain { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.chain li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 12px; background: var(--panel-2); }
.chain img, .chain .ball { width: 36px; height: 36px; object-fit: contain; justify-self: center; }
.chain b { font-weight: 700; }
.chain small { display: block; color: var(--ink-3); font-size: 12px; }
.chain em { font-style: normal; color: var(--accent); font: 700 13px var(--sans); font-variant-numeric: tabular-nums; }
.chain li.is-star { background: rgba(255, 77, 94, .12); }

/* ёлка месяца */
.tree { display: block; width: 100%; max-width: 320px; height: auto; margin: 6px auto 0; }
.tree .slot { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .14); stroke-width: .4; }
.tree .slot.today { stroke: var(--accent); stroke-width: .8; animation: slot 1.6s ease-in-out infinite; }
@keyframes slot { 50% { stroke-opacity: .3; } }
.tree .num { font: 500 3.2px var(--sans); fill: rgba(255, 255, 255, .35); text-anchor: middle; }
.tree .topstar { fill: rgba(255, 255, 255, .12); }
.tree .topstar.lit { fill: #ff4d5e; filter: drop-shadow(0 0 3px rgba(255, 120, 120, .9)); }
.tree__legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.tree__legend b { color: var(--ink); }

.share-text { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); font: 500 13px/1.5 ui-monospace, "Cascadia Mono", Menlo, monospace; white-space: pre-wrap; color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: #0d1c17; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: toast 2.6s var(--ease) forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 12% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; } }

.foot { margin: 14px 4px 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.foot a { color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .pop, .banner, .card, .sheet__in, .next.is-new img, .stage.is-shake canvas, .tree .slot.today { animation: none; }
}
