/* ============ БАЗА ============ */
:root {
  --bg: #fff5f8;
  --bg2: #f6f0ff;
  --card: #ffffff;
  --peach: #ffd6c2;
  --pink: #ffc2d1;
  --pink2: #ffe4ec;
  --lav: #d9ccff;
  --lav2: #ece6ff;
  --mint: #c9f0e4;
  --butter: #fff1b8;
  --sky: #cfe8ff;
  --ink: #4a3b4f;
  --muted: #8f7f95;
  --accent: #ff7aa2;
  --accent2: #9b7bff;
  --ok: #5fc9a3;
  --bad: #ff8b8b;
  --shadow: 0 10px 30px rgba(120, 80, 120, .14);
  --shadow-sm: 0 4px 14px rgba(120, 80, 120, .12);
  --r: 24px;
  --r-sm: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  overflow-x: hidden;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
[hidden] { display: none !important; }

#bg-hearts { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .55; }
#app { position: relative; z-index: 1; min-height: 100%; }
.screen {
  min-height: 100vh; min-height: 100dvh;
  padding: calc(16px + var(--safe-t)) 16px calc(96px + var(--safe-b));
  max-width: 520px; margin: 0 auto;
  animation: fadeUp .35s ease both;
}
.screen.no-tab { padding-bottom: calc(24px + var(--safe-b)); }
@keyframes slideIn { from { transform: translateY(10px); } to { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 162, .55); } 70% { box-shadow: 0 0 0 16px rgba(255, 122, 162, 0); } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.title { font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.sub { color: var(--muted); font-weight: 600; margin-top: 6px; line-height: 1.4; }
.hand { font-family: 'Caveat', cursive; }
.muted { color: var(--muted); }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 8px 18px rgba(255, 122, 162, .35);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.btn:active { transform: scale(.96); box-shadow: 0 3px 8px rgba(255, 122, 162, .3); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.secondary { background: var(--lav2); color: var(--ink); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; min-height: 44px; }
.btn.wide { width: 100%; }
.btn.lav { background: var(--accent2); box-shadow: 0 8px 18px rgba(155, 123, 255, .35); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 26px; }

.input {
  width: 100%; min-height: 54px; padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--lav); background: #fff; font: inherit; font-weight: 700; font-size: 18px;
  color: var(--ink); outline: none; text-align: center;
}
.input:focus { border-color: var(--accent2); }
.input.bad { animation: shake .5s; border-color: var(--bad); }

/* ============ ТАББАР ============ */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b));
  width: min(92vw, 420px); z-index: 20;
  display: flex; justify-content: space-around; padding: 8px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; box-shadow: var(--shadow);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 16px; border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800;
  transition: background .2s, color .2s;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { background: var(--pink2); color: var(--accent); }
#btn-sound .ic-off { display: none; }
#btn-sound.muted .ic-on { display: none; }
#btn-sound.muted .ic-off { display: block; }

/* ============ ТОСТ / ОВЕРЛЕЙ ============ */
.toast {
  position: fixed; left: 50%; top: calc(18px + var(--safe-t)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700;
  z-index: 50; box-shadow: var(--shadow); max-width: 90vw; text-align: center; animation: fadeUp .25s;
}
.overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(74, 59, 79, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.overlay .card { width: min(100%, 420px); animation: pop .45s cubic-bezier(.2, .9, .3, 1.3); }

/* ============ ВХОД ============ */
.gate { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - 40px); }
.gate .cat { width: 140px; margin: 0 auto 18px; animation: float 3s ease-in-out infinite; }
.gate .q { font-size: 20px; font-weight: 800; margin-top: 18px; line-height: 1.35; }
.hint-box {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--r-sm); background: var(--butter);
  font-weight: 700; font-size: 15px; line-height: 1.4; animation: fadeUp .3s;
}

