:root {
  --page-bg: #081018;
  --panel: rgba(14, 22, 31, 0.76);
  --panel-strong: rgba(11, 18, 26, 0.9);
  --panel-soft: rgba(22, 34, 46, 0.66);
  --border: rgba(184, 214, 235, 0.18);
  --text: #ecf6ff;
  --muted: #a8bac8;
  --accent: #9fd8ff;
  --accent-soft: #dff4ff;
  --accent-warm: #d7c4ab;
  --danger: #ff7c82;
  --success: #a8ffd2;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(112, 150, 196, 0.16), transparent 32%),
    radial-gradient(circle at 50% 12%, rgba(52, 83, 118, 0.18), transparent 36%),
    linear-gradient(180deg, #0b141d 0%, #05090e 100%);
  color: var(--text);
}

body {
  --font-heading: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-family: "IBM Plex Sans", Arial, sans-serif;
}

.game_page {
  width: min(1280px, calc(100% - 2rem));
  margin: 96px auto 48px;
}

.page_intro {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.eyebrow {
  margin: 0;
  color: #b6c9e9;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page_intro h1 {
  margin: 0;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.page_intro p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.7;
}

.game_shell {
  position: relative;
  min-height: 78vh;
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(123, 160, 208, 0.18), transparent 32%),
    radial-gradient(circle at 20% 16%, rgba(67, 93, 126, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(10, 16, 22, 0.92), rgba(4, 7, 11, 0.98));
  box-shadow: var(--shadow);
  isolation: isolate;
}

.game_shell:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
  border: 0;
}

.game_shell:fullscreen #gameCanvas {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 78vh;
  min-height: 620px;
  background: #0a1219;
}

