:root{
  --bg-0: #000000;
  --bg-1: #050505;
  --panel: #0b0b0c;
  --muted: #9aa3a8;
  --text: #eef6f5;
  --accent: #00ff9f;
  --accent-2: #ff7a59;
  --glass: rgba(255,255,255,0.02);
  --glass-2: rgba(255,255,255,0.01);
  --radius: 10px;
  --shadow-soft: 0 8px 30px rgba(0,0,0,0.7);
  --shadow-strong: 0 20px 60px rgba(0,0,0,0.85);
  --btn-h: 48px;
  --control-gap: 14px;
  --ease: cubic-bezier(.16,.84,.44,1);
  --fast: 180ms;
  --med: 420ms;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

*{ box-sizing: border-box; margin:0; padding:0; }
html,body,#game-root{ height:100%; width:100%; }
html{ font-family: Inter, Roboto, Arial, system-ui, -apple-system; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
body{
  background: radial-gradient(900px 300px at 8% 12%, rgba(0,255,159,0.02), transparent 6%),
              linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color:var(--text);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:18px;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 400px;
  min-height: 240px;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}

#game-canvas-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 400px;
  min-height: 240px;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  width: 100vw;
  height: 100vh;
  min-width: 400px;
  min-height: 240px;
  max-width: 100vw;
  max-height: 100vh;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  background: linear-gradient(180deg, #060607 10%, #081018 60%);
  box-shadow: 0 18px 60px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.02);
}

#overlay-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
}

#hud {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--muted);
  background: rgba(0,0,0,0.38);
  border-radius: 0 0 12px 12px;
  padding: 8px 12px 6px 12px;
  pointer-events: auto;
  justify-content: flex-start;
}
#hud span {
  margin-right: 8px;
  font-weight: 700;
  color: var(--text);
}
#hud .hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 0;
}

#controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.32);
    border-radius: 0 0 12px 12px;
    padding: 6px 12px 10px 12px;
    pointer-events: auto;
    z-index: 300;
  }
#controls button, #controls .touch-only {
   pointer-events: auto;
   z-index: 301;
}

#controls button.pressed, #controls .touch-only.pressed {
   background: linear-gradient(180deg, #1e90ff 0%, #0057b8 100%) !important;
   color: #fff !important;
   box-shadow: 0 0 0 4px rgba(30,144,255,0.18);
}

#controls button, #controls .touch-only {
  background: linear-gradient(180deg, rgba(255,255,255,0.014), rgba(255,255,255,0.008));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 8px 16px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1em;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
#controls button:hover, #controls .touch-only:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}
#controls button:active, #controls .touch-only:active {
  transform: translateY(-1px) scale(.995);
}

#vol-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}
#vol {
  width: 90px;
  min-width: 60px;
  max-width: 120px;
}

@media (max-width: 700px) {
  #game-root, #game-canvas-container, #game-canvas {
    min-width: 320px;
    min-height: 180px;
  }
  #hud, #controls {
    font-size: 13px;
    padding: 5px 6px;
    gap: 6px;
  }
  #controls button, #controls .touch-only {
    padding: 7px 10px;
    min-height: 32px;
    font-size: 0.95em;
  }
  #vol {
    width: 60px;
  }
}

canvas{
  width: 100%;
  max-width: 1024px;
  height: auto;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #060607 10%, #081018 60%);
  box-shadow: 0 18px 60px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.02);
  transform-origin: center;
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
  animation: canvasLift 1200ms var(--ease) both;
}
canvas:focus{ outline: none; box-shadow: 0 24px 80px rgba(0,0,0,0.9), 0 0 18px rgba(0,255,159,0.05); transform: translateY(-6px); }

#ui{
  width: min(1024px, 96%);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: var(--control-gap);
  padding: 10px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.004));
  border: 1px solid var(--glass);
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--med) var(--ease), transform var(--med) var(--ease);
}

#hud{ display:flex; align-items:center; gap: 18px; font-size: 14px; color:var(--muted); }
#hud span{ margin-right: 8px; font-weight:700; color:var(--text); }

#controls{ display:flex; gap:12px; align-items:center; }

