/* ---------- bundled fonts (OFL) ---------- */
@font-face {
  font-family: 'Bebas Neue';
  src: url('../fonts/BebasNeue-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  src: url('../fonts/Oswald-VariableFont_wght.ttf') format('truetype');
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('../fonts/Rajdhani-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('../fonts/Rajdhani-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

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

:root {
  --green: #7dd956;
  --green-dim: rgba(125, 217, 86, 0.25);
  --red: #c22f2f;
  --gold: #ffb75d;
  --bone: #e8e4d8;
  --panel-bg: rgba(8, 13, 10, 0.88);
  --font-head: 'Bebas Neue', 'Oswald', Impact, 'Arial Narrow', sans-serif;
  --font-body: 'Rajdhani', 'Trebuchet MS', Verdana, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #04070a;
  font-family: var(--font-body);
  color: var(--bone);
  user-select: none;
  -webkit-user-select: none;
}

body.playing, body.playing canvas#game { cursor: none; }

canvas#game {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  background: #04070a;
}

.hidden { display: none !important; }

#screen-fade {
  position: fixed; inset: 0; z-index: 25;
  background: #04070a;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#screen-fade.active { opacity: 1; }

/* ---------- overlays ---------- */
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}

#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0.04;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.6) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
#noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

#fx-hurt {
  position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(160, 10, 10, 0.55) 100%);
  transition: opacity 0.08s linear;
}
#fx-hurt.hit { animation: hurtFlash 0.15s ease; }
@keyframes hurtFlash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

#fx-lowhp {
  position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(120, 0, 0, 0.5) 100%);
}
#fx-lowhp.pulse { animation: lowpulse 1s ease-in-out infinite; }
@keyframes lowpulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.7; } }

/* ---------- banners ---------- */
#banner-wrap {
  position: fixed; top: 22%; left: 0; right: 0;
  text-align: center; z-index: 20; pointer-events: none;
}
#banner {
  font-family: var(--font-head);
  font-size: clamp(34px, 6vw, 72px);
  letter-spacing: 0.12em;
  color: var(--bone);
  text-shadow: 0 0 24px rgba(125, 217, 86, 0.5), 0 2px 0 #000;
  animation: bannerIn 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
#banner-sub {
  font-family: var(--font-body);
  font-size: clamp(14px, 2vw, 20px);
  letter-spacing: 0.35em;
  color: var(--green);
  margin-top: 8px;
  animation: bannerIn 0.5s 0.1s both;
}
#banner-wrap.out { animation: bannerOut 0.3s both; }
@keyframes bannerIn { from { opacity: 0; transform: translateY(-18px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes bannerOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes bannerShake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-4px) rotate(-0.5deg); }
  40% { transform: translateX(4px) rotate(0.5deg); }
  60% { transform: translateX(-3px) rotate(-0.3deg); }
  80% { transform: translateX(3px) rotate(0.3deg); }
}
#banner.danger { color: #ff6a5e; text-shadow: 0 0 26px rgba(220, 50, 40, 0.65), 0 2px 0 #000; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
#hud:not(.hidden) { opacity: 1; }

.bar {
  position: relative; height: 18px; width: 240px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(232, 228, 216, 0.22);
  border-radius: 3px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.6), inset 0 0 8px rgba(0,0,0,0.5);
}
.bar > div {
  height: 100%; width: 100%;
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
#hp-fill {
  background: linear-gradient(180deg, #52c46a 0%, #2c8a44 60%, #1d5c2e 100%);
  box-shadow: 0 0 12px rgba(82, 196, 106, 0.45);
  position: relative;
}
#hp-fill::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}
#hp-fill.hurt { background: linear-gradient(180deg, #e05548 0%, #a52619 60%, #6d150c 100%); }
#hp-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 11px; color: #fff;
  text-shadow: 0 1px 2px #000; letter-spacing: 0.08em;
}
.bar.stam { height: 8px; width: 180px; margin-top: 5px; }
#stam-fill { background: linear-gradient(180deg, #ffe08a, #d09b2e); }

