@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");
:root {
  color-scheme: dark;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: #e9f7ff;
  background: #060b13;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  height: 100dvh;
}
button,
select {
  font: inherit;
  color: inherit;
  background: #101d29;
  border: 1px solid #304d62;
  border-radius: 12px;
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
}
button:hover {
  border-color: #75eed1;
  background: #16312e;
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid #b8fff0;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
a {
  color: #80f8d2;
}
canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: max(14px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right)) 14px
    max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(#060b13e8, transparent);
  pointer-events: none;
}
.brand,
nav {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 18px;
}
.brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 400;
  color: #8ca9b9;
}
nav {
  display: flex;
  gap: 7px;
  align-items: center;
}
select {
  font-size: 16px;
  padding: 9px;
}
#hud {
  position: fixed;
  top: 104px;
  left: max(20px, env(safe-area-inset-left));
  width: 290px;
  pointer-events: none;
  padding: 18px;
  background: #07121baf;
  border: 1px solid #25414f;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}
#hud strong,
#hud small {
  display: block;
}
#stageCount,
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #71eac1;
}
#stageName {
  font-size: 26px;
  margin: 5px 0;
}
#mission {
  color: #a6bdc9;
  font-size: 12px;
  line-height: 1.5;
}
.progress {
  height: 5px;
  border-radius: 5px;
  background: #24333f;
  margin-top: 16px;
  overflow: hidden;
}
#fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #71eac1, #ab8fff);
  transition: width 0.25s;
}
#hud p {
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  color: #96abba;
  margin: 10px 0 0;
}
dialog {
  max-width: min(600px, calc(100vw - 28px));
  width: 600px;
  max-height: calc(100dvh - 28px);
  overflow: auto;
  color: inherit;
  border: 1px solid #32536b;
  background: linear-gradient(145deg, #112231, #07121b);
  border-radius: 26px;
  padding: 34px;
  box-shadow: 0 0 100px #4de0b21b;
}
dialog::backdrop {
  background: #01070cb3;
  backdrop-filter: blur(8px);
}
h1 {
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: -2px;
  margin: 16px 0;
}
h2 {
  font-size: 30px;
  letter-spacing: -1px;
}
dialog p {
  line-height: 1.7;
  color: #b7cad4;
}
.hint {
  font-size: 12px !important;
  color: #8aa4b4 !important;
}
.primary {
  background: #9aefd5;
  color: #06231d;
  border: 0;
  font-weight: 700;
}
.primary:hover {
  background: #c2ffed;
}
.stages {
  letter-spacing: 10px;
  font-size: 23px;
  padding: 20px 0 28px;
}
.close {
  float: right;
  padding: 8px 14px;
}
.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.choices button b,
.choices button small {
  display: block;
  margin-top: 8px;
}
.choices small {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}
.wallets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#items {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #294456;
  border-radius: 16px;
  padding: 14px;
}
.item .orb {
  font-size: 30px;
  color: #79f1cd;
}
.item .detail {
  flex: 1;
}
.item small {
  display: block;
  color: #94acbc;
}
.item button {
  padding: 10px;
}
.item button + button {
  margin-left: 5px;
}
#invoice {
  border: 1px solid #64c8ac;
  padding: 16px;
  border-radius: 16px;
  margin-top: 20px;
}
code {
  display: block;
  word-break: break-all;
  font-size: 12px;
  padding: 10px 0;
}
#shopStatus {
  font-size: 13px;
  color: #b7f8df;
  overflow-wrap: anywhere;
}
#joystick {
  position: fixed;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: #8dfed91a;
  border: 1px solid #8dfed959;
  pointer-events: none;
}
#joystick span {
  display: block;
  position: absolute;
  left: 34px;
  top: 34px;
  width: 40px;
  height: 40px;
  background: #8dfed944;
  border: 1px solid #8dfed9;
  border-radius: 50%;
}
#toast {
  position: fixed;
  bottom: max(30px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #112531ed;
  border: 1px solid #4c8e86;
  border-radius: 14px;
  padding: 12px 20px;
  max-width: calc(100% - 30px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 13px;
}
#toast.show {
  opacity: 1;
}
[hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  header {
    padding: 12px;
    gap: 7px;
  }
  .brand {
    font-size: 13px;
    letter-spacing: 1px;
    gap: 5px;
  }
  .brand img {
    width: 31px;
    height: 31px;
  }
  .brand small {
    display: none;
  }
  nav {
    gap: 4px;
  }
  nav button {
    padding: 8px 10px;
  }

  select {
    padding: 7px;
  }
  #hud {
    left: 12px;
    top: 72px;
    width: 220px;
    padding: 12px;
    border-radius: 14px;
  }
  #stageName {
    font-size: 20px;
  }
  dialog {
    padding: 23px;
  }
  .choices {
    grid-template-columns: 1fr;
  }
  .choices button {
    text-align: left;
  }
  .choices button b {
    display: inline;
    margin-left: 8px;
  }
  .choices button small {
    margin: 4px 0 0 28px;
  }
  .item {
    flex-wrap: wrap;
  }
  .item .detail {
    min-width: 100px;
  }
  .stages {
    letter-spacing: 5px;
  }
  h1 {
    letter-spacing: -1px;
  }
}
@media (max-height: 480px) {
  #hud {
    top: 70px;
    width: 220px;
    padding: 10px;
  }
  #stageName {
    font-size: 18px;
  }
  #mission {
    display: none;
  }
  dialog {
    padding: 20px;
  }
  h1 {
    font-size: 30px;
  }
  .stages {
    padding: 10px 0;
  }
  header .brand small {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (max-width: 360px) {
  .brand span {
    display: none;
  }
  header {
    gap: 4px;
  }
  nav {
    gap: 3px;
  }
}
@media (max-width: 420px) {
  .brand span {
    display: none;
  }
}
@media (max-width: 650px) {
  .brand span {
    display: none;
  }
  nav button {
    min-width: 44px;
  }
}
@media (max-width: 360px) {
  .brand {
    display: none;
  }
  nav {
    width: 100%;
    justify-content: space-between;
  }
  nav select {
    width: 58px;
  }
  #shopOpen {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

#objectiveStatus {
  color: #ffdf91 !important;
  font-size: 12px !important;
}
#eventStatus {
  font-size: 10px;
  color: #9dd0c0;
  margin-top: 6px;
}
#boost {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  min-height: 52px;
  min-width: 100px;
  border-color: #63b7a0;
  background: #102c28e8;
}
#boost:disabled {
  opacity: 0.6;
}
@media (max-width: 600px) {
  #hud {
    width: 235px;
  }
  #mission {
    font-size: 11px;
  }
  #boost {
    right: 16px;
    bottom: max(28px, env(safe-area-inset-bottom));
    font-size: 13px;
  }
}
@media (max-height: 480px) {
  #objectiveStatus {
    margin-top: 4px !important;
  }
  #eventStatus {
    display: none;
  }
}
