:root {
  color-scheme: dark;
  --bg: #242116;
  --panel: rgba(19, 21, 17, 0.86);
  --panel-strong: rgba(14, 15, 13, 0.96);
  --line: rgba(239, 233, 211, 0.22);
  --text: #f7f1dc;
  --muted: #c2baa0;
  --gold: #f2c14e;
  --green: #7cc96f;
  --cyan: #6cc6d9;
  --red: #e15a45;
  --ink: #11120e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  touch-action: none;
  user-select: none;
}

button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(247, 241, 220, 0.22);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(247, 241, 220, 0.08);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  border-color: rgba(247, 241, 220, 0.42);
  background: rgba(247, 241, 220, 0.14);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
#game:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #242116;
}

.hud {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.stats,
.actions,
.side-panel,
.screen,
.touch-pad,
.touch-actions {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, auto));
  order: 1;
  overflow: hidden;
  margin-left: 208px;
  background: rgba(19, 21, 17, 0.76);
}

.stat {
  min-width: 58px;
  padding: 5px 7px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  display: block;
  min-height: 18px;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 5px;
  order: 2;
  margin-left: auto;
  padding: 4px;
  pointer-events: auto;
}

.actions button {
  min-width: 40px;
  min-height: 36px;
  padding: 0 9px;
  font-size: 14px;
  line-height: 1;
}

#soundButton[aria-pressed="false"] {
  color: var(--muted);
  background: rgba(247, 241, 220, 0.03);
  opacity: 0.72;
}

#panelButton {
  display: none;
}

.side-panel {
  position: fixed;
  bottom: 18px;
  z-index: 5;
  width: 150px;
  max-height: min(72vh, 500px);
  padding: 8px;
  overflow: hidden auto;
  background: rgba(19, 21, 17, 0.78);
}

.level-panel {
  right: 12px;
  display: flex;
  overflow: hidden;
  width: 184px;
  max-height: min(calc(100vh - 82px), 760px);
  flex-direction: column;
}

.level-panel > .side-section:first-child {
  min-height: 100px;
  overflow: hidden auto;
  padding-right: 2px;
}

.level-panel > .inventory-section {
  flex: 0 0 auto;
}

.power-panel {
  left: 12px;
  width: 204px;
}

.side-section + .side-section {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.side-section h2 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.level-button {
  display: grid;
  min-width: 0;
  min-height: 36px;
  padding: 3px;
  place-items: center;
  border-color: rgba(247, 241, 220, 0.16);
  background: rgba(247, 241, 220, 0.07);
  line-height: 1;
}

.level-button.active {
  border-color: rgba(242, 193, 78, 0.72);
  color: var(--ink);
  background: var(--gold);
}

.level-divider {
  grid-column: 1 / -1;
  margin: 6px 0 1px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-button:disabled {
  border-color: rgba(247, 241, 220, 0.08);
  color: rgba(247, 241, 220, 0.34);
  background: rgba(8, 9, 7, 0.35);
  cursor: not-allowed;
  opacity: 1;
}

.mode-button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 5px;
  padding: 3px 8px;
  border-color: rgba(108, 198, 217, 0.32);
  background: rgba(108, 198, 217, 0.08);
  font-size: 10px;
  line-height: 1;
}

.mode-button[aria-pressed="true"] {
  border-color: rgba(108, 198, 217, 0.86);
  color: var(--ink);
  background: var(--cyan);
}

.mode-symbol {
  font-size: 20px;
  font-weight: 950;
}

.monster-symbol {
  font-size: 15px;
}

.event-status {
  margin-top: 6px;
  padding: 6px 7px;
  border: 1px solid rgba(242, 193, 78, 0.45);
  border-radius: 5px;
  color: var(--gold);
  background: rgba(242, 193, 78, 0.08);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.combo-status {
  margin-top: 6px;
  padding: 6px 7px;
  border: 1px solid rgba(225, 90, 69, 0.54);
  border-radius: 5px;
  color: #fff0c4;
  background: rgba(225, 90, 69, 0.16);
  font-size: 9px;
  font-weight: 950;
  line-height: 1.2;
  text-align: center;
}

.combo-status.hot {
  border-color: rgba(255, 210, 102, 0.9);
  color: #fff7d2;
  background: rgba(185, 63, 38, 0.34);
}

.level-number {
  font-size: 15px;
  font-weight: 950;
}

.level-name {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 8px;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0;
}

.inventory-list {
  display: grid;
  gap: 3px;
}

.inventory-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  padding: 2px 3px 2px 0;
  border-left: 2px solid transparent;
  border-radius: 5px;
  color: rgba(247, 241, 220, 0.48);
  opacity: 0.62;
}

.inventory-row.active {
  border-left-color: rgba(242, 193, 78, 0.72);
  color: var(--text);
  opacity: 1;
  background: rgba(247, 241, 220, 0.06);
}

.inventory-row:not(.active) {
  display: none;
}

.inventory-row .power-icon {
  width: 24px;
  height: 24px;
}

.inventory-row .power-icon.sprite-icon img {
  width: 30px;
  height: 30px;
}

.inventory-name {
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
}

.inventory-row.active .inventory-count {
  color: var(--gold);
}

.power-list {
  display: grid;
  gap: 2px;
  margin: 0;
}

.power-row {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}

.power-row dt {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.power-row dt span:last-child,
.power-row strong,
.power-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.power-row strong {
  color: var(--text);
  font-size: 11px;
  line-height: 1.1;
}

.power-row small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.05;
}

.power-panel .power-icon {
  width: 25px;
  height: 25px;
}

.power-panel .power-icon.sprite-icon img {
  width: 31px;
  height: 31px;
}

.power-row dd {
  min-width: 24px;
  margin: 0;
  color: var(--gold);
  font-weight: 950;
  text-align: right;
}

.power-icon {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 2px solid rgba(247, 241, 220, 0.18);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, rgba(92, 84, 64, 0.94), rgba(36, 33, 27, 0.96));
  box-shadow: inset 0 2px 5px rgba(255, 238, 189, 0.09), 0 4px 8px rgba(0, 0, 0, 0.22);
}

