/* Layout: full-bleed game canvas; HUD strips top/bottom; panels float over the battlefield. */
:root {
  --steel-950: #0c1118;
  --steel-900: #121a24;
  --steel-850: #18212d;
  --steel-800: #1d2836;
  --steel-700: #283546;
  --steel-600: #34445a;
  --steel-500: #4c6078;
  --line: rgba(205, 225, 245, 0.1);
  --ink: #eef3f7;
  --ink-dim: #9fb1c4;
  --hazard: #f2b632;
  --hazard-hi: #ffd96a;
  --hazard-dark: #a8740f;
  --toxic: #86ff4f;
  --danger: #ff4b3a;
  --ok: #7be35a;
  --cryo: #7fe6ff;
  --display: "Bungee", Impact, "Arial Black", sans-serif;
  --body: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --top-h: 56px;
  --bot-h: 78px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--steel-950);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--body);
}

#game {
  position: fixed;
  inset: 0;
  background: var(--steel-950);
}
#game canvas {
  display: block;
  touch-action: none;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-size: 16px;
}
#ui button,
#ui .interactive {
  pointer-events: auto;
}
#ui button {
  font-family: var(--body);
  color: var(--ink);
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#ui button:focus-visible {
  outline: 3px solid var(--hazard-hi);
  outline-offset: 2px;
}
.safe-probe {
  position: fixed;
  visibility: hidden;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* ---------------- top HUD ---------------- */
#hud-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(var(--top-h) + var(--sat));
  padding: var(--sat) calc(10px + var(--sar)) 0 calc(10px + var(--sal));
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(12, 17, 24, 0.94), rgba(12, 17, 24, 0.72));
  border-bottom: 2px solid rgba(242, 182, 50, 0.35);
}
.hud-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.wave-box {
  flex: 1 1 auto;
  min-width: 0;
}
.wave-tag {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--hazard);
  line-height: 1;
}
.wave-num {
  font-family: var(--display);
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wave-num small {
  font-size: 13px;
  color: var(--ink-dim);
}
.wave-meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 240px;
}
.bar {
  position: relative;
  height: 9px;
  border-radius: 5px;
  background: var(--steel-700);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(180deg, var(--hazard-hi), var(--hazard));
  border-radius: 5px;
  transition: width 0.18s linear;
}
.threats {
  display: flex;
  gap: 3px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
}
.threats img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--steel-700);
  border: 1px solid var(--line);
}
.threats .boss-dot {
  outline: 2px solid var(--danger);
}
.coins {
  font-family: var(--display);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  gap: 6px;
  padding: 3px 12px 3px 6px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 210, 90, 0.25);
  transition: transform 0.08s;
}
.coins img {
  width: 26px;
  height: 26px;
}
.coins.bump {
  transform: scale(1.14);
}
.wall-box {
  flex: 0 1 220px;
  min-width: 110px;
}
.wall-box .bar {
  height: 14px;
  border-radius: 7px;
  flex: 1;
}
.wall-box .bar > i {
  background: linear-gradient(180deg, #9ff07a, #4fb83a);
}
.wall-box.warn .bar > i {
  background: linear-gradient(180deg, #ffd96a, #e08a1a);
}
.wall-box.crit .bar > i {
  background: linear-gradient(180deg, #ff8a6a, #d22a1a);
}
.wall-box.crit .bar {
  animation: critpulse 1.2s ease-in-out infinite;
}
@keyframes critpulse {
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 75, 58, 0.6),
      inset 0 1px 2px rgba(0, 0, 0, 0.6);
  }
}
.wall-box .bar span {
  position: absolute;
  inset: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  color: #0c1118;
  font-variant-numeric: tabular-nums;
}
.wall-icon {
  width: 22px;
  height: 22px;
  flex: none;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--steel-600), var(--steel-800));
  box-shadow:
    0 2px 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #070a0f;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ---------------- bottom HUD ---------------- */
#hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--bot-h) + var(--sab));
  padding: 6px calc(10px + var(--sar)) var(--sab) calc(10px + var(--sal));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(0deg, rgba(12, 17, 24, 0.96), rgba(12, 17, 24, 0.78));
  border-top: 2px solid rgba(242, 182, 50, 0.35);
}
.plate {
  position: relative;
  height: calc(var(--bot-h) - 14px);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--steel-600), var(--steel-800));
  box-shadow:
    0 3px 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  transition:
    transform 0.06s,
    filter 0.15s;
}
.plate:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.plate[disabled],
.plate.off {
  filter: saturate(0.3) brightness(0.75);
}
.plate .lbl {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1;
}
#btn-buy {
  min-width: 150px;
  padding: 0 12px 0 6px;
  background: linear-gradient(180deg, #f8c64a, #c98a14);
  color: #1b1408;
  box-shadow:
    0 3px 0 #6a4806,
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
#btn-buy .lbl {
  color: #3d2a06;
}
#btn-buy img.tw {
  width: calc(var(--bot-h) - 18px);
  height: calc(var(--bot-h) - 18px);
  margin: -4px 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}
#btn-buy .buy-txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
#btn-buy .price {
  font-family: var(--display);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
#btn-buy .price img {
  width: 20px;
  height: 20px;
}
#btn-buy.cant .price {
  color: #7a1a10;
}
#btn-buy.ready {
  animation: buyglow 1.6s ease-in-out infinite;
}
@keyframes buyglow {
  50% {
    box-shadow:
      0 3px 0 #6a4806,
      0 0 0 3px rgba(255, 217, 106, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
}
#btn-buy .lvl-chip {
  position: absolute;
  left: 4px;
  top: 3px;
  font-family: var(--display);
  font-size: 11px;
  background: #1b2230;
  color: var(--hazard-hi);
  border-radius: 6px;
  padding: 1px 5px;
}
.shake {
  animation: shake 0.32s;
}
@keyframes shake {
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}
.ability {
  width: calc(var(--bot-h) - 14px);
  padding: 0;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
}
.ability img,
.ability svg.ico {
  width: 30px;
  height: 30px;
}
.ability .lbl {
  font-size: 11px;
}
.ability .cd {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: conic-gradient(rgba(5, 8, 12, 0.72) var(--p, 0%), transparent 0);
  pointer-events: none;
}
.ability.ready::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  border: 2px solid var(--hazard-hi);
  opacity: 0;
  animation: readyring 0.6s ease-out 1;
}
@keyframes readyring {
  0% {
    opacity: 1;
    transform: scale(0.9);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}
.ability.locked .lockbadge {
  display: flex;
}
.ability.locked > img,
.ability.locked > svg,
.ability.locked > .lbl {
  opacity: 0.12;
}
.lockbadge {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: rgba(8, 12, 18, 0.55);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.1;
}
.lockbadge::before {
  content: "";
  width: 16px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 18'%3E%3Cpath d='M4 8V5.5a4 4 0 0 1 8 0V8h1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1zm2 0h4V5.5a2 2 0 0 0-4 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 18'%3E%3Cpath d='M4 8V5.5a4 4 0 0 1 8 0V8h1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1zm2 0h4V5.5a2 2 0 0 0-4 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.ability.aiming {
  background: linear-gradient(180deg, #ff9a5a, #b4431c);
}
.ability.active {
  background: linear-gradient(180deg, #7fe6ff, #2a7aa8);
}
#btn-shop {
  padding: 0 12px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
#btn-shop svg {
  width: 28px;
  height: 28px;
}
#btn-shop .dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px #121a24;
  display: none;
}
#btn-shop.has .dot {
  display: block;
}
#recycle-bin {
  position: absolute;
  left: calc(50% - 29px);
  bottom: calc(var(--sab) + 8px);
  width: 52px;
  height: 42px;
  border-radius: 18px;
  border: 3px dashed rgba(255, 255, 255, 0.45);
  background: rgba(12, 17, 24, 0.85);
  display: grid;
  place-items: center;
  color: var(--ink);
  transition:
    transform 0.12s,
    background 0.1s,
    border-color 0.1s,
    opacity 0.15s;
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
}
#recycle-bin svg {
  width: 34px;
  height: 34px;
}
#recycle-bin.hot {
  background: rgba(255, 75, 58, 0.45);
  border-color: var(--danger);
  transform: scale(1.15);
  color: #fff;
}
#recycle-bin.show {
  opacity: 1;
  transform: none;
}
#recycle-bin.show.hot {
  transform: scale(1.15);
}
#ui.dragging #hud-bottom {
  visibility: hidden;
}
.spacer {
  flex: 1 1 auto;
}
#btn-speed {
  width: 46px;
  padding: 0;
  justify-content: center;
  font-family: var(--display);
  font-size: 16px;
}
#btn-call {
  position: absolute;
  right: calc(12px + var(--sar));
  bottom: calc(var(--bot-h) + var(--sab) + 12px);
  height: 52px;
  padding: 0 16px;
  flex-direction: row;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #ff7a5a, #b8341c);
  box-shadow:
    0 3px 0 #5a1608,
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: callin 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes callin {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
}
#btn-call .big {
  font-family: var(--body);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#btn-call .lbl {
  color: #ffe0d6;
  font-size: 14px;
}