/* ============ КАРТА ============ */
.map-head { text-align: center; margin-bottom: 8px; }
.map-head .hearts-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  background: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow-sm);
}
.map-wrap { position: relative; width: 100%; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-path .road { fill: none; stroke: #fff; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.map-path .road-dash { fill: none; stroke: var(--lav); stroke-width: 4; stroke-dasharray: 2 14; stroke-linecap: round; }
.map-path .road-done { fill: none; stroke: var(--pink); stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.node {
  position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  transition: transform .15s;
}
.node:active { transform: scale(.93); }
.node .num {
  position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--lav); color: var(--ink); font-size: 12px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.node.locked { background: var(--lav2); color: var(--muted); font-size: 24px; box-shadow: none; }
.node.current { animation: pulse 1.8s infinite; border: 3px solid var(--accent); }
.node.done { background: var(--mint); }
.node.done::after {
  content: '✓'; position: absolute; bottom: -4px; right: -4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 14px; font-weight: 900; display: flex; align-items: center; justify-content: center;
}
.node-label {
  position: absolute; width: 130px; margin-left: -65px; text-align: center; font-size: 12px; font-weight: 800;
  color: var(--ink); margin-top: 44px; pointer-events: none;
}
.node-label.dim { color: var(--muted); }
.deco { position: absolute; font-size: 28px; pointer-events: none; opacity: .8; animation: float 4s ease-in-out infinite; }

/* ============ ОБОЛОЧКА УРОВНЯ ============ */
.lvl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.lvl-head .back {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none;
}
.lvl-head .t { flex: 1; font-weight: 900; font-size: 20px; }
.lvl-head .ic { font-size: 26px; }
.lvl-body { animation: slideIn .3s; }
.progress { height: 10px; border-radius: 999px; background: var(--lav2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .35s ease; }

/* награда */
.reward { text-align: center; }
.reward .sticker { font-size: 72px; line-height: 1; animation: pop .6s cubic-bezier(.2, .9, .3, 1.4); }
.reward .comp { font-size: 20px; font-weight: 800; margin-top: 12px; line-height: 1.35; }
.reward .gain { margin-top: 12px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pill { background: var(--pink2); padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.pill.lav { background: var(--lav2); }
.pill.digit { background: var(--butter); font-size: 16px; }

/* ============ ПИСЬМО ============ */
.envelope { position: relative; width: 100%; max-width: 340px; margin: 70px auto 20px; aspect-ratio: 1.45; cursor: pointer; transition: transform .6s .6s, opacity .6s .6s; }
.envelope.open { transform: scale(.82) translateY(-10px); opacity: .85; }
.envelope .body { position: absolute; inset: 0; background: var(--peach); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.envelope .flap {
  position: absolute; left: 0; right: 0; top: 0; height: 55%; background: #ffc9b0; border-radius: 14px 14px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .6s cubic-bezier(.4, 0, .2, 1); z-index: 3;
}
.envelope .pocket { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, var(--peach) 45%); clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%); z-index: 2; border-radius: 14px; }
.envelope .paper {
  position: absolute; left: 8%; right: 8%; top: 12%; bottom: 6%; background: #fff; border-radius: 8px;
  transform: translateY(0); transition: transform .6s .3s cubic-bezier(.4, 0, .2, 1); z-index: 1;
  display: flex; align-items: center; justify-content: center; font-family: 'Caveat', cursive; font-size: 30px; color: var(--accent);
}
.envelope .seal { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 4; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: var(--shadow-sm); transition: opacity .3s, transform .3s; }
.envelope.open .flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .paper { transform: translateY(-34%); z-index: 3; }
.envelope.open .seal { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
.letter-text { font-family: 'Caveat', cursive; font-size: 24px; line-height: 1.35; }
.letter-text p + p { margin-top: 12px; }
.letter-text .sign { margin-top: 18px; text-align: right; color: var(--accent); font-size: 26px; }

/* ============ КОДОВЫЙ ЗАМОК ============ */
.lock-wrap { display: flex; justify-content: center; gap: 10px; margin: 26px 0; }
.dial { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dial .arrow { width: 44px; height: 36px; border-radius: 12px; background: var(--lav2); font-weight: 900; font-size: 18px; }
.dial .win {
  width: 56px; height: 76px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 36px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 6px 14px rgba(0, 0, 0, .4); overflow: hidden; position: relative;
}
.dial .win span { display: block; transition: transform .25s; }
.lock-icon { text-align: center; font-size: 64px; transition: transform .4s; }
.lock-icon.open { animation: wiggle .5s 3; }

/* ============ ВИКТОРИНА ============ */
.qz-q { font-size: 20px; font-weight: 800; line-height: 1.35; margin: 12px 0 16px; }
.qz-opt {
  display: block; width: 100%; text-align: left; padding: 14px 18px; border-radius: var(--r-sm); background: var(--lav2);
  font-weight: 700; font-size: 16px; margin-top: 10px; transition: background .2s, transform .1s;
}
.qz-opt:active { transform: scale(.98); }
.qz-opt.ok { background: var(--mint); }
.qz-opt.bad { background: #ffd9d9; animation: shake .4s; }
.qz-after { margin-top: 12px; font-weight: 700; color: var(--muted); font-style: italic; }

/* ============ СЕРДЕЧКИ / КОТИК (канвас-игры) ============ */
.game-canvas { width: 100%; border-radius: var(--r); background: #fff; box-shadow: var(--shadow); touch-action: none; display: block; }
.game-hud { display: flex; justify-content: space-between; font-weight: 900; margin-bottom: 10px; font-size: 18px; }

/* ============ СКРЕТЧ ============ */
.tickets { display: flex; flex-direction: column; gap: 16px; }
.ticket { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 1.5; background: #fff; }
.ticket .under { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; background: linear-gradient(135deg, var(--butter), var(--peach)); }
.ticket .under img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.ticket .under .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 72px; }
.ticket .under .cap { position: relative; z-index: 1; background: rgba(255, 255, 255, .85); padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; margin-top: auto; }
.ticket .under .ttl { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.ticket .under .txt { font-size: 19px; font-weight: 800; margin-top: 8px; line-height: 1.3; }
.ticket canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.ticket.done canvas { opacity: 0; transition: opacity .6s; pointer-events: none; }

/* ============ АНАГРАММА ============ */
.ana-clue { font-weight: 700; color: var(--muted); text-align: center; margin-top: 8px; }
.ana-slots, .ana-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.tile {
  width: var(--tile, 46px); height: calc(var(--tile, 46px) * 1.17); border-radius: 12px; background: var(--lav2); font-size: calc(var(--tile, 46px) * .52); font-weight: 900;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); transition: transform .12s, background .2s;
}
.tile:active { transform: scale(.9); }
.tile.empty { background: transparent; box-shadow: inset 0 0 0 2px var(--lav); }
.tile.slot { background: var(--pink2); }
.tile.ok { background: var(--mint); }
.ana-slots, .ana-pool { gap: var(--tgap, 8px); }
.ana-round { text-align: center; font-weight: 800; color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }

/* ============ МЕМОРИ ============ */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.mem-card { aspect-ratio: 1; perspective: 600px; }
.mem-card .in { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.4, 0, .2, 1); transform-style: preserve-3d; }
.mem-card.flip .in { transform: rotateY(180deg); }
.mem-card .f, .mem-card .b { position: absolute; inset: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow-sm); }
.mem-card .f { background: linear-gradient(135deg, var(--pink), var(--lav)); font-size: 26px; }
.mem-card .b { background: #fff; font-size: 34px; transform: rotateY(180deg); overflow: hidden; }
.mem-card .b img { width: 100%; height: 100%; object-fit: cover; }
.mem-card.match .b { background: var(--mint); }

/* ============ КОЛЕСО ============ */
.wheel-wrap { position: relative; width: min(86vw, 340px); margin: 20px auto; }
.wheel-wrap svg { width: 100%; height: auto; transition: transform 4.2s cubic-bezier(.12, .8, .1, 1); }
.wheel-wrap .pin { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 34px; z-index: 2; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .2)); }
.wheel-result { margin-top: 14px; text-align: center; font-size: 20px; font-weight: 800; line-height: 1.35; min-height: 56px; }

/* ============ ПАЗЛ ============ */
.pz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; border-radius: var(--r-sm); overflow: hidden; touch-action: none; margin-top: 16px; background: var(--lav2); padding: 3px; }
.pz-piece { aspect-ratio: 1; background-size: 400% 400%; border-radius: 6px; transition: transform .15s; position: relative; }
.pz-piece.sel { transform: scale(.92); outline: 3px solid var(--accent); z-index: 2; }
.pz-piece.drag { opacity: .35; }
.pz-piece.placed::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--ok); border-radius: 6px; }
.pz-done .pz-piece { border-radius: 0; }
.pz-done { gap: 0; padding: 0; }

/* ============ КРОССВОРД ============ */
.cw-wrap { overflow-x: auto; margin-top: 12px; padding-bottom: 6px; }
.cw-grid { --cell: 34px; display: grid; gap: 3px; margin: 0 auto; width: max-content; }
.cw-cell { width: var(--cell); height: var(--cell); border-radius: 7px; position: relative; }
.cw-cell.block { background: transparent; }
.cw-cell.letter { background: #fff; box-shadow: inset 0 0 0 2px var(--lav); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: calc(var(--cell) * .52); text-transform: uppercase; }
.cw-cell.letter.active { box-shadow: inset 0 0 0 2px var(--accent); background: var(--pink2); }
.cw-cell.letter.word { background: var(--lav2); }
.cw-cell.letter.ok { background: var(--mint); box-shadow: inset 0 0 0 2px var(--ok); }
.cw-cell .n { position: absolute; top: 1px; left: 3px; font-size: 9px; font-weight: 800; color: var(--muted); }
.cw-clue { margin-top: 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--butter); font-weight: 700; min-height: 48px; line-height: 1.35; }
.cw-dock { position: sticky; bottom: calc(6px + var(--safe-b)); z-index: 5; margin-top: 12px; padding: 8px; border-radius: 18px; background: rgba(255, 245, 248, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 -6px 24px rgba(120, 80, 120, .08); }
.kb { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin-top: 8px; }
.kb button { height: 40px; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 800; font-size: 15px; text-transform: uppercase; }
.kb button:active { background: var(--pink2); }
.kb button.wide { grid-column: span 2; }

/* ============ ТАЙМЛАЙН ============ */
.tl { position: relative; padding-left: 26px; margin-top: 10px; }
.tl::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 4px; border-radius: 2px; background: linear-gradient(var(--pink), var(--lav)); }
.tl-item { position: relative; padding: 4px 0 22px; opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s; }
.tl-item.show { opacity: 1; transform: none; }
.tl-item::before { content: ''; position: absolute; left: -24px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); box-sizing: border-box; }
.tl-item .d { font-size: 12px; font-weight: 900; color: var(--accent2); letter-spacing: .06em; text-transform: uppercase; }
.tl-item .t { font-size: 18px; font-weight: 900; margin-top: 2px; }
.tl-item .x { color: var(--muted); font-weight: 600; margin-top: 4px; line-height: 1.4; }
.tl-item img { margin-top: 10px; border-radius: var(--r-sm); box-shadow: var(--shadow-sm); max-height: 240px; object-fit: cover; width: 100%; }

/* ============ ПРИЧИНЫ ============ */
.reason-card {
  min-height: 150px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 22px; font-weight: 800; line-height: 1.35; padding: 26px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--pink2), var(--lav2)); animation: pop .4s cubic-bezier(.2, .9, .3, 1.3);
}
.reason-count { text-align: center; color: var(--muted); font-weight: 800; margin-top: 10px; font-size: 13px; }

