@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;600;700&display=swap');

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

:root {
  --hiviz: #d4e20f;
  --hiviz-glow: rgba(212, 226, 15, 0.4);
  --black: #111;
  --btn-size: 52px;
}

html, body {
  background: var(--hiviz);
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  font-family: 'Rajdhani', sans-serif;
}

.game-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--hiviz);
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,255,255,0.06) 2px, rgba(255,255,255,0.06) 4px);
  overflow: hidden;
}

/* Hamburger */
.hamburger {
  position: absolute; top: 6px; left: 6px; z-index: 100;
  width: 36px; height: 36px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  cursor: pointer; border-radius: 6px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  border: 1px solid rgba(212,226,15,0.3);
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--hiviz); border-radius: 1px; }
.hamburger:active { background: rgba(212,226,15,0.3); }

/* Device zone */
.device-zone {
  flex: 0 0 auto; position: relative;
  width: 100%;
  aspect-ratio: 280 / 308;
  background: var(--hiviz);
}
.game-canvas-container {
  position: absolute;
  top: 17.5%; left: 4.3%;
  width: 91.4%; height: 53%;
  overflow: hidden; border-radius: 3px; z-index: 1;
}
.game-canvas-container canvas { width: 100%; height: 100%; display: block; }
.device-frame {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2;
}
.device-frame img { width: 100%; height: 100%; display: block; }

/* Controls zone */
.controls-zone {
  flex: 1; display: flex; flex-direction: column;
  justify-content: space-between;
  padding: 6px 20px 0 20px;
  background: var(--hiviz);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Crect width='6' height='6' fill='%23d4e20f'/%3E%3Crect x='0' y='0' width='1' height='1' fill='rgba(0,0,0,0.06)'/%3E%3Crect x='3' y='2' width='1' height='1' fill='rgba(0,0,0,0.04)'/%3E%3Crect x='1' y='4' width='1' height='1' fill='rgba(0,0,0,0.05)'/%3E%3Crect x='4' y='1' width='1' height='1' fill='rgba(0,0,0,0.07)'/%3E%3Crect x='2' y='3' width='1' height='1' fill='rgba(255,255,255,0.08)'/%3E%3Crect x='5' y='5' width='1' height='1' fill='rgba(0,0,0,0.05)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 3px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.02) 2px, rgba(0,0,0,0.02) 3px),
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,0.015) 4px, rgba(0,0,0,0.015) 5px);
}
.controls-main {
  display: flex; justify-content: space-between; align-items: center;
  flex: 1; max-height: 210px;
}

/* D-pad */
.dpad-container { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.dpad-btn {
  position: absolute;
  width: var(--btn-size); height: var(--btn-size);
  background: var(--black); border: 2px solid #333; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #888; font-size: 18px; cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}
.dpad-btn:active {
  background: #1a1a00; border-color: var(--hiviz); color: var(--hiviz);
  box-shadow: 0 0 14px var(--hiviz-glow);
}
.dpad-up    { top: 0;    left: 50%; transform: translateX(-50%); }
.dpad-down  { bottom: 0; left: 50%; transform: translateX(-50%); }
.dpad-left  { left: 0;   top: 50%;  transform: translateY(-50%); }
.dpad-right { right: 0;  top: 50%;  transform: translateY(-50%); }

/* A/B buttons */
.action-container { position: relative; width: 140px; height: 130px; flex-shrink: 0; }
.action-btn {
  position: absolute;
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', monospace; font-weight: 900; font-size: 18px;
  cursor: pointer; border: 2px solid;
  -webkit-tap-highlight-color: transparent;
}
.action-btn:active { transform: scale(0.93); }
.btn-a {
  top: 0; right: 0;
  background: radial-gradient(circle at 35% 35%, #2060bb, #183a70);
  border-color: #4af; color: #bdf;
  box-shadow: 0 4px 10px rgba(24,58,112,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-a:active { background: radial-gradient(circle at 35% 35%, #3878dd, #2060bb); box-shadow: 0 0 20px rgba(68,170,255,0.7); }
.btn-b {
  bottom: 0; left: 0;
  background: radial-gradient(circle at 35% 35%, #c02020, #8b0000);
  border-color: #e04040; color: #fcc;
  box-shadow: 0 4px 10px rgba(139,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-b:active { background: radial-gradient(circle at 35% 35%, #e83838, #b02020); box-shadow: 0 0 20px rgba(220,50,50,0.7); }

/* Start/Select */
.system-btns {
  display: flex; gap: 24px; justify-content: center;
  padding: 8px 0 max(env(safe-area-inset-bottom), 14px) 0;
}
.sys-btn {
  width: 64px; height: 26px;
  background: var(--black); border: 1px solid #333; border-radius: 13px;
  color: #666;
  font-family: 'Orbitron', monospace; font-size: 7px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.sys-btn:active { border-color: var(--hiviz); color: var(--hiviz); }

/* Desktop */
@media (min-width: 481px) {
  body { display: flex; align-items: center; justify-content: center; background: #111; }
  .game-shell {
    height: min(100dvh, 900px);
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(212,226,15,0.15);
  }
}

/* Side menu */
.side-menu {
  position: absolute; top: 0; left: -280px; width: 260px; height: 100%;
  background: rgba(10,10,10,0.95); backdrop-filter: blur(10px);
  border-right: 2px solid rgba(212,226,15,0.3);
  z-index: 200; transition: left 0.3s ease;
  padding: 50px 20px 20px;
  display: flex; flex-direction: column;
}
.side-menu.open { left: 0; }
.side-menu-close {
  position: absolute; top: 10px; right: 12px;
  color: var(--hiviz); font-size: 22px; cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.side-menu-close:active { opacity: 0.5; }
.side-menu-content h2 {
  font-family: 'Orbitron', monospace; font-size: 14px; font-weight: 700;
  color: var(--hiviz); margin-bottom: 24px; letter-spacing: 1px;
}
.side-menu-content p {
  font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 500;
  color: #aaa; line-height: 1.5; margin-bottom: 14px;
}
.side-menu-content .side-menu-hint {
  color: #666; font-style: italic; font-size: 13px; margin-top: 20px;
}
.side-menu-content .side-menu-tagline {
  color: #888; font-style: italic; font-size: 13px; margin-bottom: 14px;
  padding-bottom: 14px; border-bottom: 1px solid rgba(212,226,15,0.15);
}
.side-menu-content a {
  display: block; color: var(--hiviz); text-decoration: none;
  font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 600;
  padding: 8px 0; border-bottom: 1px solid rgba(212,226,15,0.1);
  transition: color 0.2s;
}
.side-menu-content a:hover, .side-menu-content a:active { color: #fff; }
.side-menu-overlay {
  display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 199;
}
.side-menu-overlay.open { display: block; }
.side-menu-content .menu-email {
  color: #555; font-size: 12px; font-style: italic;
  margin-top: auto; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.side-menu-content .menu-email a { display: inline; padding: 0; border: none; color: #555; font-size: 12px; }
