* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 14px;
  background: #0d0d0c;
  color: #f3efe1;
  font-family:
    Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.start-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  background: #050505;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
}

.start-frame {
  position: relative;
  width: min(calc(100vw - 28px), 1180px, calc((100svh - 28px) * 814 / 430));
  aspect-ratio: 814 / 430;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgb(0 0 0 / 18%) 0%, rgb(0 0 0 / 10%) 34%, rgb(0 0 0 / 52%) 100%),
    #050505 url("./assets/title-screen-landscape.png") center / cover no-repeat;
  container-type: size;
}

.start-frame::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    linear-gradient(180deg, rgb(0 0 0 / 34%) 0 22%, rgb(0 0 0 / 0%) 42% 70%, rgb(0 0 0 / 38%) 100%),
    radial-gradient(ellipse at center 31%, rgb(0 0 0 / 0%) 0 33%, rgb(0 0 0 / 38%) 78%),
    linear-gradient(90deg, rgb(0 0 0 / 64%), rgb(0 0 0 / 0%) 22% 78%, rgb(0 0 0 / 64%));
  pointer-events: none;
}

.has-started .start-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.start-menu {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 44cqw);
  align-content: center;
  justify-items: center;
  padding: calc(env(safe-area-inset-top) + clamp(20px, 7cqh, 48px)) clamp(32px, 7cqw, 86px) calc(env(safe-area-inset-bottom) + clamp(20px, 8cqh, 42px));
  pointer-events: none;
}

.start-title {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  color: #f1f0ea;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.76;
  text-align: center;
  text-shadow:
    0 2px 0 rgb(104 104 100 / 72%),
    0 7px 20px rgb(0 0 0 / 90%);
  transform: scaleX(1.08);
  transform-origin: center;
}

.start-title__the,
.start-title__rank {
  display: block;
}

.start-title__the {
  font-size: clamp(3rem, 14cqh, 6.5rem);
}

.start-title__rank {
  margin-top: -0.08em;
  font-size: clamp(4.85rem, 21cqh, 9.5rem);
}

.start-button {
  position: relative;
  grid-column: 2;
  min-width: 0;
  margin-top: clamp(26px, 8cqh, 54px);
  border: 0;
  padding: 9px 18px;
  background: transparent;
  color: #f8f3ef;
  cursor: pointer;
  font: 700 clamp(1.2rem, 4.1cqh, 1.75rem) Georgia, "Times New Roman", Times, serif;
  letter-spacing: 0;
  line-height: 1;
  text-shadow:
    0 2px 0 rgb(24 24 24 / 84%),
    0 8px 18px rgb(0 0 0 / 92%);
  text-transform: uppercase;
  pointer-events: auto;
  animation: press-start-blink 1.05s steps(2, end) infinite;
  transition:
    color 160ms ease;
}

.start-button:hover {
  color: #ffffff;
}

.start-button:focus-visible {
  outline: 1px solid rgb(255 255 255 / 76%);
  outline-offset: 7px;
}

.start-button:disabled {
  cursor: default;
  opacity: 0.62;
  animation: none;
}

.start-actions {
  grid-column: 2;
  display: grid;
  justify-items: center;
  gap: clamp(10px, 2.4cqh, 16px);
  margin-top: clamp(26px, 8cqh, 54px);
  pointer-events: auto;
}

.start-actions .start-button {
  grid-column: auto;
  margin-top: 0;
}

.start-option-button {
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 7px;
  padding: 8px 18px;
  background: rgb(0 0 0 / 34%);
  color: #f8f3ef;
  cursor: pointer;
  font: 800 clamp(0.9rem, 2.7cqh, 1.1rem) Inter, "Segoe UI", sans-serif;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px 12px rgb(0 0 0 / 84%);
}

.start-option-button:hover,
.start-option-button:focus-visible {
  border-color: rgb(255 255 255 / 72%);
  outline: none;
}

@keyframes press-start-blink {
  0%,
  46% {
    opacity: 1;
  }

  47%,
  100% {
    opacity: 0.24;
  }
}

@media (max-width: 460px) {
  .start-menu {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 52cqw);
    padding:
      calc(env(safe-area-inset-top) + clamp(24px, 10cqw, 46px))
      clamp(18px, 7cqw, 38px)
      calc(env(safe-area-inset-bottom) + clamp(18px, 8cqw, 34px));
  }

  .start-title {
    transform: scaleX(1.02);
  }

  .start-title__the {
    font-size: clamp(2.6rem, 17cqw, 4.6rem);
  }

  .start-title__rank {
    font-size: clamp(3.8rem, 25cqw, 5.65rem);
  }

  .start-button {
    font-size: clamp(1.15rem, 6cqw, 1.45rem);
  }
}

.dev-layout {
  display: grid;
  grid-template-areas:
    "tabs"
    "panels"
    "game";
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: min(100%, 1180px);
}