/* portrait: two-row top bar and a compact bottom bar */
.portrait #hud-top {
  flex-wrap: wrap;
  align-content: center;
  row-gap: 4px;
  column-gap: 8px;
  padding-top: calc(var(--sat) + 4px);
}
.portrait .wave-box {
  order: 1;
  flex: 1 1 0;
}
.portrait .coins {
  order: 2;
}
.portrait #btn-pause {
  order: 3;
  width: 36px;
  height: 36px;
}
.portrait .wall-box {
  order: 4;
  flex: 1 1 100%;
  max-width: none;
}
.portrait .wall-box .bar {
  height: 12px;
}
.portrait .wall-box .bar span {
  line-height: 12px;
  font-size: 10px;
}
.portrait .wall-icon {
  width: 16px;
  height: 16px;
}
.portrait .wave-meter {
  min-width: 40px;
}
.portrait .threats {
  display: none;
}
.portrait #hud-bottom {
  gap: 6px;
  padding-left: calc(8px + var(--sal));
  padding-right: calc(8px + var(--sar));
}
.portrait .ability {
  width: 58px;
}
.portrait #btn-shop {
  padding: 0 8px;
}
.portrait #btn-speed {
  width: 40px;
}
.portrait #btn-buy {
  min-width: 0;
  flex: 1 1 auto;
}
.portrait .wave-meter {
  max-width: none;
}
.compact .plate .lbl {
  font-size: 10px;
}
.compact #btn-buy .price {
  font-size: 16px;
}
.compact .coins {
  font-size: 18px;
}
.compact .coins img {
  width: 22px;
  height: 22px;
}
.compact .wave-num {
  font-size: 18px;
}
.compact .icon-btn {
  width: 36px;
  height: 36px;
}
.compact .threats {
  display: none;
}
.tiny-h #hud-top .wave-tag {
  display: none;
}

/* ---------------- boss bar ---------------- */
#boss-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--top-h) + var(--sat) + 8px);
  width: min(520px, 72vw);
  text-align: center;
}
#boss-bar .name {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.05em;
  color: #ffd2c8;
  text-shadow: 0 2px 0 #000;
}
#boss-bar .bar {
  height: 14px;
  border-radius: 7px;
  margin-top: 3px;
  border: 2px solid #120c0c;
}
#boss-bar .bar > i {
  background: linear-gradient(180deg, #ff7a5a, #c0281a);
}
#boss-bar .bar > b {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 255, 255, 0.65);
  transition: width 0.5s ease-out;
  border-radius: 5px;
}
#boss-bar.vuln .bar {
  box-shadow: 0 0 0 2px var(--toxic);
}

/* ---------------- banners & toasts ---------------- */
#banner {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
}
#banner .b-title {
  font-family: var(--display);
  font-size: clamp(26px, 6vw, 54px);
  color: var(--ink);
  text-shadow:
    0 4px 0 #0b0f15,
    0 0 24px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.02em;
}
#banner .b-sub {
  font-size: clamp(15px, 2.6vw, 22px);
  font-weight: 700;
  color: var(--hazard-hi);
  text-shadow: 0 2px 0 #000;
  margin-top: 2px;
}
#banner.boss .b-title {
  color: #ff6a4a;
}
#banner.good .b-title {
  color: #a6ff7a;
}
#banner.show {
  animation: bannerin 2.2s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes bannerin {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.2);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.95);
  }
  18% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1);
  }
}
.reduced #banner.show {
  animation: bannerfade 2.2s linear forwards;
}
@keyframes bannerfade {
  0%,
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
#toasts {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--bot-h) + var(--sab) + 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 92vw;
}
.toast {
  background: rgba(12, 17, 24, 0.92);
  border: 1px solid var(--line);
  border-left: 4px solid var(--hazard);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 600;
  animation: toastin 0.25s ease-out;
  text-align: center;
}
.toast.bad {
  border-left-color: var(--danger);
}
.toast.good {
  border-left-color: var(--ok);
}
@keyframes toastin {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

/* ---------------- tutorial ---------------- */
#tut {
  position: absolute;
  max-width: min(320px, 80vw);
  background: #fff6d8;
  color: #1b1408;
  border: 3px solid #1b2230;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  text-wrap: balance;
  transition:
    left 0.25s,
    top 0.25s;
}
#tut .skip {
  display: block;
  margin-top: 8px;
  background: none;
  color: #6a5020;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}
#tut::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff6d8;
  border: 3px solid #1b2230;
  border-top: 0;
  border-left: 0;
  left: var(--ax, 50%);
  bottom: -11px;
  transform: rotate(45deg);
}
#tut.below::after {
  bottom: auto;
  top: -11px;
  transform: rotate(-135deg);
}
.pulse-target {
  animation: tpulse 1s ease-in-out infinite;
}
@keyframes tpulse {
  50% {
    box-shadow:
      0 0 0 4px #fff6d8,
      0 0 22px 6px rgba(255, 246, 216, 0.8);
  }
}

/* ---------------- panels ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 14, 0.62);
  display: grid;
  place-items: center;
  pointer-events: auto;
  padding: calc(12px + var(--sat)) calc(12px + var(--sar)) calc(12px + var(--sab))
    calc(12px + var(--sal));
  box-sizing: border-box;
  animation: fadein 0.15s ease-out;
}
@keyframes fadein {
  from {
    opacity: 0;
  }
}
.panel {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  border: 2px solid var(--steel-600);
  border-radius: 18px;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 16px 18px 18px;
  box-sizing: border-box;
  animation: panelin 0.22s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes panelin {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
}
.panel h2 {
  position: sticky;
  top: -16px;
  z-index: 2;
  padding: 10px 0;
  background: var(--steel-800);
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel h2 .x {
  margin-left: auto;
}
.panel .stripe {
  height: 8px;
  border-radius: 4px;
  margin: 8px 0 14px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 10px, #1f242c 10px 20px);
  opacity: 0.85;
}
.panel p {
  color: var(--ink-dim);
  margin: 6px 0;
  font-size: 17px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  box-shadow:
    0 3px 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.06s;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: none;
}
.btn.primary {
  background: linear-gradient(180deg, #f8c64a, #c98a14);
  color: #1b1408;
  box-shadow:
    0 3px 0 #6a4806,
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.danger {
  background: linear-gradient(180deg, #ff7a5a, #b8341c);
  box-shadow:
    0 3px 0 #5a1608,
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn[disabled] {
  filter: saturate(0.2) brightness(0.65);
  cursor: default;
}
.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.btn-row .btn {
  flex: 1 1 140px;
}

/* shop / workshop */
.panel.ws {
  width: min(760px, 100%);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(242, 182, 50, 0.09), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--steel-800), var(--steel-950));
  border: 2px solid #3d4f66;
  box-shadow:
    0 0 0 2px #070a0f,
    0 14px 0 rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 40px rgba(0, 0, 0, 0.35);
}
.panel.ws h2 {
  background: var(--steel-800);
  text-shadow: 0 2px 0 #070a0f;
}
.shop-coins {
  font-family: var(--display);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 14px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1a1408, #2b2210);
  border: 2px solid var(--hazard-dark);
  color: var(--hazard-hi);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    0 0 14px rgba(242, 182, 50, 0.18);
  font-variant-numeric: tabular-nums;
}
.shop-coins img {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}
.ws-sec {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 4px 0 8px;
}
.ws-k {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--hazard);
  text-transform: uppercase;
}
.ws-hint {
  font-size: 15px;
  color: var(--ink-dim);
}
.fab-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 8px 14px;
  margin: -6px -8px 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.fab-opt {
  --tier: var(--hazard);
  position: relative;
  flex: none;
  width: 92px;
  border-radius: 14px;
  padding: 8px 4px 8px;
  background: linear-gradient(180deg, var(--steel-700), var(--steel-850));
  border: 2px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 3px 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  scroll-snap-align: center;
  transition:
    transform 0.12s cubic-bezier(0.2, 1.4, 0.4, 1),
    border-color 0.15s,
    box-shadow 0.15s;
}
.fab-opt:not(.locked):hover {
  transform: translateY(-2px);
}
.fab-opt:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #070a0f;
}
.fab-opt .pad {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(
    circle at 50% 60%,
    color-mix(in srgb, var(--tier) 34%, transparent),
    transparent 68%
  );
}
.fab-opt .pad img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  transform: scale(1.22);
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.55));
}
.fab-opt .n {
  font-family: var(--display);
  font-size: 13px;
  color: var(--tier);
  text-shadow: 0 1px 0 #070a0f;
}
.fab-opt .p {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 16px;
  font-weight: 700;
  color: var(--hazard-hi);
  font-variant-numeric: tabular-nums;
}
.fab-opt .p img {
  width: 16px;
  height: 16px;
}
.fab-opt.poor .p {
  color: #ff8a7a;
}
.fab-opt.sel {
  border-color: var(--hazard);
  background: linear-gradient(180deg, #3a4a60, var(--steel-800));
  box-shadow:
    0 3px 0 #6a4806,
    0 0 0 3px rgba(242, 182, 50, 0.22),
    0 0 22px rgba(242, 182, 50, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-3px);
}
.fab-opt.sel::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 14px/1 var(--body);
  color: #1b1408;
  background: linear-gradient(180deg, #ffe08a, #e0a020);
  box-shadow: 0 2px 0 #6a4806;
}
.fab-opt.locked {
  cursor: default;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 0 6px, transparent 6px 12px),
    var(--steel-900);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}
