:root {
  --bg-top: #151728;
  --bg-bottom: #08070d;
  --panel: rgba(15, 13, 23, 0.78);
  --panel-edge: rgba(255, 255, 255, 0.12);
  --ink: #f4e9d8;
  --muted: #cebfa2;
  --accent: #ff7a18;
  --accent-2: #ffd447;
  --danger: #ff4b4b;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 130, 60, 0.16), transparent 36%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    );
  background-size: 100% 5px, 5px 100%;
  opacity: 0.22;
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.hud-panel,
.viewport {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 24px;
  box-shadow: 0 24px 80px var(--shadow);
  backdrop-filter: blur(12px);
}

.hud-panel {
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

h1 {
  margin: 8px 0 12px;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(3rem, 7vw, 4.6rem);
  letter-spacing: 0.06em;
  line-height: 0.92;
}

.deck {
  margin: 0;
  line-height: 1.65;
  color: var(--muted);
}

.legend {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.legend p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend span {
  color: var(--accent-2);
  display: inline-block;
  min-width: 52px;
}

.viewport {
  padding: 14px;
  overflow: hidden;
}

canvas {
  width: 100%;
  display: block;
  border-radius: 18px;
  background: #05070d;
  touch-action: none;
}

.mobile-controls {
  position: absolute;
  inset: auto 16px 16px 16px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.dpad,
.actions {
  display: flex;
  gap: 10px;
}

.dpad {
  flex-direction: column;
}

.dpad div,
.actions {
  display: flex;
  gap: 10px;
}

.mobile-controls button {
  font: inherit;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 12, 20, 0.8);
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  touch-action: none;
}

.actions button {
  width: 84px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .hud-panel {
    gap: 20px;
  }
}

@media (max-width: 780px) {
  .shell {
    width: min(100vw - 18px, 1000px);
    padding-top: 10px;
    gap: 14px;
  }

  .hud-panel {
    padding: 18px;
  }

  .viewport {
    padding: 8px;
  }

  .mobile-controls {
    display: flex;
  }

  .mobile-controls button {
    width: 56px;
    height: 56px;
  }

  .actions button {
    width: 74px;
  }
}
