:root{
  --red:#e0262f; --red2:#8f111b; --cream:#f1e6cf; --ink:#120a0d; --ink2:#1d1116;
  --chrome:#c7cfd4; --teal:#37d3b5; --gold:#f0b33a; --pink:#ff3d7a; --ice:#8fe3ff;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;background:var(--ink);color:var(--cream);overflow:hidden;
  font-family:'Oswald','Arial Narrow',Arial,sans-serif;user-select:none;-webkit-user-select:none}
button{font-family:inherit;cursor:pointer;border:0;color:inherit}
#app{position:fixed;inset:0;display:flex;flex-direction:column;height:100dvh;
  background:radial-gradient(120% 80% at 50% 0%,#2a1219 0%,var(--ink) 70%)}

/* ---------- HUD ---------- */
#hud{display:flex;align-items:stretch;justify-content:space-between;gap:6px;padding:6px 8px;
  padding-top:max(6px,env(safe-area-inset-top));
  background:linear-gradient(#24151b,#170d11);border-bottom:3px solid var(--red);position:relative;z-index:2}
#hud::after{content:"";position:absolute;left:0;right:0;bottom:-9px;height:6px;
  background:repeating-linear-gradient(-45deg,var(--gold) 0 8px,#1a1013 8px 16px);opacity:.75}
.hud-block{display:flex;flex-direction:column;justify-content:center;min-width:0;line-height:1.05}
.hud-block.mid{flex-direction:row;gap:14px;align-items:center}
.hud-block.mid>div{display:flex;flex-direction:column;align-items:center}
.hud-block.right{align-items:flex-end}
.lbl{font-size:10px;letter-spacing:.18em;color:#b99c9f}
.hud-block b{font-family:'Russo One',sans-serif;font-size:18px;color:var(--cream)}
.rname{font-size:12px;color:var(--gold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:34vw}
.btn-count{display:flex;align-items:center;gap:5px}
.btn-count b{color:var(--gold)!important}
.btn-ico{display:inline-block;width:16px;height:16px;border-radius:50%;flex:none;
  background:
   radial-gradient(circle at 35% 35%,#2a1a08 0 1.3px,transparent 1.6px),
   radial-gradient(circle at 65% 35%,#2a1a08 0 1.3px,transparent 1.6px),
   radial-gradient(circle at 35% 65%,#2a1a08 0 1.3px,transparent 1.6px),
   radial-gradient(circle at 65% 65%,#2a1a08 0 1.3px,transparent 1.6px),
   radial-gradient(circle at 40% 35%,#ffe7a1,#d99a2b 60%,#8a5a12);
  box-shadow:0 0 0 1.5px #6b4210,0 0 8px rgba(240,179,58,.5)}
#h-lives{display:flex;gap:3px;margin-top:3px}
.life{width:14px;height:11px;border-radius:50% 50% 40% 40%;background:linear-gradient(#9df0cd,#2c8a68);
  position:relative;box-shadow:0 0 0 1px #0d3a2b}
.life::before,.life::after{content:"";position:absolute;top:-3px;width:5px;height:5px;border-radius:50%;
  background:#ff2847;box-shadow:0 0 4px #ff2847}
.life::before{left:1px}.life::after{right:1px}

/* ---------- STAGE ---------- */
#stage{flex:1;position:relative;min-height:0;touch-action:none;overflow:hidden}
#cv{position:absolute;left:0;top:0;width:100%;height:100%;display:block}
#combo{position:absolute;top:14px;left:50%;transform:translateX(-50%);font-family:'Russo One';font-size:20px;
  color:var(--gold);text-shadow:0 2px 0 #5a2a00,0 0 14px rgba(240,179,58,.6);opacity:0;transition:opacity .2s;pointer-events:none}
#combo.on{opacity:1}
#toast{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);background:rgba(18,10,13,.85);
  border:1px solid var(--red);padding:6px 12px;font-size:14px;letter-spacing:.05em;opacity:0;transition:opacity .25s;pointer-events:none;white-space:nowrap}
#toast.on{opacity:1}

/* ---------- CONTROLS ---------- */
#controls{display:flex;gap:8px;padding:8px;padding-bottom:max(8px,env(safe-area-inset-bottom));
  background:linear-gradient(#170d11,#24151b);border-top:3px solid var(--red)}
.skill{flex:1;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px;
  background:linear-gradient(#3a1d24,#24121a);border:2px solid #5d2c35;font-size:15px;letter-spacing:.1em;
  clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px);transition:transform .08s}
.skill b{font-family:'Russo One';font-size:18px;color:var(--gold)}
.skill:active{transform:scale(.97)}
.skill.armed{background:linear-gradient(var(--red),var(--red2));border-color:#ff8b8b;box-shadow:0 0 18px rgba(224,38,47,.7)}
.skill.cryo{border-color:#2e5f72}
.skill.cryo b{color:var(--ice)}
.skill:disabled{opacity:.4}
.sq{width:48px;background:#2a161c;border:2px solid #5d2c35;font-family:'Russo One';font-size:14px}
.sq.off{opacity:.45;text-decoration:line-through}

/* ---------- SCREENS ---------- */
.screen{position:absolute;inset:0;display:none;align-items:center;justify-content:center;z-index:10;padding:16px;
  background:rgba(12,6,9,.86);backdrop-filter:blur(3px)}
.screen.show{display:flex;animation:fade .3s}
@keyframes fade{from{opacity:0}to{opacity:1}}
#scr-title,#scr-win{background:radial-gradient(90% 70% at 50% 35%,#5b0f1c 0%,#1b0a0f 60%,#0c0507 100%)}
.rays{position:absolute;inset:-50%;background:repeating-conic-gradient(from 0deg at 50% 50%,rgba(224,38,47,.16) 0 8deg,transparent 8deg 16deg);
  animation:spin 60s linear infinite;pointer-events:none}
@keyframes spin{to{transform:rotate(360deg)}}
.screen::before{content:"";position:absolute;inset:0;pointer-events:none;
  background:repeating-linear-gradient(0deg,rgba(255,255,255,.025) 0 1px,transparent 1px 3px)}

.title-wrap{position:relative;text-align:center;display:flex;flex-direction:column;align-items:center;gap:8px;max-width:520px;width:100%}
.kicker{font-family:'PT Mono',monospace;font-size:11px;letter-spacing:.2em;color:#d9a5a8;text-transform:uppercase}
.tower{position:relative;height:150px;width:220px;display:flex;flex-direction:column-reverse;align-items:center;margin:8px 0 -6px}
.tower .row{display:flex;gap:2px;margin-top:2px}
.tower .blk{width:16px;height:11px;background:linear-gradient(#e9ddc4,#a89c86);box-shadow:inset 0 -2px 0 rgba(0,0,0,.25);
  transition:transform 1.1s cubic-bezier(.4,.1,.8,.6),opacity 1.1s}
.tower .blk.win{background:linear-gradient(#ffd66b,#e0262f)}
.tower .star{width:0;height:0;margin-bottom:2px;filter:drop-shadow(0 0 10px #ff2847)}
.tower .star::before{content:"\2605";font-size:34px;color:var(--red);line-height:1}
.tower.fall .blk{transform:translate(var(--dx),var(--dy)) rotate(var(--rot));opacity:0}
.tower.fall .star{transition:transform 1s,opacity 1s;transform:translateY(-40px) scale(1.6);opacity:0}

.logo{font-family:'Russo One',sans-serif;line-height:.86;display:flex;flex-direction:column;align-items:center;transform:skewY(-4deg)}
.logo .l1{font-size:clamp(44px,13vw,86px);color:var(--cream);letter-spacing:.04em;text-shadow:4px 4px 0 var(--red2)}
.logo .l2{font-size:clamp(46px,14vw,92px);color:var(--red);letter-spacing:.02em;text-shadow:4px 4px 0 #2b0509,0 0 30px rgba(224,38,47,.5)}
.sub{font-size:15px;letter-spacing:.12em;color:var(--chrome);margin-top:8px}
.menu{display:flex;flex-direction:column;gap:10px;margin-top:14px;width:min(280px,80vw)}
.best{font-family:'PT Mono';font-size:12px;color:#b99c9f;margin-top:6px}
.best b{color:var(--gold)}

.big{display:block;width:100%;padding:14px 20px;font-family:'Russo One';font-size:22px;letter-spacing:.12em;
  background:linear-gradient(#f0353e,var(--red2));color:var(--cream);text-shadow:0 2px 0 #4a0007;
  clip-path:polygon(12px 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%,0 12px);
  box-shadow:0 0 24px rgba(224,38,47,.45);transition:transform .08s,filter .15s;margin-top:10px}
.big:hover{filter:brightness(1.12)}
.big:active{transform:scale(.97)}
.ghost{display:block;width:100%;padding:10px;font-size:15px;letter-spacing:.18em;background:transparent;border:1px solid #6a3a42;color:#d9c3b9;margin-top:8px}

.panel{position:relative;width:min(460px,100%);max-height:100%;background:linear-gradient(#26161c,#170d11);
  border:2px solid #5d2c35;padding:22px 20px;box-shadow:0 0 0 4px #120a0d,0 0 0 6px var(--red),0 20px 60px rgba(0,0,0,.6);text-align:center}
.panel.wide{width:min(720px,100%)}
.panel.scroll{overflow-y:auto;text-align:left}
.panel h2{font-family:'Russo One';font-size:26px;color:var(--cream);margin:6px 0 12px;letter-spacing:.04em;text-align:center}
.panel h3{font-family:'Russo One';font-size:15px;color:var(--gold);margin:14px 0 6px;letter-spacing:.08em}
.panel p{font-size:16px;line-height:1.4;color:#e2d3c4}
.panel ul{padding-left:18px;font-size:15px;line-height:1.45;color:#e2d3c4}
.panel .gold{color:var(--gold)}
.poster{background:linear-gradient(160deg,#2c1117 0%,#1a0c10 60%),#1a0c10}
.stamp{display:inline-block;font-family:'Russo One';font-size:13px;letter-spacing:.2em;padding:5px 12px;border:2px solid var(--red);color:var(--red);transform:rotate(-3deg)}
.stamp b{color:var(--cream)}
.stamp.ok{border-color:var(--teal);color:var(--teal)}
.stamp.bad{border-color:var(--red);color:var(--red);font-size:18px}
.norm{margin-top:12px;font-family:'PT Mono';color:#d9a5a8}
.norm b{color:var(--gold)}

.legend{display:grid;gap:6px;font-size:14px}
.legend div{display:flex;align-items:center;gap:8px}
.it{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;flex:none;
  font-style:normal;font-family:'Russo One';font-size:12px;color:#fff}
.it.button{background:radial-gradient(circle at 40% 35%,#ffe7a1,#d99a2b 60%,#8a5a12);box-shadow:0 0 0 2px #6b4210}
.it.ration{background:#1f6fd1;box-shadow:0 0 8px #38a6ff}
.it.polymer{background:#c8102e;box-shadow:0 0 8px #ff3355}
.it.tax{background:#c9a000;box-shadow:0 0 8px #ffd21f;color:#2a2000}
.it.exp{background:#7a1fc0;box-shadow:0 0 8px #b14dff}

.report{width:100%;border-collapse:collapse;margin:8px 0 4px;font-size:16px}
.report td{padding:6px 4px;border-bottom:1px dashed #4a2830;text-align:left}
.report td:last-child{text-align:right;font-family:'Russo One';color:var(--gold)}
.report tr.total td{border-bottom:0;color:var(--cream);font-size:18px}
.report tr.total td:last-child{color:var(--gold)}

.shop-bal{text-align:center;font-size:17px;margin-bottom:12px;display:flex;align-items:center;justify-content:center;gap:6px}
.shop-bal b{font-family:'Russo One';color:var(--gold);font-size:22px}
.shop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
.card{background:#1b0f13;border:1px solid #5d2c35;padding:12px;display:flex;flex-direction:column;gap:6px;position:relative}
.card h4{font-family:'Russo One';font-size:15px;color:var(--cream);letter-spacing:.03em;padding-right:58px}
.card p{font-size:13px;line-height:1.35;color:#c9b6ab;flex:1}
.card .lvl{font-family:'PT Mono';font-size:12px;color:var(--teal)}
.card button{padding:8px;background:linear-gradient(#3b1c24,#2a141a);border:1px solid var(--gold);font-family:'Russo One';
  font-size:14px;color:var(--gold);display:flex;align-items:center;justify-content:center;gap:6px}
.card button:disabled{opacity:.35;border-color:#555;color:#999}
.card.bought{animation:buy .4s}
@keyframes buy{0%{box-shadow:0 0 0 0 var(--gold)}100%{box-shadow:0 0 0 14px transparent}}
.card .tag{position:absolute;top:8px;right:8px;font-size:10px;letter-spacing:.12em;color:#b99c9f}

@media (max-width:420px){
  .hud-block b{font-size:16px}
  .hud-block.mid{gap:10px}
  .skill{padding:9px 10px;font-size:13px}
  .panel{padding:18px 14px}
}

/* ---------- СОВЕТСКИЙ СТИЛЬ ---------- */
.hud-emblem{width:30px;height:30px;flex:none;align-self:center;color:var(--gold);
  background:var(--red);border-radius:50%;padding:4px;box-shadow:0 0 0 2px var(--gold),0 0 12px rgba(224,38,47,.6)}
.hud-block.grow{flex:1}
#ticker{position:relative;z-index:1;overflow:hidden;white-space:nowrap;height:22px;margin-top:6px;
  background:linear-gradient(#b3141f,#8f111b);border-bottom:2px solid #5a0a10;box-shadow:inset 0 1px 0 rgba(255,255,255,.15)}
.tk-in{display:inline-flex;animation:tick 60s linear infinite;line-height:22px}
.tk-in span{font-family:'Russo One',sans-serif;font-size:12px;letter-spacing:.14em;color:#f7e7c4;padding:0 18px;position:relative}
.tk-in span::after{content:"\2605";position:absolute;right:-6px;color:var(--gold)}
@keyframes tick{to{transform:translateX(-50%)}}

.wedge{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.wedge::before{content:"";position:absolute;width:140%;height:34%;left:-20%;top:58%;
  background:linear-gradient(90deg,rgba(224,38,47,.0),rgba(224,38,47,.38) 40%,rgba(224,38,47,.55));transform:rotate(-14deg)}
.wedge::after{content:"";position:absolute;width:44vmin;height:44vmin;right:-10vmin;top:-8vmin;border-radius:50%;
  border:3vmin solid rgba(240,179,58,.10);box-shadow:inset 0 0 0 5vmin rgba(224,38,47,.06)}
.wedge.small::before{top:auto;bottom:-6%;height:26%;opacity:.7}
.wedge.small::after{display:none}

.emblem{position:relative;width:74px;height:74px;margin:2px 0 -4px;filter:drop-shadow(0 0 16px rgba(224,38,47,.7))}
.emblem.small{width:56px;height:56px;margin:0 auto 8px}
.em-star{position:absolute;inset:0;width:100%;height:100%;color:var(--red)}
.em-hs{position:absolute;left:28%;top:30%;width:44%;height:44%;color:var(--gold)}
.logo .l2{font-family:'Ruslan Display','Russo One',sans-serif}
.ribbon{position:relative;margin-top:10px;padding:6px 22px;background:var(--red);color:#f7e7c4;
  font-family:'Russo One';font-size:13px;letter-spacing:.12em;text-transform:uppercase;
  clip-path:polygon(0 0,100% 0,calc(100% - 12px) 50%,100% 100%,0 100%,12px 50%);box-shadow:0 4px 0 #5a0a10}
.np{font-family:'PT Mono';font-size:10px;letter-spacing:.08em;color:#9c7f82;margin-top:4px;max-width:90%}
.slogan{font-family:'Ruslan Display','Russo One',sans-serif;font-size:22px;color:var(--gold);margin:-4px 0 12px;
  text-shadow:2px 2px 0 #5a0a10;letter-spacing:.03em;line-height:1.1}
.slogan.dim{font-family:'PT Mono';font-size:13px;color:#b99c9f;text-shadow:none;margin-top:-6px}
.poster{overflow:hidden;border-color:var(--red)}
.poster>*{position:relative}
.poster>.wedge{position:absolute}
.gramota-top{display:flex;align-items:center;justify-content:center;gap:10px;font-family:'Ruslan Display','Russo One';
  font-size:18px;color:var(--gold);letter-spacing:.08em;margin-bottom:8px;padding-bottom:8px;border-bottom:2px double #7a5a1c}
.gramota-top svg{width:18px;height:18px;color:var(--red)}
.gost{text-align:center;font-family:'PT Mono';font-size:11px;letter-spacing:.3em;color:var(--red)}
@media (max-height:740px){ .tower{height:110px;transform:scale(.8);margin:-6px 0 -24px} .emblem{width:56px;height:56px} }
@media (max-height:620px){ .emblem,.np{display:none} }

/* ---------- ДЕСКТОП ---------- */
@media (min-width:800px){
  #hud{padding:10px max(24px,calc((100% - 1000px)/2));gap:24px}
  .hud-block b{font-size:24px}
  .lbl{font-size:12px}
  .rname{font-size:15px;max-width:none}
  .btn-ico{width:20px;height:20px}
  .life{width:18px;height:14px}
  #controls{justify-content:center;padding:12px 24px}
  #controls .skill{flex:0 1 260px;font-size:17px}
  #controls .sq{width:56px}
  #combo{font-size:26px}
  .panel{width:min(520px,100%)}
  .panel.wide{width:min(820px,100%)}
  .shop-grid{grid-template-columns:repeat(3,1fr)}
}