.fab-opt.locked .pad {
  background: none;
}
.fab-opt.locked .pad img {
  filter: brightness(0) opacity(0.45);
}
.fab-opt.locked .n {
  color: var(--steel-500);
}
.fab-opt .lk {
  height: 19px;
  color: var(--steel-500);
}
.fab-opt .lk svg {
  width: 17px;
  height: 17px;
}
.fab-opt.fresh {
  animation: ws-pop 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) var(--ad, 0ms);
}
.up-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.up {
  --acc: var(--hazard);
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 4px 12px;
  align-content: start;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--acc) 16%, transparent), transparent 55%),
    linear-gradient(180deg, var(--steel-800), var(--steel-900));
  border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  border-left: 4px solid var(--acc);
  border-radius: 14px;
  padding: 12px 12px 12px 10px;
  box-shadow:
    0 3px 0 #070a0f,
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.up .ico {
  grid-row: 1 / span 2;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: radial-gradient(
    circle at 50% 35%,
    color-mix(in srgb, var(--acc) 45%, var(--steel-700)),
    var(--steel-850) 80%
  );
  border: 1px solid color-mix(in srgb, var(--acc) 50%, transparent);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--acc) 22%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}
.up .ico svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.5));
}
.up-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.up h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}
.lvchip {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 3px 7px 2px;
  border-radius: 6px;
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, #0a0e14);
  border: 1px solid color-mix(in srgb, var(--acc) 40%, transparent);
  font-variant-numeric: tabular-nums;
}
.up .d {
  font-size: 15px;
  color: var(--ink-dim);
  line-height: 1.2;
}
.pips {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
  margin-top: 6px;
}
.pips i {
  flex: 1;
  height: 7px;
  border-radius: 2px;
  background: #0a0e14;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
}
.pips i.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 70%, #fff), var(--acc));
  box-shadow: 0 0 6px color-mix(in srgb, var(--acc) 55%, transparent);
}
.pips i.new {
  animation: ws-pip 0.6s ease-out var(--ad, 0ms);
}
.fx-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.fx-line .cur {
  color: var(--ink);
}
.fx-line .arr {
  font-size: 11px;
  color: var(--acc);
}
.fx-line .nx {
  color: var(--acc);
  text-shadow: 0 0 10px color-mix(in srgb, var(--acc) 45%, transparent);
}
.up .btn {
  grid-column: 1 / -1;
  min-height: 44px;
  margin-top: 4px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.up .btn img {
  width: 22px;
  height: 22px;
}
#ui .up .btn.poor {
  filter: none;
  color: #ff8a7a;
  background: linear-gradient(180deg, var(--steel-700), var(--steel-850));
}
.up .btn.poor img {
  filter: saturate(0.4) brightness(0.8);
}
.up.maxed {
  border-left-color: var(--hazard-hi);
}
.up.maxed::after {
  content: "MAX";
  position: absolute;
  top: 10px;
  right: -26px;
  width: 96px;
  transform: rotate(35deg);
  text-align: center;
  font: 12px/18px var(--display);
  color: #1b1408;
  background: linear-gradient(180deg, #ffe08a, #e0a020);
  box-shadow: 0 2px 0 #6a4806;
}
.up.bought {
  animation: ws-pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) var(--ad, 0ms);
}
.up.bought::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--acc) 55%, #fff),
    transparent 70%
  );
  mix-blend-mode: screen;
  animation: ws-flash 0.5s ease-out var(--ad, 0ms) forwards;
  pointer-events: none;
}
@keyframes ws-pop {
  0% {
    transform: scale(0.94);
  }
  45% {
    transform: scale(1.035);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes ws-flash {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 0;
  }
}
@keyframes ws-pip {
  0% {
    transform: scaleY(2.4);
    filter: brightness(2.2);
  }
  100% {
    transform: none;
    filter: none;
  }
}
.reduced .fab-opt,
.reduced .up.bought,
.reduced .up.bought::before,
.reduced .pips i.new,
.reduced .fab-opt.fresh {
  animation: none;
  transition: none;
}

/* settings */
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 600;
}
.set-row label {
  flex: 1;
}
.set-row input[type="range"] {
  width: 160px;
  accent-color: var(--hazard);
  pointer-events: auto;
}
.set-row.vol {
  gap: 8px;
}
.set-row.vol label {
  flex: 0 0 auto;
  width: 128px;
  line-height: 1.1;
}
.set-row.vol input[type="range"] {
  width: auto;
  flex: 1 1 150px;
  min-width: 70px;
}
.set-row.vol output {
  width: 44px;
  text-align: right;
  font-size: 15px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.set-row .mute-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink);
  background: var(--steel-600);
}
.set-row .mute-btn svg {
  width: 22px;
  height: 22px;
}
.set-row.vol.off .mute-btn {
  color: #ff7a5a;
}
.set-row.vol.off input[type="range"] {
  opacity: 0.45;
}
.toggle {
  width: 58px;
  height: 32px;
  border-radius: 16px;
  background: var(--steel-600);
  position: relative;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #cfd8e2;
  transition: left 0.15s;
}
.toggle[aria-pressed="true"] {
  background: var(--hazard);
}
.toggle[aria-pressed="true"]::after {
  left: 30px;
  background: #fff;
}
.language-select {
  width: min(220px, 58%);
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--steel-500);
  border-radius: 10px;
  background: var(--steel-700);
  color: var(--ink);
  font:
    600 17px system-ui,
    sans-serif;
  touch-action: manipulation;
  cursor: pointer;
}
.language-select:focus-visible {
  outline: 3px solid var(--hazard);
  outline-offset: 3px;
}
html:lang(ru),
html:lang(ja),
html:lang(ko),
html:lang(zh) {
  --display: system-ui, sans-serif;
  --body: system-ui, sans-serif;
}
html:lang(ja) #ui,
html:lang(ko) #ui,
html:lang(zh) #ui {
  letter-spacing: normal;
}

