:root {
  color-scheme: dark;
  --lime: #dce99c;
  --ink: #eef0e4;
  --muted: #a9b4a4;
  --panel: #17231deb;
  --line: #dbe7c32c;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #24332b;
  color: var(--ink);
  font:
    14px system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
body.in-world {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button,
input,
a {
  touch-action: manipulation;
}
button,
input {
  font: inherit;
}
button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #27342a;
  cursor: pointer;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 700;
  padding: 10px 14px;
}
button:hover:not(:disabled) {
  border-color: var(--lime);
  background: #354330;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}
input:not([type="range"]):not([type="checkbox"]) {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: #101b15;
  color: var(--ink);
  border-radius: 4px;
  font-size: 16px;
  padding: 10px 12px;
}
input[type="range"] {
  accent-color: var(--lime);
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
label,
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.eyebrow {
  color: var(--lime);
}
[hidden] {
  display: none !important;
}
#world-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#world-lobby {
  position: relative;
  min-height: 100dvh;
  background: linear-gradient(90deg, #0e1815ed, #17251dda 55%, #18241bbb);
  padding: 0 max(24px, env(safe-area-inset-right)) 0
    max(24px, env(safe-area-inset-left));
}
.site-top {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.site-top > a {
  font-size: 25px;
  color: var(--lime);
  font-weight: 800;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-top a span {
  font-size: 10px;
  letter-spacing: 0.13em;
  color: var(--ink);
  font-style: normal;
}
.site-top > span {
  font: 9px monospace;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.lobby-layout {
  max-width: 1150px;
  margin: auto;
  min-height: calc(100dvh - 125px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 8vw;
  align-items: center;
  padding: 36px 0;
}
.intro {
  min-width: 0;
}
h1 {
  font-size: clamp(44px, 7.7vw, 100px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.9;
  margin: 28px 0;
}
h1 span {
  display: block;
  font: 600 12px monospace;
  letter-spacing: 0.65em;
  color: var(--lime);
  margin-top: 22px;
}
.lead {
  font-size: 20px;
  line-height: 1.5;
  color: #c2cbbd;
  margin: 26px 0 14px;
}
.details {
  max-width: 380px;
  line-height: 1.8;
  font-size: 13px;
  color: var(--muted);
}
.legacy {
  display: inline-block;
  padding: 14px 0;
  min-height: 44px;
  color: var(--lime);
  font-size: 11px;
}
.deployment {
  border: 1px solid var(--line);
  border-top: 2px solid var(--lime);
  border-radius: 5px;
  padding: 24px;
  background: #17231df0;
  display: grid;
  gap: 12px;
  min-width: 0;
  box-shadow: 0 20px 70px #0004;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.panel-heading h2 {
  font-size: 22px;
  margin: 4px 0 14px;
  letter-spacing: -0.03em;
}
.panel-heading > span {
  font: 9px monospace;
  color: var(--muted);
}
.deployment label {
  color: var(--muted);
}
.deployment button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.primary {
  background: var(--lime);
  color: #1b2819;
  border-color: var(--lime);
}
.primary:hover:not(:disabled) {
  background: #eff4bc;
  color: #1b2819;
}
.deployment form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.deployment form button {
  font-size: 10px;
  padding: 8px 10px;
}
.text-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  justify-content: center !important;
  padding: 4px;
  min-height: 34px;
}
.privacy-note {
  font-size: 9px;
  color: #95a38e;
  margin: 0;
  text-align: center;
}
.lobby-bottom {
  height: 55px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font: 9px monospace;
  color: #93a68a;
  letter-spacing: 0.1em;
}
#world-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#world-hud button,
#world-hud input,
#world-hud .joystick {
  pointer-events: auto;
}
.battle-bar {
  position: absolute;
  top: env(safe-area-inset-top);
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  height: 48px;
  display: flex;
  gap: 14px;
  align-items: center;
  background: linear-gradient(#122018e8, #122018a0);
  padding: 0 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 5px 5px;
  border-bottom: 0;
  box-shadow: inset 0 -1px var(--line);
}
.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 22px;
  background: transparent;
  border: 0;
}
.room-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}
.room-info strong {
  font: 12px monospace;
  letter-spacing: 0.1em;
  color: var(--lime);
}
.room-info small {
  font: 10px monospace;
  color: var(--muted);
}
.hp-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  font: 11px monospace;
}
.hp-group progress {
  width: 100px;
  height: 4px;
  appearance: none;
  border: 0;
  background: #ffffff20;
}
.hp-group progress::-webkit-progress-bar {
  background: #ffffff20;
}
.hp-group progress::-webkit-progress-value {
  background: var(--lime);
}
.hp-group progress::-moz-progress-bar {
  background: var(--lime);
}
#world-score,
#world-network {
  font: 10px monospace;
  color: #c5d5b9;
}
#world-network {
  min-width: 64px;
  text-align: right;
}
.drive-control {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(25px, env(safe-area-inset-bottom));
}
.aim-control {
  position: absolute;
  right: max(126px, calc(env(safe-area-inset-right) + 108px));
  bottom: max(25px, env(safe-area-inset-bottom));
}
.control-caption {
  display: block;
  text-align: center;
  font: 9px monospace;
  letter-spacing: 0.09em;
  margin: 0 0 7px;
  color: #d5e0c7;
  text-shadow: 0 1px 4px #000;
}
.joystick {
  width: 100px;
  height: 100px;
  position: relative;
  touch-action: none;
  background: #142318a8;
  border: 1px solid #e8f0d23b;
  border-radius: 50%;
  box-shadow: 0 4px 20px #0002;
  display: grid;
  place-items: center;
}
.pad-ring {
  position: absolute;
  width: 65%;
  height: 65%;
  border: 1px dashed #dce99c40;
  border-radius: 50%;
  pointer-events: none;
}
.pad-knob {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #dce99c55;
  background: #46573add;
  border-radius: 50%;
  font-size: 22px;
  pointer-events: none;
  color: var(--lime);
}
.fire-button {
  position: absolute;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(35px, calc(env(safe-area-inset-bottom) + 10px));
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid #15261877;
  color: #1b2819;
  box-shadow: 0 0 0 5px #dce99c15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
}
.fire-button:hover:not(:disabled) {
  background: #eef5b6;
  color: #152418;
}
.fire-button small {
  font: 8px monospace;
  margin-top: 4px;
}
.fire-button:disabled {
  opacity: 0.7;
  background: #667354;
  color: #e4edd7;
}
.payload-control {
  position: absolute;
  width: 170px;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(26px, env(safe-area-inset-bottom));
  background: #152319bb;
  padding: 9px;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.range-line {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font: 9px monospace;
}
.range-line label {
  font-size: 8px;
  letter-spacing: 0.06em;
}
.payload-control input {
  width: 100%;
  height: 22px;
  margin: 3px 0;
  touch-action: none;
}
.payload-control button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  font-size: 10px;
  padding: 6px 8px;
  background: #253822d9;
}
.world-hint {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font: 9px monospace;
  color: #c7d0ba;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}
.field-message {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 62px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 75%;
  padding: 8px 15px;
  border-radius: 4px;
  background: #162218cf;
  text-align: center;
  font-size: 11px;
}
.death-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #192217eb;
  border: 1px solid var(--line);
  padding: 16px 24px;
  font: 13px monospace;
  text-align: center;
}
.result-panel {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(350px, 90%);
  max-height: 70dvh;
  overflow: auto;
  background: #132116f2;
  border: 1px solid var(--lime);
  border-radius: 5px;
  padding: 24px;
  text-align: center;
  pointer-events: auto;
}
.result-panel h2 {
  font-size: 25px;
  margin: 12px 0;
}
.result-panel p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.result-panel button {
  width: 100%;
}
dialog {
  width: min(460px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  background: #17251e;
  color: var(--ink);
  border: 1px solid #dce99c50;
  border-radius: 6px;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #07140fb8;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 26px;
  letter-spacing: -0.04em;
  margin: 12px 0 20px;
}
dialog p,
dialog li {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
dialog li {
  margin-bottom: 8px;
}
.close-dialog {
  float: right;
  width: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 26px;
}
.weapon-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-bottom: 9px;
  text-align: left;
  min-height: 72px;
}
.weapon-option b {
  font-size: 14px;
}
.weapon-option span {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
}
.weapon-option[aria-pressed="true"] {
  border-color: var(--lime);
  color: var(--lime);
}
#world-invite,
#world-leave {
  width: 100%;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.setting {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: 12px;
  letter-spacing: 0;
}
.setting input {
  width: 20px;
  height: 20px;
  accent-color: var(--lime);
}
.danger {
  margin-top: 10px;
  color: #edb49e;
}
#world-ranking {
  margin: 12px 0;
  font: 12px monospace;
}
#world-ranking > div {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
#world-toast {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top) + 62px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 12px 18px;
  background: #dce99c;
  color: #172317;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 8px 30px #0004;
}
.orientation-tip {
  display: none;
}
.sr-only {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.no-script {
  position: fixed;
  bottom: 20px;
  background: #17251e;
  padding: 16px;
}
@media (pointer: fine) {
  .joystick {
    opacity: 0.6;
  }
  .world-hint {
    display: block;
  }
}
@media (max-width: 700px) {
  .site-top > span {
    display: none;
  }
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    min-height: 0;
    padding: 28px 0;
  }
  .intro h1 {
    font-size: clamp(42px, 13vw, 70px);
    margin: 18px 0;
  }
  .lead {
    font-size: 16px;
    margin: 16px 0 4px;
  }
  .details {
    display: none;
  }
  .deployment {
    width: 100%;
    max-width: 420px;
    justify-self: center;
    padding: 18px;
    gap: 10px;
  }
  .lobby-bottom {
    font-size: 7px;
    height: 48px;
  }
  .lobby-bottom > span:last-child {
    display: none;
  }
  .battle-bar {
    gap: 8px;
    padding: 0 2px;
  }
  .room-info {
    gap: 6px;
  }
  .room-info strong {
    font-size: 10px;
  }
  .hp-group progress {
    width: 55px;
  }
  .hp-group {
    font-size: 9px;
    gap: 5px;
  }
  .world-hint {
    display: none;
  }
  .drive-control {
    left: max(12px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
  }
  .aim-control {
    right: max(96px, calc(env(safe-area-inset-right) + 84px));
    bottom: max(14px, env(safe-area-inset-bottom));
  }
  .joystick {
    width: 82px;
    height: 82px;
  }
  .fire-button {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(23px, calc(env(safe-area-inset-bottom) + 9px));
    width: 66px;
    height: 66px;
    font-size: 12px;
  }
  .payload-control {
    width: 145px;
    bottom: max(14px, env(safe-area-inset-bottom));
    padding: 6px;
  }
  .control-caption {
    font-size: 8px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #world-lobby {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .site-top {
    height: 40px;
  }
  .site-top > a {
    font-size: 20px;
  }
  .site-top a span {
    font-size: 8px;
  }
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 270px);
    gap: 22px;
    padding: 12px 0;
    min-height: calc(100dvh - 40px);
    align-items: center;
  }
  .intro h1 {
    font-size: clamp(30px, 6vw, 50px);
    margin: 12px 0;
  }
  .intro h1 span {
    font-size: 8px;
    letter-spacing: 0.4em;
    margin-top: 12px;
  }
  .intro .eyebrow {
    font-size: 8px;
  }
  .lead {
    font-size: 12px;
    margin: 16px 0 0;
  }
  .details,
  .lobby-bottom {
    display: none;
  }
  .legacy {
    font-size: 9px;
    margin-top: 2px;
  }
  .deployment {
    padding: 12px;
    gap: 7px;
  }
  .panel-heading {
    display: none;
  }
  .deployment label {
    font-size: 8px;
  }
  .deployment button {
    font-size: 9px;
  }
  .deployment input {
    height: 44px;
  }
  .privacy-note {
    display: none;
  }
  .text-button {
    min-height: 26px !important;
    font-size: 9px !important;
  }
  .battle-bar {
    height: 44px;
    gap: 9px;
  }
  .drive-control {
    left: max(12px, env(safe-area-inset-left));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .aim-control {
    right: max(96px, calc(env(safe-area-inset-right) + 84px));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .joystick {
    width: 80px;
    height: 80px;
  }
  .fire-button {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
    width: 66px;
    height: 66px;
    font-size: 12px;
  }
  .payload-control {
    width: 145px;
    padding: 5px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .world-hint {
    display: none;
  }
  .control-caption {
    font-size: 8px;
    margin-bottom: 4px;
  }
  dialog {
    padding: 16px;
  }
  .field-message {
    top: calc(env(safe-area-inset-top) + 50px);
    font-size: 10px;
    padding: 6px 10px;
  }
  .result-panel {
    padding: 12px;
    max-height: 65dvh;
  }
  .result-panel h2 {
    font-size: 21px;
    margin: 5px 0;
  }
}
@media (max-width: 610px) and (orientation: landscape) {
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 245px);
    gap: 12px;
  }
  .intro h1 {
    font-size: 31px;
  }
  .lead {
    font-size: 11px;
  }
  .deployment {
    padding: 10px;
  }
  .hp-group progress {
    width: 52px;
  }
  #world-score {
    display: none;
  }
  .payload-control {
    left: 44%;
    width: 128px;
  }
  .room-info small {
    font-size: 8px;
  }
  #world-network {
    font-size: 8px;
    min-width: 52px;
  }
}
@media (orientation: portrait) and (max-width: 700px) {
  .in-world .orientation-tip {
    display: block;
    position: fixed;
    top: 58px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #d4dfc7;
    background: #16231bad;
    border-radius: 3px;
    padding: 6px 12px;
    pointer-events: none;
  }
  .payload-control {
    bottom: max(120px, calc(env(safe-area-inset-bottom) + 106px));
    width: 160px;
    left: 50%;
  }
  .field-message {
    top: 88px;
  }
  .room-info small,
  #world-score {
    display: none;
  }
  #world-network {
    font-size: 8px;
    min-width: 50px;
  }
  .battle-bar {
    gap: 4px;
  }
  .hp-group progress {
    width: 50px;
  }
  .site-top {
    height: 54px;
  }
}