#hud-tl { position: absolute; top: 18px; left: 18px; }
#buffs { display: flex; gap: 6px; margin-top: 8px; }
.buff {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(232,228,216,0.2);
  font-family: var(--font-head); font-size: 9px; letter-spacing: 0.05em;
}
.buff .b-time { color: #fff; font-size: 12px; }
.buff.b-shield { border-color: #57b8ff; color: #57b8ff; box-shadow: 0 0 10px rgba(87,184,255,0.25); }
.buff.b-explosive { border-color: #ff8a3d; color: #ff8a3d; box-shadow: 0 0 10px rgba(255,138,61,0.25); }
.buff.b-adrenaline { border-color: #ffe45e; color: #ffe45e; box-shadow: 0 0 10px rgba(255,228,94,0.25); }
.buff.b-night { border-color: #7dd956; color: #7dd956; box-shadow: 0 0 10px rgba(125,217,86,0.25); }

#hud-tc {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  text-align: center;
}
#wave-label {
  font-family: var(--font-head);
  font-size: 26px; letter-spacing: 0.2em; color: var(--bone);
  text-shadow: 0 0 14px rgba(125,217,86,0.35), 0 2px 0 #000;
  transition: all 0.2s ease;
}
#zombies-left { font-size: 11px; letter-spacing: 0.3em; color: rgba(232,228,216,0.6); margin-top: 2px; }
#zombies-left b { color: #ff7a6e; }

#boss-bar { margin-top: 8px; width: 340px; }
#boss-bar.hidden { display: none; }
#boss-name { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.4em; color: #ff6a5e; }
.bar.boss { height: 10px; width: 100%; margin-top: 3px; }
#boss-fill { background: linear-gradient(180deg, #ff5b45, #8d1a0e); box-shadow: 0 0 12px rgba(255, 91, 69, 0.5); }

#hud-tr { position: absolute; top: 14px; right: 14px; text-align: right; }
#minimap {
  border: 1px solid rgba(232, 228, 216, 0.22);
  border-radius: 4px; background: rgba(4, 8, 6, 0.7);
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
#hud-stats { margin-top: 6px; font-family: var(--font-head); }
#hud-stats span { font-size: 16px; color: #fff; text-shadow: 0 1px 2px #000; }
#hud-stats .stat-tag { font-size: 9px; color: rgba(232,228,216,0.5); margin: 0 10px 0 4px; letter-spacing: 0.15em; }
#hud-btns { margin-top: 8px; display: flex; gap: 6px; justify-content: flex-end; pointer-events: auto; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(232, 228, 216, 0.25);
  color: var(--bone); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.12s ease;
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { border-color: var(--green); color: var(--green); box-shadow: 0 0 12px rgba(125,217,86,0.3); }

#hud-bl { position: absolute; bottom: 46px; left: 18px; }
#btn-upgrades {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--green-dim);
  border-radius: 4px; padding: 8px 14px;
  color: var(--bone); font-family: var(--font-body);
  transition: all 0.15s ease;
}
#btn-upgrades:hover { border-color: var(--green); box-shadow: 0 0 14px rgba(125,217,86,0.3); }
.up-key {
  font-family: var(--font-head); font-size: 10px;
  background: rgba(125, 217, 86, 0.15); color: var(--green);
  padding: 3px 7px; border-radius: 3px; border: 1px solid var(--green-dim);
}
#sp-badge {
  font-family: var(--font-head); font-size: 18px; color: var(--gold);
  min-width: 24px; text-align: center;
  text-shadow: 0 0 10px rgba(255, 183, 93, 0.6);
}
#btn-upgrades.has-points { animation: spPulse 1.2s ease-in-out infinite; }
@keyframes spPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(255,183,93,0.2); }
  50% { box-shadow: 0 0 18px rgba(255,183,93,0.6); border-color: var(--gold); }
}
.up-txt { font-size: 11px; letter-spacing: 0.25em; color: rgba(232,228,216,0.75); }