/* menu */
#menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: radial-gradient(ellipse at 50% 40%, rgba(12, 17, 24, 0.25), rgba(6, 9, 14, 0.8));
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab))
    calc(16px + var(--sal));
  box-sizing: border-box;
}
.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(620px, 100%);
}
.menu-card > .btn,
.menu-card > .menu-foot {
  max-width: 380px;
}
.logo {
  font-family: var(--display);
  font-size: clamp(38px, 8.4vw, 84px);
  line-height: 0.92;
  white-space: nowrap;
  text-align: center;
  color: var(--ink);
  text-shadow:
    0 5px 0 #0b0f15,
    0 0 30px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.01em;
}
.logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
#menu {
  background:
    linear-gradient(180deg, rgba(6, 16, 28, 0.2), rgba(6, 16, 28, 0.08) 35%, rgba(6, 16, 28, 0.62)),
    var(--menu-art) center / cover no-repeat;
}
#menu .logo {
  width: min(620px, 94vw);
  filter: drop-shadow(0 8px 14px #060d18);
}
#menu .menu-card {
  gap: 12px;
  transform: translateY(-7vh);
}
#menu .tagline {
  font-size: 20px;
  margin: 8px 0 16px;
}
#menu .btn.primary {
  color: #fff9dd;
  background: linear-gradient(#ffc750, #e89513);
  border: 2px solid #ffe19b;
  box-shadow:
    inset 0 2px #fff5b8,
    0 6px #68400d,
    0 10px 24px #06101a99;
  text-shadow: 0 2px #8b4d0b;
}
#menu .menu-foot .btn {
  background: #15273ade;
  border: 1px solid #6c88a6;
  box-shadow: 0 4px #081422;
}
@media (max-height: 450px) {
  #menu .menu-card {
    gap: 5px;
    transform: none;
  }
  #menu .logo {
    width: min(420px, 70vw);
  }
  #menu .tagline {
    margin: 3px 0;
    font-size: 15px;
  }
  #menu .menu-card .btn {
    min-height: 44px;
  }
  #menu .menu-foot .btn {
    min-height: 36px;
  }
}
.logo em {
  font-style: normal;
  color: var(--toxic);
  display: inline-block;
  transform: rotate(-6deg) translateY(-2px);
  text-shadow:
    0 5px 0 #1d4a10,
    0 0 26px rgba(134, 255, 79, 0.5);
}
.logo-sub {
  font-family: var(--display);
  font-size: clamp(14px, 3vw, 20px);
  background: var(--hazard);
  color: #1b1408;
  padding: 3px 14px;
  border-radius: 6px;
  transform: rotate(-2deg);
  box-shadow: 0 3px 0 #6a4806;
}
.tagline {
  margin: 12px 0 8px;
  font-size: 19px;
  font-weight: 600;
  color: #e6edf3;
  text-shadow: 0 2px 4px #000;
  text-align: center;
}
.menu-card .btn {
  width: 100%;
  min-height: 56px;
  font-size: 21px;
}
.menu-foot {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.menu-foot .btn {
  flex: 1;
  min-height: 46px;
  font-size: 17px;
}

/* results */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.stat {
  background: var(--steel-850);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}
.stat .k {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
}
.stat .v {
  font-family: var(--display);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.mercy {
  color: var(--ok);
  font-weight: 700;
  font-size: 17px;
}
.results-title.bad {
  color: #ff7a5a;
}
.results-title.good {
  color: #a6ff7a;
}

/* loading */
#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--steel-950);
  pointer-events: auto;
}
#loading .lw {
  width: min(360px, 80vw);
  text-align: center;
}
#loading .bar {
  height: 14px;
  border-radius: 7px;
  margin-top: 14px;
}
#loading .msg {
  margin-top: 10px;
  color: var(--ink-dim);
  font-size: 17px;
  font-weight: 600;
}
#adapt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 9, 14, 0.75);
  font-family: var(--display);
  font-size: 20px;
}
.vignette-danger {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px 20px rgba(255, 40, 20, 0.55);
  opacity: 0;
  transition: opacity 0.6s;
}
.vignette-danger.on {
  opacity: 1;
}
.reduced .vignette-danger.on {
  opacity: 0.5;
}
.grenade-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--top-h) + var(--sat) + 10px);
  background: rgba(180, 67, 28, 0.92);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 16px;
}
@media (prefers-reduced-motion: reduce) {
  .panel,
  .toast,
  .overlay {
    animation: none;
  }
}

/* Image panels use nine-slice borders so the corners keep their shape. */
#ui .plate {
  isolation: isolate;
  background: transparent;
  box-shadow: 0 4px 0 #070f1b;
  box-sizing: border-box;
}
#ui .plate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border: 12px solid transparent;
  border-image: var(--panel-steel) 32 fill / 12px / 0 stretch;
}
#ui #btn-buy::before {
  border-image-source: var(--panel-gold);
}
#ui #btn-shop::before,
#ui #btn-over::before {
  border-image-source: var(--panel-blue);
}
#ui #btn-call::before {
  border-image-source: var(--panel-red);
}
#ui .plate .ico {
  width: 26px;
  height: 28px;
  object-fit: contain;
}
#ui .icon-btn img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
  margin: auto;
}
#ui #btn-buy .price {
  line-height: 1.2;
  padding-bottom: 3px;
}
#ui #btn-buy .buy-txt {
  transform: translateY(-3px);
  gap: 5px;
}
#ui.compact:not(.portrait) #btn-buy .buy-txt {
  transform: none;
  gap: 1px;
}
#ui.compact:not(.portrait) #btn-buy .price {
  padding-bottom: 0;
  font-size: 15px;
}
#ui #btn-buy .price img {
  width: 16px;
  height: 16px;
}
#ui:not(.compact).portrait #btn-buy {
  flex-grow: 0;
  width: 230px;
}
#ui:not(.compact).portrait #hud-bottom {
  justify-content: center;
  gap: 12px;
}
#hud-bottom {
  padding-bottom: calc(8px + var(--sab));
  align-items: flex-end;
}
#ui .plate {
  height: 62px;
}
#ui.compact:not(.portrait) .plate {
  height: 48px;
}
#ui #btn-call {
  position: relative;
  right: auto;
  bottom: auto;
  width: 140px;
  height: 48px;
  flex-shrink: 0;
  padding: 0 10px;
}
#ui #btn-call .big {
  font-size: 18px;
}
#ui #btn-call .lbl {
  font-size: 12px;
  max-width: 90px;
  line-height: 1.05;
}
#ui.portrait #btn-call {
  position: absolute;
  right: calc(10px + var(--sar));
  top: 6px;
  bottom: auto;
  height: 44px;
  width: 160px;
}
#ui.portrait #btn-call::before {
  border-image-width: 8px;
}
#ui.portrait #hud-bottom {
  padding-top: 50px;
}
#ui.portrait .spacer {
  display: none;
}
#ui.compact .plate .lbl {
  font-size: 11px;
  letter-spacing: 0;
}
#ui.portrait #btn-shop {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 60px;
  flex-shrink: 0;
  padding: 4px;
}
#ui.portrait .ability {
  width: 48px;
  flex-shrink: 0;
}
#ui.portrait #btn-speed {
  width: 44px;
  flex-shrink: 0;
}
#ui.portrait #btn-buy {
  padding: 0 6px;
  gap: 3px;
}
#ui.portrait #btn-buy img.tw {
  width: 40px;
  height: 46px;
}
#ui.portrait #btn-buy .buy-txt {
  min-width: 0;
}
#banner {
  top: calc(var(--top-h) + var(--sat) + 32px);
  max-width: calc(100% - 32px);
  white-space: normal;
}
#banner .b-title {
  font-size: clamp(18px, 3.5vw, 28px);
}
#banner .b-sub {
  font-size: 14px;
}
@keyframes bannerin {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.94);
  }
  12%,
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1);
  }
}
.reduced .plate {
  transition: none;
}
#tower-info {
  position: absolute;
  left: calc(10px + var(--sal));
  top: 3px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 28px);
}
#tower-info img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
#tower-info > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#tower-info strong {
  font-size: 14px;
  line-height: 1.1;
  color: #ffe3a1;
}
#tower-info span {
  font-size: 12px;
  color: #acbed2;
}
.has-call #tower-info {
  max-width: calc(100% - 185px);
}
#ui:not(.portrait) #tower-info {
  top: auto;
  bottom: calc(var(--bot-h) + 4px);
  padding: 3px 8px;
  background: #102031e6;
  border-radius: 8px;
}
#ui.portrait #btn-pause {
  width: 44px;
  height: 44px;
}
#ui:not(.portrait) #boss-bar {
  left: calc(14px + var(--sal));
  transform: none;
  width: min(360px, 40vw);
}
#ui.compact:not(.portrait) #boss-bar .name {
  font-size: 12px;
}
#ui.compact:not(.portrait) #boss-bar .bar {
  height: 9px;
}
#ui.has-boss #banner {
  display: none;
}
#ui.desktop #hud-top {
  padding-left: 24px;
  padding-right: 24px;
  gap: 18px;
}
#ui.desktop .wave-tag {
  font-size: 16px;
}
#ui.desktop .wave-num {
  font-size: 28px;
}
#ui.desktop .wave-meter {
  max-width: 340px;
  gap: 6px;
}
#ui.desktop .threats {
  font-size: 15px;
}
#ui.desktop .threats img {
  width: 26px;
  height: 26px;
}
#ui.desktop .coins {
  font-size: 28px;
  padding: 5px 16px 5px 8px;
}
#ui.desktop .coins img {
  width: 34px;
  height: 34px;
}
#ui.desktop .wall-box {
  flex-basis: 290px;
}
#ui.desktop .wall-box .bar {
  height: 20px;
}
#ui.desktop .wall-box .bar span {
  font-size: 14px;
  line-height: 20px;
}
#ui.desktop #btn-pause {
  width: 52px;
  height: 52px;
}
#ui.desktop #hud-bottom {
  padding: 10px 24px 14px;
  gap: 12px;
}
#ui.desktop .plate {
  height: 72px;
}
#ui.desktop .plate .lbl {
  font-size: 15px;
}
#ui.desktop #btn-buy {
  min-width: 220px;
}
#ui.desktop #btn-buy img.tw {
  width: 64px;
  height: 64px;
}
#ui.desktop #btn-buy .price {
  font-size: 24px;
}
#ui.desktop #btn-call {
  height: 62px;
  width: 180px;
}
#ui.desktop .ability {
  width: 76px;
}
#ui.desktop #btn-shop {
  min-width: 150px;
}
#ui #menu .primary {
  color: #302007;
  text-shadow: none;
  font-weight: 800;
}
#ui .btn.primary {
  color: #302007;
  text-shadow: none;
}
#ui.portrait #menu {
  background-image:
    linear-gradient(180deg, #06101c14, #06101c00 45%, #06101c44), var(--menu-portrait-art);
  align-items: start;
}
#ui.portrait #menu .menu-card {
  transform: none;
  margin-top: clamp(24px, 10vh, 110px);
  gap: 14px;
}
#ui.portrait #menu .logo {
  width: min(620px, 90vw);
}
#ui.portrait #menu .tagline {
  margin: 12px 0 20px;
}
@media (max-height: 700px) {
  #ui.portrait #menu .menu-card {
    margin-top: 24px;
  }
}