.power-icon.heart {
  border-color: rgba(242, 109, 125, 0.72);
}

.power-icon.heart::before,
.power-icon.heart::after {
  position: absolute;
  top: 5px;
  width: 9px;
  height: 13px;
  border-radius: 9px 9px 3px 3px;
  background: #f26d7d;
  content: "";
}

.power-icon.heart::before {
  left: 5px;
  transform: rotate(-38deg);
}

.power-icon.heart::after {
  right: 5px;
  transform: rotate(38deg);
}

.power-icon.shield {
  border-radius: 50% 50% 46% 46%;
  border-color: rgba(108, 198, 217, 0.72);
}

.power-icon.shield::before {
  position: absolute;
  left: 5px;
  top: 3px;
  width: 12px;
  height: 15px;
  border-radius: 8px 8px 9px 9px;
  background: var(--cyan);
  clip-path: polygon(50% 0, 100% 22%, 88% 76%, 50% 100%, 12% 76%, 0 22%);
  content: "";
}

.power-icon.teleport {
  border-color: rgba(242, 193, 78, 0.76);
}

.power-icon.teleport::before {
  position: absolute;
  inset: 4px;
  border: 3px solid var(--gold);
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
}

.power-icon.range {
  border-color: rgba(108, 198, 217, 0.68);
  border-radius: 4px;
  transform: rotate(45deg);
}

.power-icon.range::before {
  position: absolute;
  inset: 5px;
  border-radius: 2px;
  background: var(--cyan);
  content: "";
}

.power-icon.bomb-slot,
.power-icon.charge-small,
.power-icon.charge-medium,
.power-icon.charge-large {
  border-color: rgba(247, 241, 220, 0.28);
}

.power-icon.bomb-slot::before,
.power-icon.charge-small::before,
.power-icon.charge-medium::before,
.power-icon.charge-large::before {
  position: absolute;
  left: 5px;
  top: 7px;
  width: 12px;
  height: 11px;
  border-radius: 50%;
  background: #2e322d;
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.25), inset 2px 2px 3px rgba(255, 255, 255, 0.1);
  content: "";
}

.power-icon.bomb-slot::after,
.power-icon.charge-small::after,
.power-icon.charge-medium::after,
.power-icon.charge-large::after {
  position: absolute;
  left: 12px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-top: 2px solid #f4d58a;
  border-right: 2px solid #f4d58a;
  border-radius: 0 6px 0 0;
  content: "";
}

