:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07100f;
  color: #f4f0e6;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #07100f;
  touch-action: none;
  user-select: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(260px, 560px) auto;
  gap: 12px;
  align-items: start;
  pointer-events: none;
}

.brand,
.readout,
.meter {
  border: 1px solid rgba(244, 240, 230, 0.18);
  background: rgba(7, 16, 15, 0.72);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}

.brand {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border-radius: 8px;
  color: #f7d57b;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.meter {
  height: 42px;
  border-radius: 8px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.meter span,
.readout span {
  font-size: 0.72rem;
  color: rgba(244, 240, 230, 0.76);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

.meter div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(244, 240, 230, 0.14);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transition: width 120ms ease;
}

.meter b,
.readout b {
  min-width: 2ch;
  text-align: right;
  font-size: 0.82rem;
  color: #fff8e7;
}

.health i {
  background: linear-gradient(90deg, #db5147, #f49c5e);
}

.gas i {
  background: linear-gradient(90deg, #39bfd0, #9ee4c2);
}

.blades i {
  background: linear-gradient(90deg, #d6d8d0, #f7d57b);
}

.readout {
  min-height: 42px;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: 420px;
}

.readout span {
  white-space: nowrap;
}

#reticle {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

#reticle::before,
#reticle::after,
#reticle i::before,
#reticle i::after {
  content: "";
  position: absolute;
  background: rgba(249, 246, 230, 0.82);
  box-shadow: 0 0 12px rgba(57, 191, 208, 0.72);
}

#reticle::before,
#reticle::after {
  left: 50%;
  width: 2px;
  height: 9px;
  transform: translateX(-50%);
}

#reticle::before { top: 0; }
#reticle::after { bottom: 0; }

#reticle i::before,
#reticle i::after {
  top: 50%;
  width: 9px;
  height: 2px;
  transform: translateY(-50%);
}

#reticle i::before { left: 0; }
#reticle i::after { right: 0; }

#notice {
  position: fixed;
  left: 50%;
  bottom: 112px;
  z-index: 4;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(247, 213, 123, 0.32);
  color: #fff8e7;
  background: rgba(7, 16, 15, 0.76);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: min(520px, calc(100vw - 28px));
  text-align: center;
  font-weight: 700;
  pointer-events: none;
}

#notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  align-items: end;
  justify-items: start;
  padding: 0 0 8vh 7vw;
  background: radial-gradient(circle at 50% 30%, rgba(57, 191, 208, 0.15), transparent 32%), rgba(5, 11, 10, 0.32);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.menu.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.menu > div {
  max-width: 620px;
  padding-right: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #9ee4c2;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 4rem;
  line-height: 0.96;
  letter-spacing: 0;
  color: #fff8e7;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.tagline {
  margin: 16px 0 24px;
  max-width: 480px;
  color: rgba(255, 248, 231, 0.82);
  font-size: 1.08rem;
  line-height: 1.45;
}

button {
  appearance: none;
  border: 0;
  font: inherit;
  color: inherit;
}

#startButton {
  min-width: 148px;
  height: 46px;
  border-radius: 8px;
  background: #f7d57b;
  color: #17201f;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(247, 213, 123, 0.24);
  cursor: pointer;
}

#startButton:hover,
#startButton:focus-visible {
  background: #ffe59d;
  outline: 2px solid rgba(255, 248, 231, 0.65);
  outline-offset: 3px;
}

#touchControls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  pointer-events: none;
}

.touch-pad {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.touch-pad.movement {
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 52px);
}

.touch-pad.actions {
  grid-template-columns: repeat(3, 54px);
  align-items: end;
}

.touch-button {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid rgba(244, 240, 230, 0.2);
  background: rgba(7, 16, 15, 0.68);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.touch-button:active,
.touch-button.active {
  background: rgba(57, 191, 208, 0.34);
}

.touch-button::before,
.touch-button::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}

.touch-button.up { grid-column: 2; grid-row: 1; }
.touch-button.left { grid-column: 1; grid-row: 2; }
.touch-button.down { grid-column: 2; grid-row: 2; }
.touch-button.right { grid-column: 3; grid-row: 2; }

.touch-button.up::before,
.touch-button.down::before,
.touch-button.left::before,
.touch-button.right::before {
  width: 0;
  height: 0;
  border-style: solid;
}

.touch-button.up::before {
  border-width: 0 10px 16px 10px;
  border-color: transparent transparent #f4f0e6 transparent;
}

.touch-button.down::before {
  border-width: 16px 10px 0 10px;
  border-color: #f4f0e6 transparent transparent transparent;
}

.touch-button.left::before {
  border-width: 10px 16px 10px 0;
  border-color: transparent #f4f0e6 transparent transparent;
}

.touch-button.right::before {
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #f4f0e6;
}

.touch-button.boost::before {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid #9ee4c2;
  box-shadow: inset 0 0 0 5px rgba(158, 228, 194, 0.16);
}

.touch-button.grapple::before {
  width: 30px;
  height: 3px;
  background: #39bfd0;
  transform: rotate(-38deg);
  box-shadow: 0 0 12px rgba(57, 191, 208, 0.75);
}

.touch-button.grapple::after {
  width: 9px;
  height: 9px;
  border: 2px solid #39bfd0;
  border-radius: 50%;
  transform: translate(10px, -9px);
}

.touch-button.slash::before,
.touch-button.slash::after {
  width: 31px;
  height: 3px;
  background: #f7d57b;
  box-shadow: 0 0 12px rgba(247, 213, 123, 0.72);
}

.touch-button.slash::before { transform: rotate(38deg); }
.touch-button.slash::after { transform: rotate(-38deg); }

@media (hover: hover) and (pointer: fine) {
  #touchControls { display: none; }
}

@media (max-width: 760px) {
  #hud {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brand {
    justify-self: start;
  }

  .meters {
    grid-template-columns: 1fr;
    max-width: 360px;
  }

  .readout {
    justify-content: flex-start;
    max-width: calc(100vw - 28px);
  }

  h1 {
    font-size: 2.6rem;
  }

  .menu {
    padding: 0 22px 18vh;
  }
}
