/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:           #060a10;
  --bg-mid:       #0c1422;
  --surface:      rgba(8, 16, 30, 0.92);
  --cyan:         #00e5ff;
  --cyan-dim:     rgba(0, 229, 255, 0.18);
  --cyan-glow:    rgba(0, 229, 255, 0.08);
  --amber:        #ff8c00;
  --amber-dim:    rgba(255, 140, 0, 0.18);
  --red:          #ff3c3c;
  --text:         #c4d4e8;
  --text-dim:     rgba(196, 212, 232, 0.38);
  --border:       rgba(0, 229, 255, 0.12);
  --border-hover: rgba(0, 229, 255, 0.35);

  --font-hud:  'Orbitron', monospace;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-ui:   'Rajdhani', sans-serif;

  --panel-w: 340px;
  --ease:    cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
}

/* ── Background ────────────────────────────────────────────────────────── */
.bg-gradient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 20% 50%, rgba(0, 229, 255, 0.04) 0%, transparent 65%),
    radial-gradient(ellipse 50% 70% at 80% 80%, rgba(0, 80, 140, 0.12) 0%, transparent 60%),
    var(--bg);
}

#grain {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  opacity: 0.04; pointer-events: none;
  mix-blend-mode: screen;
}

/* ── 3D Container ──────────────────────────────────────────────────────── */
#container {
  position: fixed; inset: 0; z-index: 2;
  transition: transform 0.6s var(--ease);
}

#container canvas {
  display: block;
  opacity: 1;
  will-change: opacity;
  transition: opacity 0.4s ease;
}

/* When panel is open, nudge the canvas left slightly */
body.panel-open #container {
  transform: translateX(calc(var(--panel-w) / -2 - 20px));
}

/* ── HEADER ────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 52px;
  background: rgba(6, 10, 16, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  animation: fadeSlideDown 0.9s var(--ease) both;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  font-family: var(--font-hud);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
}

.header-divider {
  width: 1px; height: 24px;
  background: var(--border);
}

.header-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--text);
}

.header-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s ease infinite;
}

.status-text {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--cyan);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── INFO PANEL ────────────────────────────────────────────────────────── */
.info-panel {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 118px;
  width: var(--panel-w);
  z-index: 15;
  background: var(--surface);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(1.5);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 22px 28px;
  transform: translateX(100%);
  transition: transform 0.55s var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.info-panel.open {
  transform: translateX(0);
}

/* corner brackets */
.bracket {
  position: absolute;
  width: 14px; height: 14px;
  pointer-events: none;
  z-index: 2;
}
.bracket.tl { top: 8px;  left: 8px;  border-top: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.bracket.tr { top: 8px;  right: 8px; border-top: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }
.bracket.bl { bottom: 8px; left: 8px;  border-bottom: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.bracket.br { bottom: 8px; right: 8px; border-bottom: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }

/* close button */
.panel-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: var(--cyan-dim);
  border: 1px solid var(--border-hover);
  border-radius: 2px;
  color: var(--cyan);
  cursor: pointer;
  outline: none;
  transition: background 0.2s, color 0.2s;
}
.panel-close:hover {
  background: rgba(255, 60, 60, 0.2);
  border-color: rgba(255,60,60,0.5);
  color: var(--red);
}

/* ── Weapon image zone ─────────────────────────────────────────────────── */
.weapon-img-zone {
  position: relative;
  width: 100%;
  height: 130px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.weapon-img-scanlines {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
  z-index: 2;
}

.weapon-img {
  max-width: 90%;
  max-height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0,229,255,0.35));
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.weapon-img.loaded { opacity: 1; }

.weapon-img-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
}
.weapon-img-fallback svg { width: 120px; }
.weapon-img-fallback span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--cyan);
}
.weapon-img-fallback.hidden { display: none; }

/* ── Panel header ──────────────────────────────────────────────────────── */
.panel-header { margin-bottom: 18px; }

.panel-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.weapon-tag {
  font-family: var(--font-hud);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.18em;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan);
}

.weapon-origin {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.weapon-name {
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(0,229,255,0.3);
}

.weapon-mn {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ── Specs grid ────────────────────────────────────────────────────────── */
.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--border);
}