/* First discoveries are a deliberate, paused celebration, separate from ordinary merges. */
/* tower discovery: a liquid-glass achievement card — never pauses, never takes a tap, leaves by itself */
#achv {
  position: absolute;
  left: 50%;
  top: calc(var(--top-h) + var(--sat) + 12px);
  width: min(470px, calc(100% - 24px));
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 120;
}
#ui.portrait #achv {
  top: calc(var(--top-h) + var(--sat) + 66px);
}
.achv {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  column-gap: 14px;
  padding: 12px 20px 16px 12px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.26), transparent 55%),
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0.04) 50%,
      rgba(130, 215, 255, 0.12)
    );
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 28px rgba(160, 230, 255, 0.14),
    0 18px 44px rgba(0, 0, 0, 0.38);
  animation: achv-in 0.55s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}
.achv::before {
  /* a specular glint sweeping across the glass once */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 32%,
    rgba(255, 255, 255, 0.5) 46%,
    transparent 60%
  );
  transform: translateX(-120%);
  animation: achv-shine 1.1s 0.25s ease-out both;
  pointer-events: none;
}
.achv.out {
  animation: achv-out 0.38s ease-in both;
}
.achv-art {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
}
.achv-art img {
  position: relative;
  z-index: 1;
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  animation: achv-hero 0.7s cubic-bezier(0.2, 1.5, 0.35, 1) 0.08s both;
}
.achv-rays {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 236, 170, 0.4) 0 9deg, transparent 9deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%);
  mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: achv-turn 7s linear infinite;
}
.achv-k {
  font: 13px/1.1 var(--display);
  letter-spacing: 0.06em;
  color: #cff6ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.achv-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 5px 0 3px;
}
.achv-name b {
  font: 400 24px/1.05 var(--display);
  color: #fff8e8;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}
.achv-lv {
  font: 12px/1 var(--display);
  color: #1b1408;
  background: linear-gradient(180deg, #ffe08a, #e0a020);
  padding: 4px 7px 3px;
  border-radius: 7px;
  box-shadow: 0 2px 0 rgba(106, 72, 6, 0.8);
}
.achv-hint {
  font-size: 15px;
  color: rgba(238, 246, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.achv-bar {
  /* the time left before the card leaves */
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 7px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.75);
  transform-origin: left;
  animation: achv-time var(--ms, 3800ms) linear both;
}
#ui.has-achv #banner {
  top: calc(var(--top-h) + var(--sat) + 150px);
}
#ui.portrait.has-achv #banner {
  top: calc(var(--top-h) + var(--sat) + 200px);
}
@media (max-width: 420px) {
  .achv {
    grid-template-columns: 72px 1fr;
    column-gap: 10px;
    padding: 10px 14px 14px 8px;
  }
  .achv-art {
    width: 72px;
    height: 72px;
  }
  .achv-art img {
    width: 80px;
    height: 80px;
  }
  .achv-name b {
    font-size: 20px;
  }
  .achv-hint {
    font-size: 13px;
  }
}
@keyframes achv-in {
  from {
    opacity: 0;
    transform: translateY(-26px) scale(0.9);
  }
}
@keyframes achv-out {
  to {
    opacity: 0;
    transform: translateY(-18px) scale(0.96);
  }
}
@keyframes achv-shine {
  to {
    transform: translateX(120%);
  }
}
@keyframes achv-hero {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-14deg);
  }
}
@keyframes achv-turn {
  to {
    transform: rotate(360deg);
  }
}
@keyframes achv-time {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
.reduced .achv,
.reduced .achv::before,
.reduced .achv-art img,
.reduced .achv-rays {
  animation: none;
}
.reduced .achv-rays {
  display: none;
}
.reduced .achv.out {
  animation: none;
  opacity: 0;
}

/* next-discovery goal chip: always shows the next thing to chase */
#goal {
  position: absolute;
  left: calc(12px + var(--sal));
  top: calc(var(--top-h) + var(--sat) + 8px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 26, 36, 0.92), rgba(12, 17, 24, 0.88));
  border: 1px solid rgba(242, 182, 50, 0.35);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 3;
}
#goal .g-ico {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(242, 182, 50, 0.22), transparent 70%);
}
#goal .g-ico img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: brightness(0) opacity(0.65) drop-shadow(0 0 4px rgba(242, 182, 50, 0.6));
}
#goal .g-ico b {
  position: absolute;
  font: 18px/1 var(--display);
  color: var(--hazard-hi);
  text-shadow: 0 2px 0 #070a0f;
}
#goal .g-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
#goal strong {
  font: 14px/1.1 var(--display);
  color: var(--hazard-hi);
}
#goal .g-txt span {
  font-size: 14px;
  color: var(--ink-dim);
}
#goal .g-pair {
  display: flex;
  gap: 4px;
}
#goal .g-pair i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--steel-500);
}
#goal .g-pair i.on {
  border-color: var(--hazard);
  background: var(--hazard-hi);
  box-shadow: 0 0 8px rgba(242, 182, 50, 0.7);
}
#goal.ready {
  border-color: var(--hazard);
  animation: goal-pulse 1.1s ease-in-out infinite;
}
#goal.ready .g-txt span {
  color: var(--hazard-hi);
  font-weight: 700;
}
@keyframes goal-pulse {
  50% {
    box-shadow:
      0 3px 0 rgba(0, 0, 0, 0.4),
      0 0 18px rgba(242, 182, 50, 0.55);
  }
}
#ui.has-boss #goal,
#ui.no-hud #goal {
  display: none;
}
.reduced #goal.ready {
  animation: none;
}

/* defeat near-miss meter */
.near {
  margin: 12px 0 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid var(--line);
}
.near-k {
  font: 22px/1 var(--display);
  color: var(--hazard-hi);
  text-shadow: 0 2px 0 #070a0f;
}
.near-k:empty {
  display: none;
}
.near-bar {
  height: 12px;
  margin: 8px 0 6px;
  border-radius: 6px;
  background: #0a0e14;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.near-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff4b3a, var(--hazard));
  animation: near-fill 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) 0.2s both;
}
.near-t {
  font-size: 16px;
  color: var(--ink-dim);
}
.near.close {
  border-color: var(--hazard);
  box-shadow: 0 0 18px rgba(242, 182, 50, 0.25);
}
.near.close .near-t {
  color: var(--ink);
}
@keyframes near-fill {
  from {
    width: 0;
  }
}
.reduced .near-bar i {
  animation: none;
}

/* codex */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.codex-card {
  --tier: var(--hazard);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--steel-700), var(--steel-850));
  border: 1px solid color-mix(in srgb, var(--tier) 35%, transparent);
  box-shadow: 0 3px 0 #070a0f;
  text-align: center;
}
.codex-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.5));
}
.codex-card .n {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}
.codex-card .sub {
  font: 11px/1.2 var(--display);
  color: var(--tier);
}
.codex-card.boss {
  --tier: #ff6a4a;
}
.codex-card.unknown {
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 0 6px, transparent 6px 12px),
    var(--steel-900);
  border-color: var(--line);
}
.codex-card.unknown img {
  filter: brightness(0) opacity(0.45);
}
.codex-card.unknown .n {
  color: var(--steel-500);
}
.codex-card .glyph {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 40px;
  color: var(--tier);
}
.codex-card.unknown .glyph {
  color: var(--steel-600);
}

/* portrait: call-wave and tower info float under the top HUD instead of reserving a strip */
#ui.portrait #hud-bottom {
  padding-top: 6px;
}
#ui.portrait #btn-call {
  position: fixed;
  top: calc(var(--top-h) + var(--sat) + 8px);
  right: calc(10px + var(--sar));
}
#ui.portrait #tower-info {
  position: fixed;
  top: calc(var(--top-h) + var(--sat) + 8px);
  left: calc(12px + var(--sal));
  padding: 3px 10px 3px 6px;
  background: #102031e6;
  border-radius: 10px;
  max-width: calc(100% - 24px - var(--sal) - var(--sar));
  z-index: 4;
}
#ui.portrait.has-call #tower-info {
  max-width: calc(100% - 200px);
}
#ui.portrait:has(#tower-info:not([hidden])) #goal {
  display: none;
}
@media (max-width: 370px) {
  #ui.portrait #goal .g-txt span {
    display: none;
  }
}

