:root {
  color-scheme: dark;
  --ink: #f5f1ff;
  --muted: #aaa0b8;
  --panel: rgba(24, 14, 34, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --red: #ff3f56;
  --red-dark: #b71536;
  --violet: #9d4edd;
  --app-height: 100dvh;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  min-height: var(--app-height);
  overflow: hidden;
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(139, 59, 166, 0.24), transparent 38rem),
    linear-gradient(145deg, #0c0811, #1a0e20 65%, #08060c);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button {
  color: inherit;
  font: inherit;
}

.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(1180px, 100%);
  min-width: 0;
  height: var(--app-height);
  min-height: 0;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  direction: ltr;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  transform: rotate(45deg);
  border: 2px solid var(--red);
  box-shadow: 0 0 20px rgba(255, 63, 86, 0.38);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  background: var(--red);
}

.brand-mark::before {
  top: 6px;
  bottom: 6px;
  left: 13px;
  width: 2px;
}

.brand-mark::after {
  top: 13px;
  right: 6px;
  left: 6px;
  height: 2px;
}

.brand div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.brand strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.14em;
}

.brand span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.top-actions {
  display: flex;
  gap: 7px;
  direction: ltr;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.icon-button:active {
  transform: scale(0.93);
}

.shop-button {
  position: relative;
  color: #dba6ff;
}

.shop-button small {
  position: absolute;
  top: -5px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  color: #fff;
  font-size: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  background: linear-gradient(135deg, #8c32b1, #d12e64);
  box-shadow: 0 4px 12px rgba(116, 24, 112, 0.4);
}

.game-shell {
  position: relative;
  align-self: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  max-height: calc(var(--app-height) - 138px);
  margin: auto;
  overflow: hidden;
  aspect-ratio: 8 / 5;
  border: 1px solid rgba(239, 217, 255, 0.16);
  border-radius: clamp(14px, 2vw, 24px);
  background: #1e142d;
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.45),
    0 0 0 5px rgba(255, 255, 255, 0.025),
    inset 0 0 45px rgba(0, 0, 0, 0.3);
}

.canvas-wrap::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 60px rgba(5, 2, 8, 0.3);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  outline: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.splash-screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: #0b0512;
  transition: opacity 700ms ease, visibility 700ms ease;
}

.splash-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.splash-text {
  color: #e8dff0;
  font-size: clamp(22px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 0 34px rgba(216, 67, 215, 0.45);
  animation: splash-glow 2.4s ease-in-out;
}

@keyframes splash-glow {
  0% { opacity: 0; transform: scale(0.94); }
  30% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  width: min(250px, 100%);
}

.menu-button {
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid rgba(216, 67, 215, 0.35);
  border-radius: 4px;
  background: rgba(26, 12, 34, 0.82);
  color: #e6dcee;
  font: inherit;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.menu-button:hover {
  border-color: rgba(255, 63, 86, 0.7);
  background: rgba(50, 18, 44, 0.92);
  transform: translateY(-1px);
}

.menu-button:disabled {
  cursor: default;
  opacity: 0.4;
  transform: none;
}

.menu-exit {
  border-color: rgba(255, 63, 86, 0.4);
}

.pause-overlay,
.about-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 20px;
  text-align: center;
  opacity: 0;
  background: linear-gradient(90deg, rgba(12, 6, 18, 0.9), rgba(20, 8, 25, 0.72));
  transition: opacity 250ms ease, visibility 250ms ease;
}

.pause-overlay.is-open,
.about-overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.pause-card,
.about-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(320px, 100%);
  padding: 22px;
  border: 1px solid rgba(216, 67, 215, 0.25);
  border-radius: 8px;
  background: rgba(16, 8, 22, 0.94);
}

.pause-card h2,
.about-card h2 {
  margin: 0 0 6px;
}

.about-card p {
  margin: 0;
  color: #d6cddc;
  font-size: 13px;
  line-height: 1.9;
}

.about-meta {
  color: var(--muted, #9b8ba8);
  font-size: 11px;
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 26px;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(12, 6, 18, 0.88), rgba(20, 8, 25, 0.58)),
    radial-gradient(circle at 75% 40%, rgba(187, 34, 59, 0.22), transparent 34%);
  transition: opacity 400ms ease, visibility 400ms ease;
}

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

.start-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(500px, 100%);
}

