/* ============================================================
   NEON/SWEEP — Breach Protocol
   ============================================================ */

:root {
  --bg: #05060a;
  --bg-panel: #0a0d16;
  --bg-panel2: #0e1220;
  --line: #1b2236;
  --line-bright: #2a3552;

  --cyan: #00f0ff;
  --cyan-dim: #0aa7b8;
  --pink: #ff2d78;
  --amber: #ffb300;
  --violet: #9d5cff;
  --green: #3dff8e;
  --red: #ff3b3b;
  --text: #c9d6e8;
  --text-dim: #5f6f8c;

  --n1: #00f0ff; --n2: #3dff8e; --n3: #ff2d78; --n4: #9d5cff;
  --n5: #ffb300; --n6: #2ee6c8; --n7: #e8f0ff; --n8: #ff3b3b;

  --font-display: "Tektur", "Share Tech Mono", monospace;
  --font-mono: "Share Tech Mono", "Courier New", monospace;

  --cell: 34px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- фоновые слои ---------- */

.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,240,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 100%);
  animation: grid-drift 24s linear infinite;
}
@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 44px, 44px 0; }
}

.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(157,92,255,.10), transparent 65%),
    radial-gradient(ellipse 55% 45% at 90% 100%, rgba(255,45,120,.08), transparent 65%),
    radial-gradient(ellipse 70% 50% at 50% 55%, rgba(0,240,255,.05), transparent 70%);
}

#crt {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  opacity: .5;
}
#crt::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 180px rgba(0,0,0,.75);
}

#flash {
  position: fixed; inset: 0; z-index: 95; pointer-events: none;
  opacity: 0; background: var(--red);
}
#flash.hit    { animation: flash-hit .45s ease-out; }
#flash.heal   { background: var(--green); animation: flash-soft .5s ease-out; }
#flash.shield { background: var(--cyan);  animation: flash-soft .4s ease-out; }
@keyframes flash-hit  { 0% { opacity: .38; } 100% { opacity: 0; } }
@keyframes flash-soft { 0% { opacity: .16; } 100% { opacity: 0; } }

/* ---------- каркас ---------- */

#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }

.screen {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0;
  animation: screen-in .35s ease-out;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); filter: saturate(.2); }
  to   { opacity: 1; transform: none; filter: none; }
}
.screen[hidden] { display: none; }
[hidden] { display: none !important; }

.screen-head {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10,13,22,.9), rgba(10,13,22,.4));
}
.screen-head h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: .12em; color: var(--cyan);
  text-shadow: 0 0 18px rgba(0,240,255,.45);
  flex: 1;
}
.head-dim { color: var(--text-dim); font-size: 13px; font-weight: 400; letter-spacing: .06em; }

/* ---------- кнопки ---------- */

.btn {
  font-family: var(--font-display); font-weight: 600;
  font-size: 14px; letter-spacing: .1em;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-panel2), var(--bg-panel));
  border: 1px solid var(--line-bright);
  padding: 12px 22px;
  cursor: pointer;
  position: relative;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover {
  color: var(--cyan); border-color: var(--cyan-dim);
  box-shadow: 0 0 16px rgba(0,240,255,.18), inset 0 0 12px rgba(0,240,255,.06);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .35; cursor: default; pointer-events: none; }