/* bottom bar: room to breathe. Groups (build | abilities | workshop … call, speed) get real gaps,
   abilities are wider, and a locked ability keeps its icon visible with a small "lock · Wave N"
   caption instead of a dark overlay that hid what it was. */
#ui:not(.portrait) #hud-bottom {
  gap: 12px;
}
#ui:not(.portrait) #btn-grenade {
  margin-left: 12px;
}
#ui:not(.portrait) #btn-shop {
  margin-left: 12px;
  min-width: 116px;
}
#ui:not(.portrait) .ability {
  width: calc(var(--bot-h) + 4px);
}
#ui:not(.portrait) #btn-speed {
  width: 60px;
}
#ui.desktop #hud-bottom {
  gap: 16px;
}
#ui.desktop .ability {
  width: 100px;
}
#ui.desktop #btn-shop {
  min-width: 156px;
}
#ui.desktop #btn-speed {
  width: 72px;
}
#ui .ability.locked > img,
#ui .ability.locked > svg {
  opacity: 0.4;
  filter: grayscale(0.85);
}
#ui .ability.locked > .lbl {
  opacity: 0;
}
#ui .lockbadge {
  inset: auto 0 6px 0;
  background: none;
  flex-direction: row;
  gap: 4px;
  font-size: 11px;
  color: #d2dde8;
  text-shadow: 0 1px 2px #000;
}
#ui .lockbadge::before {
  width: 10px;
  height: 12px;
}
#ui.desktop .lockbadge {
  font-size: 13px;
  bottom: 8px;
}

/* barricade HP: white digits with a dark outline read on the fill AND on the empty dark part
   (the dark digits vanished as soon as the wall lost health) */
#ui .wall-box .bar {
  height: 16px;
  border-radius: 8px;
}
#ui .wall-box .bar span {
  color: #ffffff;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.02em;
  text-shadow:
    -1px -1px 0 #05080d,
    1px -1px 0 #05080d,
    -1px 1px 0 #05080d,
    1px 1px 0 #05080d,
    0 1px 3px rgba(0, 0, 0, 0.8);
}
#ui.portrait .wall-box .bar {
  height: 15px;
}
#ui.portrait .wall-box .bar span {
  font-size: 11px;
  line-height: 15px;
}
#ui.desktop .wall-box .bar {
  height: 22px;
  border-radius: 11px;
}
#ui.desktop .wall-box .bar span {
  font-size: 15px;
  line-height: 22px;
}

/* ---------------- danger heartbeat: the vignette pulses with the audio beat ---------------- */
.vignette-danger.on.beat {
  animation: vig-beat var(--beat, 0.8s) ease-out infinite;
}
@keyframes vig-beat {
  0% {
    opacity: 0.6;
  }
  10% {
    opacity: 1;
    box-shadow: inset 0 0 120px 34px rgba(255, 30, 14, 0.7);
  }
  22% {
    opacity: 0.75;
  }
  30% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.55;
  }
}
.reduced .vignette-danger.on.beat {
  animation: none;
}

/* ---------------- boss entrance: letterbox + name card ---------------- */
#cine {
  position: absolute;
  inset: 0;
  z-index: 140;
  cursor: pointer;
}
#cine .lb {
  position: absolute;
  left: 0;
  right: 0;
  height: 12vh;
  background: #000;
  animation: lb-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
#cine .lb.top {
  top: 0;
}
#cine .lb.bot {
  bottom: 0;
}
/* portrait: the boss walks in from the top (no top bar over its head) */
#ui.portrait #cine .lb.top {
  display: none;
}
/* landscape: the boss comes in from the left, so the name card sits on the right */
#ui:not(.portrait) #cine .card {
  left: auto;
  right: calc(4vw + var(--sar));
  max-width: 72%;
  text-align: right;
}
#ui:not(.portrait) #cine .name {
  font-size: clamp(28px, 6.4vw, 72px);
}
@keyframes lb-in {
  from {
    height: 0;
  }
}
#cine .card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(12vh + 18px);
  text-align: center;
  padding: 0 16px;
  animation: cine-card 0.7s 0.25s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
@keyframes cine-card {
  0% {
    opacity: 0;
    transform: scale(1.8);
    filter: blur(6px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
#cine .kick {
  font-family: var(--display);
  font-size: clamp(13px, 2.4vw, 18px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #ff5a3a;
  text-shadow: 0 2px 0 #000;
}
#cine .name {
  font-family: var(--display);
  font-size: clamp(34px, 9vw, 86px);
  line-height: 1;
  color: #fff4ea;
  text-transform: uppercase;
  text-shadow:
    0 5px 0 #3a0b06,
    0 0 30px rgba(255, 60, 30, 0.75),
    0 0 80px rgba(255, 40, 10, 0.4);
}
#cine .epi {
  margin-top: 6px;
  font-size: clamp(14px, 2.6vw, 20px);
  font-weight: 700;
  font-style: italic;
  color: #ffd0b8;
  text-shadow: 0 2px 0 #000;
}
#cine .skip {
  position: absolute;
  right: calc(16px + var(--sar));
  bottom: calc(3vh + var(--sab));
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
  animation: cine-skip 0.4s 1s both;
}
@keyframes cine-skip {
  from {
    opacity: 0;
  }
}
#ui.cine #hud-top,
#ui.cine #hud-bottom,
#ui.cine #goal,
#ui.cine #boss-bar,
#ui.cine #banner,
#ui.cine #btn-call,
#ui.cine #tut,
#ui.cine #toasts {
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.reduced #cine .lb,
.reduced #cine .card {
  animation-duration: 0.01s;
}

