:root {
  color-scheme: dark;
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  background: #080b19;
  color: #fff9db;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 45%, #273058, #0b0e21 56%, #070914);
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible { outline: 3px solid #fff5c1; outline-offset: 5px; }
button:active { transform: translateY(2px); }
#cabinet {
  position: relative;
  width: min(100vw, 56dvh, 490px);
  height: min(100dvh, 198vw, 906px);
  overflow: hidden;
  isolation: isolate;
  background: #151d42;
  box-shadow: 0 0 72px #000a;
  container-type: inline-size;
  user-select: none;
  -webkit-user-select: none;
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud {
  position: absolute;
  inset: max(13px, env(safe-area-inset-top)) 14px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.hud button { pointer-events: auto; }
.icon, .status, .flight-guide, .combat-button, .retry-card, .mark, .primary {
  background: var(--panel) center / 100% 100% no-repeat;
}
.icon {
  --panel: url('./assets/painted/panel-utility.webp');
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
}
.glyph { display: block; width: 24px; height: 24px; object-fit: contain; }
.status {
  --panel: url('./assets/painted/panel-status.webp');
  padding: 9px 13px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #f2f7ff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.status .glyph { width: clamp(12px, 4cqw, 19px); height: auto; }
.status .spent { opacity: .3; filter: saturate(.1); }
.status .repair-icon, .status .hits, .status .vitality { display: flex; align-items: center; gap: 3px; }
.status .repair-icon, .status .hits { margin-left: 3px; padding-left: 7px; border-left: 1px solid #789ac27d; }
.status .hits .glyph { width: clamp(8px, 3cqw, 14px); }
.flight-guide {
  --panel: url('./assets/painted/panel-status.webp');
  position: absolute;
  bottom: max(8%, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 91px;
  height: 44px;
  pointer-events: none;
  animation: breathe 1.9s ease-in-out infinite alternate;
}
.flight-guide .glyph { width: 48px; }
.duel-controls {
  position: absolute;
  inset: auto 10px max(3.3%, calc(env(safe-area-inset-bottom) + 8px));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.combat-button {
  touch-action: none;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 3px;
  width: clamp(58px, 20cqw, 96px);
  min-height: clamp(58px, 18cqw, 84px);
  border: 0;
  color: #e1fff1;
  font-size: clamp(10px, 3cqw, 14px);
  font-weight: 900;
  text-shadow: 0 2px 1px #05101f;
  pointer-events: auto;
}
.combat-button .glyph { width: clamp(25px, 8cqw, 39px); height: clamp(25px, 8cqw, 39px); }
.swing {
  --panel: url('./assets/painted/panel-strike.webp');
  width: clamp(102px, 40cqw, 188px);
  min-height: clamp(52px, 22cqw, 103px);
  gap: 0;
  color: #e3f7ff;
  font-size: clamp(14px, 4.2cqw, 21px);
}
.swing .glyph { width: clamp(29px, 10.5cqw, 52px); height: clamp(29px, 10.5cqw, 52px); }
.swing.ready { color: #fff3cf; filter: drop-shadow(0 0 6px #ffdd77cc); }
.swing.ready.final { filter: drop-shadow(0 0 10px #ffdb70) drop-shadow(0 0 5px #ffdb70); }
.ion {
  --panel: url('./assets/painted/panel-pulse.webp');
  position: absolute;
  right: 12px;
  bottom: max(4%, calc(env(safe-area-inset-bottom) + 8px));
}
.ion.locked { filter: saturate(.6); }
.ion-charge {
  position: absolute;
  bottom: 8px;
  left: 15%;
  width: calc(70% * var(--charge, 0));
  height: 3px;
  border-radius: 2px;
  background: #a5ffe5;
  box-shadow: 0 0 5px #71ffd1;
}
.retry-panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: #080e23bd; }
.retry-card { --panel: url('./assets/painted/panel-dialog.webp'); text-align: center; width: min(100%, 315px); padding: 26px 18px 29px; }

.menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 5% 16px;
  background: linear-gradient(180deg, #10133212 3%, #11133173 34%, #121535b0 74%, #090d23cc);
}
.menu.paused { background: #0d112cd4; }
.mark {
  --panel: url('./assets/painted/panel-utility.webp');
  display: grid;
  place-items: center;
  width: clamp(46px, 15cqw, 66px);
  aspect-ratio: 1;
  margin-bottom: 10px;
}
.mark img { width: 65%; }
h1 { margin: 12px 0 clamp(24px, 8cqw, 40px); color: #ffe38e; line-height: 1; text-transform: uppercase; }
h1 img { display: block; width: clamp(146px, 71cqw, 330px); max-height: 27dvh; object-fit: contain; }
.paused-title, .menu.paused h1 img { display: none; }
.menu.paused .paused-title { display: block; font-size: clamp(27px, 12cqw, 63px); text-shadow: 0 4px 0 #8d471c, 0 8px 27px #130d29; }
.menu-actions { display: grid; justify-items: center; gap: 16px; }
.primary {
  --panel: url('./assets/painted/panel-primary.webp');
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: min(210px, 68cqw);
  min-height: 59px;
  padding: 10px 18px;
  border: 0;
  color: #2c1820;
  font-size: clamp(20px, 7cqw, 30px);
  font-weight: 900;
}
.secondary { display: flex; gap: 12px; }
.fullscreen-button {
  border: 1px solid #a5b7d566;
  border-radius: 8px;
  padding: 9px 18px;
  background: #101a36cc;
  color: #e3f7ff;
  font-size: 14px;
}
.fullscreen-status { max-width: 240px; font-size: 12px; color: #ffdc9b; }
.fullscreen-status:empty { display: none; }
:fullscreen #cabinet { width: min(100vw, 54.054dvh); height: min(100dvh, 185vw); }
#sound .muted, #sound[aria-pressed="true"] .waves { display: none; }
#sound[aria-pressed="true"] .muted { display: block; }
@keyframes breathe { to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .flight-guide { animation: none; } }
@media (max-height: 540px) { .menu { padding: 3% 6px; } .mark { margin-bottom: 5px; } h1 { margin: 8px 0 16px; } .menu-actions { gap: 9px; } }
@media (max-width: 280px), (max-height: 410px) { .duel-controls { gap: 5px; inset-inline: 5px; } .ion { width: min(27cqw, 60px); min-height: 51px; } .ion .glyph { width: 23px; height: 23px; } }

.build-info { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; right: 12px; margin: 0; color: #b5bed6; font: 10px/1.5 monospace; overflow-wrap: anywhere; }
.menu.paused .build-info { display: none; }
