:root {
  --ink: #2a1a10;
  --cream: #fff4dc;
  --paper: #fbf1dc;
  --mustard: #ffc93c;
  --pink: #ff4f7b;
  --teal: #27c3b3;
  --brown: #7a4a22;
  --green: #9bc46a;
  --mono: 'Rubik Mono One', 'Arial Black', sans-serif;
  --sans: 'Rubik', 'Arial', sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #1a100a;
  background-image: radial-gradient(circle at 50% 40%, #3a2416 0%, #140b06 75%);
  font-family: var(--sans); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#stage {
  position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px;
  transform-origin: 50% 50%; overflow: hidden; border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
#cv { position: absolute; inset: 0; width: 1280px; height: 720px; display: block; touch-action: none; cursor: crosshair; }
.hidden { display: none !important; }

button { font-family: inherit; color: inherit; }
.btn {
  font-family: var(--mono); font-size: 22px; letter-spacing: .5px;
  padding: 16px 30px; background: var(--mustard); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 7px 0 var(--ink);
  cursor: pointer; transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { transform: translateY(-2px) rotate(-1deg); background: #ffd65e; }
.btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.btn.big { font-size: 34px; padding: 18px 54px; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.ghost { background: var(--cream); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- экраны ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 5; }
.screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .12; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

#title { background: radial-gradient(ellipse at 50% 42%, rgba(30,14,4,.15) 0%, rgba(30,14,4,.72) 78%); gap: 26px; }
.logo { text-align: center; transform: rotate(-3deg); }
.kicker {
  display: inline-block; font-family: var(--mono); font-size: 15px; color: var(--cream);
  background: var(--pink); border: 3px solid var(--ink); padding: 6px 16px; border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink); transform: rotate(2deg); margin-bottom: 10px;
}
.wobble { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 96px; line-height: .95; letter-spacing: 2px; }
.wobble.big { font-size: 150px; }
.wobble span {
  display: inline-block; color: var(--mustard);
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--ink), 0 14px 0 rgba(0,0,0,.25);
  animation: wob 1.6s ease-in-out infinite;
}
.wobble.big span { color: #a8672c; text-shadow: 0 10px 0 var(--ink), 0 18px 0 rgba(0,0,0,.25); }
@keyframes wob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.tag { margin-top: 18px; font-weight: 800; font-size: 18px; color: var(--cream); text-shadow: 0 2px 0 var(--ink); }
.howto { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.howto span {
  background: rgba(255,244,220,.92); border: 3px solid var(--ink); border-radius: 12px; padding: 7px 12px; font-weight: 700; font-size: 15px;
}
.howto b { color: #b3401e; }
.best { font-family: var(--mono); font-size: 14px; color: var(--mustard); text-shadow: 0 2px 0 var(--ink); min-height: 18px; }

/* выбор героя */
#select { background: rgba(26,14,6,.8); gap: 22px; }
.scr-title { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 54px; color: var(--mustard); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); transform: rotate(-2deg); }
.cards { display: flex; gap: 36px; }
.hero-card {
  width: 440px; padding: 0; background: var(--paper); border: 5px solid var(--ink); border-radius: 26px;
  box-shadow: 0 10px 0 var(--ink); cursor: pointer; text-align: left; overflow: hidden;
  transition: transform .12s;
}
.hero-card:nth-child(1) { transform: rotate(-2deg); }
.hero-card:nth-child(2) { transform: rotate(2deg); }
.hero-card:hover { transform: translateY(-8px) rotate(0); }
.hero-cv { display: block; width: 100%; height: 250px; background: linear-gradient(#ffd49a, #ff9d6b); border-bottom: 4px solid var(--ink); }
.hero-card[data-hero="slim"] .hero-cv { background: linear-gradient(#b8e6ff, #7cc3ef); }
.hc-body { padding: 14px 20px 18px; }
.hc-body h3 { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 28px; }
.hc-body em { font-style: normal; font-weight: 800; color: #b3401e; font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
.stat { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; margin-top: 5px; }
.bar { display: flex; gap: 4px; }
.bar i { flex: 1; height: 12px; border: 2.5px solid var(--ink); border-radius: 4px; background: #fff; }
.bar i.on { background: var(--teal); }
.perks { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13.5px; font-weight: 700; }
.perks li::before { content: '💩 '; }
.perks li.ab { margin-top: 6px; background: var(--mustard); border: 2.5px solid var(--ink); border-radius: 10px; padding: 5px 9px; }
.perks li.ab::before { content: '★ '; }

/* ---------- гастроном ---------- */
#shop { background: #2a1a10; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 18px, transparent 18px 36px); }
.shop { width: 1236px; height: 686px; display: flex; flex-direction: column; gap: 12px; }
.shop-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--pink); border: 4px solid var(--ink); border-radius: 20px; padding: 10px 20px; box-shadow: 0 6px 0 var(--ink);
}
.shop-head h2 { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 30px; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.shop-head p { margin: 4px 0 0; font-weight: 800; color: #fff; font-size: 15px; }
.shop-head p .infl { background: var(--mustard); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 1px 7px; margin-left: 6px; }
.balance { background: var(--cream); border: 4px solid var(--ink); border-radius: 16px; padding: 4px 18px; text-align: right; transform: rotate(2deg); }
.balance span { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.balance b { font-family: var(--mono); font-weight: 400; font-size: 30px; }
.shop-body { flex: 1; display: flex; gap: 14px; min-height: 0; }
.foods { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(2, 1fr); gap: 10px; }
.food {
  position: relative; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 8px 10px 10px;
  box-shadow: 0 6px 0 var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: transform .1s;
}
.food:hover { transform: translateY(-4px) rotate(-1.5deg); }
.food:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.food.no { opacity: .5; cursor: not-allowed; }
.food.no:hover { transform: none; }
.food canvas { width: 92px; height: 86px; }
.food h4 { margin: 0; font-size: 16px; font-weight: 900; line-height: 1.05; }
.food .ftag { font-family: var(--mono); font-size: 9.5px; background: var(--ink); color: var(--mustard); border-radius: 6px; padding: 2px 6px; margin: 5px 0 4px; }
.food p { margin: 0; font-size: 11.5px; font-weight: 600; line-height: 1.22; flex: 1; }
.food .price { margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.food .price b { font-family: var(--mono); font-weight: 400; font-size: 17px; background: var(--mustard); border: 3px solid var(--ink); border-radius: 10px; padding: 2px 8px; }
.food .price small { font-weight: 800; font-size: 12px; }
.food .own { position: absolute; top: -10px; right: -8px; background: var(--teal); color: #fff; border: 3px solid var(--ink); border-radius: 999px; font-family: var(--mono); font-size: 14px; padding: 2px 9px; }

.belly { width: 300px; background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; padding: 10px 14px 14px; box-shadow: 0 6px 0 var(--ink); display: flex; flex-direction: column; gap: 8px; }
#bellyCv { width: 266px; height: 150px; border: 3px solid var(--ink); border-radius: 14px; background: linear-gradient(#ffe0a8, #ffb07c); }
.belly-label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 14px; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { aspect-ratio: 1; border: 3px dashed rgba(42,26,16,.4); border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.5); padding: 0; }
.slot.full { border-style: solid; border-color: var(--ink); background: #fff; cursor: pointer; }
.slot.full:hover { background: #ffd1d9; }
.slot canvas { width: 44px; height: 44px; }
.combos { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; min-height: 0; }
.combo { font-size: 10.5px; line-height: 1.2; font-weight: 700; padding: 3px 7px; border: 2px dashed rgba(42,26,16,.3); border-radius: 8px; color: rgba(42,26,16,.55); }
.combo b { font-weight: 900; }
.combo.on { border: 2.5px solid var(--ink); background: var(--green); color: var(--ink); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
#goBtn { font-size: 16px; padding: 12px 8px; white-space: nowrap; }

/* ---------- акт ---------- */
#results { background: rgba(20,10,4,.72); }
.receipt {
  position: relative; width: 560px; background: var(--paper); border: 5px solid var(--ink); border-radius: 10px;
  box-shadow: 0 12px 0 var(--ink); padding: 26px 34px 26px; transform: rotate(-1.5deg);
  background-image: repeating-linear-gradient(transparent 0 29px, rgba(42,26,16,.08) 29px 30px);
}
.receipt h2 { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 24px; text-align: center; }
.receipt .sub { text-align: center; font-weight: 800; font-size: 14px; margin: 4px 0 14px; color: #8a5a3a; }
.receipt .row { display: flex; justify-content: space-between; font-weight: 800; font-size: 17px; padding: 3px 0; border-bottom: 2px dotted rgba(42,26,16,.25); }
.receipt .row.total { font-family: var(--mono); font-weight: 400; font-size: 22px; border: 0; margin-top: 10px; }
.receipt .row.neg b { color: #c0392b; }
.receipt .actions { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; align-items: center; }
.receipt .actions .btn { width: 100%; font-size: 19px; }
.receipt .loan { font-size: 12px; font-weight: 700; text-align: center; color: #8a5a3a; margin-top: -6px; }
.stamp {
  position: absolute; right: -74px; top: -40px; font-family: var(--mono); font-size: 21px; background: rgba(251,241,220,.92); line-height: 1.05; text-align: center;
  padding: 10px 14px; border: 6px double; border-radius: 12px; transform: rotate(12deg); opacity: .95;
  animation: stamp .45s cubic-bezier(.2,1.6,.5,1) both .35s; pointer-events: none;
}
.stamp.ok { color: #1e8a4c; border-color: #1e8a4c; }
.stamp.bad { color: #c0392b; border-color: #c0392b; }
@keyframes stamp { from { transform: rotate(12deg) scale(3); opacity: 0; } to { transform: rotate(12deg) scale(1); opacity: .95; } }
.go-big { font-family: var(--mono); font-size: 38px; text-align: center; line-height: 1.05; color: #c0392b; margin: 8px 0 12px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#ammo {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto;
  background: rgba(42,26,16,.72); border: 3px solid var(--ink); border-radius: 18px; padding: 7px 9px;
}
.am { position: relative; width: 62px; height: 62px; padding: 0; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; cursor: pointer; transition: transform .1s; }
.am canvas { width: 56px; height: 56px; display: block; margin: auto; }
.am b { position: absolute; right: -7px; top: -9px; min-width: 24px; height: 24px; line-height: 18px; background: var(--mustard); border: 3px solid var(--ink); border-radius: 999px; font-family: var(--mono); font-size: 11px; font-weight: 400; text-align: center; }
.am i { position: absolute; left: 4px; bottom: 1px; font-style: normal; font-size: 10px; font-weight: 900; opacity: .6; }
.am.sel { background: var(--mustard); transform: translateY(-8px); box-shadow: 0 6px 0 var(--ink); }
.am.empty { opacity: .3; }
.ability {
  position: absolute; left: 14px; bottom: 14px; pointer-events: auto; width: 170px; padding: 8px 10px; text-align: left;
  background: var(--teal); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; font-weight: 900; font-size: 13px; color: var(--ink);
}
.ability small { display: block; font-weight: 700; font-size: 11px; opacity: .8; }
.ability.armed { background: var(--pink); color: #fff; animation: pulse .6s infinite; }
.ability.used { opacity: .35; }
.mute {
  position: absolute; right: 14px; bottom: 14px; z-index: 9; width: 48px; height: 48px; font-size: 22px; font-weight: 900;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}
.mute.off { text-decoration: line-through; opacity: .6; }
.rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  .rotate { display: flex; position: absolute; inset: 0; z-index: 50; background: rgba(20,10,4,.9); color: var(--mustard); font-family: var(--mono); font-size: 40px; text-align: center; align-items: center; justify-content: center; padding: 60px; }
}