#hud-br { position: absolute; bottom: 46px; right: 18px; text-align: right; }
#weapon-slots { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.wslot {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(232,228,216,0.16);
  border-radius: 4px; padding: 6px 14px;
  font-family: var(--font-head); font-size: 12px; letter-spacing: 0.1em;
  color: rgba(232,228,216,0.55);
  transition: all 0.15s ease;
  position: relative;
}
.wslot::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%; width: 2px;
  background: transparent;
  border-radius: 0 2px 2px 0;
  transition: all 0.15s ease;
}
.wslot.active::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.wslot .w-ammo { font-size: 14px; color: rgba(232,228,216,0.85); min-width: 36px; text-align: right; }
.wslot .w-num {
  font-size: 9px; color: rgba(232,228,216,0.4);
  border: 1px solid rgba(232,228,216,0.25); border-radius: 3px; padding: 1px 5px;
}
.wslot.active {
  border-color: var(--green);
  background: rgba(20, 40, 18, 0.65);
  color: #fff;
  box-shadow: 0 0 14px rgba(125,217,86,0.25);
}
.wslot.active .w-ammo { color: var(--green); font-size: 17px; }
.wslot.reloading .w-ammo { color: var(--gold); animation: reloadBlink 0.5s linear infinite; }
@keyframes reloadBlink { 50% { opacity: 0.3; } }

#hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 26px;
  background: rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(232, 228, 216, 0.12);
  display: flex; align-items: center;
}
#xp-bar { flex: 1; height: 5px; margin: 0 70px 0 18px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
#xp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #4f9e33, #a4ff6f);
  box-shadow: 0 0 10px rgba(125,217,86,0.6);
  transition: width 0.15s ease-out;
}
#level-badge {
  position: absolute; right: 18px;
  font-family: var(--font-head); font-size: 12px; color: var(--green);
  text-shadow: 0 0 8px rgba(125,217,86,0.5);
}

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 30;
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  background: rgba(2, 5, 4, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.screen.active { display: flex; opacity: 1; }
#screen-menu { background: transparent; opacity: 1; transition: none; }
#screen-menu::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(4,7,10,0.15) 0%, rgba(4,7,10,0.4) 100%);
  pointer-events: none;
  z-index: 1;
}
#screen-menu .menu-inner { display: flex; flex-direction: column; align-items: center; gap: 26px; position: relative; z-index: 2; animation: menuIn 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--green-dim);
  border-radius: 10px;
  padding: 28px 34px;
  box-shadow: 0 10px 60px rgba(0,0,0,0.8), 0 0 40px rgba(125,217,86,0.06), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: panelIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  max-height: 92vh; overflow: auto;
  position: relative;
}
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(125,217,86,0.35);
  pointer-events: none;
}
.panel::before { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.panel::after { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }
@keyframes panelIn { from { opacity: 0; transform: translateY(22px) scale(0.97); } to { opacity: 1; transform: none; } }

.panel h2 {
  font-family: var(--font-head); font-size: 22px; letter-spacing: 0.3em;
  color: var(--bone); text-shadow: 0 0 16px rgba(125,217,86,0.3);
}
.panel-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.panel-head .left { margin-right: auto; order: -1; }

.btn {
  font-family: var(--font-head);
  font-size: 15px; letter-spacing: 0.18em;
  color: var(--bone);
  background: rgba(20, 28, 20, 0.7);
  border: 1px solid rgba(232, 228, 216, 0.25);
  border-radius: 5px;
  padding: 13px 34px;
  cursor: pointer;
  transition: all 0.13s ease;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}
.btn:hover {
  border-color: var(--green); color: #fff;
  box-shadow: 0 0 18px rgba(125, 217, 86, 0.35), inset 0 0 12px rgba(125,217,86,0.08);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, rgba(90, 160, 60, 0.35), rgba(40, 80, 30, 0.45));
  border-color: var(--green);
  color: #eaffdd;
  text-shadow: 0 0 8px rgba(125,217,86,0.6);
}
.btn-primary:hover { box-shadow: 0 0 26px rgba(125, 217, 86, 0.5), inset 0 0 16px rgba(125,217,86,0.15); }
.btn.big { font-size: 19px; padding: 16px 60px; }
.btn.small { padding: 8px 22px; font-size: 12px; }
.btn.toggle.off { opacity: 0.45; }
.btn.toggle { min-width: 60px; }

