:root {
  --bg: #1a0b40;
  --bg2: #26125c;
  --panel: rgba(34, 16, 78, 0.96);
  --line: #14062c;
  --text: #f7f2ff;
  --muted: #bfa9e0;
  --yellow: #ffcf3a;
  --green: #3fae46;
  --red: #e2453c;
  --blue: #4aa8ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Rubik", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 40%, #9b46f0 0%, #5a1fb4 48%, #220a52 100%) fixed;
  user-select: none;
}
h1, h2, h3, .btn, .timer, .tabs button { font-family: "Russo One", "Rubik", sans-serif; letter-spacing: .5px; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* кнопки в духе мультяшной аркады: толстая обводка и тень снизу */
.btn {
  border: 3px solid var(--line); border-radius: 12px; padding: 10px 18px;
  background: #7a3fe0; color: #fff; font-size: 15px; cursor: pointer;
  box-shadow: 0 4px 0 var(--line); text-shadow: 0 2px 0 rgba(0,0,0,.35);
  transition: transform .08s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-yellow { background: var(--yellow); color: #2a1500; text-shadow: none; }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-big { font-size: 22px; padding: 12px 34px; }
.wide { width: 100%; }

.panel { background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 14px; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: #1a0b40; border: 2px solid #4e2c9c; border-radius: 10px; padding: 8px 10px; outline: none;
  user-select: text;
}
input:focus, textarea:focus, select:focus { border-color: var(--yellow); }
textarea { resize: vertical; }

/* ---------- лобби (главный экран) ---------- */
.lobby { flex-direction: column; overflow: hidden; }
.lobby::before, .fscreen::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background: repeating-linear-gradient(45deg, #fff 0 2px, transparent 2px 28px), repeating-linear-gradient(-45deg, #fff 0 2px, transparent 2px 28px); }
.lb-top { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 10px 14px; }
.lb-profile { justify-self: start; display: flex; align-items: center; gap: 10px; background: rgba(24, 8, 56, .6); border: 3px solid var(--line); border-radius: 12px; padding: 4px 14px 4px 4px; color: #fff; cursor: pointer; text-align: left; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08); }
.lb-profile img { width: 44px; height: 44px; border-radius: 8px; background: #3f2190; image-rendering: pixelated; object-fit: cover; object-position: center 12%; border: 2px solid var(--line); }
.lb-profile b { display: block; font: 15px "Russo One"; }
.lb-profile small { color: var(--muted); font-size: 11px; }
/* логотип: картинка с фиолетовым фоном — показываем значком со скруглёнными углами */
/* лого в стиле 8 бит: маленькая пиксельная картинка, увеличенная ровно в 2 раза; края — дизеринг прямо в картинке */
.login-logo { display: block; image-rendering: pixelated; }
/* название в лобби: толстые буквы с тёмной обводкой и объёмом вниз, «Arena» — на фиолетовой ленте */
.lb-logo { display: flex; flex-direction: column; align-items: center; line-height: 1; transform: rotate(-3deg); }
.lb-logo b { font: 44px/1 "Russo One"; text-transform: uppercase; letter-spacing: 2px; color: #fff;
  text-shadow: 2px 0 #14062c, -2px 0 #14062c, 0 -2px #14062c, 2px 2px #14062c, -2px 2px #14062c, 2px -2px #14062c, -2px -2px #14062c,
    0 4px #8a3ce6, 2px 4px #14062c, -2px 4px #14062c, 0 6px #5a1fb4, 2px 6px #14062c, -2px 6px #14062c, 0 8px #14062c; }
.lb-logo span { margin-top: 2px; padding: 3px 16px 4px; font: 15px/1 "Russo One"; text-transform: uppercase; letter-spacing: 4px; color: #ffb4f4;
  background: linear-gradient(#8a3ce6, #5a1fb4); border: 3px solid #14062c; border-radius: 6px; box-shadow: 0 3px 0 #14062c; text-shadow: 0 2px 0 #14062c; }
.login-logo { width: 300px; height: auto; margin: -8px auto 0; }
.lb-res { justify-self: end; display: flex; gap: 8px; align-items: center; }
.lb-pill { display: flex; align-items: center; gap: 8px; background: rgba(24, 8, 56, .6); border: 3px solid var(--line); border-radius: 999px; padding: 4px 16px 4px 5px; font: 17px "Russo One"; color: #fff; }
.coin { display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6b0, #ffcf3a 45%, #c98a12); border: 2px solid var(--line); flex: none; }
.lb-icon { width: 44px; height: 44px; border-radius: 10px; border: 3px solid var(--line); background: linear-gradient(#9a52ff, #6326c8); color: #fff; font-size: 20px; cursor: pointer; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22), 0 3px 0 var(--line); }
.lb-left { position: absolute; z-index: 2; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; }
.lb-side { width: 86px; padding: 8px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 3px solid var(--line); border-radius: 12px; color: #fff; font: 12px "Russo One"; cursor: pointer;
  background: linear-gradient(#9a52ff, #6326c8); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22), 0 4px 0 var(--line); text-shadow: 0 2px 0 rgba(0, 0, 0, .45); transition: transform .08s; }
.lb-side i { font-style: normal; line-height: 0; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .45)); }
.lb-side:hover { filter: brightness(1.12); }
.lb-side:active { transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22), 0 1px 0 var(--line); }
.lb-side:disabled { opacity: .5; }
#btnShop.lb-side { background: linear-gradient(#ffb547, #e0731c); }
.lb-stage { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lb-plate { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lb-plate small { font: 8px "Press Start 2P", monospace; color: #14062c; padding: 4px 8px; border: 2px solid var(--line); border-radius: 6px; }
.lb-plate b { font: clamp(26px, 4vw, 40px) "Russo One"; color: #fff; text-shadow: 0 4px 0 var(--line), 3px 0 var(--line), -3px 0 var(--line), 0 -3px var(--line); }
.lb-hero { position: relative; width: min(340px, 70vw); height: min(44vh, 360px); margin-top: 6px; }
.lb-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.lb-pedestal { position: absolute; left: 50%; bottom: -16px; width: 74%; height: 44px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #d7a6ff, #8a3ce6 55%, #4e1a9e); border: 3px solid var(--line); box-shadow: 0 7px 0 var(--line), 0 0 60px rgba(200, 120, 255, .5); }
.lb-info { margin-top: 30px; background: rgba(24, 8, 56, .6); color: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 7px 16px; font: 500 13px Rubik; cursor: pointer; }
.lb-info:hover { background: rgba(24, 8, 56, .8); }
.lb-bottom { position: relative; z-index: 2; display: flex; justify-content: flex-end; align-items: stretch; gap: 12px; padding: 0 14px 14px; }
.lb-mode { display: flex; align-items: center; gap: 10px; min-width: 230px; background: rgba(24, 8, 56, .72); border: 3px solid var(--line); border-radius: 12px; padding: 8px 16px 8px 8px; color: #fff; cursor: pointer; text-align: left; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08), 0 4px 0 var(--line); }
.lb-mode:hover { background: rgba(24, 8, 56, .85); }
.lb-mode i { width: 54px; height: 54px; border-radius: 8px; border: 2px solid var(--line); flex: none; }
.lb-mode small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.lb-mode b { display: block; font: 19px "Russo One"; }
.lb-mode em { font-style: normal; color: #9fe07a; font-size: 13px; font-weight: 600; }
.lb-play { min-width: 240px; font: 34px "Russo One"; letter-spacing: 1px; color: #fff; cursor: pointer; border: 4px solid var(--line); border-radius: 14px;
  background: linear-gradient(#ff9a44, #ef4f26); text-shadow: 0 3px 0 var(--line), 2px 0 var(--line), -2px 0 var(--line), 0 -2px var(--line);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, .45), inset 0 -6px 0 rgba(120, 20, 0, .3), 0 6px 0 var(--line); transition: transform .08s; }
.lb-play:hover { filter: brightness(1.08); }
.lb-play:active { transform: translateY(4px); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .45), 0 2px 0 var(--line); }
.lb-play:disabled { filter: grayscale(1); opacity: .6; }
@media (max-width: 700px) {
  .lb-logo b { font-size: 28px; }
  .lb-logo span { font-size: 10px; letter-spacing: 3px; padding: 2px 10px 3px; border-width: 2px; }
  .lb-left { position: static; transform: none; flex-direction: row; justify-content: center; gap: 10px; padding: 4px 14px 10px; order: 3; }
  .lb-side { width: auto; flex: 1; max-width: 120px; }
  .lb-stage { order: 2; }
  .lb-bottom { order: 4; flex-direction: column; }
  .lb-mode { min-width: 0; }
  .lb-play { min-width: 0; padding: 12px; font-size: 30px; }
  .lb-hero { height: min(36vh, 320px); }
}

/* ---------- экран бойца (как карточка героя в мобильных играх) ---------- */
.fscreen { flex-direction: column; overflow: hidden; }
.fs-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.fs-body { position: relative; z-index: 1; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.15fr) minmax(320px, 1.1fr); gap: 18px; padding: 0 18px 18px; }
.fs-left { display: flex; flex-direction: column; gap: 14px; justify-content: center; min-width: 0; }
.fs-name { padding: 12px 34px 14px 18px; background: linear-gradient(100deg, var(--rar), color-mix(in srgb, var(--rar) 45%, #14062c)); border: 3px solid var(--line); clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%); }
.fs-name b { display: block; font: clamp(26px, 3.2vw, 44px)/1.05 "Russo One"; color: #fff; text-shadow: 0 3px 0 var(--line), 2px 0 var(--line), -2px 0 var(--line), 0 -2px var(--line); overflow-wrap: anywhere; }
.fs-name small { display: inline-block; margin-top: 8px; font: 8px "Press Start 2P", monospace; color: #14062c; background: rgba(255, 255, 255, .88); padding: 4px 6px; }
.fs-desc { margin: 0; background: rgba(24, 8, 56, .6); border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.fs-lock { margin: 0; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.fs-buttons { display: flex; flex-direction: column; gap: 10px; }
.fs-select { font: 26px "Russo One"; padding: 14px; color: #2a1500; cursor: pointer; background: linear-gradient(#ffe066, #f5a81b); border: 4px solid var(--line); border-radius: 12px; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .55), 0 5px 0 var(--line); transition: transform .08s; }
.fs-select:active { transform: translateY(3px); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .55), 0 2px 0 var(--line); }
.fs-select:disabled { filter: saturate(.35) brightness(.9); cursor: default; transform: none; }
.fs-buttons .btn { font-size: 16px; padding: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fs-center { display: flex; align-items: center; justify-content: center; min-height: 0; }
.fs-hero { width: 100%; height: min(58vh, 460px); margin: 0; }
.fs-right { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.fs-box { background: rgba(24, 8, 56, .65); border: 3px solid var(--line); border-radius: 12px; padding: 8px; }
.fs-stage { position: relative; height: 190px; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.fs-box .fp-tabs { margin-top: 6px; }
.fp-tabs button { background: #1e0e4e; }
.fs-stats { display: flex; flex-direction: column; gap: 7px; padding: 10px; }
.fs-stat { display: grid; grid-template-columns: 22px 82px 1fr 64px; align-items: center; gap: 8px; }
.fs-stat .ic { line-height: 0; }
.fs-stat .nm { font: 13px "Russo One"; }
.fs-stat i { position: relative; height: 14px; border: 2px solid var(--line); background: #170838; }
.fs-stat i::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), var(--line) calc(20% - 2px) 20%); }
.fs-stat em { display: block; height: 100%; background: var(--c); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); }
.fs-stat b { text-align: right; font: 11px "Press Start 2P", monospace; }
.fs-ab { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: rgba(24, 8, 56, .65); border: 3px solid var(--line); border-radius: 12px; padding: 8px 10px; color: var(--text); cursor: pointer; font: inherit; }
.fs-ab:hover, .fs-ab.on { background: rgba(80, 40, 160, .9); }
.fs-ab.now { box-shadow: inset 4px 0 0 var(--yellow); }
.fs-ab.ult { background: linear-gradient(90deg, rgba(255, 207, 58, .2), rgba(24, 8, 56, .65) 65%); }
.fs-ab .ic { line-height: 0; flex: none; }
.fs-ab .tx { flex: 1; min-width: 0; }
.fs-ab small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.fs-ab b { display: block; font: 16px "Russo One"; color: #fff; }
.fs-ab.ult b { color: var(--yellow); }
.fs-ab em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.fs-ab .play { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: #2a1500; border: 2px solid var(--line); font-size: 11px; }
@media (max-width: 900px) {
  .fscreen { overflow-y: auto; }
  .fs-body { display: flex; flex-direction: column; flex: none; padding: 0 12px 16px; }
  .fs-center { order: -1; }
  .fs-hero { height: 240px; margin-bottom: 26px; }
  .fs-right { overflow: visible; }
  .fs-select { font-size: 22px; padding: 10px; }
}

/* ---------- экран «Бойцы» ---------- */
#fighters { overflow: auto; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding-bottom: 20px; }
/* заголовок блока «Открыты» / «Закрыты» — на всю ширину сетки */
.roster-sec { grid-column: 1 / -1; font: 12px "Press Start 2P", monospace; color: var(--muted); padding: 8px 2px 2px; border-bottom: 2px solid #5a35a8; }
.roster-sec:not(:first-child) { margin-top: 14px; }
.adm-tests { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.badge.test { background: #2f6a2a; }
/* стили ника (косметика из сундуков) */
.nk-mint { color: #7be04a !important; }
.nk-sky { color: #6cc4ff !important; }
.nk-rose { color: #ff8ad8 !important; }
.nk-gold { color: #ffd23f !important; text-shadow: 0 0 6px rgba(255, 210, 63, .7), 0 1px 2px #000 !important; }
.nk-ice { color: #dff6ff !important; text-shadow: 0 0 6px #7fd8ff, 0 1px 2px #000 !important; }
.nk-fire { background: linear-gradient(180deg, #ffe08a, #ff8a1f 55%, #e2453c); -webkit-background-clip: text; background-clip: text; color: transparent !important; filter: drop-shadow(0 1px 1px #000); }
.nk-neon { color: #7fffd4 !important; text-shadow: 0 0 4px #7fffd4, 0 0 10px #2affc0, 0 1px 2px #000 !important; }
.nk-rainbow { background: linear-gradient(90deg, #ff4d5e, #ffd23f, #3fd46b, #4aa8ff, #b04aff, #ff4d5e); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important; animation: nkRainbow 2s linear infinite; filter: drop-shadow(0 1px 1px #000); }
@keyframes nkRainbow { to { background-position: 200% 0; } }
.cosm-box { margin-top: 18px; }
.cosm-box h3 { margin: 0 0 8px; }
.cosm-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cosm { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 120px; padding: 8px 10px; border: 2px solid var(--rar); border-radius: 6px; background: rgba(0, 0, 0, .25); color: #fff; cursor: pointer; font: inherit; }
.cosm b { font: 12px "Press Start 2P", monospace; }
.cosm small { color: var(--muted); font-size: 11px; }
.cosm.on { outline: 3px solid var(--yellow); }
.cosm.locked { opacity: .45; cursor: default; }
.cosm-prize { font: 16px "Press Start 2P", monospace !important; display: block; margin: 10px 0; }
.chest-card li.sub { margin-left: 12px; font-size: 12px; }
/* Бодикаунт над бойцом: иконка и число */
.lbl .cn { display: flex; align-items: center; justify-content: center; gap: 2px; margin-bottom: 1px; }
.lbl .cn b { font: 9px "Press Start 2P", monospace; color: #e8b8ff; text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000; }
/* полоска здоровья ящика */
.lbl.crate .bar { width: 38px; height: 5px; }
.lbl.crate .bar i { background: #e0a04a; }
.score .pxi { vertical-align: middle; }
/* наблюдение после смерти */
.spectate { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 14px; background: rgba(20, 8, 44, .82); border: 3px solid #5a35a8; box-shadow: 0 0 0 2px #000; pointer-events: auto; z-index: 5; }
.spectate .sp-top { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 9px "Press Start 2P", monospace; color: var(--muted); }
.spectate .sp-place { font: 14px "Press Start 2P", monospace; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.spectate .sp-name { color: #fff; }
.spectate .sp-btns { display: flex; gap: 8px; }
/* настройки звука */
.settings { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(8, 2, 20, .6); }
.set-box { width: min(420px, calc(100vw - 32px)); padding: 18px 20px; background: #20104a; border: 3px solid #5a35a8; box-shadow: 0 0 0 3px #000, 0 10px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 14px; }
.set-box h3 { margin: 0; font: 16px "Press Start 2P", monospace; color: var(--yellow); }
.set-box label { display: flex; flex-direction: column; gap: 6px; font: 11px "Press Start 2P", monospace; color: #fff; position: relative; }
.set-box label b { position: absolute; right: 0; top: 0; color: var(--yellow); font-weight: normal; }
.set-box input[type=range] { width: 100%; accent-color: #ffd23f; height: 22px; }
.set-box label.chk { flex-direction: row; align-items: center; gap: 10px; }
.set-box label.chk input { width: 22px; height: 22px; accent-color: #ffd23f; }
.game-sound { position: absolute; top: 10px; right: 10px; z-index: 6; padding: 6px 8px; line-height: 0; }
.card {
  background: linear-gradient(180deg, #3f2190, #26125c); border: 3px solid var(--line); border-radius: 14px;
  padding: 8px; cursor: pointer; text-align: center; box-shadow: 0 4px 0 var(--line); position: relative;
}
.card:hover { filter: brightness(1.15); }
.card.sel { outline: 4px solid var(--yellow); outline-offset: 0; }
.card img, .card .noimg { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: radial-gradient(circle, #3f2190, #26125c); display: block; }
.card .nm { font-family: "Russo One"; margin-top: 6px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tag { position: absolute; top: 12px; left: 12px; font-size: 10px; background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 6px; color: var(--muted); }
.menu-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.selected-info { color: var(--muted); max-width: 520px; font-size: 14px; }
.selected-info b { color: #fff; font-family: "Russo One"; font-size: 18px; }

/* ---------- создание ---------- */
#creator { gap: 12px; padding: 12px; }
.cr-left { width: 300px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.cr-left h3 { margin: 4px 0 0; font-size: 16px; color: var(--yellow); }
.cr-right { width: 340px; display: flex; flex-direction: column; overflow: hidden; }
.cr-center { flex: 1; position: relative; min-width: 0; border-radius: 16px; overflow: hidden; border: 3px solid var(--line); }
#crCanvas { width: 100%; height: 100%; display: block; }
.cr-name { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: min(420px, 90%); text-align: center; }
.cr-name input { text-align: center; font-family: "Russo One"; font-size: 24px; background: rgba(0,0,0,.35); border-color: transparent; }
.cr-desc { color: var(--muted); font-size: 13px; margin-top: 6px; text-shadow: 0 1px 2px #000; }
.cr-bottom { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); min-height: 18px; }
.status.err { color: #ff9aa5; }
.status.ok { color: #8ff0ac; }
.hint { font-size: 12px; color: var(--muted); }
.photo-drop { position: relative; border: 2px dashed #4e2c9c; border-radius: 12px; min-height: 64px; display: grid; place-items: center; cursor: pointer; background: #1a0b40; overflow: hidden; flex: none; }
.photo-drop:hover, .photo-drop.over { border-color: var(--yellow); }
.photo-empty { text-align: center; font-size: 13px; color: var(--muted); padding: 10px; }
.photo-empty small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }
.photo-drop img { width: 100%; max-height: 180px; object-fit: contain; display: block; }
.photo-drop [hidden] { display: none; }
.photo-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--red); color: #fff; cursor: pointer; font-weight: 700; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--yellow); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; background: #1a0b40; color: var(--muted); border: 2px solid #4e2c9c; border-radius: 10px; padding: 8px 4px; cursor: pointer; font-size: 13px; }
.tabs button.active { background: var(--yellow); color: #2a1500; border-color: var(--line); }
.form { overflow: auto; flex: 1; padding-right: 4px; }
.row { margin-bottom: 10px; }
.row label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.row label b { color: #fff; }
.row input[type=range] { padding: 0; accent-color: var(--yellow); }
.row input[type=color] { padding: 0; height: 34px; cursor: pointer; }
.colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.colors .row label { justify-content: center; font-size: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button { background: #1a0b40; color: var(--text); border: 2px solid #4e2c9c; border-radius: 8px; padding: 5px 8px; font: 500 12px Rubik; cursor: pointer; }
.chips button.on { background: var(--yellow); color: #2a1500; border-color: var(--line); }
.ab-card { border: 2px solid #4e2c9c; border-radius: 12px; padding: 10px; margin-bottom: 10px; background: rgba(0,0,0,.2); }
.ab-card .ab-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ab-card .key { font-family: "Russo One"; background: var(--yellow); color: #2a1500; border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--line); flex: none; }
.ab-card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ab-card .del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 18px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { width: auto; }

/* ---------- бой ---------- */
#game { cursor: crosshair; }
#gameCanvas { width: 100%; height: 100%; display: block; }
.match-intro { position: absolute; inset: 0; z-index: 4; pointer-events: none; text-align: center; color: white; text-shadow: 2px 3px 0 #14062c, 0 0 12px #14062c; }
.match-intro-roster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(5px, 1.5vh, 14px); padding: 2vh 3vw; background: rgba(10, 5, 28, .76); }
.match-intro-roster[hidden] { display: none; }
.match-intro-title { color: #fff; font: 900 clamp(16px, 3.5vw, 34px) Rubik, sans-serif; letter-spacing: .06em; }
.match-intro-cards { display: grid; grid-template-columns: repeat(var(--card-columns), minmax(0, 1fr)); gap: clamp(4px, 1vw, 12px); width: min(92vw, 1000px); height: min(68vh, 530px); }
.match-intro-card { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #130d27; border: 3px solid #34235e; box-shadow: 0 5px 0 #080514, 0 8px 16px #0008; transform: skew(-2deg); animation: introCard .45s both; animation-delay: calc(var(--card-index) * 45ms); }
.match-intro-card.is-player { border-color: #ffdc4d; box-shadow: 0 0 16px #ffca4477, 0 5px 0 #080514; }
.match-intro-art { flex: 1; min-height: 0; background: radial-gradient(circle at 50% 42%, #ffcd5b, #ee604a 55%, #912665); overflow: hidden; }
.match-intro-card:nth-child(3n+2) .match-intro-art { background: radial-gradient(circle at 50% 40%, #82f3ef, #397fc7 55%, #422379); }
.match-intro-card:nth-child(3n) .match-intro-art { background: radial-gradient(circle at 50% 40%, #f8b0ff, #944dc4 55%, #382268); }
.match-intro-art canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; transform: scale(1.13); }
.match-intro-info { padding: clamp(3px, .6vw, 8px); text-align: left; line-height: 1.2; }
.match-intro-info b, .match-intro-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-intro-info b { font: 900 clamp(9px, 1.5vw, 16px) Rubik, sans-serif; }
.match-intro-info span { margin-top: 2px; color: #ffda69; font: 700 clamp(8px, 1.1vw, 12px) Rubik, sans-serif; }
.match-intro-mode { color: #ffdb57; font: 900 clamp(12px, 2.3vw, 24px) Rubik, sans-serif; text-transform: uppercase; }
@keyframes introCard { from { opacity: 0; transform: skew(-2deg) translateY(25px) scale(.9); } to { opacity: 1; transform: skew(-2deg) translateY(0) scale(1); } }
.match-intro-count { position: absolute; inset: 0; display: grid; place-items: center; font: clamp(64px, 16vw, 140px) "Press Start 2P", monospace; color: #ffcf3a; text-shadow: 4px 0 #14062c, -4px 0 #14062c, 0 4px #14062c, 0 -4px #14062c, 6px 8px 0 #14062c; }
.room-ready { color: #bdadc9; font-size: .8em; white-space: nowrap; }
.room-ready.on { color: #72e66b; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; transform: translate(-50%, -100%); text-align: center; white-space: nowrap; }
.lbl .n { font: 700 12px Rubik; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.lbl .bar { width: 64px; height: 9px; background: #14062c; border: 2px solid #14062c; border-radius: 5px; overflow: hidden; margin: 2px auto 0; }
.lbl .bar i { display: block; height: 100%; background: var(--red); transition: width .1s; }
.lbl.me .bar i { background: var(--green); }
.lbl .sh { height: 4px; background: #9fe6ff; margin-top: 1px; border-radius: 2px; }
.dmg { position: absolute; font: 900 18px Rubik; color: #fff; text-shadow: 0 2px 0 #000, 0 0 4px #000; pointer-events: none; transform: translate(-50%, 0); animation: up .8s ease-out forwards; }
.dmg.heal { color: #6dff9b; }
.dmg.big { font-size: 22px; color: #ffd23f; animation-duration: 1.2s; }
.dmg.stutter { font-size: 13px; color: #cfe6ff; }
@keyframes up { to { transform: translate(-50%, -50px); opacity: 0; } }

.hud-top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.timer { font-size: 28px; text-shadow: 0 3px 0 var(--line); }
.score { display: flex; gap: 6px; justify-content: center; margin-top: 4px; flex-wrap: wrap; }
.score span { background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 8px; font-size: 13px; }
.score span.me { background: var(--yellow); color: #2a1500; font-weight: 700; }
.killfeed { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; pointer-events: none; }
.killfeed div { background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 8px; font-size: 13px; animation: fade 4s forwards; }
@keyframes fade { 80% { opacity: 1; } to { opacity: 0; } }
.hud-bottom { position: absolute; bottom: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; gap: 12px; }
.hud-me { width: min(320px, 45vw); }
.hud-name { font-family: "Russo One"; font-size: 18px; text-shadow: 0 2px 0 var(--line); }
.hpbar { position: relative; height: 22px; background: var(--line); border: 3px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 4px; }
.hpbar div { height: 100%; background: linear-gradient(#5dff8a, #2bb24f); transition: width .15s; }
.hpbar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px Rubik; text-shadow: 0 1px 2px #000; }
.ammo { display: flex; gap: 4px; margin-top: 6px; }
.ammo i { flex: 1; height: 10px; background: var(--line); border-radius: 4px; overflow: hidden; position: relative; }
.ammo i b { position: absolute; inset: 0; background: #ffa531; }
.abilities { display: flex; gap: 10px; }
.ab { width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--line); position: relative; display: grid; place-items: center; box-shadow: 0 4px 0 var(--line); overflow: hidden; }
.ab .k { position: absolute; bottom: 2px; font: 700 13px "Russo One"; text-shadow: 0 1px 2px #000; }
.ab .ic { line-height: 0; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.ab .cd { position: absolute; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; font: 900 20px Rubik; }
.ab .nm { position: absolute; top: -18px; }
.hud-help { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255,255,255,.5); pointer-events: none; white-space: nowrap; }
.respawn { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font: 28px "Russo One"; text-shadow: 0 3px 0 var(--line); pointer-events: none; }
/* конец боя */
#gameCanvas { transition: filter .8s; }
#gameCanvas.lose { filter: grayscale(.75) brightness(.8); }
.outro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 14vh; gap: 14px; pointer-events: none; text-align: center; }
.outro b { font: 46px "Press Start 2P", monospace; letter-spacing: 2px; }
.outro small { font: 13px "Press Start 2P", monospace; color: #fff; text-shadow: 2px 2px 0 #000; opacity: 0; animation: fadeIn .4s .5s forwards; }
.outro.win { background: radial-gradient(circle, rgba(255, 210, 63, .18), transparent 60%); }
.outro.win b { color: var(--yellow); text-shadow: 4px 4px 0 #6b431f, 0 0 24px rgba(255, 210, 63, .8); animation: winPop .6s cubic-bezier(.2, 1.6, .4, 1) both, winGlow 1.2s .6s ease-in-out infinite alternate; }
.outro.lose { background: radial-gradient(circle, transparent 35%, rgba(0, 0, 0, .55)); }
.outro.lose b { color: #ff4d5e; text-shadow: 4px 4px 0 #2a0b0e; animation: loseDrop .7s cubic-bezier(.3, 1.4, .5, 1) both, loseShake .4s .7s; }
@keyframes winPop { from { transform: scale(.2) rotate(-8deg); opacity: 0; } }
@keyframes winGlow { to { transform: scale(1.06); text-shadow: 4px 4px 0 #6b431f, 0 0 40px rgba(255, 210, 63, 1); } }
@keyframes loseDrop { from { transform: translateY(-120px); opacity: 0; } }
@keyframes loseShake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes fadeIn { to { opacity: 1; } }
@media (max-width: 600px) { .outro b { font-size: 26px; } .outro small { font-size: 10px; } }
.results { position: absolute; inset: 0; background: rgba(16, 5, 38, .72); display: grid; place-items: center; cursor: default; padding: 16px; }
/* табло итогов: квадратные пиксельные края, полоса сверху по исходу боя, таблица с портретами */
.res-board { width: min(460px, 100%); background: #22104e; border: 4px solid #14062c; box-shadow: inset 0 0 0 2px #4e2c9c, 8px 8px 0 rgba(0, 0, 0, .45); animation: resIn .25s steps(4) both; }
@keyframes resIn { from { transform: translateY(24px); opacity: 0; } }
.res-head { padding: 12px 16px 14px; border-bottom: 4px solid #14062c; background: #5a35a8; }
.res-head.win { background: #f5a81b; color: #2a1500; }
.res-head.lose { background: #7a2a28; }
.res-head.def { background: #2f5a78; }
.res-head small { font: 8px "Press Start 2P", monospace; opacity: .75; letter-spacing: 1px; text-transform: uppercase; }
.res-head h2 { margin: 8px 0 0; font: 20px "Press Start 2P", monospace; line-height: 1.3; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); }
.res-cols, .res-row { display: grid; grid-template-columns: 30px 40px 1fr 40px 40px; align-items: center; gap: 8px; padding: 0 14px; }
.res-cols { padding-top: 10px; padding-bottom: 6px; font: 8px "Press Start 2P", monospace; color: var(--muted); }
.res-cols span:nth-child(n+4) { text-align: center; font: 13px Rubik; color: var(--muted); }
.res-list { padding: 0 0 6px; }
.res-row { height: 46px; position: relative; animation: resRow .3s steps(3) both; }
.res-row:nth-child(even) { background: rgba(255, 255, 255, .03); }
@keyframes resRow { from { opacity: 0; transform: translateX(-12px); } }
.res-row.me { background: rgba(255, 207, 58, .12); box-shadow: inset 4px 0 0 var(--yellow); }
.res-row img { width: 40px; height: 40px; object-fit: cover; object-position: center 20%; image-rendering: pixelated; background: #170838; border: 2px solid #14062c; }
.res-place { width: 24px; height: 24px; display: grid; place-items: center; font: 10px "Press Start 2P", monospace; color: var(--muted); }
.res-place.p1, .res-place.p2, .res-place.p3 { color: #22104e; border: 2px solid #14062c; }
.res-place.p1 { background: #ffcf3a; }
.res-place.p2 { background: #b9c2cc; }
.res-place.p3 { background: #c07a44; }
.res-name { min-width: 0; }
.res-name b { display: inline-block; vertical-align: middle; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.res-name em { display: inline-block; vertical-align: middle; margin-left: 8px; font: 7px "Press Start 2P", monospace; font-style: normal; color: #22104e; background: var(--yellow); padding: 3px 4px; }
.res-name i { display: block; height: 3px; margin-top: 5px; background: #6fbf4a; max-width: 100%; }
.res-row.me .res-name i { background: var(--yellow); }
.res-num { text-align: center; font: 12px "Press Start 2P", monospace; }
.res-num.dim { color: var(--muted); }
.res-reward { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 14px; padding: 12px 0; border-top: 2px dashed #4e2c9c; font: 14px "Press Start 2P", monospace; color: var(--yellow); }
.res-reward:empty { display: none; }
.res-reward small { font-size: 8px; color: var(--muted); }
.res-reward .coin { width: 14px; height: 14px; background: #ffcf3a; box-shadow: inset -3px -3px 0 #a8742a, inset 3px 3px 0 #ffe08a, 0 0 0 2px #14062c; }
.res-actions { display: flex; gap: 10px; padding: 12px 14px 14px; background: #170838; border-top: 4px solid #14062c; }
.res-actions .btn { flex: 1; border-radius: 0; font: 10px "Press Start 2P", monospace; padding: 12px 8px; }
@media (max-width: 420px) { .res-head h2 { font-size: 15px; } .res-cols, .res-row { grid-template-columns: 26px 34px 1fr 34px 34px; gap: 6px; padding: 0 10px; } .res-row img { width: 34px; height: 34px; } }
.results-card { background: var(--panel); border: 4px solid var(--line); border-radius: 18px; padding: 24px 32px; min-width: 320px; text-align: center; }
.results-card h2 { margin: 0 0 12px; color: var(--yellow); font-size: 32px; text-shadow: 0 3px 0 var(--line); }
.results-card ol { text-align: left; padding-left: 24px; margin: 0 0 18px; }
.results-card li { padding: 4px 0; }
.results-card li.me { color: var(--yellow); font-weight: 700; }


@media (max-width: 900px) {
  #creator { flex-direction: column; overflow: auto; }
  .cr-left, .cr-right { width: 100%; }
  .cr-center { min-height: 60vh; flex: none; }
  .cr-right { max-height: none; overflow: visible; }
}

/* ---------- пиксельный фэнтези-стиль ---------- */
#gameCanvas, #crCanvas, .card img { image-rendering: pixelated; }
.btn { background: linear-gradient(#9a52ff, #6326c8); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22), 0 4px 0 var(--line); }
.btn:active { box-shadow: inset 0 3px 0 rgba(255, 255, 255, .22), 0 1px 0 var(--line); }
.btn-yellow { background: linear-gradient(#ffe066, #f5a81b); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .55), 0 4px 0 var(--line); }
.btn-green { background: linear-gradient(#5fd25a, #2f9a3a); }
.btn-red { background: linear-gradient(#f2645a, #c1312a); }
.panel, .results-card { box-shadow: inset 0 0 0 2px #5a35a8, inset 0 0 0 4px #1a0b40; }
.cr-center { border-color: #5a35a8; }
.lbl .n, .dmg, .killfeed, .score span, .hud-name, .hpbar span, .respawn, .timer, .ab .k, .ab .cd, .hud-help { font-family: "Press Start 2P", monospace !important; }
.lbl .n { font-size: 8px; color: #fff; text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000; }
.lbl.me .n { color: var(--yellow); }
.lbl .bar { width: 48px; height: 6px; border-radius: 0; border-width: 1px; }
.lbl .bar i { background: #c9322b; }
.lbl.me .bar i { background: #4fbf3a; }
.dmg { font-size: 12px; color: #ffe08a; text-shadow: 2px 2px 0 #000; }
.timer { font-size: 18px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.score span, .killfeed div { font-size: 8px; border-radius: 0; border: 1px solid #5a35a8; background: rgba(24, 8, 56, .8); padding: 4px 6px; }
.hud-name { font-size: 11px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.hpbar { border-radius: 0; border: 2px solid #5a35a8; box-shadow: 0 0 0 2px #000; }
.hpbar div { background: linear-gradient(#e0473f, #9b2420); }
.hpbar span { font-size: 8px; }
.ammo i { border-radius: 0; border: 1px solid #000; }
.ammo i b { background: #ffcf3a; }
.ab { border-radius: 6px; border: 3px solid #5a35a8; box-shadow: 0 0 0 2px #000; }
.ab .k { font-size: 9px; }
.ab .cd { font-size: 12px; }
.hud-help { font-size: 7px; }
.respawn { font-size: 16px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.card { border-radius: 6px; box-shadow: inset 0 0 0 2px #5a35a8, 0 4px 0 var(--line); }
.card img, .card .noimg { border-radius: 2px; }

/* спеллы: строка «опиши спелл» и кнопка показа */
.ab-card .play { padding: 4px 10px; font-size: 12px; }
.ai-row { display: flex; gap: 6px; margin-bottom: 8px; }
.ai-row input { font-size: 12px; padding: 6px 8px; }
.ai-row .btn { padding: 4px 10px; }

/* ---------- баланс в редакторе ---------- */
.power { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.power .pbar { flex: 1; height: 12px; background: var(--line); border: 2px solid #5a35a8; }
.power .pbar i { display: block; height: 100%; background: linear-gradient(#7ad85a, #3f8a2a); transition: width .15s; }
.power .pbar i.over { background: linear-gradient(#ff6a5a, #e2453c); }
.power b { font-family: "Press Start 2P", monospace; font-size: 9px; color: var(--text); }
.power-hint { font-size: 11px; color: #ff9aa5; min-height: 4px; margin-bottom: 6px; }

/* ---------- выбор боя ---------- */
#play { overflow: auto; }
.play-wrap { max-width: 980px; width: 100%; margin: 0 auto; padding: 18px 16px 40px; }
.play-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.play-head h2 { margin: 0; font-size: 22px; }
.play-head h2 span { color: var(--yellow); }
.play-wrap h3 { color: var(--yellow); margin: 18px 0 8px; font-size: 16px; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick { text-align: left; background: linear-gradient(180deg, #3f2190, #26125c); color: var(--text); border: 3px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; box-shadow: inset 0 0 0 2px #5a35a8, 0 4px 0 var(--line); font: inherit; }
.pick b { display: block; font-family: "Russo One"; font-size: 16px; }
.pick small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.pick.on { box-shadow: inset 0 0 0 3px var(--yellow), 0 4px 0 var(--line); }
.pick:disabled { opacity: .55; cursor: default; }
.pick.map i { display: block; height: 54px; border-radius: 4px; margin-bottom: 8px; border: 2px solid var(--line); image-rendering: pixelated; }
.play-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; }
.mp-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: auto; }
.join-row { display: flex; gap: 6px; }
.join-row input { width: 92px; text-transform: uppercase; text-align: center; font-family: "Press Start 2P", monospace; font-size: 13px; letter-spacing: 2px; }
.room { margin-top: 18px; padding: 14px; border: 3px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: inset 0 0 0 2px #5a35a8; }
.room-code { font-size: 15px; }
.room-code b { font-family: "Press Start 2P", monospace; font-size: 26px; color: var(--yellow); margin-left: 8px; letter-spacing: 4px; }
.room-code small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.room ol { margin: 12px 0 0; padding-left: 22px; }
.room li { padding: 3px 0; }
.room em { color: var(--muted); font-style: normal; }

/* ---------- бой: баннер, союзники, кристалл ---------- */
.banner { position: absolute; top: 28%; left: 50%; transform: translate(-50%, -50%); font: 22px "Press Start 2P", monospace; color: var(--yellow); text-shadow: 3px 3px 0 #000; pointer-events: none; text-align: center; animation: pop .35s ease-out; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
.lbl.ally .n { color: #8fc8ff; }
.lbl.ally .bar i { background: #4aa8ff; }
.lbl.core .bar { width: 80px; }
.lbl.core .bar i { background: #3fd0ff; }
.lbl.core .n { color: #b8f0ff; }
.abilities .ab { cursor: pointer; padding: 0; font: inherit; color: inherit; pointer-events: auto; }
.rotate-hint { display: none; }

/* ---------- телефон: джойстики ---------- */
#touch { position: absolute; inset: 0; display: none; touch-action: none; }
body.touch #touch { display: block; }
body.touch .hud-help { display: none; }
.stick { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .2); display: none; pointer-events: none; }
.stick.on { display: block; }
.stick i { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 207, 58, .7); border: 3px solid #000; }
.stick.right i { background: rgba(255, 90, 80, .7); }
#touch .exit { position: absolute; top: 10px; left: 10px; width: 40px; height: 40px; border-radius: 8px; border: 3px solid var(--line); background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px; }
body.touch .hud-bottom { bottom: 10px; }
body.touch .abilities { gap: 14px; margin-bottom: 140px; }
body.touch .ab { width: 64px; height: 64px; }

@media (max-width: 760px), (max-height: 500px) {
  .menu-body { padding: 6px 12px; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .btn-big { font-size: 18px; padding: 10px 22px; }
  .selected-info { font-size: 12px; }
  .hud-me { width: min(240px, 40vw); }
  .hud-name { font-size: 9px; }
  .timer { font-size: 13px; }
  .score span { font-size: 7px; }
  .killfeed div { font-size: 7px; }
  .banner { font-size: 14px; }
  .lbl .n { font-size: 7px; }
  .pick-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .mp-box { margin-left: 0; }
}
@media (orientation: portrait) and (pointer: coarse) {
  #game .rotate-hint { display: grid; place-items: center; position: absolute; inset: 0; background: rgba(18, 6, 42, .92); color: var(--yellow); font: 14px "Press Start 2P", monospace; text-align: center; padding: 20px; z-index: 5; }
}

/* низкий экран (телефон горизонтально): компактное меню */
@media (max-height: 500px) {
  .roster-head { margin-bottom: 6px; }
  .roster-head h2 { font-size: 16px; }
  .roster-head .btn { padding: 6px 12px; font-size: 13px; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
  .card .nm { font-size: 11px; }
  .selected-info span { display: none; }
  .selected-info b { font-size: 14px; }
  .menu-actions .btn { padding: 6px 12px; font-size: 13px; }
  .btn-big { font-size: 16px; padding: 8px 18px; }
  .play-wrap { padding: 8px 12px 20px; }
  .play-wrap h3 { margin: 8px 0 6px; }
  .pick { padding: 8px; }
  .pick.map i { height: 30px; }
  .play-actions { margin-top: 10px; }
  #creator { padding: 6px; }
}

/* ---------- монеты, редкость, замки ---------- */
.wallet { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.coins { font-family: "Press Start 2P", monospace; font-size: 12px; color: var(--yellow); background: rgba(0, 0, 0, .45); border: 2px solid #5a35a8; padding: 8px 10px; border-radius: 6px; text-shadow: 2px 2px 0 #000; }
.card { border-color: var(--rar, var(--line)); }
.card .rar { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); font: 7px "Press Start 2P", monospace; color: var(--rar); text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.card.locked img { filter: grayscale(1) brightness(.45); }
.card.locked .nm { color: var(--muted); }
.card .lock { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); line-height: 0; filter: drop-shadow(0 2px 0 #000); }
/* свои пиксельные иконки (icons.js) */
.pxi { image-rendering: pixelated; vertical-align: middle; display: inline-block; }
[data-ic] { font-style: normal; line-height: 0; display: inline-block; vertical-align: middle; }
.card .tag { top: auto; bottom: 46px; left: 8px; }
.reward { font: 12px "Press Start 2P", monospace; color: var(--yellow); margin: 0 0 14px; min-height: 12px; text-shadow: 2px 2px 0 #000; }

/* ---------- сундуки ---------- */
.chest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.chest-card { background: linear-gradient(180deg, #3f2190, #26125c); border: 3px solid var(--line); border-radius: 8px; box-shadow: inset 0 0 0 2px #5a35a8, 0 4px 0 var(--line); padding: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chest-card .pic canvas { image-rendering: pixelated; display: block; }
.chest-card b { font-family: "Russo One"; font-size: 16px; }
.chest-card ul { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.chest-card .btn { width: 100%; }
.chest-open { position: fixed; inset: 0; background: rgba(16, 5, 38, .88); display: grid; place-items: center; z-index: 10; }
.chest-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
#chestCv { width: 216px; height: 192px; image-rendering: pixelated; }
#chestCv.shake { animation: shake .12s infinite; }
@keyframes shake { 0% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3px); } 100% { transform: rotate(-4deg); } }
.prize { text-align: center; animation: pop .4s ease-out; }
.prize small { display: block; font: 11px "Press Start 2P", monospace; color: var(--muted); margin-bottom: 8px; }
.prize img { width: 140px; image-rendering: pixelated; border: 4px solid var(--rar); border-radius: 8px; background: radial-gradient(circle, color-mix(in srgb, var(--rar) 45%, transparent), #26125c); box-shadow: 0 0 30px var(--rar); }
.prize b { display: block; font: 16px "Press Start 2P", monospace; color: #fff; margin-top: 10px; text-shadow: 2px 2px 0 #000; }
.prize b img { width: auto; border: 0; border-radius: 0; background: none; box-shadow: none; vertical-align: middle; } /* монетка в надписи — не как портрет бойца */
.prize span { font: 10px "Press Start 2P", monospace; color: var(--rar); }
@media (max-height: 500px) { #chestCv { width: 144px; height: 128px; } .prize img { width: 100px; } }

/* ульта: золотая кнопка побольше, подпись в редакторе */
.ab.ult { width: 84px; height: 84px; border-color: #ffcf3a; box-shadow: 0 0 0 2px #000, 0 0 14px rgba(255, 207, 58, .55); }
.ab.ult .k { font-size: 7px; color: var(--yellow); }
body.touch .ab.ult { width: 74px; height: 74px; }
/* гаджеты: точки сверху; кончились — кнопка серая. Ульта набита — пульсирует */
.ab .gz { position: absolute; top: 3px; font: 7px "Press Start 2P", monospace; color: var(--yellow); text-shadow: 0 1px 0 #000; letter-spacing: 1px; }
.ab.empty { filter: grayscale(1) brightness(.6); }
.ab.ult.ready { animation: ultReady .7s ease-in-out infinite alternate; }
@keyframes ultReady { to { box-shadow: 0 0 0 2px #000, 0 0 28px 8px rgba(255, 207, 58, .95); } }
.ab-card .slot { font: 9px "Press Start 2P", monospace; color: var(--muted); margin-bottom: 8px; }
.ab-card .slot.ult { color: var(--yellow); }

/* ---------- полигон ---------- */
.train-reset { position: absolute; top: 10px; left: 10px; padding: 6px 12px; font-size: 13px; z-index: 2; }
body.touch .train-reset { left: 60px; }

/* ---------- вход и админка ---------- */
.my-name { font: 10px "Press Start 2P", monospace; color: var(--text); }
.login { position: fixed; inset: 0; background: rgba(16, 5, 38, .92); display: grid; place-items: center; z-index: 20; }
.login .results-card { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
.login input { text-align: center; font-size: 18px; }
#admin { overflow: auto; }
.adm-card { background: var(--panel); border: 3px solid var(--line); border-radius: 8px; box-shadow: inset 0 0 0 2px #5a35a8; padding: 12px; margin-top: 12px; }
.adm-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.adm-top .nm { font-family: "Russo One"; font-size: 18px; }
.adm-top small { color: var(--muted); }
.adm-top .del { margin-left: auto; padding: 4px 10px; }
.adm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.adm-row > span { width: 80px; color: var(--yellow); font-size: 13px; }
.adm-row .btn { padding: 5px 10px; font-size: 13px; }
.adm-row input { width: 90px; padding: 5px 8px; }
.adm-row select { width: auto; max-width: 260px; padding: 5px 8px; }
.adm-row small { color: var(--muted); font-size: 12px; }
.adm-owned { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: #2a1f14; border: 2px solid #5a35a8; border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 12px; }
.chip button { background: none; border: none; color: var(--red); cursor: pointer; font-weight: 700; }
.adm-top .badge { font: 9px "Press Start 2P", monospace; color: var(--yellow); }
.adm-top .adm-toggle { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.adm-top .del { margin-left: 0; }

/* ---------- панель бойца снизу (по клику) ---------- */
.fighter-panel { position: fixed; z-index: 15; left: 50%; bottom: 0; transform: translateX(-50%); width: min(980px, 100%); max-height: 62vh; overflow-y: auto; display: flex; gap: 16px; background: var(--panel); border: 3px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: inset 0 0 0 2px #5a35a8, 0 -8px 30px rgba(0, 0, 0, .6); padding: 14px; font-size: 12px; animation: fpUp .18s ease-out; }
@keyframes fpUp { from { transform: translate(-50%, 40px); opacity: 0; } }
body.panel-open
.fp-close { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.fp-close:hover { color: #fff; }
.fp-left { flex: 0 0 400px; display: flex; flex-direction: column; gap: 6px; }
.fp-stage { position: relative; height: 260px; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.fp-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.fp-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fp-labels .dmg { font-size: 12px; }
.fp-cap { position: absolute; left: 8px; top: 8px; font: 9px "Press Start 2P", monospace; color: var(--yellow); text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.fp-ab.now .k { color: #fff; }
.fp-ab.now { box-shadow: inset 3px 0 0 var(--yellow); }
.fp-tabs { display: flex; gap: 4px; }
.fp-tabs button { flex: 1; padding: 6px 0; background: #1e0e4e; color: var(--muted); border: 2px solid var(--line); border-radius: 6px; font: 9px "Press Start 2P", monospace; cursor: pointer; }
.fp-tabs button.on { background: var(--yellow); color: #1e0e4e; }
.fp-info { flex: 1; min-width: 0; }
.fp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 8px 0; }
.fp-stat { display: grid; grid-template-columns: 92px 1fr 74px; align-items: center; gap: 6px; }
.fp-stat span { color: var(--muted); }
.fp-stat i { height: 8px; background: #1e0e4e; border: 1px solid #5a35a8; border-radius: 4px; overflow: hidden; }
.fp-stat em { display: block; height: 100%; background: linear-gradient(90deg, #6fbf4a, #ffcf3a); }
.fp-stat b { text-align: right; font-weight: normal; }
.fp-ab { cursor: pointer; border-radius: 6px; padding-left: 4px; }
.fp-ab:hover, .fp-ab.on { background: rgba(255, 207, 58, .1); }
.fp-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .fighter-panel { flex-direction: column; max-height: 80vh; }
  .fp-left { flex: none; }
  .fp-stage { height: 200px; }
  .fp-stats { grid-template-columns: 1fr; }
}
.tip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tip-head b { font-family: "Russo One"; font-size: 17px; }
.tip-head span { font: 8px "Press Start 2P", monospace; }
.tip-desc { color: var(--muted); margin: 6px 0; }
.tip-stats { color: var(--text); margin: 6px 0 8px; }
.tip-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid #3f2190; }
.tip-row .k { font: 8px "Press Start 2P", monospace; color: var(--yellow); min-width: 26px; padding-top: 3px; }
.tip-row .ic { line-height: 0; }
.tip-row b { color: #fff; }
.tip-row small { color: var(--muted); }
.tip-row p { margin: 2px 0 0; color: var(--muted); }
.tip-row.ult b { color: var(--yellow); }
.tip-lock { color: var(--muted); }
