:root {
  --bg: #040914;
  --bg-2: #091422;
  --panel: rgba(8, 16, 30, 0.78);
  --panel-2: rgba(12, 24, 42, 0.94);
  --panel-3: rgba(20, 38, 64, 0.78);
  --border: rgba(128, 219, 255, 0.18);
  --border-strong: rgba(130, 229, 255, 0.34);
  --text: #f3f8ff;
  --soft: #a8bdd6;
  --soft-2: #86a3c6;
  --accent: #6ce4ff;
  --accent-2: #9cffb7;
  --gold: #ffd57a;
  --gold-2: #ffb24d;
  --danger: #ff7d95;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  background:
    radial-gradient(circle at top, #163050 0%, #091420 32%, #040914 68%, #02050b 100%);
}

body {
  position: relative;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 18% 16%, rgba(108, 228, 255, 0.15), transparent 18%),
    radial-gradient(circle at 82% 14%, rgba(156, 255, 183, 0.11), transparent 22%),
    radial-gradient(circle at 50% 86%, rgba(130, 122, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%, transparent 76%, rgba(255, 255, 255, 0.015));
  z-index: 0;
}

body::after {
  background-image:
    radial-gradient(circle at 10% 30%, rgba(255,255,255,0.22) 0 1px, transparent 1.5px),
    radial-gradient(circle at 24% 64%, rgba(255,255,255,0.16) 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 18%, rgba(255,255,255,0.14) 0 1px, transparent 1.5px),
    radial-gradient(circle at 88% 42%, rgba(255,255,255,0.18) 0 1px, transparent 1.5px),
    linear-gradient(rgba(108, 228, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 228, 255, 0.04) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 84px 84px, 84px 84px;
  mix-blend-mode: screen;
  opacity: 0.42;
  z-index: 0;
}

canvas {
  display: block;
  position: relative;
  z-index: 1;
}

.panel-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 18%, rgba(108, 228, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(3, 7, 14, 0.9), rgba(5, 10, 18, 0.88));
  z-index: 50;
}

.panel-card {
  position: relative;
  width: min(820px, 96vw);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 34px 34px 28px;
  background:
    linear-gradient(180deg, rgba(10, 18, 33, 0.96), rgba(6, 13, 24, 0.96));
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}

.panel-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% -6%, rgba(108, 228, 255, 0.2), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(255, 181, 89, 0.08), transparent 32%);
  pointer-events: none;
}

.panel-card::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 74px;
  transform: translateX(-50%);
  width: min(360px, 76%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 228, 255, 0.7), transparent);
  opacity: 0.85;
}

.eyebrow {
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  color: var(--accent);
  font-size: 0.82rem;
  margin-bottom: 18px;
  text-shadow: 0 0 18px rgba(108, 228, 255, 0.35);
}

h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.8rem, 6.3vw, 5rem);
  line-height: 0.95;
  margin-bottom: 18px;
  letter-spacing: -0.04em;
  color: #f7fbff;
  text-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
}

h1::after {
  content: '';
  display: block;
  width: min(190px, 36vw);
  height: 10px;
  margin: 16px auto 0;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(108, 228, 255, 0.45), rgba(108, 228, 255, 0));
  filter: blur(3px);
}

.lead {
  position: relative;
  z-index: 1;
  color: var(--soft);
  line-height: 1.68;
  font-size: clamp(1rem, 2.05vw, 1.2rem);
  margin: 0 auto 28px;
  max-width: 660px;
}

.lead strong {
  color: #ffffff;
}

.menu-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.primary-btn, .secondary-btn, #shopBtn, #shootBtn, #restartBtn, #menuBtn, .shop-item button {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
  border-radius: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 16px 36px rgba(0,0,0,0.24);
}

.primary-btn::before, .secondary-btn::before, #shopBtn::before, #shootBtn::before, #restartBtn::before, #menuBtn::before, .shop-item button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 42%, transparent 100%);
  opacity: 0.75;
  pointer-events: none;
}

.primary-btn:hover, .secondary-btn:hover, #shopBtn:hover, #shootBtn:hover, #restartBtn:hover, #menuBtn:hover, .shop-item button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  border-color: rgba(255,255,255,0.2);
}

.primary-btn {
  min-width: 228px;
  padding: 17px 22px;
  font-size: 1.08rem;
  background: linear-gradient(180deg, rgba(74, 175, 240, 0.48), rgba(22, 70, 120, 0.58));
}

.secondary-btn {
  min-width: 228px;
  padding: 17px 22px;
  font-size: 1.04rem;
  background: linear-gradient(180deg, rgba(118, 97, 53, 0.68), rgba(60, 45, 23, 0.88));
}