.btn-primary {
  color: #06232a;
  background: linear-gradient(180deg, #35f6ff, #00c2d4);
  border-color: var(--cyan);
  text-shadow: none;
  box-shadow: 0 0 24px rgba(0,240,255,.35);
}
.btn-primary:hover { color: #041a20; box-shadow: 0 0 34px rgba(0,240,255,.55); }

.btn-danger { border-color: #5a2233; color: #ff7ba1; }
.btn-danger:hover { color: var(--pink); border-color: var(--pink); box-shadow: 0 0 16px rgba(255,45,120,.25); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--cyan); }

.btn-small { padding: 8px 14px; font-size: 12px; }
.btn-back { flex: none; }

.pill {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 11px; color: var(--violet);
  border: 1px solid rgba(157,92,255,.4); border-radius: 10px;
}

/* ---------- титульный экран ---------- */

#screen-title { align-items: center; justify-content: center; gap: 0; position: relative; }

.title-box { text-align: center; padding: 24px; }

.title-tag {
  color: var(--text-dim); font-size: 12px; letter-spacing: .25em;
  margin-bottom: 18px; text-transform: lowercase;
}

.logo {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(44px, 9vw, 96px);
  letter-spacing: .04em; line-height: 1;
  color: #eaf6ff;
  text-shadow:
    0 0 12px rgba(0,240,255,.8),
    0 0 46px rgba(0,240,255,.35),
    0 0 90px rgba(157,92,255,.3);
}

.title-sub {
  margin-top: 14px; color: var(--pink); font-size: 14px; letter-spacing: .3em;
  text-shadow: 0 0 14px rgba(255,45,120,.5);
}
.blink { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.title-menu {
  margin-top: 44px;
  display: flex; flex-direction: column; gap: 12px;
  width: min(340px, 80vw); margin-left: auto; margin-right: auto;
}
.title-foot { margin-top: 26px; }

.boot-log {
  position: absolute; left: 18px; bottom: 14px;
  font-size: 11px; color: rgba(95,111,140,.75); line-height: 1.7;
  text-align: left; pointer-events: none; white-space: pre;
}

/* глитч-заголовок */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0; opacity: .8; pointer-events: none;
}
.glitch::before {
  color: var(--pink); z-index: -1;
  animation: glitch-a 3.2s infinite steps(1);
  clip-path: inset(20% 0 40% 0);
}
.glitch::after {
  color: var(--cyan); z-index: -2;
  animation: glitch-b 2.7s infinite steps(1);
  clip-path: inset(60% 0 10% 0);
}
@keyframes glitch-a {
  0%, 93%, 100% { transform: none; opacity: 0; }
  94% { transform: translate(-4px, 2px); opacity: .8; }
  96% { transform: translate(3px, -1px); opacity: .8; }
  98% { transform: translate(-2px, 0); opacity: .6; }
}
@keyframes glitch-b {
  0%, 91%, 100% { transform: none; opacity: 0; }
  92% { transform: translate(4px, -2px); opacity: .7; }
  95% { transform: translate(-3px, 1px); opacity: .7; }
  97% { transform: translate(2px, 2px); opacity: .5; }
}

/* ---------- HUD прогона ---------- */

.run-hud {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10,13,22,.95), rgba(10,13,22,.55));
  flex-wrap: wrap;
}
.hud-left, .hud-right, .hud-center { display: flex; align-items: center; gap: 14px; }

.hud-label { color: var(--text-dim); font-size: 10px; letter-spacing: .2em; display: block; }
.hud-value { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--cyan); }
.hud-sector, .hud-stat { text-align: center; }

.hud-mod {
  font-size: 11px; padding: 4px 10px; letter-spacing: .08em;
  border: 1px dashed rgba(255,179,0,.5); color: var(--amber);
  animation: mod-pulse 2.4s ease-in-out infinite;
}
@keyframes mod-pulse { 50% { box-shadow: 0 0 12px rgba(255,179,0,.25); } }

.hud-hp { display: flex; gap: 5px; }
.hp-pip {
  width: 20px; height: 26px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(180deg, #58ffd9, #00d4b8);
  box-shadow: 0 0 10px rgba(61,255,142,.5);
  transition: all .25s;
}
.hp-pip.empty { background: #1a2233; box-shadow: inset 0 0 6px rgba(0,0,0,.6); }
.hp-pip.lost { animation: pip-lost .5s ease-out forwards; }
@keyframes pip-lost {
  0% { background: var(--red); transform: scale(1.4); box-shadow: 0 0 22px rgba(255,59,59,.8); }
  100% { background: #1a2233; transform: scale(1); box-shadow: inset 0 0 6px rgba(0,0,0,.6); }
}

.hud-shield {
  color: var(--cyan); font-size: 15px;
  text-shadow: 0 0 10px rgba(0,240,255,.6);
}

/* ---------- поле ---------- */

.board-zone {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 14px; min-height: 0; overflow: auto;
  position: relative;
}

.board-frame {
  position: relative;
  padding: 10px;
  background: linear-gradient(180deg, rgba(14,18,32,.85), rgba(8,10,18,.9));
  border: 1px solid var(--line-bright);
  box-shadow:
    0 0 0 1px rgba(0,240,255,.06),
    0 0 40px rgba(0,240,255,.07),
    0 24px 60px rgba(0,0,0,.6);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}
.board-frame.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-6px, 3px) rotate(-.4deg); }
  40% { transform: translate(5px, -4px) rotate(.4deg); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}

.board {
  display: grid;
  gap: 3px;
  touch-action: manipulation;
}

#fx-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 5;
}