.spec-cell {
  background: rgba(6, 10, 16, 0.85);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spec-label {
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.spec-val {
  font-family: var(--font-hud);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.06em;
}

/* ── Stats section ─────────────────────────────────────────────────────── */
.stats-section {
  margin-bottom: 20px;
}

.stats-title {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  width: 78px;
  flex-shrink: 0;
  text-align: right;
}

.stat-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.stat-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), rgba(0,229,255,0.6));
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,229,255,0.4);
  transition: width 0.8s var(--ease);
}

/* High damage = amber/orange tint */
.stat-fill.high {
  background: linear-gradient(90deg, var(--amber), rgba(255,140,0,0.6));
  box-shadow: 0 0 6px rgba(255,140,0,0.4);
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--cyan);
  width: 26px;
  text-align: right;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

/* ── Description ───────────────────────────────────────────────────────── */
.panel-desc-wrap {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.panel-desc-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: rgba(0,229,255,0.4);
  margin-bottom: 8px;
}

.panel-desc {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(196, 212, 232, 0.65);
}

/* ── WEAPON SELECTOR ───────────────────────────────────────────────────── */
.controls {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  height: 110px;
  border-top: 1px solid var(--border);
  background: rgba(6, 10, 16, 0.94);
  backdrop-filter: blur(20px);
  animation: fadeSlideUp 0.9s var(--ease) 0.2s both;
}

.ctrl-btn {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 12px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  outline: none;
  overflow: hidden;
  transition: color 0.25s, background 0.3s;
}
.ctrl-btn:last-child { border-right: none; }

/* top line indicator */
.ctrl-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.ctrl-btn:hover::before,
.ctrl-btn.active::before {
  transform: scaleX(1);
}

/* hover shimmer */
.ctrl-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,229,255,0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}
.ctrl-btn:hover::after,
.ctrl-btn.active::after { opacity: 1; }

.ctrl-btn:hover { color: var(--text); background: rgba(0,229,255,0.03); }
.ctrl-btn.active { color: var(--text); background: rgba(0,229,255,0.06); }

.btn-type {
  font-family: var(--font-hud);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: rgba(0, 229, 255, 0.5);
  transition: color 0.25s;
  position: relative; z-index: 1;
}
.ctrl-btn.active .btn-type,
.ctrl-btn:hover  .btn-type { color: var(--cyan); }

.btn-mn {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  position: relative; z-index: 1;
  transition: color 0.25s, text-shadow 0.25s;
}
.ctrl-btn.active .btn-mn {
  color: #fff;
  text-shadow: 0 0 16px rgba(0,229,255,0.4);
}

.btn-en {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 300;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  position: relative; z-index: 1;
}

/* ── Hint ──────────────────────────────────────────────────────────────── */
.hint {
  position: fixed;
  bottom: 118px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 300;
  letter-spacing: 0.22em;
  color: rgba(196, 212, 232, 0.2);
  animation: fadeIn 2s var(--ease) 1.2s both;
  white-space: nowrap;
  pointer-events: none;
  transition: transform 0.55s var(--ease), opacity 0.4s;
}
body.panel-open .hint { opacity: 0; pointer-events: none; }

.hint-sep { opacity: 0.35; font-size: 10px; }

/* ── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Panel content fade-in animation */
@keyframes panelContentIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.info-panel.open .panel-header,
.info-panel.open .weapon-img-zone,
.info-panel.open .specs-grid,
.info-panel.open .stats-section,
.info-panel.open .panel-desc-wrap {
  animation: panelContentIn 0.5s var(--ease) both;
}
.info-panel.open .weapon-img-zone  { animation-delay: 0.05s; }
.info-panel.open .panel-header     { animation-delay: 0.12s; }
.info-panel.open .specs-grid       { animation-delay: 0.18s; }
.info-panel.open .stats-section    { animation-delay: 0.24s; }
.info-panel.open .panel-desc-wrap  { animation-delay: 0.30s; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  :root { --panel-w: 100vw; }
  .controls { height: 90px; }
  .ctrl-btn { padding: 0 6px; }
  .btn-mn   { font-size: 13px; }
  .btn-en   { display: none; }
  .hint     { display: none; }
  body.panel-open #container { transform: none; }
}

@media (max-width: 400px) {
  .btn-type { display: none; }
}