/* ============ КУПОНЫ ============ */
.coupon {
  display: grid; grid-template-columns: 54px 1fr; gap: 6px 14px; align-items: start; padding: 16px; border-radius: var(--r); background: #fff; box-shadow: var(--shadow);
  border: 2px dashed var(--pink); position: relative; overflow: hidden;
}
.coupon .ic { grid-row: 1 / 3; }
.coupon .body { min-width: 0; }
.coupon + .coupon { margin-top: 12px; }
.coupon .ic { font-size: 34px; flex: none; width: 54px; height: 54px; border-radius: 50%; background: var(--pink2); display: flex; align-items: center; justify-content: center; }
.coupon .t { font-weight: 900; font-size: 17px; }
.coupon .x { color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 2px; line-height: 1.3; }
.coupon .use { grid-column: 2; justify-self: start; min-height: 40px; padding: 0 16px; font-size: 14px; margin-top: 4px; }
.coupon.used { opacity: .55; border-style: solid; }
.coupon.used::after { content: 'использован'; position: absolute; right: -28px; top: 14px; transform: rotate(35deg); background: var(--ok); color: #fff; font-size: 11px; font-weight: 900; padding: 4px 36px; letter-spacing: .1em; text-transform: uppercase; }

/* ============ КОРОБКА ============ */
.giftbox { position: relative; width: 220px; height: 220px; margin: 30px auto; cursor: pointer; }
.giftbox .base { position: absolute; left: 20px; right: 20px; bottom: 0; height: 130px; background: var(--pink); border-radius: 12px; box-shadow: var(--shadow); }
.giftbox .base::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 34px; margin-left: -17px; background: var(--accent2); }
.giftbox .lid { position: absolute; left: 6px; right: 6px; top: 62px; height: 46px; background: #ffb3c6; border-radius: 10px; box-shadow: var(--shadow-sm); transition: transform .8s cubic-bezier(.3, 1.4, .5, 1); transform-origin: left bottom; z-index: 2; }
.giftbox .lid::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 34px; margin-left: -17px; background: var(--accent2); }
.giftbox .bow { position: absolute; left: 50%; top: 30px; transform: translateX(-50%); font-size: 54px; z-index: 3; transition: transform .5s, opacity .5s; }
.giftbox.open .lid { transform: translate(-30px, -90px) rotate(-28deg); }
.giftbox.open .bow { transform: translate(-50%, -80px) rotate(20deg); opacity: 0; }
.giftbox.shake { animation: wiggle .3s 3; }