body.is-runtime-static,
body.is-runtime-mobile {
  place-items: stretch;
  overflow: hidden;
  padding: 0;
  overscroll-behavior: none;
  touch-action: none;
}

body.is-runtime-static .dev-layout,
body.is-runtime-mobile .dev-layout {
  grid-template-areas: "game";
  width: 100%;
  height: 100svh;
  gap: 0;
}

.dev-layout:not(.has-dev-panel-open) {
  grid-template-areas:
    "tabs"
    "game";
}

.dev-layout:not(.has-dev-panel-open) .dev-side-stack {
  display: none;
}

body.is-runtime-static .dev-tabs,
body.is-runtime-static .dev-side-stack,
body.is-runtime-mobile .dev-tabs,
body.is-runtime-mobile .dev-side-stack {
  display: none;
}

body.is-runtime-static .phone-shell,
body.is-runtime-mobile .phone-shell {
  width: 100vw;
  height: 100svh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
}

body.is-runtime-static .start-screen,
body.is-runtime-mobile .start-screen {
  place-items: center;
  padding: 0;
}

body.is-runtime-static .start-frame,
body.is-runtime-mobile .start-frame {
  width: 100vw;
  height: 100svh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
}

body.is-runtime-mobile:not(.has-started) {
  overflow: hidden;
}

@media (orientation: portrait) {
  body.is-runtime-mobile .start-frame {
    position: absolute;
    top: calc((100svh - 100vw) / 2);
    left: calc((100vw - 100svh) / 2);
    width: 100svh;
    height: 100vw;
    max-width: none;
    transform: rotate(90deg);
    transform-origin: center center;
  }
}

.dev-tabs {
  grid-area: tabs;
  display: flex;
  align-items: end;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 0 2px;
  scrollbar-width: thin;
  scrollbar-color: rgb(224 208 133 / 34%) transparent;
}

.dev-tab {
  flex: 0 0 auto;
  min-width: 0;
  height: 36px;
  border: 1px solid rgb(224 208 133 / 24%);
  border-radius: 7px;
  padding: 0 12px;
  background: #1b1c18;
  color: rgb(243 239 225 / 68%);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.dev-tab:hover,
.dev-tab:focus-visible {
  border-color: rgb(228 211 131 / 64%);
  color: #f3efe1;
  outline: none;
}

.dev-tab.is-active {
  border-color: rgb(224 208 133 / 38%);
  background: #303126;
  color: #f3efe1;
}

.phone-shell {
  position: relative;
  grid-area: game;
  justify-self: center;
  width: 100%;
  aspect-ratio: 814 / 430;
  height: auto;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: #151515;
}

@media (min-width: 560px) {
  .start-frame,
  .phone-shell,
  .dev-panel {
    border: 1px solid rgb(224 208 133 / 18%);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
  }
}

.scene,
.scene canvas {
  width: 100%;
  height: 100%;
}

.scene {
  transition: filter 140ms ease;
  will-change: filter;
}

.scene canvas {
  display: block;
  touch-action: none;
}

.mobile-joystick,
.mobile-fire-button {
  display: none;
}

.options-modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 18px);
  background: rgb(0 0 0 / 58%);
  pointer-events: auto;
}

.options-modal[hidden] {
  display: none;
}

.options-card {
  width: min(92vw, 420px);
  border: 1px solid rgb(224 208 133 / 34%);
  border-radius: 8px;
  padding: 20px;
  background: rgb(8 8 7 / 86%);
  color: #f3efe1;
  box-shadow: 0 24px 70px rgb(0 0 0 / 62%);
  backdrop-filter: blur(12px);
}