.eyebrow {
  margin-bottom: 8px;
  color: #d4c6dc;
  font-size: clamp(10px, 1.3vw, 13px);
  letter-spacing: 0.08em;
}

.start-card h1 {
  margin: 0;
  direction: ltr;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(54px, 9vw, 108px);
  font-weight: 400;
  line-height: 0.77;
  letter-spacing: 0.015em;
  text-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.start-card h1 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 2px var(--red);
  text-shadow: 0 0 34px rgba(255, 63, 86, 0.18);
}

.start-card p {
  max-width: 430px;
  margin: clamp(16px, 3vw, 28px) 0 18px;
  color: #d6cddc;
  font-size: clamp(11px, 1.6vw, 15px);
  line-height: 1.9;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-width: 190px;
  padding: 13px 24px;
  cursor: pointer;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(100deg, var(--red-dark), var(--red));
  box-shadow: 0 12px 36px rgba(183, 21, 54, 0.35);
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(183, 21, 54, 0.5);
}

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

.primary-button b {
  font-size: 20px;
}

.start-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 16px;
  margin-top: 18px;
  color: var(--muted);
  direction: ltr;
  font-size: 10px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin: 0 2px;
  padding: 0 6px;
  color: #e7deed;
  font-family: Consolas, monospace;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-color: rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
}

.desktop-help {
  display: flex;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  direction: ltr;
  font-size: 11px;
}

.desktop-help > span {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.desktop-help i {
  width: 1px;
  height: 16px;
  margin: 0 12px;
  background: var(--line);
}

.desktop-help .goal-copy {
  margin-left: auto;
  color: #dfd5e5;
  direction: rtl;
}

.touch-controls,
.orientation-gate {
  display: none;
}

.orientation-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  place-content: center;
  justify-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(164, 50, 106, 0.25), transparent 18rem),
    linear-gradient(145deg, #0d0712, #201027);
}

.orientation-gate strong {
  margin-top: 24px;
  font-size: clamp(22px, 7vw, 34px);
}

.orientation-gate p {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.orientation-gate button {
  padding: 11px 19px;
  cursor: pointer;
  border: 1px solid rgba(255, 75, 102, 0.55);
  border-radius: 9px;
  background: rgba(183, 21, 54, 0.24);
}

.phone-rotate {
  position: relative;
  width: 64px;
  height: 104px;
  border: 3px solid var(--red);
  border-radius: 13px;
  box-shadow: 0 0 35px rgba(255, 63, 86, 0.25);
  animation: turn-phone 2.2s ease-in-out infinite;
}

.phone-rotate::before {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 17px;
  height: 3px;
  content: "";
  border-radius: 99px;
  background: var(--red);
  transform: translateX(-50%);
}

.phone-rotate span {
  position: absolute;
  right: -31px;
  bottom: -18px;
  width: 43px;
  height: 43px;
  border-top: 3px solid #dcbbe8;
  border-right: 3px solid #dcbbe8;
  border-radius: 50%;
}

.phone-rotate span::after {
  position: absolute;
  top: -6px;
  right: -5px;
  width: 11px;
  height: 11px;
  content: "";
  border-top: 3px solid #dcbbe8;
  border-right: 3px solid #dcbbe8;
  transform: rotate(15deg);
}

@keyframes turn-phone {
  0%,
  28% {
    transform: rotate(0deg);
  }

  68%,
  100% {
    transform: rotate(90deg);
  }
}

.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), (max-width: 760px) {
  .app {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 38px;
  }

  .brand-mark {
    width: 27px;
    height: 27px;
  }

  .brand-mark::before {
    top: 5px;
    bottom: 5px;
    left: 11px;
  }

  .brand-mark::after {
    top: 11px;
    right: 5px;
    left: 5px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    margin-top: 4px;
    font-size: 8px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .desktop-help {
    display: none;
  }

  .game-shell {
    display: grid;
    grid-template-rows: auto minmax(118px, 1fr);
    align-self: start;
    gap: 8px;
    width: calc(100vw - 28px);
    max-width: 100%;
  }

  .canvas-wrap {
    max-height: none;
  }

  .start-screen {
    padding: 16px;
  }

  .start-controls {
    display: none;
  }

  .touch-controls {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 4px;
    min-height: 118px;
    padding: 4px 2px;
    direction: ltr;
    user-select: none;
    touch-action: none;
  }

  .move-pad,
  .action-pad {
    display: contents;
  }

  .touch-button {
    display: grid;
    place-items: center;
    flex: none;
    width: clamp(52px, 14vw, 64px);
    height: clamp(52px, 14vw, 64px);
    padding: 0;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background:
      radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.12), transparent 45%),
      rgba(38, 25, 49, 0.94);
    box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.22), 0 8px 22px rgba(0, 0, 0, 0.2);
    justify-self: center;
  }

  .touch-button.is-pressed {
    transform: scale(0.9);
    border-color: rgba(255, 255, 255, 0.32);
    background-color: rgba(81, 52, 97, 0.98);
  }

  .move-button {
    color: #e6dcef;
    font-size: 18px;
  }

  .action-button {
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
    color: #f5eefa;
  }

  .action-button span {
    font-size: 9px;
  }

  .action-button b {
    font-size: 20px;
  }

  .jump-button {
    width: clamp(60px, 16vw, 72px);
    height: clamp(60px, 16vw, 72px);
    border-color: rgba(255, 77, 101, 0.5);
    background:
      radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.16), transparent 45%),
      linear-gradient(145deg, #cf2044, #7d122c);
  }

  .attack-button {
    border-color: rgba(170, 102, 220, 0.5);
  }

  .mine-button {
    border-color: rgba(255, 196, 84, 0.5);
  }

}