.power-icon.bomb-slot::before {
  background: #4a5149;
}

.power-icon.charge-small {
  border-color: rgba(225, 90, 69, 0.72);
}

.power-icon.charge-small::before {
  background: #e15a45;
}

.power-icon.charge-medium {
  border-color: rgba(242, 193, 78, 0.72);
}

.power-icon.charge-medium::before {
  background: var(--gold);
}

.power-icon.charge-large {
  border-color: rgba(108, 198, 217, 0.74);
}

.power-icon.charge-large::before {
  background: var(--cyan);
}

.power-icon.boots {
  border-color: rgba(124, 201, 111, 0.72);
  border-radius: 6px;
}

.power-icon.boots::before {
  position: absolute;
  left: 5px;
  top: 9px;
  width: 14px;
  height: 5px;
  border-radius: 5px 5px 3px 3px;
  background: #ecf6cf;
  content: "";
}

.power-icon.sprite-icon {
  overflow: visible;
}

.power-icon.sprite-icon::before,
.power-icon.sprite-icon::after {
  content: none;
}

.power-icon.sprite-icon img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.power-icon.sprite-icon.range,
.power-icon.sprite-icon.boots {
  border-radius: 50%;
  transform: none;
}

.power-icon.special-charge {
  display: grid;
  border-width: 2px;
  border-style: solid;
  border-radius: 50%;
  place-items: center;
  color: #f7f1dc;
  background: #242824;
  font-size: 11px;
  font-weight: 950;
}

