/* ============================================================================
   NRK: STEEL PERIMETER // MODULE: STYLESHEET (style.css)
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }

body {
  background: radial-gradient(ellipse at 50% 10%, #152238 0%, #070912 55%, #030408 100%);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', system-ui, sans-serif;
  color: #e8f4ff;
  overflow: hidden;
  padding: 6px;
}

.top-bar {
  width: 100%;
  max-width: 520px;
  height: 38px;
  background: rgba(8, 12, 24, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 30;
}
.brand-tag { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: #00f0ff; text-decoration: none; }
.top-actions { display: flex; gap: 5px; align-items: center; }
.icon-btn {
  background: #101b30;
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #00f0ff;
  height: 25px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.icon-btn:hover { background: #182846; }
.icon-btn.gold { color: #ffbe0b; border-color: rgba(255, 190, 11, 0.5); background: rgba(255, 190, 11, 0.12); }
.icon-btn.retry { color: #38bdf8; border-color: rgba(56, 189, 248, 0.5); background: rgba(56, 189, 248, 0.12); }
.icon-btn.test-shield { color: #ff8da5; border-color: rgba(255, 77, 114, 0.55); background: rgba(255, 77, 114, 0.10); }
.icon-btn.test-shield.active { color: #07111f; border-color: #00ff88; background: #00ff88; box-shadow: 0 0 12px rgba(0,255,136,.45); }

.hud-strip {
  width: 100%;
  max-width: 520px;
  background: #0a1020;
  border-left: 1px solid rgba(0, 240, 255, 0.35);
  border-right: 1px solid rgba(0, 240, 255, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 5px 10px;
  font-size: 9px;
  font-weight: 700;
  color: #9cb8d9;
}
.hud-strip b { color: #fff; font-size: 11px; }
.hud-cyan { color: #00f0ff !important; }
.hud-pink { color: #ff4d72 !important; }
.hud-gold { color: #ffbe0b !important; }

/* Постійна панель поточного завдання місії / квесту */
.mission-bar {
  width: 100%;
  max-width: 520px;
  background: rgba(9, 17, 34, 0.96);
  border-left: 1px solid rgba(0, 240, 255, 0.35);
  border-right: 1px solid rgba(0, 240, 255, 0.35);
  border-top: 1px solid rgba(0, 240, 255, 0.15);
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9px;
  color: #cbd5e1;
}
.mission-title-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #00f0ff;
  font-weight: 800;
  font-size: 9px;
}
.mission-steps-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 8.5px;
  color: #94a3b8;
}
.mission-step-item.done { color: #00ff88; text-decoration: line-through; opacity: 0.8; }
.mission-step-item.active { color: #ffbe0b; font-weight: 800; }

#gameWrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  max-height: 55vh;
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: 0 0 12px 12px;
  background: #060913;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.15);
  overflow: hidden;
  touch-action: none;
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#buffBar {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 10;
}
.buff-tag {
  font-size: 8.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(0, 255, 208, 0.2);
  border: 1px solid #00ffd0;
  color: #00ffd0;
}
.buff-tag.turbo { background: rgba(255, 190, 11, 0.22); border-color: #ffbe0b; color: #ffbe0b; }
.buff-tag.debuff { background: rgba(255, 30, 86, 0.28); border-color: #ff1e56; color: #ff7597; }

#bannerBox {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(6, 12, 26, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.65);
  border-radius: 10px;
  padding: 11px 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 15;
  text-align: center;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3);
  width: max-content;
  max-width: 92%;
}
#bannerBox.show { opacity: 1; }
#bannerMain { font-size: 14px; font-weight: 900; color: #fff; text-shadow: 0 0 14px #00f0ff; }
#bannerSub { margin-top: 4px; font-size: 9px; font-weight: 700; color: #ffbe0b; letter-spacing: 0.7px; }

#overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(12, 20, 42, 0.97), rgba(4, 6, 14, 0.99));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  text-align: center;
  z-index: 25;
}
#overlay.hidden { display: none; }
h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, #00f0ff, #8b5cf6, #ff0055);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.desc { font-size: 10px; color: #9eb6d4; line-height: 1.4; max-width: 390px; }

.summary-card {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 10px;
  padding: 9px 12px;
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  font-size: 10px;
  text-align: left;
}
.summary-card b { color: #ffbe0b; }

.scen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: 100%;
  max-width: 380px;
}
.scen-btn {
  background: #0d162c;
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #9cb8d9;
  padding: 6px 4px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}
.scen-btn.tutorial-btn {
  grid-column: 1 / -1;
  border-color: rgba(0, 255, 136, 0.55);
  color: #00ff88;
  font-size: 9px;
  padding: 7px 6px;
}
.scen-btn.campaign-btn {
  grid-column: 1 / -1;
  border-color: rgba(255, 190, 11, 0.55);
  color: #ffbe0b;
  font-size: 9px;
  padding: 7px 6px;
}
.scen-btn.active {
  border-color: #00ffd0;
  background: rgba(0, 255, 208, 0.22);
  color: #fff;
}