@media (pointer: coarse) and (orientation: landscape) {
  .app {
    display: block;
    width: min(100%, calc((var(--app-height) - 12px) * 1.6));
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .topbar {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    left: max(18px, env(safe-area-inset-left));
    z-index: 8;
    pointer-events: none;
  }

  .brand {
    display: none;
  }

  .top-actions {
    margin-left: auto;
    pointer-events: auto;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    border-color: rgba(255, 255, 255, 0.17);
    background: rgba(15, 9, 20, 0.56);
    backdrop-filter: blur(5px);
  }

  .game-shell {
    display: block;
    width: 100%;
    max-width: none;
    height: calc(var(--app-height) - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  }

  .canvas-wrap {
    width: auto;
    height: 100%;
    max-height: 100%;
  }

  .touch-controls {
    display: flex;
    position: absolute;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(14px, env(safe-area-inset-left));
    z-index: 5;
    min-height: 84px;
    padding: 0;
    justify-content: space-between;
    pointer-events: none;
  }

  .move-pad,
  .action-pad {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
  }

  .touch-button {
    width: clamp(52px, 11vh, 68px);
    height: clamp(52px, 11vh, 68px);
    opacity: 0.82;
  }

  .jump-button {
    width: clamp(60px, 13vh, 78px);
    height: clamp(60px, 13vh, 78px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .start-screen {
    padding: 10px 90px;
  }

  .start-card {
    width: min(720px, 100%);
  }

  .eyebrow {
    display: none;
  }

  .start-card h1 {
    font-size: clamp(40px, 14vh, 64px);
    line-height: 1;
    white-space: nowrap;
  }

  .start-card h1 br {
    display: none;
  }

  .start-card h1 em {
    margin-left: 10px;
  }

  .start-card p {
    max-width: 600px;
    margin: 9px 0 10px;
    font-size: 11px;
    line-height: 1.55;
  }

  .primary-button {
    min-width: 174px;
    padding: 9px 20px;
  }

  .start-controls {
    display: none;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .orientation-gate {
    display: grid;
  }
}

@media (orientation: portrait) and (max-width: 600px) {
  .orientation-gate {
    display: grid;
  }
}

.orientation-gate.is-required {
  display: grid;
}

.shop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  visibility: hidden;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  opacity: 0;
  background: rgba(5, 2, 9, 0.78);
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.shop-overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.shop-panel {
  width: min(880px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(222, 176, 255, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 0%, rgba(177, 55, 140, 0.2), transparent 19rem),
    linear-gradient(145deg, rgba(31, 16, 39, 0.98), rgba(16, 9, 23, 0.99));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6), inset 0 1px rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
  scrollbar-color: #633570 transparent;
}

.shop-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
}

.shop-header > div:first-child {
  display: flex;
  flex-direction: column;
}

.shop-header > div:first-child span {
  color: #cf8ee8;
  direction: ltr;
  font-family: Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.shop-header h2 {
  margin: 4px 0 0;
  font-size: clamp(23px, 4vw, 34px);
}

.shop-balance {
  min-width: 118px;
  padding: 8px 15px;
  text-align: center;
  border: 1px solid rgba(207, 142, 232, 0.16);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
}

.shop-balance small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.shop-balance strong {
  display: block;
  margin-top: 3px;
  direction: ltr;
  font-size: 19px;
}

.shop-balance i {
  color: #d96cff;
  font-style: normal;
}

.shop-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  font-size: 24px;
}

.shop-intro {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

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

.upgrade-card {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 5px 12px;
  min-width: 0;
  padding: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.upgrade-card::before {
  position: absolute;
  top: -35px;
  right: -35px;
  width: 90px;
  height: 90px;
  content: "";
  opacity: 0.16;
  border-radius: 50%;
  background: var(--card-glow, #a554c5);
  filter: blur(18px);
}

.upgrade-card:hover {
  transform: translateY(-2px);
  border-color: rgba(220, 166, 255, 0.25);
  background: rgba(255, 255, 255, 0.055);
}

.upgrade-card.is-maxed {
  border-color: rgba(92, 201, 137, 0.2);
}

.upgrade-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid color-mix(in srgb, var(--card-glow, #a554c5), white 15%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card-glow, #a554c5), transparent 82%);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--card-glow, #a554c5), transparent 72%);
  font-size: 22px;
}

.power-icon {
  --card-glow: #ff4964;
  color: #ff7186;
}

.health-icon {
  --card-glow: #e54747;
  color: #ff6969;
}

.dash-icon {
  --card-glow: #ffc154;
  color: #ffd16e;
}

.focus-icon {
  --card-glow: #ad62ef;
  color: #cb8cff;
}

.upgrade-copy {
  min-width: 0;
}

.upgrade-copy > span {
  color: #bdaec6;
  font-size: 9px;
}

.upgrade-copy strong {
  display: block;
  margin: 2px 0 4px;
  font-size: 15px;
}

.upgrade-copy p {
  margin: 0;
  overflow: hidden;
  color: #91879a;
  font-size: 9px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-level {
  display: flex;
  grid-column: 2;
  gap: 4px;
}

.upgrade-level i {
  width: 18px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.11);
}

.upgrade-level i.is-filled {
  background: linear-gradient(90deg, #9c45ca, #f14672);
  box-shadow: 0 0 8px rgba(208, 69, 152, 0.45);
}

.upgrade-card > button {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 86px;
  padding: 9px 10px;
  cursor: pointer;
  border: 1px solid rgba(213, 126, 244, 0.25);
  border-radius: 10px;
  background: rgba(145, 57, 177, 0.14);
  font-size: 10px;
}

.upgrade-card > button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shop-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: #d8a9ef;
  text-align: center;
  font-size: 11px;
}

@media (orientation: landscape) and (max-height: 560px) {
  .shop-overlay {
    place-items: stretch center;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .shop-panel {
    width: min(940px, 100%);
    max-height: calc(100dvh - 16px);
    padding: 12px 18px;
    border-radius: 16px;
  }

  .shop-header h2 {
    font-size: 21px;
  }

  .shop-intro {
    margin: 5px 0 9px;
    font-size: 9px;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .upgrade-card {
    grid-template-columns: 43px minmax(0, 1fr) auto;
    min-height: 84px;
    padding: 8px 10px;
  }

  .upgrade-icon {
    width: 39px;
    height: 39px;
    border-radius: 10px;
    font-size: 17px;
  }

  .upgrade-copy strong {
    font-size: 12px;
  }

  .upgrade-copy p {
    font-size: 8px;
  }

  .upgrade-card > button {
    min-width: 72px;
    padding: 7px;
  }

  .shop-message {
    margin-top: 5px;
  }
}

@media (max-width: 620px) and (orientation: portrait) {
  .shop-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .top-actions {
    gap: 4px;
  }

  .icon-button {
    width: 33px;
    height: 33px;
  }

  .touch-controls {
    min-height: 108px;
  }

  .touch-button {
    width: 54px;
    height: 54px;
  }

  .jump-button {
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 350px) {
  .touch-controls {
    min-height: 98px;
  }

  .touch-button {
    width: 48px;
    height: 48px;
  }

  .jump-button {
    width: 56px;
    height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