.power-icon.special-charge.lure { border-color: #7cc96f; color: #7cc96f; }
.power-icon.special-charge.remote { border-color: #f2c14e; color: #f2c14e; }
.power-icon.special-charge.chain { border-color: #e15a45; color: #e15a45; }
.power-icon.special-charge.frost { border-color: #8de6f2; color: #8de6f2; }
.power-icon.special-charge.drill { border-color: #d89a55; color: #d89a55; }

.power-icon.utility-power {
  display: grid;
  border-width: 2px;
  border-style: solid;
  place-items: center;
  font-size: 11px;
  font-weight: 950;
}

.power-icon.utility-power.shockwave { border-color: #f29a5b; color: #ffd09a; }
.power-icon.utility-power.timebubble { border-color: #84d8dc; color: #bff7f4; }
.power-icon.utility-power.twinbomb { border-color: #d8b3ef; color: #ead6f5; }

.power-icon.shield,
.power-icon.teleport {
  border-color: rgba(247, 241, 220, 0.18);
}

.power-icon.shield::before,
.power-icon.teleport::before {
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.72;
}

.power-icon.shield {
  color: var(--cyan);
}

.power-icon.shield::after {
  position: absolute;
  left: 7px;
  top: 4px;
  width: 16px;
  height: 22px;
  border-radius: 12px 12px 13px 13px;
  background: rgba(108, 198, 217, 0.24);
  clip-path: polygon(50% 0, 100% 18%, 88% 72%, 50% 100%, 12% 72%, 0 18%);
  box-shadow: inset 0 0 0 5px var(--cyan);
  content: "";
}

.power-icon.teleport {
  color: var(--gold);
}

.power-icon.teleport::after {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--cyan);
  border-right-color: transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(242, 193, 78, 0.85);
  content: "";
  transform: rotate(-22deg);
}

.primary {
  border-color: rgba(247, 241, 220, 0.36);
  color: var(--ink);
  background: var(--gold);
}

.primary:hover {
  color: var(--ink);
  background: #ffd96f;
}

.screen {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 22px;
  background: var(--panel-strong);
}

.screen[hidden] {
  display: none;
}

.title-art {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(34vh, 300px);
  margin: 0 0 14px;
  border: 1px solid rgba(247, 241, 220, 0.18);
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
}

.title-art[hidden] {
  display: none;
}

.screen h1 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: clamp(30px, 7vw, 50px);
  line-height: 0.98;
  letter-spacing: 0;
}

.screen p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.character-switcher {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
}

.character-switcher h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.figure-choices {
  display: flex;
  gap: 3px;
}

.figure-choice {
  display: grid;
  width: 62px;
  min-width: 62px;
  height: 54px;
  min-height: 54px;
  grid-template-rows: 34px 14px;
  place-items: center;
  gap: 0;
  padding: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  text-align: center;
}

.figure-choice > span:last-child {
  width: 100%;
  max-height: 16px;
  overflow: hidden;
  line-height: 1;
  overflow-wrap: anywhere;
}

.figure-choice[aria-pressed="true"] {
  border-color: rgba(242, 193, 78, 0.82);
  color: var(--text);
  background: rgba(242, 193, 78, 0.14);
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.18);
}

.figure-preview {
  position: relative;
  display: block;
  width: 58px;
  height: 66px;
  overflow: hidden;
  align-self: start;
  transform: scale(0.5);
  transform-origin: center top;
}

.figure-preview .figure-head,
.figure-preview .figure-body {
  position: absolute;
  left: 50%;
  display: block;
  transform: translateX(-50%);
}

.figure-preview .figure-head {
  z-index: 2;
  top: 7px;
  width: 30px;
  height: 29px;
  border-radius: 48% 48% 46% 46%;
  background: #efbd8d;
}

.figure-preview .figure-body {
  bottom: 2px;
  width: 38px;
  height: 34px;
  border-radius: 11px 11px 7px 7px;
}

.figure-preview.laurin .figure-head::before {
  position: absolute;
  left: -1px;
  top: -5px;
  width: 32px;
  height: 17px;
  border-radius: 50% 50% 38% 42%;
  background: #67452e;
  content: "";
}

.figure-preview.laurin .figure-head::after {
  position: absolute;
  left: 7px;
  top: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2f76b7;
  box-shadow: 11px 0 #2f76b7;
  content: "";
}

.figure-preview.laurin .figure-body {
  background: linear-gradient(#8bd277, #3f8e48);
}

.figure-preview.doktor-bumm .figure-head {
  top: 8px;
  width: 31px;
  height: 30px;
}

.figure-preview.doktor-bumm .figure-head::before {
  position: absolute;
  left: -1px;
  top: -7px;
  width: 33px;
  height: 16px;
  border-radius: 48% 52% 38% 42%;
  background: #3f3028;
  content: "";
  transform: rotate(-5deg);
}

.figure-preview.doktor-bumm .figure-head::after {
  position: absolute;
  left: 4px;
  top: 12px;
  width: 8px;
  height: 8px;
  border: 2px solid #b77937;
  border-radius: 50%;
  box-shadow: 13px 0 0 -2px #efbd8d, 13px 0 0 0 #b77937;
  content: "";
}

.figure-preview.doktor-bumm .figure-body {
  width: 42px;
  background: linear-gradient(#4d9b93, #315e60);
}

.figure-preview.oma .figure-head {
  top: 8px;
  width: 32px;
  height: 30px;
}

.figure-preview.oma .figure-head::before {
  position: absolute;
  left: -5px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d9d2bd;
  box-shadow: 10px -4px #ebe5d2, 20px -2px #d9d2bd, 28px 3px #c7bea7;
  content: "";
}

.figure-preview.oma .figure-head::after {
  position: absolute;
  left: 3px;
  top: 11px;
  width: 9px;
  height: 9px;
  border: 2px solid #9b6c39;
  border-radius: 50%;
  box-shadow: 13px 0 0 -2px #efbd8d, 13px 0 0 0 #9b6c39;
  content: "";
}

.figure-preview.oma .figure-body {
  width: 42px;
  background: linear-gradient(#c45e47, #7e3734);
}

.screen-help {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(247, 241, 220, 0.14);
}

.screen-help[hidden] {
  display: none;
}

.help-column h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.help-column dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.help-column dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 9px;
  align-items: baseline;
}

.help-column:nth-child(2) dl div {
  grid-template-columns: 108px minmax(0, 1fr);
}

.help-column dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.help-column dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.touch-controls {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  display: none;
  grid-template-columns: 154px 1fr 82px;
  align-items: end;
  gap: 12px;
  pointer-events: none;
}

.compact-inventory {
  display: none;
}

.device-touch.device-compact .compact-inventory {
  display: flex;
  min-width: 0;
  align-self: end;
  gap: 3px;
  overflow: hidden auto;
  padding: 4px;
  pointer-events: auto;
  background: rgba(19, 21, 17, 0.82);
}

.compact-inventory .inventory-row.active {
  display: grid;
  min-width: 39px;
  min-height: 38px;
  grid-template-columns: 23px auto;
  gap: 2px;
  padding: 1px 3px;
  border-left: 0;
}

.compact-inventory .inventory-name {
  display: none;
}

.compact-inventory .inventory-row .power-icon {
  width: 22px;
  height: 22px;
}

.compact-inventory .inventory-row .power-icon.sprite-icon img {
  width: 27px;
  height: 27px;
}

.touch-pad,
.touch-actions {
  display: grid;
  gap: 8px;
  padding: 8px;
  pointer-events: auto;
}

.touch-pad > button {
  width: 44px;
  margin: 0 auto;
}

.touch-row {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 8px;
}

.touch-actions {
  place-items: center;
}

.blast-button {
  width: 58px;
  height: 58px;
  border-color: rgba(225, 90, 69, 0.58);
  color: #fff4e2;
  background: rgba(225, 90, 69, 0.34);
  font-size: 26px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (pointer: coarse) {
  .touch-controls {
    display: grid;
  }

  .side-panel {
    bottom: 110px;
    max-height: min(48vh, 320px);
  }
}

.device-touch .touch-controls {
  display: grid;
}

.device-touch .side-panel {
  bottom: 110px;
  max-height: min(48vh, 320px);
}

.device-touch .inventory-section .inventory-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-touch .inventory-section .inventory-row {
  min-height: 24px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 3px;
}

.device-touch .inventory-section .inventory-row .power-icon {
  width: 20px;
  height: 20px;
}

.device-touch .inventory-section .inventory-row .power-icon.sprite-icon img {
  width: 25px;
  height: 25px;
}

.device-touch button {
  touch-action: manipulation;
}

.device-compact .power-panel {
  display: none;
}

.device-touch.device-compact #panelButton {
  display: block;
}

.device-touch.device-compact .level-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 12px));
  transition: opacity 140ms ease, transform 140ms ease;
}

.device-touch.device-compact.mobile-panel-open .level-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.device-low-power .hud,
.device-low-power .character-switcher,
.device-low-power .side-panel,
.device-low-power .screen {
  backdrop-filter: none;
}

@media (max-width: 720px) {
  .hud {
    top: 76px;
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    align-self: flex-end;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, 430px);
    margin-left: 0;
  }

  .stat {
    min-width: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat:nth-child(3) {
    border-right: 0;
  }

  .stat:nth-child(n + 4) {
    border-bottom: 0;
  }

  .actions {
    width: max-content;
  }

  .side-panel {
    width: 138px;
  }

  .level-panel {
    width: 164px;
  }

  .power-panel {
    display: none;
  }

  .screen-help {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .screen {
    top: calc(50% + 31px);
    max-height: calc(100dvh - 76px);
  }

  .help-column dl div {
    grid-template-columns: 80px minmax(0, 1fr);
  }
}

@media (max-width: 440px) {
  .character-switcher {
    left: 8px;
    top: 8px;
  }

  .hud {
    top: 72px;
    left: 8px;
    right: 8px;
    gap: 8px;
  }

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

  .stat:nth-child(2n) {
    border-right: 0;
  }

  .stat:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .label {
    font-size: 10px;
  }

  .value {
    font-size: 18px;
  }

  .touch-controls {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: 154px 1fr 74px;
  }

  .side-panel {
    bottom: 108px;
    width: 126px;
    padding: 6px;
  }

  .level-panel {
    right: 8px;
    width: 148px;
  }

  .power-panel {
    left: 8px;
    width: 168px;
  }

  .level-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .level-button {
    min-height: 34px;
  }

  .level-name {
    display: none;
  }

  .screen {
    padding: 18px;
  }

  .screen h1 {
    font-size: 30px;
  }

  .screen p {
    margin-bottom: 12px;
    font-size: 14px;
  }

  .figure-choice {
    width: 58px;
    min-width: 58px;
  }

  .screen-help {
    margin-bottom: 12px;
    padding: 10px 0;
  }

  .help-column dl {
    gap: 4px;
  }

  .help-column dl div {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 7px;
  }

  .help-column dt,
  .help-column dd {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button:active {
    transform: none;
  }

  .device-touch.device-compact .level-panel {
    transition: none;
  }
}