.target-hint {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; letter-spacing: .1em;
  color: var(--amber); border: 1px dashed rgba(255,179,0,.5);
  padding: 6px 14px; background: rgba(10,13,22,.9); z-index: 6;
  animation: mod-pulse 1.6s infinite;
}

/* клетки */

.cell {
  width: var(--cell); height: var(--cell);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: calc(var(--cell) * .52);
  cursor: pointer;
  background: linear-gradient(160deg, #141a2c, #0c101d);
  border: 1px solid #232c44;
  border-top-color: #2e3a5c;
  box-shadow: inset 0 1px 0 rgba(120,150,220,.08);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.cell:hover:not(.rev) {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 10px rgba(0,240,255,.25), inset 0 0 8px rgba(0,240,255,.12);
  z-index: 2;
}
.flag-mode .cell:hover:not(.rev) {
  border-color: var(--amber);
  box-shadow: 0 0 10px rgba(255,179,0,.3), inset 0 0 8px rgba(255,179,0,.15);
}

.cell.rev {
  background: #070a12;
  border-color: #161d30;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.55);
  cursor: default;
  animation: cell-open .18s ease-out;
}
@keyframes cell-open {
  from { background: #22406a; box-shadow: 0 0 14px rgba(0,240,255,.4); }
}

.cell.rev.n0 { cursor: default; }
.cell.rev[data-n]:not(.boom):not(.defused) { cursor: pointer; } /* аккорд */

.cell.n1 { color: var(--n1); } .cell.n2 { color: var(--n2); }
.cell.n3 { color: var(--n3); } .cell.n4 { color: var(--n4); }
.cell.n5 { color: var(--n5); } .cell.n6 { color: var(--n6); }
.cell.n7 { color: var(--n7); } .cell.n8 { color: var(--n8); }
.cell.rev[data-n] { text-shadow: 0 0 8px currentColor; font-weight: 700; }

.cell.flag { border-color: rgba(255,179,0,.6); }
.cell.flag::after {
  content: "⚑"; color: var(--amber); font-size: calc(var(--cell) * .5);
  text-shadow: 0 0 8px rgba(255,179,0,.7);
  animation: flag-in .15s ease-out;
}
@keyframes flag-in { from { transform: scale(1.6); opacity: 0; } }

.cell.boom {
  background: radial-gradient(circle, #3d0f16, #12060a);
  border-color: rgba(255,59,59,.5);
}
.cell.boom::after {
  content: "✸"; color: var(--red); font-size: calc(var(--cell) * .58);
  text-shadow: 0 0 12px rgba(255,59,59,.9);
}

.cell.defused {
  background: radial-gradient(circle, #0a2a1e, #071510);
  border-color: rgba(61,255,142,.4);
}
.cell.defused::after {
  content: "◈"; color: var(--green); font-size: calc(var(--cell) * .5);
  text-shadow: 0 0 10px rgba(61,255,142,.7);
}

.cell.mine-shown {
  background: radial-gradient(circle, #2a1020, #12060f);
  border-color: rgba(255,45,120,.5);
}
.cell.mine-shown::after {
  content: "✸"; color: var(--pink); font-size: calc(var(--cell) * .55);
  text-shadow: 0 0 10px rgba(255,45,120,.8);
}

.cell.cache:not(.rev) {
  border-color: rgba(255,179,0,.45);
  box-shadow: inset 0 0 10px rgba(255,179,0,.15);
  animation: cache-shimmer 2s ease-in-out infinite;
}
@keyframes cache-shimmer {
  50% { box-shadow: inset 0 0 14px rgba(255,179,0,.35), 0 0 8px rgba(255,179,0,.2); }
}

.cell.glitched { color: var(--violet) !important; }
.cell.glitched .num { animation: glitch-num .9s steps(2) infinite; }
@keyframes glitch-num { 50% { opacity: .35; transform: translateX(1px); } }

.cell.scan-pulse { animation: scan-pulse .5s ease-out; }
@keyframes scan-pulse {
  0% { background: #0a3a44; box-shadow: 0 0 18px rgba(0,240,255,.7); }
}

/* ---------- карта сети ---------- */

.map-zone {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 10px 16px;
}
#map-svg {
  width: min(680px, 100%);
  height: auto; flex: none;
}

.map-zone-label {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .18em;
  fill: #2c3852;
  transition: fill .3s;
}
.map-zone-label.active { fill: var(--cyan); }

.map-edge {
  stroke: #1c2540; stroke-width: 2;
}
.map-edge.taken {
  stroke: rgba(0,240,255,.5); stroke-width: 2.5;
  filter: drop-shadow(0 0 4px rgba(0,240,255,.4));
}
.map-edge.open {
  stroke: rgba(255,179,0,.55); stroke-width: 2.5;
  stroke-dasharray: 6 6;
  animation: edge-flow 1s linear infinite;
}
@keyframes edge-flow { to { stroke-dashoffset: -12; } }

.map-node .node-ring { fill: none; stroke: transparent; stroke-width: 2; }
.map-node .node-bg { fill: #101728; stroke: #2a3552; stroke-width: 1.5; }
.map-node .node-icon {
  font-family: var(--font-mono); font-size: 19px; text-anchor: middle;
  fill: var(--text-dim);
}

.map-node.locked { opacity: .38; }

.map-node.open { cursor: pointer; }
.map-node.open .node-bg { stroke: var(--cyan-dim); }
.map-node.open .node-ring {
  stroke: rgba(0,240,255,.5);
  animation: node-pulse 1.6s ease-in-out infinite;
}
.map-node.open:hover .node-bg { fill: #16233c; stroke: var(--cyan); }
.map-node.open .node-icon { fill: var(--cyan); }
@keyframes node-pulse {
  0%, 100% { stroke-opacity: .25; r: 26; }
  50% { stroke-opacity: .8; }
}

.map-node.current .node-bg { stroke: var(--cyan); fill: #0c2530; }
.map-node.current .node-icon { fill: var(--cyan); }
.map-node.current .node-ring {
  stroke: rgba(0,240,255,.9);
  animation: node-pulse 1.2s ease-in-out infinite;
}

.map-node.done { opacity: .55; }
.map-node.done .node-icon { fill: var(--green); }
.map-node.done .node-bg { stroke: rgba(61,255,142,.35); }

.map-node.type-elite .node-icon { font-size: 17px; }
.map-node.type-elite.open .node-icon, .map-node.type-elite.locked .node-icon { fill: var(--pink); }
.map-node.type-elite.open .node-bg { stroke: rgba(255,45,120,.6); }
.map-node.type-elite.open .node-ring { stroke: rgba(255,45,120,.5); }
.map-node.type-shop.open .node-icon { fill: var(--amber); }
.map-node.type-shop.open .node-bg { stroke: rgba(255,179,0,.5); }
.map-node.type-event.open .node-icon { fill: var(--violet); }
.map-node.type-event.open .node-bg { stroke: rgba(157,92,255,.55); }
.map-node.type-core .node-icon { font-size: 24px; }
.map-node.type-core.open .node-icon, .map-node.type-core.locked .node-icon { fill: var(--pink); }
.map-node.type-core.open .node-ring { stroke: rgba(255,45,120,.7); }
.map-node.type-core.open .node-bg { stroke: var(--pink); fill: #1c0a14; }

/* комм-панель ВЕКТОРА */

.comm-panel {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(10,13,22,.97), rgba(10,13,22,.6));
  min-height: 92px;
}
.comm-avatar {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; font-size: 22px;
  color: var(--violet);
  border: 1px solid rgba(157,92,255,.5);
  background: rgba(157,92,255,.08);
  box-shadow: 0 0 14px rgba(157,92,255,.2);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.comm-name {
  font-family: var(--font-display); font-size: 12px; letter-spacing: .18em;
  color: var(--violet); margin-bottom: 5px;
}
.comm-tag { color: var(--text-dim); font-size: 10px; letter-spacing: .1em; }
.comm-text {
  font-size: 13px; line-height: 1.6; color: var(--text);
  white-space: pre-line; max-width: 760px;
}
.comm-text::after {
  content: "▮"; color: var(--violet);
  animation: blink 1s steps(2) infinite;
}

/* ---------- событие ---------- */

#screen-event { align-items: center; justify-content: center; padding: 20px; }

.event-wrap { width: min(620px, 94vw); }

.event-card {
  padding: 26px;
  background: linear-gradient(165deg, rgba(20,14,36,.92), rgba(10,13,22,.96));
  border: 1px solid rgba(157,92,255,.4);
  box-shadow: 0 0 50px rgba(157,92,255,.12), 0 24px 60px rgba(0,0,0,.6);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  display: flex; flex-direction: column; gap: 18px;
  animation: screen-in .35s ease-out;
}

.event-head { display: flex; align-items: center; gap: 16px; }
.event-icon {
  font-size: 40px; color: var(--violet);
  text-shadow: 0 0 20px rgba(157,92,255,.6);
}
.event-name {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: .1em; color: #e8ddff;
}
.event-kind { font-size: 11px; letter-spacing: .2em; color: var(--text-dim); margin-top: 3px; }

.event-text { font-size: 14px; line-height: 1.7; color: var(--text); }

.event-choices { display: flex; flex-direction: column; gap: 10px; }
.event-choice {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  text-align: left;
}
.event-choice .choice-hint {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em;
  color: var(--text-dim); text-transform: none;
}
.event-choice:hover .choice-hint { color: var(--amber); }

.event-result {
  font-size: 14px; line-height: 1.7; color: var(--green);
  border-left: 2px solid rgba(61,255,142,.5);
  padding: 4px 0 4px 14px;
  animation: screen-in .3s ease-out;
}

.summary-flavor { color: var(--violet); font-size: 12px; letter-spacing: .05em; }

.hud-elite {
  border-color: rgba(255,45,120,.6) !important; color: var(--pink) !important;
}

/* ---------- док с предметами ---------- */

.run-dock {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(10,13,22,.95), rgba(10,13,22,.5));
}

.perk-bar { display: flex; gap: 6px; }
.perk-chip {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; border: 1px solid rgba(157,92,255,.45); color: var(--violet);
  background: rgba(157,92,255,.08); cursor: help; position: relative;
}

.item-bar { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
.item-slot {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; cursor: pointer;
  font-family: var(--font-display); font-size: 12px; letter-spacing: .06em;
  background: linear-gradient(180deg, var(--bg-panel2), var(--bg-panel));
  border: 1px solid var(--line-bright);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: all .15s;
}
.item-slot:hover { border-color: var(--cyan-dim); color: var(--cyan); box-shadow: 0 0 12px rgba(0,240,255,.2); }
.item-slot .item-icon { font-size: 17px; }
.item-slot.armed { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 14px rgba(255,179,0,.3); }
.item-bar .empty-note { color: var(--text-dim); font-size: 11px; letter-spacing: .15em; align-self: center; }

.btn-tool {
  font-size: 18px; padding: 8px 16px;
}
.btn-tool.on {
  color: var(--amber); border-color: var(--amber);
  box-shadow: 0 0 14px rgba(255,179,0,.35);
}

/* ---------- магазин ---------- */

.shop-wallet {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--amber); text-shadow: 0 0 14px rgba(255,179,0,.4);
}

.shop-banner {
  margin: 14px 24px 0; padding: 10px 16px;
  font-size: 13px; letter-spacing: .05em;
  color: var(--green); border: 1px solid rgba(61,255,142,.3);
  background: rgba(61,255,142,.05);
}

.shop-offers {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px; padding: 18px 24px; align-content: start;
}

.offer-card {
  position: relative;
  padding: 16px;
  background: linear-gradient(165deg, var(--bg-panel2), var(--bg-panel));
  border: 1px solid var(--line-bright);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  display: flex; flex-direction: column; gap: 8px;
  transition: all .15s;
  animation: card-in .4s ease-out backwards;
}
.offer-card:nth-child(2) { animation-delay: .06s; }
.offer-card:nth-child(3) { animation-delay: .12s; }
.offer-card:nth-child(4) { animation-delay: .18s; }
.offer-card:nth-child(5) { animation-delay: .24s; }
@keyframes card-in { from { opacity: 0; transform: translateY(16px); } }

.offer-card:not(.sold):hover { border-color: var(--cyan-dim); box-shadow: 0 0 20px rgba(0,240,255,.12); }
.offer-card.sold { opacity: .4; filter: saturate(.3); }

.offer-head { display: flex; align-items: center; gap: 10px; }
.offer-icon { font-size: 26px; }
.offer-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: .05em; }
.offer-kind { font-size: 10px; letter-spacing: .2em; color: var(--text-dim); }
.offer-kind.k-perk { color: var(--violet); }
.offer-desc { font-size: 12px; color: var(--text-dim); line-height: 1.55; flex: 1; }
.offer-buy { align-self: stretch; }
.offer-buy .price { color: var(--amber); }
.offer-card.sold .offer-buy { visibility: hidden; }

.shop-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px 18px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.shop-inv { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.shop-inv .inv-chip {
  border: 1px solid var(--line-bright); padding: 4px 10px; font-size: 13px;
}
.shop-actions { display: flex; gap: 12px; }

/* ---------- аплинк ---------- */

.uplink-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; padding: 18px 24px; overflow-y: auto;
}

.upgrade-card {
  padding: 16px;
  border: 1px solid var(--line-bright);
  background: linear-gradient(165deg, var(--bg-panel2), var(--bg-panel));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  display: flex; flex-direction: column; gap: 8px;
}
.upgrade-card.owned { border-color: rgba(61,255,142,.4); }
.upgrade-card.locked { opacity: .45; }
.upgrade-card .offer-name { color: var(--text); }
.upgrade-card.owned .offer-name::after {
  content: " ✓ УСТАНОВЛЕНО"; color: var(--green); font-size: 10px; letter-spacing: .15em;
}

.shards-badge {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--violet); text-shadow: 0 0 16px rgba(157,92,255,.5);
}

.uplink-stats { padding: 10px 24px 20px; border-top: 1px solid var(--line); }
.uplink-stats h3 { font-size: 11px; letter-spacing: .2em; color: var(--text-dim); margin-bottom: 10px; font-weight: 400; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-box {
  border: 1px solid var(--line); padding: 10px 12px;
  background: rgba(14,18,32,.5);
}
.stat-box .stat-num {
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--cyan);
}
.stat-box .stat-name { font-size: 10px; letter-spacing: .12em; color: var(--text-dim); margin-top: 2px; }

/* ---------- помощь ---------- */

.help-body {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; padding: 18px 24px; align-content: start;
}
.help-card {
  border: 1px solid var(--line-bright); padding: 18px;
  background: linear-gradient(165deg, var(--bg-panel2), var(--bg-panel));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.help-card h3 {
  font-family: var(--font-display); font-size: 14px; letter-spacing: .12em;
  color: var(--cyan); margin-bottom: 10px;
}
.help-card p { font-size: 13px; line-height: 1.65; color: var(--text-dim); }
.help-card p + p { margin-top: 8px; }
.help-card b { color: var(--text); font-weight: 400; }

.c-cyan { color: var(--cyan) !important; }
.c-pink { color: var(--pink) !important; }
.c-amber { color: var(--amber) !important; }
.c-violet { color: var(--violet) !important; }

/* ---------- итоги ---------- */

#screen-summary { align-items: center; justify-content: center; }
.summary-box { text-align: center; padding: 24px; width: min(560px, 92vw); }
.summary-box h2 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(34px, 7vw, 64px); letter-spacing: .05em;
}
.summary-box h2.win {
  color: var(--green);
  text-shadow: 0 0 20px rgba(61,255,142,.6), 0 0 60px rgba(61,255,142,.25);
}
.summary-box h2.lose {
  color: var(--red);
  text-shadow: 0 0 20px rgba(255,59,59,.6), 0 0 60px rgba(255,59,59,.25);
}
.summary-sub { margin: 10px 0 24px; color: var(--text-dim); font-size: 13px; letter-spacing: .1em; }
.summary-shards {
  margin: 18px 0 26px; font-family: var(--font-display); font-size: 18px;
  color: var(--violet); text-shadow: 0 0 16px rgba(157,92,255,.5);
}

/* ---------- модалка / тост ---------- */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,4,8,.8); backdrop-filter: blur(3px);
  animation: screen-in .2s ease-out;
}
.modal[hidden] { display: none; }
.modal-box {
  width: min(420px, 90vw); padding: 26px;
  background: var(--bg-panel2); border: 1px solid var(--line-bright);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}
.modal-text { font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 99; pointer-events: none;
  padding: 10px 22px; font-size: 13px; letter-spacing: .08em;
  color: var(--cyan); background: rgba(10,13,22,.92);
  border: 1px solid rgba(0,240,255,.35);
  box-shadow: 0 0 20px rgba(0,240,255,.15);
  animation: toast-in 2.2s ease-out forwards;
}
.toast.warn { color: var(--amber); border-color: rgba(255,179,0,.4); }
.toast[hidden] { display: none; }
@keyframes toast-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(12px); }
  8%, 82% { opacity: 1; transform: translateX(-50%); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ---------- адаптив ---------- */

@media (max-width: 640px) {
  .run-hud { padding: 8px 10px; gap: 8px; }
  .hud-value { font-size: 15px; }
  .screen-head { padding: 14px 14px 10px; }
  .shop-offers, .uplink-grid, .help-body { padding: 14px; }
  .shop-foot { padding: 12px 14px; }
  .run-dock { padding: 8px 10px 10px; flex-wrap: wrap; }
  .item-bar { order: 3; width: 100%; }
}