button{
  background: linear-gradient(180deg, rgba(255,255,255,0.014), rgba(255,255,255,0.008));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 10px 16px;
  min-height: var(--btn-h);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
button:hover{ transform: translateY(-4px); box-shadow: var(--shadow-strong); }
button:active{ transform: translateY(-2px) scale(.998); }

button.primary{
  background: linear-gradient(90deg, var(--accent) 0%, rgba(0,255,159,0.85) 60%);
  color: #02120b;
  border: none;
  box-shadow: 0 18px 56px rgba(0,0,0,0.8);
}

button.ghost{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.04);
  color: var(--muted);
}

button:focus, input:focus, label:focus{
  outline: none;
  box-shadow: 0 0 0 6px rgba(0,255,159,0.05);
  border-radius: 8px;
}

label{ font-size:14px; color:var(--muted); font-weight:700; display:inline-flex; gap:8px; align-items:center; }

input[type="range"]{
  appearance:none;
  height: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: 999px;
  outline:none;
  width:220px;
  transition: box-shadow var(--fast) var(--ease);
}
input[type="range"]::-webkit-slider-runnable-track{
  height:8px; border-radius:999px; background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:18px; height:18px; border-radius:50%;
  background: radial-gradient(circle at 30% 30%, #fff, #e6e6e6 30%);
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  border: 2px solid rgba(0,0,0,0.45);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb{ transform: scale(1.08); box-shadow: 0 12px 28px rgba(0,0,0,0.7); }

@media (max-width: 1100px){
  #game-root{ padding:12px; }
  canvas{ max-width: 92vw; }
  #ui{ width: 92vw; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
  #hud{ justify-content:flex-start; gap:10px; padding:0 6px; }
  #controls{ justify-content:flex-end; gap:8px; padding:0 6px; }
  input[type="range"]{ width:160px; }
}

@media (max-width: 520px){
  #ui{ gap:8px; padding:8px; }
  #hud{ font-size:13px; }
  button{ padding:10px 12px; min-height:40px; font-size:13px; }
  input[type="range"]{ width:140px; }
}

.icon{
  display:inline-flex; align-items:center; justify-content:center;
  width:32px; height:32px; border-radius:8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.004));
  border:1px solid rgba(255,255,255,0.02);
}

.badge{
  background: linear-gradient(90deg, rgba(0,255,159,0.06), rgba(255,122,89,0.03));
  color: var(--text);
  padding:6px 10px; border-radius:999px; font-weight:800; font-size:13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

button.primary::after{
  content: "";
  display:block;
  position:absolute;
  pointer-events:none;
  inset: 0;
  border-radius: 10px;
  box-shadow: 0 0 0 0 rgba(0,255,159,0.0);
  transition: box-shadow 420ms var(--ease);
}
button.primary:hover::after{ box-shadow: 0 8px 40px rgba(0,255,159,0.10); }

#game-root.interacting canvas{ transform: scale(0.996); box-shadow: 0 26px 80px rgba(0,0,0,0.88); }
#game-root.paused canvas{ filter: grayscale(0.15) contrast(0.95) brightness(0.9); transform: translateY(2px); }

.virtual-joystick {
  touch-action: none;
  user-select: none;
  background: none;
  border: none;
  pointer-events: auto;
  border-radius: 50%;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  z-index: 150;
}
.virtual-joystick canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.touch-only {
  display: none;
}

@media (pointer: coarse), (hover: none) {
  #hud {
    font-size: 20px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.8);
    justify-content: flex-start;
  }
  #hud span {
    margin-right: 12px;
  }
  #controls {
    padding: 26px 12px 10px 12px;
    pointer-events: auto;
    z-index: 300;
  }
  #controls span, #controls button, #controls .touch-only {
    pointer-events: auto;
    z-index: 301;
  }
#controls span {
    font-size: 15px;
    color: var(--text);
    font-weight: 700;
    margin-right: 8px;
  }
  #touch-controls {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
  }
  #touch-controls .virtual-joystick {
    pointer-events: auto;
  }
}


@keyframes canvasLift{
  0%{ opacity:0; transform: translateY(10px) scale(.998) }
  60%{ opacity:1; transform: translateY(-6px) scale(1.002) }
  100%{ transform:none }
}

.hidden{ display:none !important; }
.center{ display:flex; align-items:center; justify-content:center; }
.text-muted{ color:var(--muted); }

:focus{ outline: none; }
:focus-visible{ box-shadow: 0 0 0 6px rgba(0,255,159,0.06); border-radius:6px; }