.screen_fx,
.screen_vignette,
.screen_static {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen_vignette {
  background:
    radial-gradient(circle at center, transparent 42%, rgba(0, 0, 0, 0.26) 74%, rgba(0, 0, 0, 0.58) 100%),
    linear-gradient(180deg, rgba(128, 160, 194, 0.08), rgba(0, 0, 0, 0.24));
  mix-blend-mode: multiply;
}

.screen_static {
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 4px, 4px 100%;
  animation: staticDrift 7s linear infinite;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: rgba(232, 244, 255, 0.86);
  box-shadow: 0 0 14px rgba(140, 208, 255, 0.28);
}

.crosshair::before {
  width: 2px;
  height: 18px;
}

.crosshair::after {
  width: 18px;
  height: 2px;
}

.hud {
  position: absolute;
  inset: 1rem 1rem auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  z-index: 3;
  pointer-events: none;
}

.hud_cluster {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.hud_cluster_center {
  justify-content: center;
  flex: 1 1 auto;
}

.hud_cluster_right {
  justify-content: flex-end;
}

.hud_card {
  min-width: 176px;
  display: grid;
  gap: 0.32rem;
  padding: 0.86rem 0.95rem;
  border: 1px solid rgba(202, 227, 242, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(129, 164, 196, 0.12), transparent 48%),
    linear-gradient(180deg, rgba(14, 22, 31, 0.88), rgba(8, 13, 19, 0.78)),
    rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.hud_icon_button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  min-height: 48px;
  padding: 0 1rem;
  border: 1px solid rgba(203, 226, 242, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(16, 24, 33, 0.9), rgba(9, 14, 20, 0.8)),
    rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.hud_icon_button:hover,
.hud_icon_button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(164, 217, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(20, 30, 41, 0.95), rgba(10, 16, 22, 0.86)),
    rgba(0, 0, 0, 0.28);
}

.hud_icon_button .material-symbols-outlined {
  font-size: 1.2rem;
}

.hud_label {
  color: #b8cad7;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hud_card strong {
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 1.08rem;
  line-height: 1.2;
}

.hud_subtle {
  color: #96aebe;
  font-size: 0.84rem;
}

.battery_meter {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 12, 16, 0.8), rgba(20, 29, 38, 0.92));
  border: 1px solid rgba(199, 225, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.battery_fill {
  height: 100%;
  width: 76%;
  background: linear-gradient(90deg, #78d0ff, #b4ecff 56%, #f3fcff);
  transition: width 120ms linear, filter 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.message_toast,
.interaction_prompt {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.message_toast {
  top: 5.9rem;
  min-width: min(90vw, 380px);
  padding: 0.8rem 1rem;
  border: 1px solid rgba(168, 210, 235, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at top, rgba(147, 185, 213, 0.12), transparent 55%),
    rgba(8, 13, 19, 0.84);
  color: var(--text);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

.message_toast.visible,
.interaction_prompt.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.interaction_prompt {
  bottom: 1.25rem;
  padding: 0.72rem 0.92rem;
  border-radius: 999px;
  background: rgba(11, 17, 23, 0.88);
  border: 1px solid rgba(182, 226, 255, 0.18);
  color: #f7fbff;
  font-size: 0.92rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.interaction_prompt kbd,
.control_grid kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.24rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 0.82rem;
}

.note_panel {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100% - 2rem));
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1rem 1.06rem;
  border: 1px solid rgba(184, 211, 227, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(120, 157, 186, 0.14), transparent 46%),
    linear-gradient(180deg, rgba(15, 22, 29, 0.92), rgba(11, 16, 21, 0.84)),
    rgba(0, 0, 0, 0.18);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.24);
  z-index: 3;
}

.note_panel_label {
  color: #b6d4e4;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.note_panel h2 {
  margin: 0;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 1.1rem;
}

.note_panel p {
  margin: 0;
  color: #d7e6f0;
  line-height: 1.62;
  font-size: 0.92rem;
}

.touch_controls {
  display: none;
}

.touch_pad,
.touch_action_btn {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.touch_action_btn.is-active,
.touch_pad.is-active {
  transform: translateY(-1px);
}

.overlay_screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 7, 10, 0.52);
  backdrop-filter: blur(6px);
  z-index: 5;
}

.overlay_screen.hidden {
  display: none;
}

.overlay_card {
  width: min(520px, 100%);
  display: grid;
  gap: 0.9rem;
  padding: clamp(1.3rem, 4vw, 2rem);
  border-radius: 28px;
  border: 1px solid rgba(188, 216, 234, 0.16);
  background:
    radial-gradient(circle at top, rgba(129, 166, 198, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(13, 20, 27, 0.94), rgba(7, 11, 16, 0.88));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.overlay_card.danger {
  background:
    radial-gradient(circle at top, rgba(169, 81, 86, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(24, 14, 18, 0.95), rgba(11, 7, 9, 0.88));
}

.overlay_card.success {
  background:
    radial-gradient(circle at top, rgba(87, 157, 133, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(12, 22, 18, 0.95), rgba(7, 11, 9, 0.88));
}

.overlay_kicker {
  margin: 0;
  color: #b8cae5;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.overlay_card h2 {
  margin: 0;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 0.98;
}

.overlay_card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.control_grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  padding: 0.2rem 0 0.1rem;
  color: #dbe5f2;
}

.control_grid span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.overlay_actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.overlay_actions button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.92rem 1.3rem;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 0.96rem;
  color: #091018;
  background: linear-gradient(135deg, #ecf7ff, #9fd8ff);
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.overlay_actions button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.overlay_actions .ghost_button {
  color: #eff7ff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(194, 220, 238, 0.18);
}

.help_grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.info_card {
  padding: 1rem 1.05rem;
  border-radius: 22px;
  border: 1px solid rgba(188, 216, 234, 0.1);
  background: linear-gradient(180deg, rgba(12, 18, 25, 0.82), rgba(7, 11, 16, 0.62));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.info_card h2 {
  margin: 0 0 0.45rem;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 1rem;
}

.info_card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

@keyframes staticDrift {
  from {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -3px, 0);
  }

  to {
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 1080px) {
  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud_cluster,
  .hud_cluster_right,
  .hud_cluster_center {
    justify-content: flex-start;
    flex-wrap: wrap;
    flex: 0 0 auto;
  }

  .note_panel {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .help_grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .game_page {
    width: min(100%, calc(100% - 1rem));
    margin-top: 72px;
  }

  .game_shell {
    border-radius: 22px;
  }

  #gameCanvas {
    min-height: 72vh;
  }

  .hud {
    inset: 0.75rem 0.75rem auto;
    gap: 0.75rem;
  }

  .hud_card {
    min-width: 150px;
  }

  .hud_icon_button {
    min-height: 44px;
  }

  .message_toast {
    top: auto;
    bottom: 6.8rem;
    width: min(88vw, 360px);
  }

  .interaction_prompt {
    bottom: 0.9rem;
    width: min(92vw, 420px);
    text-align: center;
    border-radius: 18px;
  }

  .note_panel {
    bottom: 5rem;
  }
}

@media (max-width: 1024px) and (pointer: coarse), (max-width: 820px) {
  .crosshair {
    opacity: 0.58;
  }

  .touch_controls {
    position: absolute;
    left: max(0.75rem, calc(env(safe-area-inset-left) + 0.35rem));
    right: max(0.75rem, calc(env(safe-area-inset-right) + 0.35rem));
    bottom: max(0.75rem, calc(env(safe-area-inset-bottom) + 0.35rem));
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 0.85rem;
    pointer-events: none;
  }

  .touch_pad_group,
  .touch_actions {
    pointer-events: auto;
  }

  .touch_pad_group {
    display: grid;
    gap: 0.45rem;
    justify-items: start;
  }

  .touch_pad_group_right {
    justify-items: end;
  }

  .touch_group_label {
    display: inline-flex;
    align-items: center;
    min-height: 1.4rem;
    padding: 0.16rem 0.58rem;
    border: 1px solid rgba(188, 216, 234, 0.14);
    border-radius: 999px;
    background: rgba(8, 13, 19, 0.7);
    color: #dceaf6;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
  }

  .touch_pad {
    position: relative;
    width: min(22vw, 152px);
    min-width: 118px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(194, 222, 241, 0.16);
    background:
      radial-gradient(circle at 50% 36%, rgba(156, 202, 233, 0.18), transparent 46%),
      linear-gradient(180deg, rgba(14, 22, 31, 0.84), rgba(7, 11, 16, 0.78));
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
  }

  .touch_pad::before,
  .touch_pad::after {
    content: "";
    position: absolute;
    inset: 50%;
    background: rgba(230, 245, 255, 0.08);
    transform: translate(-50%, -50%);
    border-radius: 999px;
  }

  .touch_pad::before {
    width: 70%;
    height: 1px;
  }

  .touch_pad::after {
    width: 1px;
    height: 70%;
  }

  .touch_pad_thumb {
    position: absolute;
    inset: 0;
    width: 35%;
    height: 35%;
    margin: auto;
    border-radius: 50%;
    border: 1px solid rgba(239, 248, 255, 0.34);
    background:
      radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), rgba(163, 214, 247, 0.92) 58%, rgba(93, 140, 175, 0.92) 100%);
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: transform 90ms ease;
  }

  .touch_pad.is-active .touch_pad_thumb {
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.3),
      0 0 0 6px rgba(146, 206, 247, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }

  .touch_actions {
    display: grid;
    gap: 0.55rem;
    align-self: center;
  }

  .touch_action_btn {
    appearance: none;
    min-width: 92px;
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border: 1px solid rgba(199, 226, 243, 0.16);
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(15, 23, 32, 0.92), rgba(9, 14, 20, 0.82)),
      rgba(0, 0, 0, 0.2);
    color: var(--text);
    font: inherit;
    font-family: "Space Grotesk", Arial, sans-serif;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  }

  .touch_action_btn_ghost {
    background:
      linear-gradient(180deg, rgba(28, 18, 22, 0.92), rgba(12, 10, 14, 0.82)),
      rgba(0, 0, 0, 0.2);
  }

  .touch_action_btn.is-active,
  .touch_action_btn:active {
    border-color: rgba(172, 222, 255, 0.28);
    background:
      linear-gradient(180deg, rgba(20, 30, 41, 0.96), rgba(10, 16, 22, 0.88)),
      rgba(0, 0, 0, 0.24);
  }

  .message_toast {
    top: auto;
    bottom: min(15.25rem, calc(100% - 4rem));
  }

  .interaction_prompt {
    bottom: min(10.4rem, calc(100% - 7rem));
  }

  .note_panel {
    bottom: min(13rem, calc(100% - 10rem));
  }
}

@media (max-width: 640px) {
  .page_intro h1 {
    line-height: 1;
  }

  #gameCanvas {
    height: 68vh;
    min-height: 540px;
  }

  .hud_card {
    width: 100%;
    min-width: 0;
  }

  .hud_cluster {
    width: 100%;
    flex-direction: column;
  }

  .hud_cluster_center {
    align-items: stretch;
  }

  .hud_icon_button {
    width: 100%;
    justify-content: center;
  }

  .control_grid {
    grid-template-columns: 1fr;
  }

  .overlay_actions {
    flex-direction: column;
  }

  .overlay_actions button {
    width: 100%;
  }
}

@media (max-width: 640px) and (pointer: coarse), (max-width: 560px) {
  .touch_controls {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .touch_pad_group,
  .touch_pad_group_right {
    justify-items: center;
  }

  .touch_actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .touch_action_btn {
    min-width: 0;
  }

  .touch_pad {
    width: min(39vw, 142px);
  }

  .message_toast {
    bottom: min(20rem, calc(100% - 4rem));
  }

  .interaction_prompt {
    bottom: min(15.3rem, calc(100% - 7rem));
    width: min(92vw, 420px);
    border-radius: 18px;
  }

  .note_panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: min(17.6rem, calc(100% - 10rem));
    width: auto;
  }
}