.diff-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 380px;
}
.diff-btn {
  flex: 1;
  background: #0d162c;
  border: 1px solid rgba(255, 190, 11, 0.3);
  color: #9cb8d9;
  padding: 5px 4px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.diff-btn.active {
  border-color: #ff0055;
  background: rgba(255, 0, 85, 0.25);
  color: #fff;
}

.btn-main {
  background: linear-gradient(135deg, #ff0055, #7b2cbf);
  border: 1px solid #00f0ff;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
  width: 100%;
  max-width: 260px;
  margin-top: 2px;
}
.btn-sub {
  background: rgba(255, 190, 11, 0.14);
  border: 1px solid #ffbe0b;
  color: #ffbe0b;
  padding: 7px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  max-width: 260px;
}

.mobile-pad {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 2px;
  gap: 8px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 40px);
  gap: 4px;
}
.pad-btn {
  background: #101b33;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 8px;
  color: #00f0ff;
  font-size: 15px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.pad-btn:active, .pad-btn.pressed {
  background: #00f0ff;
  color: #050a14;
  box-shadow: 0 0 15px #00f0ff;
}
.weapons-col { display: flex; align-items: center; gap: 10px; }
.alt-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1e293b, #0f172a);
  border: 2px solid #475569;
  color: #64748b;
  font-family: inherit;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.alt-btn.armed {
  background: radial-gradient(circle at 35% 35%, #f59e0b, #b45309);
  border-color: #fef08a;
  color: #fff;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.55);
}
.fire-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff3366, #a90038);
  border: 2px solid #00f0ff;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 0 22px rgba(255, 0, 85, 0.45);
  cursor: pointer;
  touch-action: manipulation;
}
.fire-btn:active { transform: scale(0.93); box-shadow: 0 0 28px #00f0ff; }

@media (max-width: 390px) {
  .brand-tag { font-size: 9px; letter-spacing: .8px; }
  .top-actions { gap: 3px; }
  .icon-btn { padding: 0 5px; font-size: 8px; }
}

#hub-leaderboard-modal { z-index: 999999 !important; }
/* PUBLIC BETA V7 — responsive portrait + short desktop viewport */
html { width:100%; min-height:100%; }
body { width:100%; min-height:100dvh; height:auto; overflow-x:hidden; overflow-y:auto;
  justify-content:flex-start; padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
.top-bar,.hud-strip,.mission-bar,#gameWrap,.mobile-pad { max-width:min(520px,100%); }
#gameWrap { aspect-ratio:1; max-height:none; flex:0 0 auto; }
.mobile-pad { display:grid; grid-template-columns: minmax(0,1.2fr) minmax(0,0.35fr) minmax(0,1.8fr);
  align-items:center; gap: clamp(2px,1.2vw,8px); padding:8px 2px 6px; }
.dpad { grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:repeat(3,clamp(28px,8vw,40px)); gap:3px; min-width:0; }
.weapons-col { display:flex; justify-content:flex-end; min-width:0; gap:clamp(3px,1.5vw,10px); }
.alt-btn { width:clamp(40px,12vw,66px); height:clamp(40px,12vw,66px); font-size:clamp(6px,1.8vw,9px); flex:0 1 auto; }
.fire-btn { width:clamp(50px,15vw,76px); height:clamp(50px,15vw,76px); font-size:clamp(9px,2.2vw,12px); flex:0 1 auto; }
.hud-strip { gap:3px 6px; overflow-wrap:anywhere; }
.mission-title-line { gap:8px; }
.mission-title-line > span:first-child { min-width:0; flex:1; }
.mission-title-line > span:last-child { max-width:48%; text-align:right; }
@media(max-width:600px) {
  .top-bar { padding:0 5px; }
  .top-actions { gap:3px; }
  .brand-tag { font-size:clamp(7px,2.1vw,10px); letter-spacing:0; white-space:nowrap; }
  .icon-btn { padding:0 clamp(3px,1vw,7px); font-size:clamp(7px,1.6vw,9px); }
  .hud-strip { font-size:clamp(7px,1.7vw,9px); padding:4px 5px; }
  .hud-strip b { font-size:clamp(8px,2vw,11px); }
  .mobile-pad { grid-template-columns:minmax(0,1.2fr) minmax(0,.36fr) minmax(0,1.65fr); }
}
@media(max-height:800px) and (min-width:601px) {
  body { padding:2px; }
  .top-bar,.hud-strip,.mission-bar,.mobile-pad,#gameWrap { max-width:min(520px,calc((100dvh - 210px))); }
  .dpad { grid-template-rows:repeat(3,30px); }
  .alt-btn { width:48px; height:48px; }
  .fire-btn { width:54px; height:54px; }
  .mobile-pad { padding:3px 1px; }
}


/* DESKTOP FULL-HEIGHT PATCH V7.1
   A fine-pointer desktop uses keyboard/mouse, so the touch control dock does
   not consume valuable height. Keep the canvas square and scale the board only.
   Phone/tablet touch layout above is intentionally unchanged. */
@media (min-width: 900px) and (pointer: fine) {
  :root {
    /* Reserve room for top bar, HUD, mission caption and vertical padding. */
    --nrk-desktop-board: min(980px, calc(100dvh - 134px), calc(100vw - 24px));
  }
  html, body { min-height: 100%; }
  body {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    justify-content: center;
    padding: 4px;
  }
  .top-bar, .hud-strip, .mission-bar, #gameWrap {
    width: var(--nrk-desktop-board);
    max-width: none;
    flex-shrink: 0;
  }
  #gameWrap {
    height: var(--nrk-desktop-board);
    max-height: none;
    aspect-ratio: 1 / 1;
  }
  .mobile-pad { display: none; }
}
/* Small desktop windows may have taller multi-line HUD/mission text.
   Favor fitting the complete field rather than clipping the lower edge. */
@media (min-width: 900px) and (pointer: fine) and (max-height: 660px) {
  :root { --nrk-desktop-board: min(980px, calc(100dvh - 154px), calc(100vw - 24px)); }
}