/* ---------- main menu ---------- */
#screen-menu .menu-inner { display: flex; flex-direction: column; align-items: center; gap: 26px; position: relative; z-index: 2; animation: menuIn 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
#game-title {
  font-family: var(--font-head);
  text-align: center; line-height: 0.9;
  font-size: clamp(56px, 10vw, 120px);
  letter-spacing: 0.04em;
  animation: titleFlicker 4s linear infinite;
  position: relative;
}
#game-title::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  color: transparent;
  text-shadow: 0 0 8px rgba(125,217,86,0.3);
  clip-path: inset(0 0 65% 0);
  animation: titleScan 3s linear infinite;
  pointer-events: none;
}
@keyframes titleScan {
  0% { clip-path: inset(0 0 85% 0); }
  50% { clip-path: inset(30% 0 40% 0); }
  100% { clip-path: inset(80% 0 0 0); }
}
#game-title span {
  display: block;
  color: var(--bone);
  text-shadow: 0 0 8px rgba(232,228,216,0.4), 0 0 40px rgba(125,217,86,0.25), 0 4px 0 #000;
}
#game-title em {
  display: block; font-style: normal;
  color: var(--green);
  text-shadow: 0 0 14px rgba(125,217,86,0.7), 0 0 60px rgba(125,217,86,0.35), 0 4px 0 #000;
}
@keyframes titleFlicker {
  0%, 100% { opacity: 1; }
  91% { opacity: 1; } 92% { opacity: 0.55; } 93% { opacity: 1; }
  95.5% { opacity: 0.7; } 96% { opacity: 1; }
  97.2% { opacity: 0.85; } 97.4% { opacity: 1; }
}
.title-sub {
  text-align: center;
  font-family: var(--font-body);
  letter-spacing: 0.6em; font-size: clamp(12px, 1.6vw, 17px);
  color: rgba(232, 228, 216, 0.65);
  text-shadow: 0 0 12px rgba(255, 91, 69, 0.4);
}
#best-line {
  font-family: var(--font-head); font-size: 13px; letter-spacing: 0.2em;
  color: var(--gold); text-shadow: 0 0 10px rgba(255,183,93,0.4);
}
#menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 300px; }
#menu-buttons .btn { width: 100%; }
.menu-foot {
  font-size: 11px; letter-spacing: 0.2em;
  color: rgba(232, 228, 216, 0.4);
  animation: fadeIn 1s 0.5s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- map select ---------- */
.map-panel { width: min(920px, 94vw); text-align: center; }
.map-panel .panel-head { justify-content: center; }
#mode-toggle { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.mode-btn {
  font-family: var(--font-head); font-size: 14px; letter-spacing: 0.2em;
  padding: 10px 26px; border-radius: 5px; cursor: pointer;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(232,228,216,0.25); color: rgba(232,228,216,0.6);
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.mode-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent);
  pointer-events: none;
}
.mode-btn.active { border-color: var(--green); color: #fff; background: rgba(40, 80, 30, 0.4); box-shadow: 0 0 16px rgba(125,217,86,0.25); }
.xp-bonus { font-size: 10px; color: var(--gold); margin-left: 6px; }
#map-grid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 24px; }
.map-card {
  width: 158px; cursor: pointer;
  border: 1px solid rgba(232,228,216,0.2); border-radius: 8px;
  overflow: hidden; background: rgba(0,0,0,0.4);
  transition: all 0.18s ease;
  position: relative;
}
.map-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
  border-radius: inherit;
}
.map-card:hover { transform: translateY(-4px); border-color: rgba(125,217,86,0.6); box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
.map-card.selected { border-color: var(--green); box-shadow: 0 0 24px rgba(125,217,86,0.4); }
.map-thumb { height: 84px; }
.t-cross { background: linear-gradient(135deg, #3c3f3a 0%, #565a52 45%, #3c3f3a 100%), #3c3f3a; }
.t-station { background: linear-gradient(135deg, #4a4438 0%, #6b6350 50%, #4a4438 100%), #4a4438; }
.t-maze { background: repeating-linear-gradient(45deg, #24331f 0 12px, #35482c 12px 24px), #24331f; }
.t-park { background: linear-gradient(135deg, #23411f 0%, #3c6a2e 55%, #23411f 100%), #23411f; }
.t-road { background: linear-gradient(180deg, #2c3b28 0%, #565a52 30%, #565a52 70%, #2c3b28 100%), #565a52; }
.map-name { font-family: var(--font-head); font-size: 13px; letter-spacing: 0.1em; padding: 9px 6px 2px; color: var(--bone); }
.map-tag { font-size: 9px; color: rgba(232,228,216,0.45); padding: 0 6px 10px; letter-spacing: 0.05em; }

/* ---------- how to ---------- */
.how-panel { width: min(620px, 94vw); }
.how-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.how-row { display: flex; align-items: center; gap: 16px; font-size: 13px; color: rgba(232,228,216,0.8); }
.key {
  font-family: var(--font-head); font-size: 11px; letter-spacing: 0.1em;
  min-width: 110px; text-align: center;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(232,228,216,0.3);
  border-bottom-width: 3px; border-radius: 4px; padding: 6px 10px;
  color: var(--green);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
  transition: all 0.1s ease;
}
.key:hover { border-color: var(--green); box-shadow: 0 0 8px rgba(125,217,86,0.3); }
.tips { border-top: 1px solid var(--green-dim); padding-top: 14px; }
.tips p { font-size: 12px; color: rgba(232,228,216,0.6); margin-bottom: 6px; line-height: 1.5; }

/* ---------- pause / gameover ---------- */
.pause-panel, .go-panel { text-align: center; min-width: 340px; }
.pause-buttons, .go-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }

#go-title {
  font-size: 44px !important; color: #ff6a5e !important;
  text-shadow: 0 0 30px rgba(220, 50, 40, 0.6), 0 3px 0 #000 !important;
  animation: goIn 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes goIn { from { opacity: 0; transform: scale(1.6); letter-spacing: 0.6em; } to { opacity: 1; transform: none; letter-spacing: 0.3em; } }
#go-best-flag {
  font-family: var(--font-head); color: var(--gold); font-size: 14px; letter-spacing: 0.4em;
  margin-top: 8px; text-shadow: 0 0 14px rgba(255,183,93,0.7);
  animation: spPulse 1s ease-in-out infinite;
}
.go-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.go-cell {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(232,228,216,0.14);
  border-radius: 6px; padding: 14px 8px;
  transition: all 0.2s ease;
  animation: cellIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.go-cell:nth-child(1) { animation-delay: 0.05s; }
.go-cell:nth-child(2) { animation-delay: 0.1s; }
.go-cell:nth-child(3) { animation-delay: 0.15s; }
.go-cell:nth-child(4) { animation-delay: 0.2s; }
.go-cell:nth-child(5) { animation-delay: 0.25s; }
.go-cell:nth-child(6) { animation-delay: 0.3s; }
@keyframes cellIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
.go-cell span { font-family: var(--font-head); font-size: 24px; color: #fff; text-shadow: 0 0 10px rgba(125,217,86,0.3); }
.go-cell label { display: block; font-size: 9px; letter-spacing: 0.3em; color: rgba(232,228,216,0.45); margin-top: 4px; }

/* ---------- upgrade ---------- */
.up-panel { width: min(1060px, 96vw); }
.up-head { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.up-head h2 { margin-right: auto; }
#up-points { font-family: var(--font-head); font-size: 15px; letter-spacing: 0.15em; color: rgba(232,228,216,0.7); }
#up-points b { color: var(--gold); font-size: 20px; text-shadow: 0 0 12px rgba(255,183,93,0.6); }
#up-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px; max-height: 62vh; overflow-y: auto; padding: 4px;
}
#up-grid::-webkit-scrollbar { width: 8px; }
#up-grid::-webkit-scrollbar-thumb { background: var(--green-dim); border-radius: 4px; }
.up-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(232, 228, 216, 0.16);
  border-left: 3px solid var(--cat-color, var(--green));
  border-radius: 6px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all 0.15s ease;
  position: relative;
}
.up-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-color, var(--green)), transparent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.up-card:hover::before { opacity: 0.5; }
.up-card.maxed { opacity: 0.55; border-color: var(--cat-color, var(--green)); }
.up-card.can-buy:hover { border-color: var(--cat-color, var(--green)); box-shadow: 0 4px 20px rgba(125,217,86,0.15); transform: translateY(-2px); }
.up-card .u-top { display: flex; align-items: center; justify-content: space-between; }
.up-card .u-name { font-family: var(--font-head); font-size: 13px; letter-spacing: 0.08em; color: var(--bone); }
.up-card .u-cat { font-size: 8px; letter-spacing: 0.25em; color: var(--cat-color, var(--green)); opacity: 0.8; }
.up-card .u-pips { display: flex; gap: 3px; }
.up-card .pip { width: 14px; height: 5px; border-radius: 2px; background: rgba(232,228,216,0.15); }
.up-card .pip.on { background: var(--cat-color, var(--green)); box-shadow: 0 0 6px var(--cat-color, var(--green)); }
.up-card .u-desc { font-size: 11px; color: rgba(232,228,216,0.55); line-height: 1.4; min-height: 30px; }
.up-card .u-buy {
  font-family: var(--font-head); font-size: 10px; letter-spacing: 0.2em;
  background: rgba(125, 217, 86, 0.12); color: var(--green);
  border: 1px solid var(--green-dim); border-radius: 4px;
  padding: 6px; cursor: pointer; transition: all 0.12s ease;
}
.up-card .u-buy:hover { background: rgba(125, 217, 86, 0.28); }
.up-card .u-buy:disabled { opacity: 0.35; cursor: default; }
.up-card .u-buy:disabled:hover { background: rgba(125, 217, 86, 0.12); }

/* ---------- settings ---------- */
.set-panel { width: min(440px, 92vw); }
.set-row { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.set-row label { width: 110px; font-size: 13px; letter-spacing: 0.1em; color: rgba(232,228,216,0.75); }
.set-row input[type="range"] { flex: 1; accent-color: var(--green); cursor: pointer; height: 6px; }
.sl-val { font-family: var(--font-head); width: 34px; text-align: right; font-size: 13px; color: var(--green); }
.set-panel .btn-primary { width: 100%; margin-top: 12px; }

.map-thumb canvas { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
@media (max-width: 720px) {
  #minimap { display: none; }
  .bar { width: 160px; }
  .go-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- big ammo indicator (docked directly above the weapon dock) ---------- */
#ammo-indicator {
  position: absolute; bottom: calc(100% + 12px); right: 0;
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-head);
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(0,0,0,0.8);
  z-index: 11;
}
#ammo-big { font-size: 44px; line-height: 1; color: #fff; letter-spacing: 0.04em; }
#ammo-big.low { color: var(--gold); }
#ammo-big.empty { color: var(--red); animation: reloadBlink 0.5s linear infinite; }
#ammo-reserve { font-size: 18px; color: rgba(232,228,216,0.55); }
#reload-arc { width: 30px; height: 30px; transform: translateY(4px) rotate(-90deg); display: none; }
#reload-arc.show { display: block; }
#reload-arc .arc-track { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 4; }
#reload-arc .arc-fill {
  fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 107; stroke-dashoffset: 107;
}
#reload-hint, #reload-me-hint {
  position: absolute; right: 0; top: -18px;
  font-size: 13px; letter-spacing: 0.2em; color: var(--gold);
}
#reload-me-hint { color: var(--red); animation: reloadBlink 0.6s linear infinite; }

/* ---------- buff icons ---------- */
.buff { width: 46px; height: 46px; position: relative; }
.buff svg { width: 22px; height: 22px; display: block; margin: 3px auto 1px; }
.buff svg path, .buff svg circle, .buff svg rect { fill: currentColor; }

/* ---------- touch controls (mobile) ---------- */
#touch-controls { position: fixed; inset: 0; z-index: 12; pointer-events: none; display: none; }
#touch-controls.on { display: block; }
#tc-move, #tc-fire {
  position: absolute; bottom: 5vh;
  width: 34vw; max-width: 180px; height: 34vw; max-height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(232,228,216,0.25);
  pointer-events: auto;
  touch-action: none;
}
#tc-move { left: 4vw; }
#tc-fire { right: 4vw; background: rgba(125,217,86,0.06); border-color: rgba(125,217,86,0.35); }
#tc-fire-knob, #tc-move::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 40%; height: 40%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(232,228,216,0.22);
  border: 1px solid rgba(232,228,216,0.35);
  transition: transform 0.08s ease;
}
#tc-fire-knob.active, #tc-move.dragging::after { transform: translate(-50%, -50%) scale(1.25); background: rgba(125,217,86,0.4); }

@media (pointer: coarse) {
  body.playing #touch-controls.on { display: block; }
  #hud-bottom { height: 20px; }
  #ammo-indicator { bottom: calc(100% + 8px); right: 0; }
  #ammo-big { font-size: 34px; }
  .wslot { padding: 4px 10px; font-size: 10px; }
  #hud-btns .icon-btn { width: 44px; height: 44px; }
}

/* keep the weapon dock + ammo readout clear of the fire joystick
   (joystick: right 4vw, width min(34vw, 180px)) */
@media (pointer: coarse) {
  #hud-br { right: calc(4vw + min(34vw, 180px) + 16px); }
}
html.touch #hud-br { right: calc(4vw + min(34vw, 180px) + 16px); }

/* ---------- tutorial overlay ---------- */
#tutorial-overlay {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#tutorial-overlay.hidden { display: none; }
#tutorial-content {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(4, 7, 10, 0.85);
  border: 1px solid rgba(125, 217, 86, 0.35);
  border-radius: 8px;
  padding: 14px 22px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7), 0 0 20px rgba(125,217,86,0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#tutorial-step-text {
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: 0.18em;
  color: var(--bone);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  min-width: 260px;
}
#tutorial-dots {
  display: flex;
  gap: 8px;
}
#tutorial-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(232, 228, 216, 0.25);
  transition: all 0.25s ease;
}
#tutorial-dots .dot.active {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  transform: scale(1.2);
}
#tutorial-dots .dot.done {
  background: rgba(125, 217, 86, 0.6);
}
#btn-tutorial-skip {
  pointer-events: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(232, 228, 216, 0.25);
  color: rgba(232, 228, 216, 0.7);
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}
#btn-tutorial-skip:hover {
  border-color: rgba(232, 228, 216, 0.55);
  color: var(--bone);
}