/* ============ ФИНАЛ ============ */
.final { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.final .photo { width: min(78vw, 320px); aspect-ratio: 1; margin: 0 auto 22px; border-radius: 32px; overflow: hidden; box-shadow: var(--shadow); transform: rotate(-2deg); background: var(--lav2); animation: pop .8s cubic-bezier(.2, .9, .3, 1.2); }
.final .photo img { width: 100%; height: 100%; object-fit: cover; }
.final .line { font-size: 34px; font-weight: 900; letter-spacing: -.02em; }
.final .sub { font-family: 'Caveat', cursive; font-size: 26px; color: var(--accent2); margin-top: 6px; }
.final .q { font-size: 22px; font-weight: 800; margin-top: 28px; }
.final .answers { position: relative; height: 140px; margin-top: 18px; }
.final .answers .btn { position: absolute; transition: left .25s, top .25s; }
.final .btn-yes { left: 50%; top: 0; transform: translateX(-50%); min-width: 150px; }
.final .btn-no { left: 50%; top: 66px; transform: translateX(-50%); min-width: 120px; }
.final .btn-later { left: 50%; top: 66px; transform: translateX(-50%); animation: fadeUp .5s; }
.final .after { font-size: 20px; font-weight: 800; line-height: 1.4; margin-top: 20px; animation: fadeUp .4s; }

/* ============ СТАТИСТИКА ============ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.stat { background: #fff; border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); }
.stat .v { font-size: 30px; font-weight: 900; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--muted); margin-left: 4px; }
.stat.live .v small { display: block; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; font-weight: 800; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.stat.wide { grid-column: span 2; }
.stat.live .v { color: var(--accent); }
.stickers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.stickers .s { aspect-ratio: 1; border-radius: 16px; background: var(--pink2); display: flex; align-items: center; justify-content: center; font-size: 30px; box-shadow: var(--shadow-sm); }
.stickers .s.empty { background: var(--lav2); opacity: .5; font-size: 18px; box-shadow: none; }
.digits { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.digits .d { width: 48px; height: 58px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.digits .d.empty { background: var(--lav2); color: var(--muted); }
.funny { margin-top: 12px; }
.funny .r { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px dashed var(--lav); font-weight: 700; gap: 12px; }
.funny .r:last-child { border: 0; }
.funny .r b { font-size: 18px; white-space: nowrap; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

@media (min-width: 600px) {
  .tile { width: 52px; height: 60px; }
}