/* ---------------- daily challenge ---------------- */
#menu .btn.daily {
  display: grid;
  justify-items: center;
  gap: 1px;
  width: 100%;
  max-width: 380px;
  padding: 8px 16px;
  min-height: 64px;
  color: #eafcff;
  background: linear-gradient(180deg, #1e6f8c, #0f3e57);
  border: 2px solid #6fd6ff;
  box-shadow:
    inset 0 2px rgba(190, 240, 255, 0.5),
    0 5px #062436,
    0 10px 22px #06101a99;
}
#menu .btn.daily .d-t {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px #062436;
}
#menu .btn.daily .d-r {
  font-size: 13px;
  font-weight: 700;
  color: #bfefff;
}
#menu .btn.daily .d-b {
  font-size: 12px;
  font-weight: 800;
  color: var(--hazard-hi);
}
#menu .btn.daily.locked {
  filter: saturate(0.25) brightness(0.8);
}
#menu .btn.daily.locked .d-t::before {
  content: "🔒 ";
}
/* short landscape phones: everything has to fit in ~390px of height */
@media (max-height: 450px) {
  #menu .btn.daily {
    min-height: 44px;
    padding: 3px 12px;
  }
  #menu .btn.daily .d-t {
    font-size: 15px;
  }
  #menu .btn.daily .d-b {
    display: none;
  }
  #menu:has(.btn.daily) .logo {
    width: min(340px, 56vw);
  }
  #menu:has(.btn.daily) .tagline {
    display: none;
  }
}
.daily-res .daily-rule {
  color: #8fdcff;
  font-weight: 800;
}
.daily-score {
  margin: 6px auto 4px;
  text-align: center;
}
.daily-score .k {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.daily-score .v {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: clamp(36px, 8vw, 58px);
  color: #ffe27a;
  text-shadow: 0 4px 0 #5a3a06;
}
.daily-score .v img {
  width: 0.8em;
  height: 0.8em;
}
.daily-score .rec {
  font-weight: 800;
  color: var(--ink-dim);
}
.daily-score.record .rec {
  color: #a6ff7a;
  animation: rec-pop 0.9s 0.3s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes rec-pop {
  from {
    opacity: 0;
    transform: scale(1.8);
  }
}
.daily-hint {
  font-size: 13px;
  color: var(--ink-dim);
  margin: 2px 0 6px;
}

/* Action dock: fixed proportions, legible states and keyboard equivalents. */
#ui #hud-bottom {
  gap: 10px;
  padding: 8px calc(12px + var(--sar)) calc(10px + var(--sab)) calc(12px + var(--sal));
  align-items: center;
}
#ui #hud-bottom > .plate {
  flex: 0 0 auto;
  height: 60px;
  margin: 0;
  border: 1px solid #63758b;
  border-radius: 10px;
  background: linear-gradient(180deg, #34465a, #1b2939);
  box-shadow:
    inset 0 1px 0 #ffffff24,
    inset 0 -2px 0 #07101c66,
    0 3px 0 #080e17;
  overflow: hidden;
  transition:
    transform 0.12s,
    border-color 0.12s,
    filter 0.12s;
}
#ui #hud-bottom > .plate::before {
  display: none;
}
#ui #hud-bottom > .plate .lbl {
  color: #f4f7fc;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px #07101c;
}
#ui #hud-bottom > .plate:active,
#ui #hud-bottom > .plate.keyboard-press {
  transform: translateY(2px);
  filter: brightness(1.18);
}
@media (hover: hover) {
  #ui #hud-bottom > .plate:hover {
    border-color: #b8c9dc;
    filter: brightness(1.1);
  }
}
#ui #hud-bottom #btn-buy {
  width: 174px;
  min-width: 0;
  gap: 10px;
  padding: 8px 28px 7px 10px;
  border-color: #f5d16f;
  background: linear-gradient(180deg, #f7d976, #e4ac34);
  box-shadow:
    inset 0 1px 0 #fff2b6,
    inset 0 -2px 0 #b77822,
    0 3px 0 #60421a;
  animation: none;
}
#ui #hud-bottom #btn-buy .lbl {
  color: #36270c;
  text-shadow: none;
}
#ui #hud-bottom #btn-buy .buy-txt {
  transform: none;
  gap: 2px;
}
#ui #hud-bottom #btn-buy .price {
  color: #281d09;
  font-size: 23px;
  padding: 0;
  line-height: 1.1;
}
#ui #hud-bottom #btn-buy.cant .price {
  color: #781e14;
}
#ui #hud-bottom #btn-buy:disabled {
  background: linear-gradient(180deg, #354454, #24313f);
  border-color: #647486;
  box-shadow:
    inset 0 1px 0 #64748688,
    0 3px 0 #101821;
  filter: none;
  transform: none;
  cursor: not-allowed;
}
#ui #hud-bottom #btn-buy:disabled .lbl,
#ui #hud-bottom #btn-buy:disabled .price {
  color: #c0cbd7;
}
#ui #hud-bottom #btn-buy:disabled.cant .price {
  color: #ffb1a3;
}
#ui #hud-bottom #btn-buy:disabled .tw,
#ui #hud-bottom #btn-buy:disabled .coin-i {
  filter: grayscale(0.75);
  opacity: 0.65;
}
#ui #hud-bottom #btn-buy:disabled .shortcut-key {
  background: #24313f;
  border-color: #647486;
  color: #c0cbd7;
}
#ui #hud-bottom #btn-buy img.tw {
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin: 0;
}
#ui #hud-bottom #btn-buy .price img {
  width: 17px;
  height: 17px;
}
#ui #hud-bottom #btn-buy .lvl-chip {
  font-size: 9px;
  left: 5px;
  top: 3px;
  padding: 1px 4px;
}
#ui #hud-bottom > .ability {
  width: 126px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 7px;
  padding: 9px 8px;
}
#ui #hud-bottom #btn-over {
  width: 142px;
}
#ui #hud-bottom .ability > img,
#ui #hud-bottom .ability > svg {
  width: 30px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
#ui #hud-bottom .action-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}
#ui #hud-bottom .ability .lbl {
  font-size: 13px;
  opacity: 1;
}
#ui #hud-bottom .ability-state {
  color: #c5d2df;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
#ui #hud-bottom .ability.locked {
  border-color: #526276;
}
#ui #hud-bottom .ability.locked > img {
  opacity: 0.7;
  filter: grayscale(0.65);
}
#ui #hud-bottom .ability.locked .ability-state::before {
  content: "🔒 ";
  font-size: 9px;
}
#ui #hud-bottom .ability:not(.locked)[data-cd="0"] {
  border-color: #6fa6c3;
}
#ui #hud-bottom .ability:not(.locked)[data-cd="0"] .ability-state {
  color: #a0e3ee;
}
#ui #hud-bottom .ability .cd {
  inset: auto 0 0;
  height: 3px;
  border-radius: 0;
  background: linear-gradient(90deg, #0b1320 var(--p, 0%), #79d3e4 0);
}
#ui #hud-bottom .ability.locked .cd {
  display: none;
}
#ui #hud-bottom .ability.aiming {
  border-color: #ffd493;
  background: linear-gradient(180deg, #81512b, #4a301e);
}
#ui #hud-bottom .ability.active {
  border-color: #b1f1ff;
  background: linear-gradient(180deg, #23627b, #183b52);
}
#ui #hud-bottom #btn-shop {
  width: 122px;
  min-width: 0;
  flex-direction: row;
  padding: 9px 27px 9px 10px;
  gap: 7px;
}
#ui #hud-bottom #btn-shop .ico {
  width: 25px;
  height: 28px;
}
#ui #hud-bottom #btn-shop .dot {
  top: auto;
  bottom: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
}
#ui #hud-bottom #btn-speed {
  width: 52px;
  justify-content: center;
  padding: 0;
  font-size: 18px;
}
#ui #hud-bottom #btn-call {
  width: 145px;
  height: 54px;
  justify-content: center;
  border-color: #d78068;
  background: linear-gradient(180deg, #b14f3a, #7f3226);
  animation: dock-call-in 0.18s ease-out;
}
@keyframes dock-call-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
#ui #hud-bottom .shortcut-key {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  #ui #hud-bottom .shortcut-key {
    display: grid;
    place-items: center;
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 16px;
    height: 17px;
    box-sizing: border-box;
    padding: 0 3px;
    border: 1px solid #9aafc066;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #0b1729b3;
    color: #e4eef8;
    font:
      700 10px/1 system-ui,
      sans-serif;
  }
  #ui #hud-bottom #btn-buy .shortcut-key {
    background: #5a411b;
    border-color: #b58436;
    color: #fff3c8;
  }
}
#ui.desktop #hud-bottom {
  padding-left: 22px;
  padding-right: 22px;
  gap: 12px;
}
#ui.desktop #hud-bottom > .plate {
  height: 66px;
}
#ui.desktop #hud-bottom #btn-buy {
  width: 184px;
}
#ui.desktop #hud-bottom #btn-shop {
  width: 132px;
}
#ui.desktop #hud-bottom #btn-call {
  height: 58px;
}

