html, body {
  margin: 0;
  min-height: 100%;
  background: #0d0908;
  color: #f5ead8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(146, 42, 24, 0.42), transparent 42%),
    radial-gradient(circle at 20% 80%, rgba(220, 120, 30, 0.12), transparent 34%),
    #090606;
}

.app-shell {
  width: min(1360px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: 18px;
  align-items: start;
}

.game-surface {
  position: relative;
  background: #140d0b;
  border: 1px solid #4b2d22;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55), inset 0 0 80px rgba(255, 105, 18, 0.08);
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 60px);
  object-fit: contain;
  background: #160d0b;
  image-rendering: auto;
  transform-origin: 50% 50%;
  transition: none;
  will-change: transform;
}

.touch-joystick {
  --origin-x: 0px;
  --origin-y: 0px;
  --pip-x: 0px;
  --pip-y: 0px;
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 35ms ease;
}

.touch-joystick.is-active { opacity: 1; }

.joystick-base,
.joystick-pip {
  position: absolute;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.joystick-base {
  left: var(--origin-x);
  top: var(--origin-y);
  width: 116px;
  height: 116px;
  border: 2px solid rgba(255, 179, 95, 0.76);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 179, 95, 0.16), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(18, 9, 8, 0.1) 0 45%, rgba(79, 36, 25, 0.56) 46% 100%);
  box-shadow: 0 0 18px rgba(255, 105, 18, 0.22), inset 0 0 28px rgba(0, 0, 0, 0.46);
}

.joystick-pip {
  left: var(--pip-x);
  top: var(--pip-y);
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 234, 193, 0.88);
  background:
    radial-gradient(circle at 38% 30%, #fff2c7, #ffab3a 48%, #7c2518 100%);
  box-shadow: 0 0 14px rgba(255, 157, 32, 0.48), inset 0 -5px 12px rgba(0, 0, 0, 0.32);
}

.hud {
  min-height: 420px;
  background: linear-gradient(180deg, rgba(47, 31, 24, 0.96), rgba(22, 14, 12, 0.96));
  border: 1px solid #5f3a29;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.42);
}

.brand {
  color: #ff9b2f;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.version {
  color: #c5aa8d;
  font-weight: 650;
  margin-left: 6px;
}

h1 {
  margin: 5px 0 18px;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(211, 157, 103, 0.22);
}

.stat span { color: #c5aa8d; }
.stat strong { text-align: right; }

.meter {
  height: 10px;
  border: 1px solid #71462f;
  border-radius: 999px;
  background: #140b09;
  overflow: hidden;
  margin: 12px 0 4px;
}

#feverFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e08b20, #e44920, #a40f0f);
}

.controls {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

button {
  flex: 1;
  min-height: 38px;
  border: 1px solid #8c6042;
  border-radius: 6px;
  background: #211512;
  color: #f5ead8;
  font: inherit;
  cursor: pointer;
}

button:hover { border-color: #ff9b2f; color: #ffb35f; }

.mobile-controls {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 30;
  display: none;
  grid-template-columns: 48px;
  gap: 8px;
  pointer-events: auto;
}

.mobile-controls button {
  flex: none;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-color: rgba(255, 226, 184, 0.66);
  background: rgba(12, 3, 4, 0.82);
  color: #fff0d2;
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.mobile-controls button:disabled {
  opacity: 0.42;
  color: #a98c76;
}

.hint {
  color: #c5aa8d;
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  body {
    padding: 0;
    display: block;
    overflow: hidden;
    background: #050102;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    display: block;
  }

  .game-surface {
    width: 100vw;
    height: 100dvh;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  canvas {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    object-fit: contain;
  }

  .hud { display: none; }

  .mobile-controls { display: grid; }
}


:fullscreen body,
:fullscreen .app-shell {
  width: 100%;
}

.app-shell:fullscreen {
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  display: block;
  padding: 0;
  background: #050102;
}

.app-shell:fullscreen .hud {
  display: none;
}

.app-shell:fullscreen .mobile-controls {
  display: grid;
}

.app-shell:fullscreen .game-surface {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-shell:fullscreen canvas {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  object-fit: contain;
}