.options-title {
  margin: 0 0 18px;
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.options-fields {
  display: grid;
  gap: 16px;
}

.options-field {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.options-field__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.options-field output {
  min-width: 42px;
  color: #8ddeae;
  text-align: right;
}

.options-field input[type="range"] {
  width: 100%;
  accent-color: #e0d085;
}

.options-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.options-actions[hidden] {
  display: none;
}

.options-button {
  min-width: 104px;
  border: 1px solid rgb(224 208 133 / 36%);
  border-radius: 7px;
  padding: 10px 14px;
  background: rgb(48 49 38 / 88%);
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.options-button--secondary,
.options-button--close {
  background: rgb(18 18 15 / 78%);
  color: rgb(243 239 225 / 76%);
}

.options-button--close {
  display: block;
  margin: 20px auto 0;
}

.options-button:hover,
.options-button:focus-visible {
  border-color: rgb(224 208 133 / 68%);
  background: rgb(68 67 48 / 92%);
  outline: none;
}

.dev-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: none;
  min-width: 0;
  overflow: visible;
  padding: 14px;
  background: #131412;
}

.dev-side-stack {
  grid-area: panels;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 10px;
  width: 100%;
  max-height: none;
  overflow: visible;
  pointer-events: none;
}

.dev-side-stack .dev-panel {
  max-height: none;
  overflow: visible;
  pointer-events: auto;
}

.dev-side-stack--left {
  align-self: stretch;
}

.dev-side-stack--right {
  align-self: stretch;
}

.dev-tab-panel[hidden] {
  display: none;
}

.tile-editor {
  display: grid;
  gap: 10px;
}

@media (min-width: 760px) {
  .tile-editor-panel .tile-editor {
    grid-template-columns: minmax(260px, 0.82fr) minmax(320px, 1.18fr);
    grid-template-areas:
      "toolbar map"
      "options map"
      "actions map"
      "feedback map";
    align-items: start;
    column-gap: 16px;
  }

  .tile-editor-panel .tile-editor-toolbar {
    grid-area: toolbar;
  }

  .tile-editor-panel .tile-editor-options {
    grid-area: options;
  }

  .tile-editor-panel .map-editor-main {
    grid-area: map;
  }

  .tile-editor-panel .map-editor-actions {
    grid-area: actions;
  }

  .tile-editor-panel .map-feedback {
    grid-area: feedback;
  }

  .tile-editor-panel .map-scroll {
    width: min(100%, 440px);
  }
}

.tile-editor-toolbar {
  display: grid;
  grid-template-columns: 34px 48px 34px 34px 34px;
  gap: 8px;
}

.tile-editor-toolbar button,
.map-editor-actions button {
  min-width: 0;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px;
  padding: 0 10px;
  background: #2a2b25;
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.tile-editor-toolbar button:focus,
.map-editor-actions button:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.tile-editor-toolbar button:disabled,
.map-editor-actions button:disabled {
  color: rgb(243 239 225 / 38%);
  cursor: default;
}

.map-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tile-editor-options {
  position: relative;
  display: grid;
  gap: 8px;
}

.map-material-controls {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.material-field {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #e4d383;
  font-size: 12px;
}

.material-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.material-field select {
  min-width: 0;
  height: 30px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px;
  padding: 0 8px;
  background: #1f211f;
  color: #f3efe1;
  font: inherit;
  font-size: 12px;
}

.material-field select:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.material-preview,
.material-preview-popover__image {
  display: block;
  border: 1px solid rgb(224 208 133 / 32%);
  background-color: #4d4d43;
  background-position: center;
  background-size: cover;
}

.material-preview {
  width: 34px;
  height: 30px;
  border-radius: 7px;
}

.material-preview-popover {
  position: fixed;
  z-index: 20;
  display: none;
  width: 132px;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgb(224 208 133 / 34%);
  border-radius: 8px;
  background: rgb(12 12 10 / 88%);
  color: #f3efe1;
  box-shadow: 0 18px 34px rgb(0 0 0 / 38%);
  pointer-events: none;
}

.material-preview-popover.is-visible {
  display: grid;
}

.material-preview-popover__image {
  width: 114px;
  height: 82px;
  border-radius: 6px;
}

.material-preview-popover__label {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: #e4d383;
  font-size: 12px;
  line-height: 1.2;
}

.toggle-control {
  display: grid;
  grid-template-columns: 38px 32px;
  align-items: center;
  gap: 8px;
  color: rgb(243 239 225 / 72%);
}

.toggle-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.toggle-track {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 999px;
  background: #1f211f;
}

.toggle-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgb(243 239 225 / 62%);
  content: "";
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.toggle-control input:checked + .toggle-track::after {
  background: #e4d383;
  transform: translateX(16px);
}

.toggle-control input:focus-visible + .toggle-track {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.toggle-value {
  color: rgb(243 239 225 / 72%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.map-editor-main {
  display: grid;
  grid-template-columns: 34px minmax(0, auto) 38px;
  justify-content: center;
  align-items: start;
  gap: 8px;
}

.floor-stack {
  display: grid;
  align-content: start;
  gap: 7px;
}

.floor-stack button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 28%);
  border-radius: 7px;
  padding: 0;
  background: #20211d;
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.floor-stack button:hover,
.floor-stack button:focus-visible {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.floor-stack button.is-active {
  border-color: #e4d383;
  background: #303126;
  color: #e4d383;
}

.floor-stack button.is-new-floor {
  color: rgb(243 239 225 / 62%);
}

.map-scroll {
  justify-self: center;
  width: min(100%, 280px);
  max-height: none;
  aspect-ratio: 1;
  overflow: auto;
  border: 1px solid rgb(224 208 133 / 22%);
  border-radius: 8px;
  background: #0d0e0c;
  scrollbar-color: rgb(224 208 133 / 34%) transparent;
  scrollbar-width: thin;
}

.map-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

.map-canvas.is-dragging-player {
  cursor: grabbing;
}

.map-canvas.is-picking-direction {
  cursor: alias;
}

.map-tool-palette {
  display: grid;
  gap: 7px;
}

.map-tool-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 28%);
  border-radius: 7px;
  padding: 0;
  background: #20211d;
  cursor: pointer;
}

.map-tool-button:hover,
.map-tool-button:focus-visible {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.map-tool-button.is-active {
  border-color: #e4d383;
  background: #303126;
}

.map-tool-icon {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
}

.map-tool-icon--tile {
  border: 1px solid rgb(243 239 225 / 78%);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgb(243 239 225 / 62%) calc(50% - 1px), rgb(243 239 225 / 62%) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent calc(50% - 1px), rgb(243 239 225 / 62%) calc(50% - 1px), rgb(243 239 225 / 62%) calc(50% + 1px), transparent calc(50% + 1px)),
    #5d5a46;
  border-radius: 3px;
}

.map-tool-icon--enemy,
.map-tool-icon--boss {
  border-radius: 48% 48% 42% 42%;
  background: #f3efe1;
  box-shadow: inset -2px -3px 0 rgb(0 0 0 / 20%);
}

.map-tool-icon--boss {
  background: #e4b83a;
  box-shadow:
    inset -2px -3px 0 rgb(88 58 0 / 30%),
    0 0 12px rgb(228 184 58 / 26%);
}

.map-tool-icon--enemy::before,
.map-tool-icon--boss::before {
  position: absolute;
  top: 5px;
  left: 4px;
  width: 4px;
  height: 5px;
  border-radius: 50%;
  background: #11120f;
  box-shadow: 7px 0 0 #11120f;
  content: "";
}

.map-tool-icon--enemy::after,
.map-tool-icon--boss::after {
  position: absolute;
  left: 5px;
  bottom: 3px;
  width: 9px;
  height: 4px;
  background:
    linear-gradient(90deg, #11120f 0 1px, transparent 1px 3px, #11120f 3px 4px, transparent 4px 6px, #11120f 6px 7px, transparent 7px),
    #f3efe1;
  content: "";
}

.map-tool-icon--boss::after {
  background:
    linear-gradient(90deg, #11120f 0 1px, transparent 1px 3px, #11120f 3px 4px, transparent 4px 6px, #11120f 6px 7px, transparent 7px),
    #e4b83a;
}

.map-feedback {
  min-height: 15px;
  margin: 0;
  overflow: hidden;
  color: rgb(243 239 225 / 72%);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-feedback.is-error {
  color: #ffd2c8;
}

.camera-panel {
  display: grid;
  gap: 8px;
}

.camera-copy-button {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px;
  padding: 0 10px;
  background: #2a2b25;
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.camera-copy-button:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}

.panel-heading span {
  overflow: hidden;
  color: #f3efe1;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-heading small {
  color: #e4d383;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.hud {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud-panel,
.dev-panel,
.status {
  border: 1px solid rgb(224 208 133 / 22%);
  border-radius: 7px;
  background: rgb(12 12 10 / 62%);
  color: #f3efe1;
  backdrop-filter: blur(10px);
}

.hud-panel {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
}

.run-timer {
  position: absolute;
  z-index: 5;
  top: calc(env(safe-area-inset-top) + 15px);
  left: 50%;
  min-width: 96px;
  color: #ffffff;
  font-family: "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 8px rgb(0 0 0 / 92%);
  pointer-events: none;
  transform: translateX(-50%);
}

.run-timer[hidden],
.run-summary-modal[hidden] {
  display: none;
}

.health-hud {
  width: 126px;
  gap: 8px;
}

.health-hud__icon {
  color: #e24438;
  font-size: 15px;
  line-height: 1;
}

.health-hud__track {
  position: relative;
  flex: 1;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgb(255 215 188 / 22%);
  border-radius: 999px;
  background: rgb(76 14 14 / 68%);
}

.health-hud__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: #d92f2f;
  transform-origin: left center;
  transition: width 160ms ease;
}

.options-gear-button {
  display: none;
}

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.weapon-slot-hud {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.weapon-slot-hud[hidden] {
  display: none;
}

.weapon-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid rgb(224 208 133 / 18%);
  border-radius: 7px;
  padding: 5px 8px;
  background: rgb(12 12 10 / 50%);
  color: rgb(200 200 200 / 42%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.weapon-slot.is-unlocked {
  color: #c8c8c8;
}

.weapon-slot.is-active {
  border-color: rgb(224 208 133 / 58%);
  background: rgb(39 38 31 / 74%);
  box-shadow: inset 0 0 0 1px rgb(255 238 166 / 10%);
}

.weapon-slot__key {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgb(255 255 255 / 8%);
  color: inherit;
  font-size: 10px;
}

.weapon-slot__icon {
  position: relative;
  display: inline-block;
  opacity: 0.52;
}

.weapon-slot.is-unlocked .weapon-slot__icon,
.weapon-slot.is-active .weapon-slot__icon {
  opacity: 1;
}

.weapon-slot__icon--pistol {
  width: 34px;
  height: 24px;
  background: transparent url("./assets/ui/weapon-pistol-icon.png") center / contain no-repeat;
}

.weapon-slot__icon--pistol::after {
  display: none;
}

.weapon-slot__icon--shotgun {
  width: 42px;
  height: 24px;
  background: transparent url("./assets/ui/weapon-shotgun-icon.png") center / contain no-repeat;
}

.weapon-slot__icon--shotgun::after {
  display: none;
}

.ammo-hud {
  position: relative;
  justify-content: flex-end;
  min-width: 74px;
  gap: 7px;
  color: #c8c8c8;
  font-weight: 800;
}

.ammo-hud__icon {
  position: relative;
  width: 18px;
  height: 22px;
  background: transparent url("./assets/ui/ammo-pistol-icon.png") center / contain no-repeat;
}

.ammo-hud.is-weapon-shotgun .ammo-hud__icon {
  background-image: url("./assets/ui/ammo-shotgun-icon.png");
}

.ammo-hud__icon::after {
  display: none;
}

.ammo-hud__count {
  min-width: 22px;
  color: #c8c8c8;
  font-size: 13px;
  line-height: 1;
  text-align: right;
}

.ammo-hud.is-weapon-shotgun .ammo-hud__count {
  color: #8ddeae;
}

.ammo-hud.is-empty .ammo-hud__icon,
.ammo-hud.is-empty .ammo-hud__count {
  opacity: 0.52;
}

.ammo-hud__pickup {
  position: absolute;
  top: calc(100% + 4px);
  right: 8px;
  color: #c8c8c8;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity 180ms ease,
    transform 280ms ease;
}

.ammo-hud__pickup.is-visible {
  opacity: 1;
  transform: translateY(-3px);
}

body.is-runtime-mobile .weapon-slot-hud {
  position: fixed;
  z-index: 8;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  left: 50%;
  transform: translateX(-50%);
}

body.is-runtime-mobile .weapon-slot {
  min-width: 66px;
  justify-content: center;
  padding: 7px 8px;
}

body.is-runtime-mobile .weapon-slot__key,
body.is-runtime-mobile .weapon-slot__label {
  display: none;
}

body.is-runtime-mobile .options-gear-button {
  position: absolute;
  z-index: 8;
  top: calc(env(safe-area-inset-top) + 54px);
  left: calc(env(safe-area-inset-left) + 16px);
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgb(224 208 133 / 34%);
  border-radius: 7px;
  background: rgb(12 12 10 / 72%);
  color: #f3efe1;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

body.is-runtime-mobile .options-gear-button:focus-visible {
  outline: 1px solid rgb(224 208 133 / 74%);
  outline-offset: 3px;
}

.corpse-search-button {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(224 208 133 / 42%);
  border-radius: 999px;
  padding: 7px 12px 7px 8px;
  background: rgb(12 12 10 / 72%);
  color: #f3efe1;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 10px 28px rgb(0 0 0 / 38%);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transform: translateX(-50%);
  pointer-events: auto;
  touch-action: none;
}

.corpse-search-button[hidden] {
  display: none;
}

.corpse-search-button__key {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 50%;
  background: rgb(255 255 255 / 9%);
  color: #e4d383;
  font-size: 12px;
}

.corpse-search-button__label {
  white-space: nowrap;
}

body.is-runtime-mobile .corpse-search-button {
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  padding: 11px 16px;
  font-size: 12px;
}

body.is-runtime-mobile .corpse-search-button__key {
  display: none;
}

.damage-flash {
  position: absolute;
  z-index: 4;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgb(255 42 32 / 0%) 0 38%, rgb(255 42 32 / 28%) 100%),
    linear-gradient(180deg, rgb(255 42 32 / 12%), rgb(255 42 32 / 0%) 42%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.stage-banner {
  position: absolute;
  z-index: 6;
  top: calc(env(safe-area-inset-top) + 54px);
  left: 50%;
  min-width: 112px;
  border: 1px solid rgb(224 208 133 / 42%);
  border-radius: 7px;
  padding: 8px 12px;
  background: rgb(12 12 10 / 76%);
  color: #f3efe1;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.stage-banner.is-countdown {
  top: 50%;
  color: #e4b83a;
  font-size: 34px;
  transform: translate(-50%, -50%);
}

.run-summary-modal {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 18px);
  background: rgb(0 0 0 / 52%);
  pointer-events: auto;
}

.run-summary-card {
  position: relative;
  width: min(92%, 470px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 36px);
  overflow: auto;
  border: 1px solid rgb(224 208 133 / 30%);
  border-radius: 8px;
  padding: 20px;
  background: rgb(8 8 7 / 78%);
  color: #f3efe1;
  box-shadow: 0 24px 70px rgb(0 0 0 / 58%);
  backdrop-filter: blur(12px);
}

.run-summary-title {
  margin: 0 0 16px;
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.run-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.2;
}

.run-summary-table th,
.run-summary-table td {
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  padding: 8px 6px;
  text-align: right;
  white-space: nowrap;
}

.run-summary-table th:first-child,
.run-summary-table td:first-child {
  text-align: left;
}

.run-summary-table th {
  color: rgb(243 239 225 / 68%);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.run-summary-table tbody tr:last-child td {
  border-bottom: 0;
  padding-top: 11px;
  color: #ffffff;
  font-weight: 900;
}

.run-summary-record {
  color: #ffffff;
}

.run-summary-table td.run-summary-record.is-new-record {
  color: #77d98c;
}

.run-summary-back-button {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgb(224 208 133 / 28%);
  border-radius: 7px;
  background: rgb(18 18 15 / 78%);
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.run-summary-back-button[hidden] {
  display: none;
}

.run-summary-back-button:focus-visible,
.run-summary-back-button:hover {
  border-color: rgb(224 208 133 / 68%);
  background: rgb(68 67 48 / 92%);
  outline: none;
}

.run-record-time-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: right;
  text-transform: inherit;
}

.run-record-time-link:focus-visible,
.run-record-time-link:hover {
  color: #ffffff;
  outline: none;
}

.run-record-time-link__icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgb(224 208 133 / 38%);
  border-radius: 6px;
  background: rgb(18 18 15 / 62%);
  color: #f3efe1;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.run-record-time-link:focus-visible .run-record-time-link__icon,
.run-record-time-link:hover .run-record-time-link__icon {
  border-color: rgb(224 208 133 / 68%);
  background: rgb(68 67 48 / 92%);
}

.run-nickname-form {
  display: grid;
  gap: 12px;
}

.run-nickname-field {
  display: grid;
  gap: 8px;
}

.run-nickname-field__label {
  color: rgb(243 239 225 / 74%);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.run-nickname-field__input {
  width: min(100%, 180px);
  justify-self: center;
  border: 1px solid rgb(224 208 133 / 34%);
  border-radius: 7px;
  padding: 11px 12px;
  background: rgb(10 10 8 / 72%);
  color: #ffffff;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}

.run-nickname-field__input:focus {
  border-color: rgb(224 208 133 / 68%);
}

.run-nickname-form__status {
  min-height: 14px;
  margin: 0;
  color: rgb(243 239 225 / 66%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.run-nickname-form__button {
  justify-self: center;
}

.record-time-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 12px;
}

.record-time-tab {
  min-width: 0;
  min-height: 32px;
  border: 1px solid rgb(224 208 133 / 20%);
  border-radius: 7px;
  padding: 7px 5px;
  background: rgb(18 18 15 / 68%);
  color: rgb(243 239 225 / 68%);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.record-time-tab.is-active {
  border-color: rgb(224 208 133 / 62%);
  background: rgb(68 67 48 / 78%);
  color: #ffffff;
}

.record-time-tab:focus-visible,
.record-time-tab:hover {
  border-color: rgb(224 208 133 / 68%);
  outline: none;
}

.record-time-table th:first-child,
.record-time-table td:first-child {
  width: 42px;
}

.record-time-table tbody tr:last-child td {
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  padding: 8px 6px;
  color: #f3efe1;
  font-weight: 900;
}

.record-time-table th:nth-child(2),
.record-time-table td:nth-child(2) {
  text-align: left;
}

.record-time-status {
  min-height: 14px;
  margin: 10px 0 0;
  color: rgb(243 239 225 / 62%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.run-summary-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.run-summary-button {
  min-width: 112px;
  border: 1px solid rgb(224 208 133 / 36%);
  border-radius: 7px;
  padding: 10px 14px;
  background: rgb(48 49 38 / 88%);
  color: #f3efe1;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.run-summary-button:focus-visible,
.run-summary-button:hover {
  border-color: rgb(224 208 133 / 68%);
  background: rgb(68 67 48 / 92%);
  outline: none;
}

.run-summary-button--secondary {
  background: rgb(18 18 15 / 78%);
  color: rgb(243 239 225 / 76%);
}

.phone-shell.is-player-hit .damage-flash {
  opacity: 1;
  transition-duration: 45ms;
}

.crosshair {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.94);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    visibility 120ms ease;
  visibility: hidden;
}

.crosshair.is-visible {
  opacity: 0.9;
  transform: translate(-50%, -50%) scale(1);
  visibility: visible;
}

.crosshair::before {
  position: absolute;
  inset: -11px;
  border: 2px solid rgb(243 239 225 / 82%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 68%), 0 0 14px rgb(0 0 0 / 74%);
  content: "";
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.crosshair.is-shotgun::before {
  opacity: 1;
  transform: scale(1);
}

.crosshair.is-shotgun .crosshair__arm,
.crosshair.is-shotgun .crosshair__dot {
  opacity: 0;
}

.crosshair__arm,
.crosshair__dot {
  position: absolute;
  display: block;
  background: #f3efe1;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 62%), 0 0 10px rgb(0 0 0 / 72%);
}

.crosshair__arm {
  border-radius: 999px;
}

body.is-runtime-mobile .crosshair.is-visible .crosshair__arm {
  opacity: 0;
  transition: opacity 90ms ease;
}

body.is-runtime-mobile .crosshair.is-firing .crosshair__arm {
  opacity: 1;
}

.crosshair__arm--top,
.crosshair__arm--bottom {
  left: 50%;
  width: 2px;
  height: 10px;
  transform: translateX(-50%);
}

.crosshair__arm--top {
  top: 0;
}

.crosshair__arm--bottom {
  bottom: 0;
}

.crosshair__arm--left,
.crosshair__arm--right {
  top: 50%;
  width: 10px;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair__arm--left {
  left: 0;
}

.crosshair__arm--right {
  right: 0;
}

.crosshair__dot {
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e4d383;
  transform: translate(-50%, -50%);
}

.crosshair.is-firing {
  opacity: 1;
  transform: translate(-50%, -50%) scale(0.88);
}

.crosshair.is-firing .crosshair__arm,
.crosshair.is-firing .crosshair__dot {
  background: #ffd2c8;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 68%), 0 0 14px rgb(255 116 89 / 42%);
}

.crosshair.is-shotgun.is-firing::before {
  border-color: rgb(255 210 200 / 90%);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 68%), 0 0 18px rgb(255 116 89 / 36%);
}

body.is-runtime-mobile .mobile-joystick {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  display: block;
  width: 118px;
  height: 118px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition:
    opacity 90ms ease,
    transform 90ms ease;
}

body.is-runtime-mobile .mobile-joystick.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.mobile-joystick__base,
.mobile-joystick__stick {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.mobile-joystick__base {
  inset: 0;
  border: 1px solid rgb(243 239 225 / 28%);
  background: rgb(6 7 7 / 34%);
  box-shadow:
    inset 0 0 0 2px rgb(0 0 0 / 30%),
    0 10px 28px rgb(0 0 0 / 34%);
  backdrop-filter: blur(8px);
}

.mobile-joystick__stick {
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border: 1px solid rgb(255 241 193 / 48%);
  background:
    radial-gradient(circle at 38% 32%, rgb(255 255 255 / 36%), rgb(255 241 193 / 18%) 30%, rgb(26 26 22 / 72%) 72%);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 50%),
    0 0 24px rgb(228 211 131 / 16%);
  transform: translate(-50%, -50%);
}

body.is-runtime-mobile .mobile-fire-button {
  position: absolute;
  z-index: 5;
  right: calc(env(safe-area-inset-right) + 26px);
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 1px solid rgb(255 210 200 / 44%);
  border-radius: 50%;
  padding: 0;
  background:
    radial-gradient(circle at 50% 50%, rgb(255 210 200 / 24%) 0 20%, transparent 21%),
    rgb(23 15 13 / 62%);
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 5%),
    0 0 0 1px rgb(0 0 0 / 48%),
    0 12px 32px rgb(0 0 0 / 40%);
  backdrop-filter: blur(8px);
  cursor: pointer;
  touch-action: none;
}

body.is-runtime-mobile .mobile-fire-button::before,
body.is-runtime-mobile .mobile-fire-button::after {
  position: absolute;
  content: "";
}

body.is-runtime-mobile .mobile-fire-button::before {
  width: 36px;
  height: 36px;
  border: 2px solid #ffd2c8;
  border-radius: 50%;
  box-shadow: 0 0 14px rgb(255 116 89 / 32%);
}

body.is-runtime-mobile .mobile-fire-button::after {
  width: 54px;
  height: 54px;
  background:
    linear-gradient(#ffd2c8, #ffd2c8) center / 2px 54px no-repeat,
    linear-gradient(90deg, #ffd2c8, #ffd2c8) center / 54px 2px no-repeat;
  box-shadow: 0 0 12px rgb(255 116 89 / 34%);
}

body.is-runtime-mobile .mobile-fire-button.is-firing {
  border-color: rgb(255 241 193 / 78%);
  background:
    radial-gradient(circle at 50% 50%, rgb(255 241 193 / 34%) 0 24%, transparent 25%),
    rgb(54 27 20 / 72%);
  transform: scale(0.96);
}

.rank-panel {
  display: grid;
  gap: 8px;
}

.control-field {
  display: grid;
  grid-template-columns: minmax(0, 82px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.control-field span,
.movement-status,
.weapon-status {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-field > span:first-child {
  color: #e4d383;
}

.control-field select {
  min-width: 0;
  width: 100%;
  height: 36px;
  border: 1px solid rgb(224 208 133 / 28%);
  border-radius: 7px;
  padding: 0 10px;
  background: #1f211f;
  color: #f3efe1;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.control-field select:focus {
  border-color: rgb(228 211 131 / 72%);
}

.control-field select:disabled {
  color: rgb(243 239 225 / 45%);
}

.range-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 8px;
}

.range-control input {
  min-width: 0;
  width: 100%;
  accent-color: #e4d383;
}

.range-control output {
  color: rgb(243 239 225 / 72%);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 158px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.copy-row button {
  min-width: 0;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px;
  padding: 0 10px;
  background: #2a2b25;
  color: #f3efe1;
  font: inherit;
  font-size: 12px;
  line-height: 1;
}

.copy-row button:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.copy-row button:disabled {
  color: rgb(243 239 225 / 42%);
}

.color-panel {
  display: grid;
  gap: 8px;
}

.palette-row {
  display: grid;
  grid-template-columns: minmax(0, 84px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.palette-row > span:first-child {
  overflow: hidden;
  color: #e4d383;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-controls {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
}

.palette-color-input {
  width: 36px;
  height: 36px;
  min-width: 0;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px 0 0 7px;
  padding: 0;
  background: var(--swatch);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.palette-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.palette-color-input::-webkit-color-swatch {
  border: 0;
}

.palette-hex-input {
  min-width: 0;
  width: 100%;
  height: 36px;
  border: 1px solid rgb(224 208 133 / 28%);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  padding: 0 10px;
  background: #1f211f;
  color: #f3efe1;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  outline: none;
  text-transform: uppercase;
}

.palette-hex-input:focus,
.palette-color-input:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.palette-hex-input.is-invalid {
  border-color: rgb(255 116 89 / 58%);
  color: #ffd2c8;
}

.color-actions {
  display: grid;
  grid-template-columns: 0.84fr 1fr;
  gap: 8px;
}

.color-actions button {
  min-width: 0;
  height: 34px;
  border: 1px solid rgb(224 208 133 / 32%);
  border-radius: 7px;
  padding: 0 10px;
  background: #2a2b25;
  color: #f3efe1;
  font: inherit;
  font-size: 12px;
  line-height: 1;
}

.color-actions button:focus {
  border-color: rgb(228 211 131 / 72%);
  outline: none;
}

.movement-status,
.weapon-status {
  margin: 0;
  color: rgb(243 239 225 / 72%);
}

.status {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%);
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

body.is-scene-loading .status {
  z-index: 18;
  inset: 0;
  display: grid;
  place-items: center;
  width: auto;
  max-width: none;
  border: 0;
  border-radius: 0;
  padding: 24px;
  overflow: hidden;
  isolation: isolate;
  background: #050505 var(--loading-screen-image, url("./assets/load-screen-1.webp")) center / cover no-repeat;
  color: #f3efe1;
  font-size: clamp(1rem, 2.8vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  backdrop-filter: none;
  transform: none;
}

body.load-screen--1 {
  --loading-screen-image: url("./assets/load-screen-1.webp");
}

body.load-screen--2 {
  --loading-screen-image: url("./assets/load-screen-2.webp");
}

body.is-scene-loading .status::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(180deg, rgb(0 0 0 / 20%) 0%, rgb(0 0 0 / 4%) 42%, rgb(0 0 0 / 58%) 100%),
    radial-gradient(ellipse at center, rgb(0 0 0 / 0%) 0 42%, rgb(0 0 0 / 42%) 100%);
  pointer-events: none;
}

body.is-scene-loading .status__text {
  position: relative;
  padding: 10px 16px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 7px;
  background: rgb(0 0 0 / 52%);
  box-shadow: 0 12px 34px rgb(0 0 0 / 36%);
  text-shadow: 0 0 18px rgb(243 239 225 / 34%);
  animation: loadingTextPulse 1.35s ease-in-out infinite;
}

@keyframes loadingTextPulse {
  0%,
  100% {
    opacity: 0.58;
  }

  50% {
    opacity: 1;
  }
}

.status.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.status.is-error {
  border-color: rgb(255 116 89 / 45%);
  color: #ffd2c8;
}

@media (max-width: 1020px) {
  body {
    padding: 10px;
  }

  .dev-layout {
    width: 100%;
    gap: 10px;
  }

  .phone-shell {
    width: 100%;
    height: auto;
    border-radius: 0;
  }

  .dev-panel {
    border-radius: 0;
    box-shadow: none;
  }

  .dev-side-stack {
    gap: 10px;
  }

  .map-scroll {
    width: min(100%, 260px);
  }
}

@media (max-height: 680px) {
  .phone-shell {
    min-height: 0;
  }
}

@media (min-width: 760px) {
  .tile-editor-panel .tile-editor {
    grid-template-columns: minmax(280px, 0.72fr) minmax(420px, 1.28fr);
  }

  .tile-editor-panel .map-scroll {
    width: min(100%, 480px);
  }
}

@media (min-width: 1120px) {
  .tile-editor-panel .map-scroll {
    width: min(100%, 520px);
  }
}