#ui.portrait #hud-bottom {
  gap: 5px;
  padding: 6px calc(8px + var(--sar)) calc(8px + var(--sab)) calc(8px + var(--sal));
}
#ui.portrait #hud-bottom > .plate {
  height: 64px;
}
#ui.portrait #hud-bottom #btn-buy {
  width: auto;
  flex: 1 1 auto;
  max-width: 180px;
  padding: 8px 5px;
  gap: 4px;
}
#ui.portrait #hud-bottom #btn-buy img.tw {
  width: 32px;
  height: 36px;
}
#ui.portrait #hud-bottom #btn-buy .lbl {
  font-size: 11px;
}
#ui.portrait #hud-bottom #btn-buy .price {
  font-size: 19px;
}
#ui.portrait #hud-bottom > .ability,
#ui.portrait #hud-bottom #btn-over {
  width: 56px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 3px;
}
#ui.portrait #hud-bottom .ability > img {
  width: 24px;
  height: 25px;
}
#ui.portrait #hud-bottom .action-copy {
  align-items: center;
  gap: 3px;
}
#ui.portrait #hud-bottom .ability .lbl {
  font-size: 10px;
  letter-spacing: 0;
}
#ui.portrait #hud-bottom .ability-state {
  font-size: 9px;
}
#ui.portrait #hud-bottom .ability.locked .ability-state::before {
  font-size: 7px;
}
#ui.portrait #hud-bottom #btn-shop {
  width: 58px;
  flex-direction: column;
  justify-content: center;
  padding: 4px;
  gap: 4px;
}
#ui.portrait #hud-bottom #btn-shop .lbl {
  font-size: 10px;
}
#ui.portrait #hud-bottom #btn-speed {
  width: 38px;
  font-size: 15px;
}
#ui.portrait #hud-bottom .shortcut-key {
  display: none;
}
#ui.portrait #hud-bottom #btn-call {
  height: 44px;
  width: 150px;
}
#ui.portrait:not(.compact) #hud-bottom > .ability,
#ui.portrait:not(.compact) #hud-bottom #btn-over {
  width: 96px;
}
#ui.portrait:not(.compact) #hud-bottom #btn-shop {
  width: 110px;
}
#ui.portrait:not(.compact) #hud-bottom .ability .lbl,
#ui.portrait:not(.compact) #hud-bottom #btn-shop .lbl {
  font-size: 13px;
}
#ui.portrait:not(.compact) #hud-bottom .ability-state {
  font-size: 11px;
}
@media (max-width: 340px) {
  #ui.portrait #hud-bottom #btn-buy img.tw {
    width: 20px;
    height: 26px;
  }
  #ui.portrait #hud-bottom #btn-buy .lbl {
    font-size: 10px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #ui #hud-bottom {
    gap: 7px;
    padding: 6px calc(8px + var(--sar)) calc(8px + var(--sab)) calc(8px + var(--sal));
  }
  #ui #hud-bottom > .plate {
    height: 48px;
  }
  #ui #hud-bottom #btn-buy {
    width: 148px;
  }
  #ui #hud-bottom #btn-buy img.tw {
    width: 32px;
    height: 32px;
  }
  #ui #hud-bottom #btn-buy .price {
    font-size: 19px;
  }
  #ui #hud-bottom > .ability {
    width: 112px;
    gap: 5px;
  }
  #ui #hud-bottom #btn-over {
    width: 124px;
  }
  #ui #hud-bottom .ability > img {
    width: 24px;
    height: 26px;
  }
  #ui #hud-bottom .ability .lbl {
    font-size: 12px;
  }
  #ui #hud-bottom .ability-state {
    font-size: 10px;
  }
  #ui #hud-bottom #btn-shop {
    width: 112px;
  }
  #ui #hud-bottom #btn-call {
    width: 120px;
    height: 48px;
  }
  #ui #hud-bottom #btn-speed {
    width: 42px;
  }
}
@media (max-width: 740px) and (max-height: 500px) and (orientation: landscape) {
  #ui #hud-bottom {
    gap: 5px;
  }
  #ui #hud-bottom #btn-buy {
    width: 116px;
    padding: 5px;
    gap: 4px;
  }
  #ui #hud-bottom #btn-buy .lbl {
    font-size: 11px;
  }
  #ui #hud-bottom > .ability,
  #ui #hud-bottom #btn-over {
    width: 56px;
    padding: 2px;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
  }
  #ui #hud-bottom .ability > img {
    width: 19px;
    height: 20px;
  }
  #ui #hud-bottom .action-copy {
    align-items: center;
    gap: 2px;
  }
  #ui #hud-bottom .ability .lbl {
    font-size: 10px;
    letter-spacing: 0;
  }
  #ui #hud-bottom .ability-state {
    font-size: 9px;
  }
  #ui #hud-bottom #btn-shop {
    width: 60px;
    padding: 2px;
    flex-direction: column;
    gap: 1px;
  }
  #ui #hud-bottom #btn-shop .ico {
    width: 22px;
    height: 23px;
  }
  #ui #hud-bottom #btn-shop .lbl {
    font-size: 10px;
  }
  #ui #hud-bottom #btn-call {
    width: 96px;
    padding: 0 4px;
    gap: 4px;
  }
  #ui #hud-bottom #btn-call .big {
    font-size: 15px;
  }
  #ui #hud-bottom #btn-call .lbl {
    font-size: 11px;
  }
  #ui #hud-bottom #btn-speed {
    width: 36px;
  }
  #ui #hud-bottom .shortcut-key {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #ui #hud-bottom > .plate {
    transition: none;
  }
  #ui #hud-bottom #btn-call {
    animation: none;
  }
}
#ui.reduced #hud-bottom > .plate {
  transition: none;
}
#ui.reduced #hud-bottom #btn-call {
  animation: none;
}
/* Localized labels may need two lines without leaving their touch target. */
#ui #hud-bottom .action-copy {
  flex: 1 1 auto;
  max-width: 100%;
}
#ui #hud-bottom .ability .lbl,
#ui #hud-bottom .ability-state,
#ui #hud-bottom #btn-shop .lbl {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.1;
}
#ui.portrait #hud-bottom .action-copy {
  flex: 0 1 auto;
  width: 100%;
}
#ui:has(> .overlay) #goal {
  visibility: hidden;
}

html:lang(ru) #ui.portrait.compact #hud-bottom .ability .lbl {
  font-size: 9px;
}
#ui #gren-hint {
  width: max-content;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  text-align: center;
}
#ui:has(#gren-hint:not([hidden])) #goal,
#ui:has(> .overlay) #gren-hint {
  visibility: hidden;
}
html:lang(ru) .panel h2,
html:lang(ja) .panel h2,
html:lang(ko) .panel h2,
html:lang(zh) .panel h2 {
  font-weight: 800;
}
/* Finger-tip and ghost follow the same real slot centers; input always passes through. */
#tutorial-gesture {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
#tutorial-gesture * {
  pointer-events: none;
}
#tutorial-gesture .tg-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: #ffe18e;
  opacity: 0.65;
}
#tutorial-gesture .tg-ring {
  position: absolute;
  width: var(--ring-size);
  height: var(--ring-size);
  margin: calc(var(--ring-size) / -2);
  border: 2px solid #fff3c4;
  border-radius: 22%;
  box-sizing: border-box;
  box-shadow: 0 0 0 3px #0c172b66;
}
#tutorial-gesture .tg-source {
  left: var(--from-x);
  top: var(--from-y);
  animation: tutorial-press 2.7s ease-in-out infinite;
}
#tutorial-gesture .tg-target {
  left: var(--to-x);
  top: var(--to-y);
  border-color: #ffd154;
  animation: tutorial-drop 2.7s ease-in-out infinite;
}
#tutorial-gesture .tg-mover {
  position: absolute;
  left: var(--from-x);
  top: var(--from-y);
  animation: tutorial-drag 2.7s infinite;
}
#tutorial-gesture .tg-hand {
  position: absolute;
  width: var(--hand-size);
  height: auto;
  transform: translate(-36%, -8%);
  filter: drop-shadow(2px 4px 2px #0008);
}
#tutorial-gesture .tg-ghost {
  position: absolute;
  width: var(--ghost-size);
  height: var(--ghost-size);
  object-fit: contain;
  transform: translate(-50%, -50%);
  animation: tutorial-lift 2.7s infinite;
  filter: drop-shadow(0 5px 4px #0008);
}
@keyframes tutorial-drag {
  0%,
  12% {
    transform: translate(0, 0) scale(1.08);
    opacity: 1;
  }
  18% {
    transform: translate(0, 0) scale(1.08);
    opacity: 1;
  }
  27% {
    transform: translate(0, 0) scale(0.93);
    opacity: 1;
  }
  34% {
    transform: translate(0, -6px) scale(1);
    opacity: 1;
    animation-timing-function: cubic-bezier(0.4, 0, 0.25, 1);
  }
  70%,
  78% {
    transform: translate(var(--dx), var(--dy)) scale(0.96);
    opacity: 1;
  }
  85% {
    transform: translate(var(--dx), calc(var(--dy) - 5px)) scale(1.08);
    opacity: 1;
  }
  94%,
  100% {
    transform: translate(var(--dx), calc(var(--dy) - 5px)) scale(1.08);
    opacity: 0;
  }
}
@keyframes tutorial-lift {
  0%,
  27%,
  79%,
  100% {
    opacity: 0;
  }
  35%,
  69% {
    opacity: 0.65;
  }
}
@keyframes tutorial-press {
  0%,
  17%,
  45%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  27% {
    opacity: 1;
    transform: scale(0.88);
  }
}
@keyframes tutorial-drop {
  0%,
  60%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  78% {
    opacity: 1;
    transform: scale(1.13);
  }
}
#ui:has(> .overlay) #tutorial-gesture,
#ui.no-hud #tutorial-gesture,
#ui.cine #tutorial-gesture {
  display: none;
}
#ui.reduced #tutorial-gesture .tg-mover {
  animation: none;
  opacity: 1;
}
#ui.reduced #tutorial-gesture .tg-ring {
  animation: none;
}
#ui.reduced #tutorial-gesture .tg-ghost {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  #tutorial-gesture .tg-mover,
  #tutorial-gesture .tg-ring {
    animation: none;
    opacity: 1;
  }
  #tutorial-gesture .tg-ghost {
    display: none;
  }
}
#ui:has(#adapt) #tutorial-gesture {
  display: none;
}
/* A single compact boss strip leaves more of the phone battle visible. */
#ui.portrait #boss-bar {
  width: min(520px, calc(100% - 24px));
  top: calc(var(--top-h) + var(--sat) + 6px);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 9px;
  box-sizing: border-box;
  border: 1px solid #694139;
  border-radius: 9px;
  background: #101923ed;
}
#ui.portrait #boss-bar .name {
  flex: 0 1 auto;
  max-width: 48%;
  font-size: 12px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-align: left;
}
#ui.portrait #boss-bar .bar {
  flex: 1 1 100px;
  min-width: 60px;
  height: 11px;
  margin: 0;
  border-width: 1px;
}