.menu-stats {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.menu-stat {
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(23, 32, 48, 0.9), rgba(16, 23, 36, 0.9));
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 12;
}

#stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(76vw, 940px);
}

.stat {
  padding: 8px 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(11, 18, 30, 0.84), rgba(8, 13, 22, 0.84));
  border: 1px solid rgba(255,255,255,0.1);
  color: #edf7ff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 14px 30px rgba(0,0,0,0.22);
  backdrop-filter: blur(8px);
}

.hud-actions { pointer-events: none; }

#shopBtn {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(123, 102, 57, 0.86), rgba(62, 47, 23, 0.92));
}

#joystick-base {
  position: absolute;
  left: 22px;
  bottom: 22px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08), rgba(255,255,255,0.04) 52%, rgba(0,0,0,0.16) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.05),
    inset 0 0 60px rgba(108,228,255,0.06),
    0 20px 40px rgba(0,0,0,0.28);
  display: none;
  pointer-events: auto;
  touch-action: none;
  z-index: 8;
}

#joystick-stick {
  position: absolute;
  width: 64px;
  height: 64px;
  left: 42px;
  top: 42px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.97), rgba(152,255,178,0.85));
  box-shadow: 0 12px 26px rgba(0,0,0,0.26), 0 0 24px rgba(152,255,178,0.15);
}

#lookZone {
  position: absolute;
  top: 0;
  right: 0;
  width: 48%;
  height: 100%;
  display: none;
  pointer-events: auto;
  touch-action: none;
  z-index: 7;
  background: linear-gradient(270deg, rgba(108,228,255,0.06), transparent 24%);
}

#shootBtn {
  position: absolute;
  right: 26px;
  bottom: 30px;
  width: 88px;
  height: 88px;
  display: none;
  border-radius: 50%;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(66, 151, 233, 0.64), rgba(20, 72, 140, 0.76));
  box-shadow: 0 18px 40px rgba(0,0,0,0.28), 0 0 30px rgba(108,228,255,0.14);
  z-index: 9;
}

#message {
  position: absolute;
  left: 50%;
  top: 15%;
  transform: translateX(-50%);
  min-width: min(90vw, 520px);
  padding: 16px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,18,31,0.9), rgba(6,12,22,0.86));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 22px 60px rgba(0,0,0,0.34);
  text-align: center;
  font-size: clamp(1rem, 2.5vw, 1.8rem);
  font-weight: 800;
  display: none;
  z-index: 20;
}

#restartBtn, #menuBtn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  padding: 12px 22px;
  z-index: 21;
}

#restartBtn {
  top: calc(15% + 98px);
  background: linear-gradient(180deg, rgba(102, 209, 152, 0.54), rgba(33, 116, 82, 0.68));
}

#menuBtn {
  top: calc(15% + 154px);
  background: linear-gradient(180deg, rgba(87, 183, 243, 0.52), rgba(27, 88, 150, 0.7));
}

.modal-shell {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2,6,12,0.7);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.modal-card {
  width: min(580px, 94vw);
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(10,18,31,0.98), rgba(7,13,22,0.98));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 90px rgba(0,0,0,0.45);
}

.modal-card h3 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.shop-balance {
  color: var(--gold);
  margin-bottom: 18px;
}

.shop-grid {
  display: grid;
  gap: 12px;
}

.shop-item {
  padding: 15px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
}

.shop-item h4 { margin-bottom: 8px; }

.shop-item p {
  color: var(--soft);
  line-height: 1.48;
  margin-bottom: 10px;
}

.shop-item button {
  width: 100%;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(74, 175, 240, 0.44), rgba(21, 77, 142, 0.5));
}

.close-btn {
  margin-top: 14px;
  width: 100%;
}

@media (max-width: 780px) {
  .panel-card {
    padding: 24px 18px 22px;
    border-radius: 26px;
  }

  .panel-card::after {
    top: 62px;
    width: 70%;
  }

  .menu-actions { flex-direction: column; }

  .primary-btn, .secondary-btn { width: 100%; }

  #stats { max-width: 94vw; }

  .stat {
    padding: 7px 11px;
    font-size: 0.94rem;
  }

  #joystick-base {
    left: 16px;
    bottom: 16px;
    width: 132px;
    height: 132px;
  }

  #joystick-stick {
    width: 56px;
    height: 56px;
    left: 38px;
    top: 38px;
  }

  #shootBtn {
    width: 84px;
    height: 84px;
    right: 18px;
    bottom: 22px;
  }
}
