:root {
  color-scheme: light;
  --ink: #25313c;
  --muted: #66717d;
  --paper: #fff7e8;
  --paper-deep: #ead9b9;
  --sky: #94d6e7;
  --button: #f05b4f;
  --button-dark: #b83532;
  --edge: rgba(48, 36, 24, 0.22);
}

* {
  box-sizing: border-box;
}

.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;
}

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

.splash-screen {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 700ms ease, visibility 700ms ease;
}

.splash-screen::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(91, 64, 39, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #86d3e5, #d9eeee 62%, #f2d08b);
  background-size: 22px 22px, auto;
  content: "";
}

.splash-content {
  position: relative;
  z-index: 4;
  display: grid;
  width: min(820px, 88vw);
  height: min(410px, 56vh);
  place-items: center;
  justify-items: center;
}

.splash-logo {
  position: relative;
  z-index: 2;
  width: min(760px, 82vw);
  max-height: 48vh;
  object-fit: contain;
  filter: drop-shadow(0 14px 0 rgba(73, 47, 28, 0.16));
  opacity: 0;
  transform: translateY(-42vh) scale(.62) rotate(-5deg);
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

.splash-logo.secret-tap {
  filter: drop-shadow(0 14px 0 rgba(73, 47, 28, 0.16)) brightness(1.13);
}

.splash-sticker-paper {
  position: absolute;
  z-index: 1;
  width: 154px;
  height: 154px;
  border: 3px solid rgba(94, 67, 43, 0.24);
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(100, 70, 42, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #fff7df, #ead2a3);
  background-size: 18px 100%, auto;
  box-shadow: 0 13px 0 rgba(74, 50, 31, 0.15);
  opacity: 0;
  transform: translateY(36vh) scale(.25) rotate(13deg);
}

.splash-screen.playing .splash-logo {
  animation: splash-logo-bounce 6.35s cubic-bezier(.2, .8, .25, 1) both;
}

.splash-screen.playing .splash-sticker-paper {
  animation: sticker-paper-rise 2.85s cubic-bezier(.2, .8, .25, 1) 3.12s both;
}

.splash-screen.playing::before {
  animation: splash-backdrop-away 920ms ease 5.45s both;
}

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

.splash-scrap {
  position: absolute;
  z-index: 3;
  width: 64px;
  height: 28px;
  border: 3px solid rgba(87, 57, 34, 0.24);
  border-radius: 5px;
  background: #f5cf68;
  box-shadow: 0 6px 0 rgba(65, 42, 27, 0.12);
  opacity: 0;
}

.splash-screen.playing .splash-scrap { animation: scrap-float 1100ms ease-out both; }
.scrap-one { top: 21%; left: 16%; rotate: -16deg; background: #e65d53; animation-delay: 250ms !important; }
.scrap-two { top: 18%; right: 14%; rotate: 13deg; background: #77b960; animation-delay: 360ms !important; }
.scrap-three { bottom: 19%; left: 24%; rotate: 9deg; background: #4e8edb; animation-delay: 460ms !important; }
.scrap-four { right: 23%; bottom: 17%; rotate: -11deg; background: #f5cf68; animation-delay: 560ms !important; }

.paper-unfold {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  perspective: 1000px;
}

.paper-center,
.paper-fold {
  position: absolute;
  display: block;
  border: 2px solid rgba(94, 67, 43, 0.2);
  background:
    linear-gradient(90deg, rgba(100, 70, 42, 0.07) 1px, transparent 1px),
    #fff5dc;
  background-size: 18px 100%, auto;
  box-shadow: inset 0 0 18px rgba(116, 81, 48, 0.08);
}

.paper-center {
  top: calc(50% - 70px);
  left: calc(50% - 70px);
  width: 140px;
  height: 140px;
}

.fold-left,
.fold-right {
  top: calc(50% - 70px);
  width: calc(50vw - 70px);
  height: 140px;
  transform: scaleX(0);
}

.fold-left { right: calc(50% + 70px); transform-origin: right center; }
.fold-right { left: calc(50% + 70px); transform-origin: left center; }

.fold-top,
.fold-bottom {
  left: 0;
  width: 100%;
  height: calc(50vh - 70px);
  transform: scaleY(0);
}

.fold-top { bottom: calc(50% + 70px); transform-origin: center bottom; }
.fold-bottom { top: calc(50% + 70px); transform-origin: center top; }

.splash-screen.playing .paper-unfold {
  animation: paper-layer-life 2.95s ease 3.38s both;
}

.splash-screen.playing .paper-center { animation: paper-center-open 340ms ease 3.38s both; }
.splash-screen.playing .fold-left { animation: unfold-horizontal 420ms cubic-bezier(.2, .8, .3, 1) 3.7s both; }
.splash-screen.playing .fold-right { animation: unfold-horizontal 420ms cubic-bezier(.2, .8, .3, 1) 4.08s both; }
.splash-screen.playing .fold-top { animation: unfold-vertical 470ms cubic-bezier(.2, .8, .3, 1) 4.46s both; }
.splash-screen.playing .fold-bottom { animation: unfold-vertical 470ms cubic-bezier(.2, .8, .3, 1) 4.86s both; }

body:not(.splash-playing):not(.splash-complete) .shell {
  visibility: hidden;
}

body.splash-playing .shell {
  visibility: visible;
  animation: interface-unfold 2.08s cubic-bezier(.2, .8, .25, 1) 4.12s both;
}

@keyframes splash-logo-bounce {
  0% { opacity: 0; transform: translateY(-42vh) scale(.62) rotate(-5deg); }
  9% { opacity: 1; transform: translateY(28px) scale(1.08) rotate(2deg); }
  15% { transform: translateY(-18px) scale(.97) rotate(-1deg); }
  21% { transform: translateY(0) scale(1) rotate(0); }
  54% { opacity: 1; transform: translateY(0) scale(1); }
  79% { opacity: 1; transform: translateY(0) scale(.94); }
  91% { opacity: 1; transform: translateY(-10px) scale(.9); }
  100% { opacity: 0; transform: translateY(-76px) scale(.72) rotate(2deg); }
}

@keyframes sticker-paper-rise {
  0% { opacity: 0; transform: translateY(36vh) scale(.25) rotate(13deg); }
  28% { opacity: 1; transform: translateY(18px) scale(.94) rotate(-4deg); }
  40% { transform: translateY(0) scale(1) rotate(0); }
  74% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(5.8); }
}

@keyframes splash-backdrop-away {
  to { opacity: 0; }
}

@keyframes paper-layer-life {
  0%, 82% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes paper-center-open {
  from { opacity: 0; transform: scale(.18) rotate(8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes unfold-horizontal {
  from { transform: scaleX(0) rotateY(82deg); filter: brightness(.78); }
  to { transform: scaleX(1) rotateY(0); filter: brightness(1); }
}

@keyframes unfold-vertical {
  from { transform: scaleY(0) rotateX(82deg); filter: brightness(.8); }
  to { transform: scaleY(1) rotateX(0); filter: brightness(1); }
}

@keyframes interface-unfold {
  0% { opacity: 0; clip-path: inset(calc(50% - 70px) calc(50% - 70px)); transform: scale(.985); }
  38% { opacity: 1; clip-path: inset(calc(50% - 70px) 0); transform: scale(.992); }
  68% { clip-path: inset(0 0 calc(50% - 70px) 0); }
  100% { opacity: 1; clip-path: inset(0); transform: scale(1); }
}

@keyframes scrap-float {
  0% { opacity: 0; transform: translateY(70px) scale(.6); }
  100% { opacity: .92; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen.playing .splash-logo {
    animation-name: splash-logo-gentle;
  }

  .splash-screen.playing .splash-scrap {
    animation-name: scrap-fade;
  }

  .splash-screen.playing .paper-center {
    animation-name: paper-center-gentle;
  }

  .splash-screen.playing .fold-left,
  .splash-screen.playing .fold-right {
    animation-name: unfold-horizontal-gentle;
  }

  .splash-screen.playing .fold-top,
  .splash-screen.playing .fold-bottom {
    animation-name: unfold-vertical-gentle;
  }

  body.splash-playing .shell {
    animation-name: interface-unfold-gentle;
  }
}

@keyframes splash-logo-gentle {
  0% { opacity: 0; transform: scale(.9); }
  12%, 76% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.94); }
}

@keyframes scrap-fade {
  from { opacity: 0; }
  to { opacity: .72; }
}

@keyframes paper-center-gentle {
  from { opacity: 0; transform: scale(.86); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes unfold-horizontal-gentle {
  from { opacity: 0; transform: scaleX(.72); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes unfold-vertical-gentle {
  from { opacity: 0; transform: scaleY(.72); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes interface-unfold-gentle {
  from { opacity: 0; clip-path: inset(12%); }
  to { opacity: 1; clip-path: inset(0); }
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 255, 255, 0.72), transparent 22rem),
    linear-gradient(180deg, #8fd7e7 0%, #c6edf0 48%, #f8db91 100%);
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 2px solid var(--edge);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 4px 0 rgba(45, 31, 20, 0.18);
}

button {
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-height: 38px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(45, 31, 20, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  color: #fffaf2;
  background: linear-gradient(180deg, var(--button), var(--button-dark));
  text-shadow: 0 1px rgba(0, 0, 0, 0.18);
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 6px 10px 10px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(286px, 22vw, 360px);
  align-items: center;
  gap: 10px;
  min-height: 104px;
  height: clamp(104px, 14vh, 128px);
}

.brand {
  display: grid;
  place-items: center;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(620px, 60vw);
  height: clamp(92px, 13vh, 118px);
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 6px 0 rgba(77, 48, 27, 0.16));
}

h2 {
  margin: 0;
  line-height: 1.02;
}

h2 {
  font-size: 1.25rem;
}

.status-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
  gap: 6px;
  align-items: center;
}

.audio-toggle {
  position: relative;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.32rem;
  line-height: 1;
}

.audio-toggle.is-muted::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 25px;
  height: 3px;
  border: 1px solid rgba(255, 248, 229, .78);
  border-radius: 2px;
  background: #d94e47;
  content: "";
  transform: translate(-50%, -50%) rotate(-48deg);
  box-shadow: 0 1px 0 rgba(67, 43, 28, .3);
}

.turn-spotlight {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  min-height: 68px;
  overflow: hidden;
  border: 3px solid rgba(69, 45, 29, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px),
    rgba(255, 248, 229, 0.9);
  background-size: 16px 16px, auto;
  box-shadow: 0 5px 0 rgba(45, 31, 20, 0.14);
}

#turnTankCanvas {
  width: 90px;
  height: 58px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.turn-spotlight > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.turn-spotlight span {
  color: #8b5636;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.turn-spotlight strong {
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 2px dashed rgba(69, 45, 29, 0.24);
  border-radius: 999px;
  background: rgba(255, 248, 229, 0.82);
  font-weight: 900;
}

.wind-pill {
  gap: 8px;
  min-width: 160px;
  justify-content: center;
}

.wind-name {
  padding-right: 7px;
  border-right: 2px dotted rgba(75, 52, 34, 0.22);
  color: #66492f;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.wind-arrow {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #e55345;
  font-size: 1.55rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.game-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(286px, 22vw, 360px);
  gap: 10px;
  align-items: stretch;
  min-height: 0;
}

.canvas-frame {
  position: relative;
  display: grid;
  place-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
}

canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 4px solid rgba(74, 50, 31, 0.28);
  border-radius: 8px;
  background: var(--sky);
  box-shadow: 0 12px 0 rgba(87, 58, 35, 0.16), 0 20px 44px rgba(45, 34, 24, 0.22);
  cursor: grab;
  touch-action: none;
}

canvas.dragging {
  cursor: grabbing;
}

canvas.pinching {
  cursor: zoom-in;
}

.map-tools {
  position: absolute;
  z-index: 12;
  top: 12px;
  right: 12px;
  display: grid;
  width: 46px;
  gap: 7px;
}

.map-tools.hidden {
  display: none;
}

.minimap-toggle {
  display: grid;
  width: 46px;
  min-height: 46px;
  place-items: center;
  padding: 0;
  border-color: rgba(76, 52, 33, 0.3);
  background: rgba(255, 248, 229, 0.94);
  box-shadow: 0 4px 0 rgba(45, 31, 20, 0.18);
}

.minimap-toggle[aria-pressed="true"] {
  border-color: #d34f43;
  background: #f6d7b1;
  box-shadow: inset 0 0 0 2px rgba(211, 79, 67, 0.14), 0 4px 0 rgba(45, 31, 20, 0.18);
}

.minimap-toggle-icon {
  position: relative;
  display: block;
  width: 27px;
  height: 22px;
  overflow: hidden;
  border: 2px solid #654a35;
  border-radius: 3px;
  background: #83cee0;
}

.minimap-toggle-icon::before {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 8px;
  background: #83b957;
  clip-path: polygon(0 74%, 24% 25%, 45% 60%, 68% 8%, 100% 70%, 100% 100%, 0 100%);
  content: "";
}

.minimap-toggle-icon::after {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f2c84c;
  content: "";
}

.minimap-toggle-icon i {
  position: absolute;
  z-index: 2;
  top: 6px;
  left: 8px;
  width: 11px;
  height: 9px;
  border: 1px solid #ed5548;
  content: "";
}

.canvas-zoom-controls {
  display: grid;
  gap: 6px;
}

.canvas-zoom-controls .icon-button {
  width: 46px;
  min-height: 40px;
  padding: 0;
  background: rgba(255, 248, 229, 0.94);
  font-size: 1.35rem;
  line-height: 1;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
  border: 4px solid rgba(74, 50, 31, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    linear-gradient(180deg, #fff7e8, #f0dfbf);
  background-size: 18px 18px, auto;
  box-shadow: 0 10px 0 rgba(87, 58, 35, 0.14);
}

.panel-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.panel-scroll > * {
  min-width: 0;
}

.setup,
.play {
  display: grid;
  gap: 12px;
}

.setup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 11px;
  border-bottom: 2px dashed rgba(70, 51, 34, 0.2);
}

.setup-heading span {
  color: #a14637;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-heading h2 {
  margin-top: 3px;
}

.setup-progress {
  display: flex;
  gap: 7px;
}

.setup-progress i {
  width: 28px;
  height: 8px;
  border: 2px solid rgba(77, 55, 38, 0.28);
  border-radius: 4px;
  background: #d6c8af;
}

.setup-progress i.active {
  border-color: #9d4439;
  background: #e75a4e;
}

.setup-step {
  display: none;
  gap: 12px;
}

.setup-step.active {
  display: grid;
}

.setup-step[data-setup-step="2"].active {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.setup-step[data-setup-step="2"] .rule-settings-row {
  display: contents;
}

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

.setup-navigation {
  display: grid;
  grid-template-columns: minmax(100px, .45fr) minmax(170px, 1fr);
  gap: 9px;
  padding-top: 12px;
  border-top: 2px dashed rgba(70, 51, 34, 0.2);
}

.setup-navigation .primary {
  grid-column: 2;
}

.setup-navigation button:active {
  transform: none;
  box-shadow: 0 2px 0 rgba(45, 31, 20, 0.18);
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.player-count-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.player-count-picker button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 5px 9px;
}

.player-count-picker button[aria-checked="true"] {
  border-color: #cf4d42;
  background: #f7ddba;
  box-shadow: inset 0 0 0 2px rgba(207, 77, 66, 0.15), 0 4px 0 rgba(45, 31, 20, 0.18);
}

.setup-field {
  display: grid;
  grid-template-rows: 28px minmax(58px, 1fr);
  gap: 6px;
  height: 100%;
}

.rule-setting {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 100px;
}

.rule-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.rule-setting-icon {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 3px solid #6b4b32;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(99, 70, 43, .08) 1px, transparent 1px),
    #efd39a;
  background-size: 8px 100%, auto;
  box-shadow: 0 4px 0 rgba(58, 39, 24, .2);
}

.rounds-rule-icon::before {
  position: absolute;
  top: 8px;
  left: 50%;
  display: grid;
  width: 25px;
  height: 20px;
  place-items: center;
  border: 2px solid #6b4825;
  border-radius: 3px 3px 9px 9px;
  background: linear-gradient(135deg, #f2c75f, #d99628);
  clip-path: polygon(0 0, 100% 0, 89% 72%, 68% 100%, 32% 100%, 11% 72%);
  color: #fff0a6;
  content: "\2605";
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 1px #8d5d24;
  transform: translateX(-50%);
}

.rounds-rule-icon::after {
  position: absolute;
  top: 28px;
  left: 50%;
  width: 5px;
  height: 9px;
  border: 2px solid #6b4825;
  border-top: 0;
  background: #dda13a;
  content: "";
  transform: translateX(-50%);
}

.rounds-rule-icon i {
  position: absolute;
  z-index: 1;
  top: 36px;
  left: 50%;
  width: 21px;
  height: 4px;
  border: 2px solid #6b4825;
  border-radius: 5px 5px 2px 2px;
  background: #efc45e;
  transform: translateX(-50%);
}

.wind-rule-icon {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .48), transparent 72%),
    #9dd9e3;
}

.wind-rule-icon i {
  position: absolute;
  height: 3px;
  border-radius: 999px;
  background: #fff5d9;
  filter: drop-shadow(1px 2px 0 rgba(73, 101, 103, .18));
}

.wind-rule-icon i::before {
  position: absolute;
  top: -1px;
  left: -4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff5d9;
  content: "";
}

.wind-rule-icon i::after {
  position: absolute;
  top: -4px;
  right: -3px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #fff5d9;
  content: "";
}

.wind-rule-icon i:nth-child(1) { top: 12px; left: 10px; width: 25px; }
.wind-rule-icon i:nth-child(2) { top: 22px; left: 7px; width: 32px; }
.wind-rule-icon i:nth-child(3) { top: 32px; left: 12px; width: 22px; }

.interest-rule-icon {
  background:
    linear-gradient(90deg, rgba(99, 70, 43, .08) 1px, transparent 1px),
    #efd39a;
  background-size: 8px 100%, auto;
}

.interest-rule-icon::before {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid #744d23;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffe89b 0 11%, transparent 12%),
    #dfa936;
  box-shadow: 0 2px 0 rgba(77, 50, 27, .24);
  content: "";
}

.interest-rule-icon i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #70451d;
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.wallet-rule-icon {
  background:
    linear-gradient(90deg, rgba(99, 70, 43, .08) 1px, transparent 1px),
    #efd39a;
  background-size: 8px 100%, auto;
}

.wallet-rule-icon .cash-wad {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%) rotate(-4deg) scale(.72);
}

.setup-slider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.setup-slider-heading output {
  min-width: 70px;
  padding: 4px 8px;
  border: 2px solid rgba(90, 62, 38, 0.22);
  border-radius: 6px;
  color: #6a4930;
  background: #f4d27f;
  box-shadow: 0 3px 0 rgba(45, 31, 20, 0.14);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.setup-slider {
  display: grid;
  gap: 1px;
  padding: 4px 8px 2px;
  border: 2px dashed rgba(70, 51, 34, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

.setup-slider input[type="range"] {
  appearance: none;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.setup-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid rgba(78, 55, 37, 0.38);
  border-radius: 4px;
  background: #d8cbb5;
  box-shadow: inset 0 1px 2px rgba(55, 38, 25, 0.2);
}

.setup-slider input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid #755136;
  border-radius: 50%;
  background: #e0574b;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.4), 0 2px 0 rgba(45, 31, 20, 0.18);
}

.setup-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border: 1px solid rgba(78, 55, 37, 0.38);
  border-radius: 4px;
  background: #d8cbb5;
}

.setup-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #755136;
  border-radius: 50%;
  background: #e0574b;
}

.slider-stops {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding-inline: 9px;
  color: #80684e;
  font-size: 0.65rem;
  font-weight: 900;
  text-align: center;
}

.slider-stops span {
  position: relative;
  display: flex;
  justify-content: center;
  width: 0;
  padding-top: 7px;
}

.slider-stops span::before {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 2px;
  height: 8px;
  border-radius: 1px;
  background: #8c7358;
  content: "";
  transform: translateX(-50%);
}

.option-picker {
  display: grid;
  gap: 5px;
}

.option-picker.three-options {
  grid-template-columns: repeat(3, 1fr);
}

.option-picker.two-options {
  grid-template-columns: repeat(2, 1fr);
}

.option-picker.four-options {
  grid-template-columns: repeat(4, 1fr);
}

.option-picker.five-options {
  grid-template-columns: repeat(5, 1fr);
}

.option-picker.six-options {
  grid-template-columns: repeat(6, 1fr);
}

.option-picker.seven-options {
  grid-template-columns: repeat(7, 1fr);
}

.option-picker button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 48px;
  padding: 4px 2px;
  font-size: 0.66rem;
  line-height: 1;
}

.option-picker button[aria-checked="true"] {
  border-color: #cf4d42;
  background: #f7ddba;
  box-shadow: inset 0 0 0 2px rgba(207, 77, 66, 0.15), 0 4px 0 rgba(45, 31, 20, 0.18);
}

.setup-icon {
  position: relative;
  display: block;
  width: 30px;
  height: 21px;
}

.setup-icon.map {
  overflow: hidden;
  width: 36px;
  height: 22px;
  border: 2px solid #674a32;
  border-radius: 3px;
  background:
    radial-gradient(ellipse at 24% 27%, rgba(255, 250, 229, 0.95) 0 9%, transparent 10%),
    radial-gradient(ellipse at 34% 27%, rgba(255, 250, 229, 0.95) 0 11%, transparent 12%),
    radial-gradient(circle at 78% 23%, #f2c64c 0 9%, transparent 10%),
    linear-gradient(#72c9df 0 58%, #c9e9e4 59% 100%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.48);
}

.setup-icon.map-1280 {
  width: 27px;
  height: 19px;
}

.setup-icon.map-1920 {
  width: 36px;
  height: 22px;
}

.setup-icon.map-2560 {
  width: 36px;
  height: 22px;
}

.setup-icon.map-3400 {
  width: 46px;
  height: 24px;
}

.setup-icon.map-4400 {
  width: 56px;
  height: 26px;
}

.setup-icon.map::before {
  position: absolute;
  z-index: 1;
  right: -1px;
  bottom: -1px;
  left: -1px;
  height: 13px;
  border-top: 2px dotted rgba(89, 67, 39, 0.75);
  background:
    linear-gradient(rgba(107, 166, 77, 0.98) 0 28%, transparent 29%),
    repeating-linear-gradient(90deg, #c69a52 0 5px, #b98647 5px 9px);
  clip-path: polygon(0 60%, 16% 38%, 31% 62%, 47% 20%, 64% 52%, 81% 28%, 100% 48%, 100% 100%, 0 100%);
  content: "";
}

.setup-icon.map::after {
  position: absolute;
  z-index: 2;
  right: 3px;
  bottom: 3px;
  width: 3px;
  height: 3px;
  border: 1px solid #5a4330;
  border-radius: 1px;
  background: #e55249;
  box-shadow: -20px 1px 0 #4d8fd0;
  content: "";
}

.setup-icon.map-1280::before {
  clip-path: polygon(0 58%, 28% 35%, 52% 60%, 76% 30%, 100% 51%, 100% 100%, 0 100%);
}

.setup-icon.map-3400::before {
  clip-path: polygon(0 66%, 10% 29%, 23% 58%, 36% 15%, 50% 67%, 64% 25%, 76% 53%, 89% 18%, 100% 45%, 100% 100%, 0 100%);
}

.setup-icon.map-4400::before {
  clip-path: polygon(0 57%, 8% 19%, 17% 63%, 27% 31%, 38% 72%, 49% 9%, 60% 58%, 70% 22%, 81% 68%, 91% 15%, 100% 48%, 100% 100%, 0 100%);
}

.setup-icon.terrain {
  overflow: hidden;
  border-bottom: 3px solid #674a32;
  background: #80bd5b;
  clip-path: polygon(0 72%, 20% 50%, 38% 68%, 58% 28%, 76% 58%, 100% 14%, 100% 100%, 0 100%);
}

.setup-icon.terrain.gentle {
  clip-path: polygon(0 72%, 22% 58%, 43% 67%, 64% 48%, 82% 62%, 100% 52%, 100% 100%, 0 100%);
}

.setup-icon.terrain.extreme {
  clip-path: polygon(0 84%, 18% 70%, 36% 91%, 56% 8%, 73% 76%, 89% 28%, 100% 66%, 100% 100%, 0 100%);
}

.setup-icon.rounds,
.setup-icon.interest {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 2px solid #79552e;
  border-radius: 50%;
  color: #5f432d;
  background: #f1c451;
  font-size: 0.7rem;
  font-weight: 900;
}

.setup-icon.wind {
  width: 34px;
  height: 22px;
  color: #e45449;
}

.setup-icon.wind i {
  position: absolute;
  display: block;
  font-size: 1rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, 0.65);
}

.setup-icon.wind .gust-1 {
  top: 1px;
  left: 1px;
  transform: rotate(-5deg);
}

.setup-icon.wind .gust-2 {
  top: 11px;
  left: 10px;
  transform: rotate(4deg);
}

.setup-icon.wind .gust-3 {
  top: 0;
  left: 19px;
  transform: rotate(8deg);
}

.setup-icon.wind .gust-4 {
  top: 10px;
  left: 25px;
  transform: rotate(-7deg);
}

.setup-icon.wind.off {
  color: #887867;
  font-size: 1.45rem;
  font-weight: 900;
}

.setup-icon.sky-mode {
  overflow: hidden;
  width: 34px;
  height: 24px;
  border: 2px solid #624a39;
  border-radius: 3px;
  background: linear-gradient(#70cce1, #d6eeee);
}

.setup-icon.sky-mode i {
  position: absolute;
  top: 4px;
  left: 12px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #f3c84d;
  box-shadow: 0 0 0 2px rgba(255, 231, 137, 0.55);
}

.setup-icon.sky-mode.night {
  background: linear-gradient(#060911, #273243);
}

.setup-icon.sky-mode.night i {
  background: #f1efdf;
  box-shadow: 4px -2px 0 #111827;
}

.setup-icon.sky-mode.random {
  background: linear-gradient(90deg, #70cce1 0 50%, #0b101b 50%);
}

.setup-icon.sky-mode.random i {
  left: 10px;
  box-shadow: 8px 0 0 #f1efdf;
}

.setup-icon.aim-arc {
  width: 36px;
  height: 23px;
  border-bottom: 2px solid rgba(93, 67, 43, 0.42);
}

.setup-icon.aim-arc i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e3584c;
}

.setup-icon.aim-arc i:nth-child(1) { bottom: 2px; left: 1px; }
.setup-icon.aim-arc i:nth-child(2) { bottom: 11px; left: 10px; }
.setup-icon.aim-arc i:nth-child(3) { bottom: 15px; left: 20px; }
.setup-icon.aim-arc i:nth-child(4) { right: 1px; bottom: 10px; opacity: 0.42; }

.setup-icon.aim-arc b {
  position: absolute;
  top: 10px;
  left: 4px;
  width: 28px;
  height: 3px;
  background: #887867;
  border-radius: 2px;
  transform: none;
}

.setup-icon.aim-arc.off {
  border-bottom-color: transparent;
}

.people-icons {
  display: flex;
  align-items: end;
  justify-content: center;
  min-width: 0;
}

.people-icons i {
  position: relative;
  display: block;
  width: 16px;
  height: 17px;
  margin-left: -3px;
  border: 2px solid #684b33;
  border-radius: 7px 7px 4px 4px;
  background: #e85b55;
  transform: scale(0.82);
}

.people-icons i::before {
  position: absolute;
  top: -10px;
  left: 2px;
  width: 8px;
  height: 8px;
  border: 2px solid #684b33;
  border-radius: 50%;
  background: #f3d08b;
  content: "";
}

.people-icons i:nth-child(2) {
  background: #49a36d;
}

.people-icons i:nth-child(3) {
  background: #4e8edb;
}

.people-icons i:nth-child(4) {
  background: #e0ab3d;
}

.people-icons i:nth-child(5) {
  background: #9b63bd;
}

.people-icons i:nth-child(6) {
  background: #36a9b5;
}

.custom-wallet-control {
  display: grid;
  gap: 7px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.82rem;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--button);
}

.custom-wallet-control input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
}

.player-rows {
  display: grid;
  gap: 8px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.economy-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 2px dashed rgba(70, 51, 34, 0.22);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
  font-size: 0.82rem;
  font-weight: 900;
  min-height: 100%;
}

.economy-preview strong {
  color: #2d7650;
  text-align: right;
}

.wallet-inline {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto;
  gap: 5px;
  align-items: center;
  min-width: 0;
  color: #2d7650;
}

.economy-preview .wallet-inline input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px dashed rgba(45, 118, 80, 0.48);
  border-radius: 0;
  color: #2d7650;
  background: transparent;
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: right;
}

.economy-preview .wallet-inline input:focus {
  outline: 2px solid rgba(45, 118, 80, 0.24);
  outline-offset: 2px;
}

.wallet-inline span {
  color: #2d7650;
  font-size: 0.72rem;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .setup-step[data-setup-step="2"].active {
    grid-template-columns: 1fr;
  }

  .rule-setting {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 7px;
  }

  .rule-setting-icon {
    width: 38px;
    height: 38px;
    transform: scale(.82);
    transform-origin: center;
  }

}

.wind-stops span {
  line-height: 1.05;
}

.player-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 3px solid color-mix(in srgb, var(--player-color) 68%, #5d4634);
  border-radius: 7px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--player-color) 18%, transparent), transparent 70%),
    rgba(255, 255, 255, 0.52);
  box-shadow: inset 8px 0 color-mix(in srgb, var(--player-color) 60%, transparent);
}

body:not(.match-active) .game-wrap {
  grid-template-columns: minmax(0, 1fr);
}

body:not(.match-active) .panel {
  position: fixed;
  z-index: 45;
  top: 50%;
  left: 50%;
  width: min(920px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 32px);
  padding: 18px;
  transform: translate(-50%, -50%);
  box-shadow: 0 14px 0 rgba(87, 58, 35, 0.18), 0 24px 60px rgba(45, 34, 24, 0.3);
}

body:not(.match-active) .panel-scroll {
  flex: 0 1 auto;
  max-height: calc(100dvh - 108px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

body:not(.match-active) .setup {
  gap: 14px;
}

body:not(.match-active) .player-rows {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 8px;
}

@media (min-width: 1025px) and (min-height: 580px) {
  body:not(.match-active) .panel:has([data-setup-step="1"].active) {
    height: auto;
    max-height: calc(100dvh - 12px);
    overflow: visible;
  }

  body:not(.match-active) .panel:has([data-setup-step="1"].active) .panel-scroll {
    max-height: none;
    overflow: visible;
  }

}

@media (min-width: 1100px) {
  body:not(.match-active) .panel:has([data-setup-step="1"].active) {
    width: min(1040px, calc(100vw - 24px));
  }

  body:not(.match-active) .player-rows[data-count="5"],
  body:not(.match-active) .player-rows[data-count="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .player-rows[data-count="5"] .player-row:nth-child(3) .tank-picker-menu,
  .player-rows[data-count="5"] .player-row:nth-child(3) .player-type-menu,
  .player-rows[data-count="6"] .player-row:nth-child(3) .tank-picker-menu,
  .player-rows[data-count="6"] .player-row:nth-child(3) .player-type-menu {
    top: calc(100% + 5px);
    bottom: auto;
  }
}

body:not(.match-active) .panel-footer {
  padding-top: 8px;
}

@media (min-width: 701px) {
  body:not(.match-active) .setup-navigation {
    padding-right: 92px;
  }

  body:not(.match-active) .panel-footer {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: flex;
    gap: 6px;
    padding: 0;
    background: transparent;
  }
}

.player-row input,
.player-row select {
  min-width: 0;
  font-size: 0.8rem;
}

.player-type-picker,
.tank-picker {
  position: relative;
  min-width: 0;
}

.player-type-button,
.tank-picker-button {
  display: grid;
  align-items: center;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.player-type-button {
  grid-template-columns: 29px minmax(0, 1fr) 12px;
  min-height: 38px;
  padding: 3px 7px;
  font-size: 0.76rem;
}

.player-type-menu {
  position: absolute;
  z-index: 55;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  display: grid;
  padding: 5px;
  border: 3px solid rgba(74, 50, 31, 0.28);
  border-radius: 7px;
  background: #fff7e8;
  box-shadow: 0 9px 18px rgba(45, 34, 24, 0.24);
}

.player-type-menu.hidden {
  display: none;
}

.player-type-menu button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-height: 35px;
  padding: 3px 6px;
  border: 0;
  border-bottom: 1px dashed rgba(70, 51, 34, 0.18);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.75rem;
  text-align: left;
}

.player-type-menu button[aria-selected="true"] {
  background: #f2dfb8;
}

.player-type-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}

.player-type-icon.human::before {
  position: absolute;
  top: 1px;
  left: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid #674930;
  border-radius: 50%;
  background: #f0c986;
  content: "";
}

.player-type-icon.human::after {
  position: absolute;
  bottom: 1px;
  left: 5px;
  width: 14px;
  height: 10px;
  border: 2px solid #674930;
  border-radius: 7px 7px 3px 3px;
  background: #4e8edb;
  content: "";
}

.player-type-icon:not(.human)::before {
  position: absolute;
  top: 3px;
  left: 2px;
  width: 20px;
  height: 15px;
  border: 2px solid #674930;
  border-radius: 4px;
  background: #a7d7d7;
  content: "";
}

.player-type-icon:not(.human)::after {
  position: absolute;
  bottom: 1px;
  left: 8px;
  width: 10px;
  height: 4px;
  border-radius: 2px;
  background: #674930;
  content: "";
}

.player-type-icon:not(.human) i::before,
.player-type-icon:not(.human) i::after {
  position: absolute;
  z-index: 1;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4c795a;
  content: "";
}

.player-type-icon:not(.human) i::before {
  left: 7px;
}

.player-type-icon:not(.human) i::after {
  left: 15px;
}

.player-type-icon.cpu-normal::before {
  border-radius: 50% 50% 4px 4px;
  background: #efc35b;
}

.player-type-icon.cpu-normal i::before,
.player-type-icon.cpu-normal i::after {
  background: #d95148;
}

.player-type-icon.cpu-expert::before {
  border-color: #493b33;
  background: #e46155;
  clip-path: polygon(50% 0, 100% 28%, 90% 100%, 10% 100%, 0 28%);
}

.player-type-icon.cpu-expert i::before,
.player-type-icon.cpu-expert i::after {
  box-shadow: 0 0 5px #fff;
  background: #fff0a6;
}

.tank-picker {
  grid-column: 1 / -1;
}

.tank-picker-button {
  grid-template-columns: 58px minmax(0, 1fr) 14px;
  min-height: 48px;
  padding: 3px 7px 3px 3px;
}

.tank-picker-button > span:nth-child(2) {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tank-picker-button small {
  color: #80684e;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tank-picker-button strong {
  overflow: hidden;
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tank-picker-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 5px);
  right: 0;
  width: min(316px, calc(100vw - 28px));
  padding: 8px;
  border: 3px solid rgba(74, 50, 31, 0.3);
  border-radius: 7px;
  background: #fff7e8;
  box-shadow: 0 12px 24px rgba(45, 34, 24, 0.28);
}

.tank-picker-menu.hidden {
  display: none;
}

.player-row:nth-child(n+3) .tank-picker-menu,
.player-row:nth-child(n+3) .player-type-menu {
  top: auto;
  bottom: calc(100% + 5px);
}

.tank-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #3d352e;
  font-size: 0.8rem;
}

.tank-picker-heading button {
  width: 26px;
  min-height: 26px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.tank-design-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.tank-design-choice {
  display: grid;
  place-items: center;
  gap: 1px;
  min-width: 0;
  min-height: 61px;
  padding: 3px;
  font-size: 0.62rem;
}

.tank-design-choice[aria-checked="true"] {
  border-color: #cf4d42;
  background: #f7ddba;
  box-shadow: inset 0 0 0 2px rgba(207, 77, 66, 0.14), 0 3px 0 rgba(45, 31, 20, 0.16);
}

.tank-color-label {
  display: block;
  margin: 8px 0 5px;
  color: #80684e;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tank-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.tank-design-mini {
  position: relative;
  display: block;
  width: 54px;
  height: 34px;
  flex: 0 0 auto;
}

.tank-design-mini::before {
  position: absolute;
  right: 5px;
  bottom: 7px;
  left: 4px;
  height: 12px;
  border: 2px solid #65482f;
  border-radius: 5px 8px 4px 4px;
  background: var(--tank-color);
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.18);
  content: "";
}

.tank-design-mini::after {
  position: absolute;
  z-index: 3;
  right: 1px;
  bottom: 20px;
  width: 19px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(#f1d994 0 45%, #65482f 46% 100%);
  content: "";
  transform: rotate(-18deg);
  transform-origin: left center;
}

.tank-design-mini i {
  position: absolute;
  z-index: 2;
  left: 16px;
  bottom: 18px;
  width: 17px;
  height: 10px;
  border: 2px solid #65482f;
  border-radius: 7px 7px 2px 2px;
  background: var(--tank-color);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.2);
}

.tank-design-mini b {
  position: absolute;
  z-index: 1;
  right: 3px;
  bottom: 1px;
  left: 3px;
  height: 10px;
  border: 2px solid #493e35;
  border-radius: 7px;
  background: repeating-linear-gradient(90deg, #544a40 0 6px, #85735f 6px 8px);
  content: "";
}

.tank-design-mini em {
  position: absolute;
  z-index: 2;
  bottom: 4px;
  left: 12px;
  width: 7px;
  height: 7px;
  border: 1px solid #3d352e;
  border-radius: 50%;
  background: #d4aa52;
  box-shadow: 12px 0 #d4aa52, 24px 0 #d4aa52;
}

.tank-design-mini.design-1::before {
  right: 10px;
  left: 10px;
  height: 15px;
  border-radius: 9px 9px 3px 3px;
}

.tank-design-mini.design-1 i {
  left: 21px;
  bottom: 21px;
  width: 12px;
  height: 13px;
  border-radius: 5px 5px 2px 2px;
}

.tank-design-mini.design-1 b {
  right: 9px;
  left: 9px;
  height: 12px;
  border-radius: 4px;
}

.tank-design-mini.design-1 em {
  left: 15px;
  box-shadow: 10px 0 #d4aa52, 20px 0 #d4aa52;
}

.tank-design-mini.design-2::before {
  right: 3px;
  left: 3px;
  height: 15px;
  border-radius: 50% 50% 8px 8px;
}

.tank-design-mini.design-2 i {
  left: 13px;
  bottom: 19px;
  width: 27px;
  height: 13px;
  border-radius: 50% 50% 3px 3px;
}

.tank-design-mini.design-2 b {
  height: 8px;
  border-radius: 50%;
}

.tank-design-mini.design-2 em {
  bottom: 3px;
  left: 8px;
  width: 8px;
  height: 8px;
  box-shadow: 15px 0 #d4aa52, 30px 0 #d4aa52;
}

.tank-design-mini.design-3::before {
  right: 0;
  left: 0;
  height: 14px;
  border-radius: 2px;
}

.tank-design-mini.design-3 i {
  left: 11px;
  bottom: 20px;
  width: 31px;
  height: 12px;
  border-radius: 2px;
}

.tank-design-mini.design-3 b {
  right: 0;
  left: 0;
  height: 11px;
  border-radius: 2px;
}

.tank-design-mini.design-4::before {
  right: 4px;
  left: 4px;
  height: 10px;
  border-radius: 3px 3px 9px 9px;
  background: repeating-linear-gradient(90deg, var(--tank-color) 0 6px, rgba(255, 255, 255, 0.22) 6px 8px);
}

.tank-design-mini.design-4 i {
  left: 13px;
  bottom: 17px;
  width: 28px;
  height: 9px;
  border-radius: 3px 3px 8px 8px;
}

.tank-design-mini.design-4 b {
  right: 1px;
  left: 1px;
  border: 0;
  background: transparent;
}

.tank-design-mini.design-4 em {
  bottom: 2px;
  left: 4px;
  width: 10px;
  height: 10px;
  box-shadow: 12px 0 #d4aa52, 24px 0 #d4aa52, 36px 0 #d4aa52;
}

.tank-design-mini.design-5::before {
  right: 1px;
  left: 1px;
  height: 15px;
  border-radius: 2px;
  clip-path: polygon(0 100%, 18% 18%, 82% 0, 100% 100%);
}

.tank-design-mini.design-5 i {
  left: 10px;
  bottom: 20px;
  width: 29px;
  height: 10px;
  border-radius: 2px 8px 2px 2px;
  transform: skewX(-15deg);
}

.tank-design-mini.design-5 b {
  right: 0;
  left: 0;
  height: 9px;
  border-radius: 1px;
  transform: skewX(-9deg);
}

.color-choice {
  display: block;
  width: 27px;
  min-height: 27px;
  padding: 0;
  border: 2px solid rgba(40, 29, 21, 0.34);
  border-radius: 50%;
  background: var(--color);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.4), 0 2px 0 rgba(45, 31, 20, 0.16);
}

.color-choice[aria-checked="true"] {
  outline: 3px solid #2f3d45;
  outline-offset: 1px;
}

.swatch {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(40, 29, 21, 0.28);
  border-radius: 50%;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.45);
}

.readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}

.weapon-field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.weapon-picker {
  position: relative;
}

.weapon-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 18px;
  align-items: center;
  width: 100%;
  padding: 3px 8px 3px 5px;
  text-align: left;
}

.weapon-button img,
.weapon-option img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.picker-arrow {
  color: var(--muted);
  text-align: center;
}

.weapon-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  display: grid;
  max-height: min(var(--weapon-menu-max-height, 520px), calc(100dvh - 24px));
  padding: 5px;
  overflow-y: auto;
  border: 3px solid rgba(74, 50, 31, 0.28);
  border-radius: 7px;
  background: #fff7e8;
  box-shadow: 0 10px 22px rgba(45, 34, 24, 0.24);
}

.weapon-menu.opens-up {
  top: auto;
  bottom: calc(100% + 5px);
}

.weapon-menu-group {
  display: grid;
}

.weapon-group-label {
  position: sticky;
  z-index: 1;
  top: -5px;
  padding: 6px 7px 4px;
  border-bottom: 2px solid rgba(112, 76, 43, 0.2);
  color: #8b4a37;
  background: #fff7e8;
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
}

.used-weapons-group {
  margin-top: 4px;
  border-top: 2px dashed rgba(74, 50, 31, 0.2);
}

.used-weapons-group .weapon-group-label {
  color: #746d65;
  background: #eee8dc;
}

.used-weapon-option {
  color: #716d66;
  background: rgba(111, 106, 97, 0.08);
}

.used-weapon-option .weapon-option-ammo {
  color: #817b72;
  text-transform: uppercase;
}

.weapon-menu.hidden {
  display: none;
}

.weapon-option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 40px;
  padding: 2px 6px;
  border: 0;
  border-bottom: 1px dashed rgba(70, 51, 34, 0.18);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.weapon-ammo,
.weapon-option-ammo {
  min-width: 30px;
  color: #725136;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: right;
}

.weapon-option:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.weapon-option:disabled:hover {
  background: transparent;
}

.weapon-option:hover,
.weapon-option[aria-selected="true"] {
  background: #f2dfb8;
}

.weapon-info {
  min-height: 82px;
  padding: 9px 10px;
  border: 2px dashed rgba(70, 51, 34, 0.22);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
  font-size: 0.83rem;
  line-height: 1.25;
}

.weapon-info p {
  margin: 0 0 8px;
}

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

.weapon-stats > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid rgba(70, 51, 34, 0.16);
  border-radius: 4px;
  color: #71543b;
  background: rgba(255, 250, 239, 0.66);
  font-size: 0.65rem;
  line-height: 1.05;
}

.weapon-stats b {
  color: #3f4a50;
  font-size: 0.58rem;
  text-transform: uppercase;
}

.stat-meter {
  display: flex;
  gap: 2px;
  height: 7px;
}

.stat-meter i {
  display: block;
  flex: 1;
  border-radius: 1px;
  background: #d8cfbd;
}

.stat-meter i.filled {
  background: #df564a;
}

.stat-meter.radius-meter i.filled {
  background: #d3a33f;
}

.preview-command {
  min-height: 38px;
  color: #5f4934;
  background: #f7e5bd;
}

.readout span,
.tip span {
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--button);
}

.sidebar-aim-control {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 7px;
  align-items: center;
}

.aim-step-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.power-control {
  margin-bottom: 8px;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 2px solid var(--edge);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 4px 0 rgba(45, 31, 20, 0.18);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#fireBtn {
  width: 100%;
  min-height: 46px;
}

@media (min-width: 1025px) and (max-height: 820px) {
  body.match-active .panel-scroll {
    flex: 0 0 auto;
    overflow: visible;
  }

  body.match-active .play {
    gap: 6px;
  }

  body.match-active .weapon-info {
    min-height: 0;
    padding: 5px 7px;
  }

  body.match-active .weapon-info p {
    display: none;
  }

  body.match-active .preview-command {
    min-height: 32px;
  }

  body.match-active .score-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 82px;
  }

  body.match-active .readout {
    font-size: .82rem;
  }

  body.match-active .sidebar-aim-control {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 5px;
  }

  body.match-active .aim-step-button {
    width: 32px;
    min-height: 32px;
  }
}

.zoom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.zoom-controls {
  display: grid;
  grid-template-columns: 38px 64px 38px;
  gap: 5px;
}

.icon-button.compact,
.zoom-value {
  min-height: 36px;
}

.zoom-value {
  padding: 0 6px;
  font-size: 0.82rem;
}

.keyboard-controls {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 2px dashed rgba(70, 51, 34, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  font-size: 0.78rem;
}

.keyboard-controls > div {
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
}

.keyboard-controls > div:nth-child(4),
.keyboard-controls > div:nth-child(5) {
  grid-template-columns: 73px minmax(0, 1fr);
}

.keyboard-controls span {
  color: var(--muted);
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  min-height: 25px;
  padding: 0 5px;
  border: 2px solid rgba(55, 39, 26, 0.22);
  border-radius: 5px;
  color: #60462f;
  background: #fffaf0;
  box-shadow: 0 3px 0 rgba(45, 31, 20, 0.18);
  font-weight: 900;
}

.score-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.match-active .score-list {
  flex: 0 1 auto;
  gap: 6px;
  max-height: min(50vh, 390px);
  margin-top: 14px;
  padding-top: 14px;
  padding-bottom: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 2px dashed rgba(104, 78, 51, .24);
}

.score-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 49px;
  padding: 8px 8px 11px;
  border: 2px solid rgba(55, 39, 26, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
  font-weight: 900;
}

.score-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.score-main > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-track {
  display: flex;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(50, 35, 24, 0.32);
  border-radius: 3px;
  background: rgba(70, 54, 39, 0.2);
}

.hp-track > span {
  display: block;
  flex: 0 0 auto;
  height: 100%;
  transition: width 240ms ease;
}

.hp-track .hp-shield {
  background: #58cce5;
  box-shadow: inset 1px 0 rgba(222, 250, 255, .78);
}

.score-value {
  display: grid;
  gap: 3px;
  justify-items: end;
  min-width: 82px;
  font-size: 0.82rem;
}

.score-top {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  white-space: nowrap;
}

.trophy-count {
  color: #9a671d;
  font-size: 1rem;
  line-height: 1;
}

.score-value small {
  color: var(--muted);
  font-size: 0.68rem;
}

.score-list .out {
  opacity: 0.48;
}

.panel-footer {
  z-index: 25;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 38px 38px;
  gap: 7px;
  flex: 0 0 auto;
  padding: 10px 0 0;
  background: #f0dfbf;
}

.panel-footer .skip-round {
  grid-column: 1 / -1;
  min-height: 40px;
  border-color: rgba(155, 74, 55, 0.34);
  color: #873f35;
  background: #f6d99e;
}

.panel-footer button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 0.76rem;
}

#newGameBtn {
  grid-column: 1;
}

#keyboardBtn {
  grid-column: 2;
}

#copyrightBtn {
  grid-column: 4;
  width: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
}

#panelAudioToggleBtn {
  grid-column: 3;
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.mobile-install-button {
  grid-column: 1 / -1;
}

.mobile-experience-sheet {
  width: min(520px, calc(100vw - 20px));
}

.mobile-experience-copy {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.mobile-experience-copy p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.mobile-app-icon {
  display: block;
  grid-row: 1 / 3;
  width: 64px;
  height: 64px;
  border: 3px solid #765235;
  border-radius: 13px;
  background: #171b20 url("assets/crafted-tanks-icon.svg") center / 94% no-repeat;
  box-shadow: 0 5px 0 rgba(54, 37, 24, .18);
}

.mobile-install-help:empty {
  display: none;
}

.mobile-install-help:not(:empty) {
  padding: 8px 10px;
  border: 2px dashed rgba(111, 79, 48, .26);
  border-radius: 6px;
  background: #fff4d8;
  font-size: .82rem;
}

.mobile-experience-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 42, 43, 0.62);
  backdrop-filter: blur(5px);
}

.modal-layer.hidden {
  display: none;
}

.bonus-unlock-layer {
  z-index: 360;
  background: rgba(24, 31, 34, 0.72);
}

.bonus-unlock-sheet {
  position: relative;
  display: grid;
  width: min(680px, 94vw);
  max-height: calc(100dvh - 24px);
  justify-items: center;
  gap: 12px;
  overflow-y: auto;
  padding: 30px 26px 24px;
  border: 4px solid rgba(74, 50, 31, 0.4);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(118, 87, 50, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #fff8e9, #ead7b5);
  background-size: 22px 22px, auto;
  box-shadow: 0 14px 0 rgba(48, 34, 22, 0.22), 0 28px 70px rgba(18, 21, 21, 0.5);
  text-align: center;
  animation: bonus-unlock-arrive 460ms cubic-bezier(.18, .9, .25, 1) both;
}

.bonus-unlock-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 100px;
  height: 24px;
  border: 2px solid rgba(91, 64, 39, 0.18);
  background: rgba(244, 211, 119, 0.88);
  transform: translateX(-50%) rotate(-2deg);
}

.bonus-unlock-sheet h2 {
  max-width: 570px;
  margin: 0;
  color: #2f704c;
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  line-height: 1.14;
}

.bonus-unlock-weapons {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0 14px;
  border-top: 2px dashed rgba(91, 64, 39, 0.22);
  border-bottom: 2px dashed rgba(91, 64, 39, 0.22);
}

.bonus-unlock-weapon {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 7px;
  color: #4f4033;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
}

.bonus-unlock-weapon img {
  width: 92px;
  height: 92px;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 0 rgba(76, 52, 33, 0.16));
  animation: bonus-weapon-pop 480ms cubic-bezier(.18, .9, .25, 1) both;
  animation-delay: calc(var(--bonus-index) * 80ms + 120ms);
}

.bonus-unlock-sheet .primary {
  width: min(290px, 100%);
  min-height: 46px;
}

@keyframes bonus-unlock-arrive {
  0% { opacity: 0; transform: translateY(28px) scale(.86) rotate(-1deg); }
  65% { opacity: 1; transform: translateY(-4px) scale(1.025) rotate(.4deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes bonus-weapon-pop {
  0% { opacity: 0; transform: translateY(14px) scale(.55) rotate(-8deg); }
  70% { opacity: 1; transform: translateY(-3px) scale(1.08) rotate(3deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@media (max-width: 560px) {
  .bonus-unlock-sheet {
    gap: 9px;
    padding: 25px 16px 17px;
  }

  .bonus-unlock-weapons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
    padding: 10px 0;
  }

  .bonus-unlock-weapon img {
    width: 68px;
    height: 68px;
  }
}

.info-layer {
  z-index: 140;
}

.info-sheet {
  width: min(470px, 92vw);
  overflow: hidden;
  border: 4px solid rgba(74, 50, 31, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(118, 87, 50, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #fff8e9, #ead7b5);
  background-size: 22px 22px, auto;
  box-shadow: 0 14px 0 rgba(48, 34, 22, 0.18), 0 24px 60px rgba(26, 24, 22, 0.36);
}

.info-sheet .keyboard-controls {
  margin: 14px;
}

.copyright-copy {
  display: grid;
  gap: 10px;
  padding: 22px;
  color: #594735;
  text-align: center;
}

.copyright-copy p {
  margin: 0;
}

.copyright-copy a {
  color: #2d7650;
  font-weight: 900;
}

.copyright-copy span {
  color: #d94e47;
}

.copyright-copy em {
  color: #7f5a3b;
}

.copyright-copy .audio-credit {
  padding-top: 8px;
  border-top: 1px dashed rgba(83, 61, 39, .24);
  font-size: .7rem;
  line-height: 1.4;
}

.store-footer-actions .audio-toggle {
  min-height: 40px;
}

.interest-audio-toggle,
.winner-audio-toggle {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
}

.store-sheet,
.preview-sheet {
  width: min(1180px, 96vw);
  max-height: min(880px, 94vh);
  overflow: hidden;
  border: 4px solid rgba(74, 50, 31, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(118, 87, 50, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #fff8e9, #ead7b5);
  background-size: 22px 22px, auto;
  box-shadow: 0 18px 0 rgba(48, 34, 22, 0.18), 0 28px 70px rgba(26, 24, 22, 0.38);
}

.store-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.store-interest-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(27, 31, 31, .7);
  backdrop-filter: blur(4px);
}

.store-interest-overlay.hidden {
  display: none;
}

.interest-receipt {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(470px, 94vw);
  padding: 32px 34px 30px;
  overflow: visible;
  border: 4px solid rgba(75, 51, 31, .4);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(105, 75, 43, .07) 1px, transparent 1px),
    linear-gradient(180deg, #fff9e9, #ecd9b4);
  background-size: 18px 100%, auto;
  box-shadow: 0 12px 0 rgba(54, 37, 23, .24), 0 24px 60px rgba(20, 20, 18, .42);
  text-align: center;
}

.receipt-tape {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 112px;
  height: 27px;
  border: 1px solid rgba(121, 92, 43, .24);
  background: rgba(238, 205, 105, .84);
  box-shadow: 0 2px 0 rgba(80, 55, 30, .12);
  transform: translateX(-50%) rotate(-2deg);
}

.interest-player {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 6px 11px;
  border: 2px dashed rgba(73, 53, 35, .24);
  border-radius: 6px;
  color: #3b4145;
  background: rgba(255, 255, 255, .52);
}

.interest-player > span {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(54, 40, 29, .38);
  border-radius: 50%;
}

.interest-tank {
  display: block;
  width: 180px;
  height: 90px;
  margin: 8px 0 0;
}

.interest-coin {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 13px 0 8px;
  place-items: center;
  border: 5px solid #7b5525;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, #ffe99a 0 11%, transparent 12%),
    #e2ae36;
  box-shadow: inset 0 0 0 5px #f5cd5e, 0 6px 0 rgba(74, 50, 29, .18);
  transform: rotate(-5deg);
}

.interest-coin i {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px dashed #845b25;
  border-radius: 50%;
  color: #6e461b;
  font-family: Georgia, serif;
  font-size: 27px;
  font-style: normal;
  font-weight: 900;
}

.interest-receipt h2 {
  margin: 4px 0 6px;
  color: #2e7650;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.12;
}

.interest-receipt p {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 800;
}

.interest-total {
  display: grid;
  width: 100%;
  gap: 3px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-block: 2px dashed rgba(62, 105, 72, .3);
  color: var(--muted);
}

.interest-total span {
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.interest-total strong {
  color: #2d7650;
  font-size: 1.8rem;
}

.interest-receipt .primary {
  width: 100%;
  min-height: 48px;
}

@media (max-height: 620px) {
  .store-interest-overlay {
    align-items: start;
    padding: 8px;
  }

  .interest-receipt {
    margin: auto;
    padding: 23px 24px 17px;
  }

  .interest-player {
    margin-top: 4px;
    padding: 4px 9px;
  }

  .interest-tank {
    width: 144px;
    height: 72px;
    margin-top: 3px;
  }

  .interest-coin {
    width: 54px;
    height: 54px;
    margin: 8px 0 6px;
    border-width: 4px;
    box-shadow: inset 0 0 0 3px #f5cd5e, 0 4px 0 rgba(74, 50, 29, .18);
  }

  .interest-coin i {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .interest-receipt h2 {
    font-size: 1.35rem;
  }

  .interest-receipt p {
    margin-bottom: 8px;
    font-size: .82rem;
  }

  .interest-total {
    margin-bottom: 10px;
    padding: 6px 12px;
  }

  .interest-total strong {
    font-size: 1.4rem;
  }

  .interest-receipt .primary {
    min-height: 42px;
  }
}

@media (max-height: 430px) {
  .interest-receipt {
    width: min(470px, 90vw);
    padding: 17px 18px 12px;
  }

  .receipt-tape {
    top: -9px;
    width: 90px;
    height: 19px;
  }

  .interest-tank {
    width: 112px;
    height: 56px;
    margin-top: 0;
  }

  .interest-player {
    margin-top: 0;
    padding: 2px 8px;
    font-size: .78rem;
  }

  .interest-coin {
    width: 40px;
    height: 40px;
    margin: 3px 0;
    border-width: 3px;
    box-shadow: inset 0 0 0 2px #f5cd5e, 0 3px 0 rgba(74, 50, 29, .18);
  }

  .interest-coin i {
    width: 27px;
    height: 27px;
    border-width: 1px;
    font-size: 18px;
  }

  .interest-receipt h2 {
    margin: 2px 0 3px;
    font-size: 1.08rem;
  }

  .interest-receipt p {
    margin-bottom: 4px;
    font-size: .72rem;
  }

  .interest-total {
    gap: 0;
    margin-bottom: 6px;
    padding: 3px 10px;
  }

  .interest-total strong {
    font-size: 1.15rem;
  }

  .interest-receipt .primary {
    min-height: 36px;
  }
}

.store-header,
.store-footer,
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
}

.store-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  border-bottom: 2px dashed rgba(74, 50, 31, 0.24);
}

.store-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.armory-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 3px solid rgba(78, 51, 30, 0.3);
  border-radius: 50%;
  background: #e7c66d;
  box-shadow: inset 0 0 0 5px #fff0bd, 0 5px 0 rgba(62, 42, 28, 0.16);
}

.stone-armory {
  position: relative;
  display: block;
  width: 58px;
  height: 54px;
  filter: drop-shadow(0 3px 0 rgba(67, 46, 31, 0.2));
}

.armory-wall {
  position: absolute;
  right: 5px;
  bottom: 3px;
  left: 5px;
  height: 37px;
  border: 3px solid #594b40;
  border-radius: 2px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(77, 67, 58, 0.35) 48% 52%, transparent 53%) 0 0 / 18px 11px,
    linear-gradient(rgba(255, 255, 255, 0.18) 47%, #71665c 48% 54%, transparent 55%) 0 0 / 100% 11px,
    #aaa095;
}

.armory-wall::before {
  position: absolute;
  right: -3px;
  bottom: 31px;
  left: -3px;
  height: 17px;
  border: 3px solid #594b40;
  border-bottom: 0;
  background: #9d9389;
  clip-path: polygon(0 0, 24% 0, 24% 45%, 38% 45%, 38% 0, 62% 0, 62% 45%, 76% 45%, 76% 0, 100% 0, 100% 100%, 0 100%);
  content: "";
}

.armory-door {
  position: absolute;
  z-index: 2;
  bottom: 3px;
  left: 20px;
  width: 19px;
  height: 27px;
  border: 3px solid #4c3c30;
  border-bottom: 0;
  border-radius: 10px 10px 1px 1px;
  background:
    linear-gradient(90deg, transparent 45%, rgba(50, 34, 25, 0.45) 46% 52%, transparent 53%),
    #76533a;
  box-shadow: inset 3px 0 rgba(255, 255, 255, 0.12);
}

.armory-door::after {
  position: absolute;
  top: 13px;
  right: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #e0bc58;
  content: "";
}

.armory-shield {
  position: absolute;
  z-index: 3;
  top: 9px;
  left: 24px;
  width: 12px;
  height: 14px;
  border: 2px solid #59412d;
  background: #c64e43;
  clip-path: polygon(50% 0, 100% 20%, 88% 76%, 50% 100%, 12% 76%, 0 20%);
}

.armory-shield::after {
  position: absolute;
  inset: 3px 4px;
  background: #efd16e;
  content: "";
}

.store-header h2,
.preview-header h2 {
  margin-top: 3px;
}

.store-header p,
.preview-sheet p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 800;
}

#storePlayer {
  display: inline-block;
  margin: -8px 0 0;
  padding: 6px 10px;
  border: 3px solid var(--shopper-color, #e85b55);
  border-radius: 6px;
  color: #2f3740;
  background: color-mix(in srgb, var(--shopper-color, #e85b55) 18%, #fff8e9);
  font-size: 1.08rem;
}

.store-shopper {
  display: grid;
  justify-items: center;
  align-self: start;
  min-width: 220px;
}

#storeTankCanvas {
  width: 144px;
  height: 72px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.wallet-panel {
  justify-self: end;
}

.store-kicker {
  color: #a14637;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wallet-panel {
  position: relative;
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 190px;
}

.wallet-panel span,
.wallet-panel small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.wallet-panel strong {
  color: #2d7650;
  font-size: 1.55rem;
}

.wallet-balance {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

#storeInterest {
  margin-top: 4px;
  line-height: 1.25;
}

.wallet-confetti {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.wallet-confetti i {
  position: absolute;
  width: var(--size, 8px);
  height: calc(var(--size, 8px) * 0.58);
  border: 1px solid rgba(25, 70, 39, 0.68);
  border-radius: 2px;
  background: hsl(calc(82 + var(--i) * 11) 72% calc(32% + (var(--i) % 4) * 5%));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65), 0 0 7px rgba(45, 133, 69, 0.46);
  opacity: 0;
}

.wallet-confetti.pop i {
  animation: cash-confetti 980ms cubic-bezier(.12, .76, .24, 1) both;
  animation-delay: calc((var(--i) % 6) * 12ms);
}

@keyframes cash-confetti {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0) scale(0.25); }
  12% { opacity: 1; }
  58% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(var(--spin)) scale(1.1);
  }
}

.cash-wad {
  position: relative;
  display: block;
  width: 54px;
  height: 34px;
  flex: 0 0 auto;
  transform: rotate(-4deg);
}

.cash-wad::before,
.cash-wad::after {
  position: absolute;
  width: 44px;
  height: 24px;
  border: 2px solid #315f45;
  border-radius: 3px;
  background:
    radial-gradient(circle at center, #d9edbd 0 14%, transparent 15%),
    linear-gradient(90deg, #91c978, #c7e4a8 30% 70%, #80bd6e);
  box-shadow: inset 0 0 0 3px rgba(239, 249, 214, 0.42);
  content: "";
}

.cash-wad::before {
  top: 1px;
  left: 7px;
  transform: rotate(8deg);
}

.cash-wad::after {
  top: 7px;
  left: 2px;
  transform: rotate(-3deg);
}

.cash-wad i {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 20px;
  width: 13px;
  height: 27px;
  border: 2px solid #9b7336;
  border-radius: 2px;
  background: #e8c668;
  box-shadow: inset 0 0 0 2px rgba(255, 241, 174, 0.5);
  transform: rotate(3deg);
}

.store-grid {
  display: block;
  padding: 10px;
  overflow-y: auto;
}

.store-category + .store-category {
  margin-top: 14px;
}

.store-category-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 3px 6px;
}

.store-category-header h3,
.store-category-header p {
  margin: 0;
}

.store-category-header h3 {
  color: #8b4936;
  font-size: 1rem;
}

.store-category-header p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.store-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.store-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 7px;
  min-height: 0;
  padding: 7px;
  border: 2px solid rgba(70, 51, 34, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.store-item > img {
  width: 46px;
  height: 46px;
  padding: 3px;
  object-fit: contain;
}

.store-quantity {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  display: grid;
  min-width: 28px;
  height: 25px;
  place-items: center;
  padding: 0 7px;
  border: 2px solid #7b5133;
  border-radius: 13px;
  color: #fff9e9;
  background: #2f7b50;
  box-shadow: 0 3px 0 rgba(52, 36, 24, 0.18);
  font-size: 0.74rem;
  font-weight: 900;
}

.store-item-body {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.store-item-title,
.store-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.store-item-title strong {
  min-width: 0;
  padding-right: 34px;
  line-height: 1.05;
}

.store-owned {
  color: #8b5636;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.store-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

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

.store-item .weapon-stats > span {
  padding: 3px 4px;
  font-size: 0.6rem;
}

.store-item-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.shield-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-height: 25px;
  padding: 3px 6px;
  border: 1px solid rgba(53, 128, 149, .3);
  border-radius: 5px;
  color: #2d6878;
  background: rgba(189, 239, 245, .48);
  font-size: .68rem;
  font-weight: 900;
}

.shield-round-limit {
  color: #52717a;
  font-size: .64rem;
  font-weight: 900;
}

.store-footer {
  border-top: 2px dashed rgba(74, 50, 31, 0.24);
  color: var(--muted);
  font-weight: 900;
}

.store-footer-actions {
  display: flex;
  gap: 8px;
}

.preview-layer {
  z-index: 120;
}

.winner-layer {
  z-index: 145;
}

.winner-layer.match-results .winner-sheet {
  width: min(1040px, 96vw);
}

.winner-sheet {
  position: relative;
  display: grid;
  grid-auto-rows: max-content;
  justify-items: center;
  width: min(760px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  border: 4px solid rgba(74, 50, 31, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(118, 87, 50, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #fff8e9, #ead7b5);
  background-size: 22px 22px, auto;
  box-shadow: 0 14px 0 rgba(48, 34, 22, 0.2), 0 26px 64px rgba(26, 24, 22, 0.42);
  text-align: center;
}

.winner-sheet::before {
  width: 78px;
  height: 18px;
  margin-top: -34px;
  margin-bottom: 7px;
  border: 2px solid rgba(91, 64, 39, 0.18);
  background: rgba(244, 211, 119, 0.82);
  content: "";
  transform: rotate(-3deg);
}

#winnerTankCanvas {
  width: 260px;
  height: 130px;
  max-width: 100%;
  margin-bottom: 14px;
}

.winner-sheet h2 {
  margin: 5px 0 7px;
  color: #913f34;
  font-size: 1.8rem;
}

.winner-stats {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: max-content;
  margin: 0 0 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.winner-stat-header,
.winner-stat-row {
  display: grid;
  grid-template-columns: 34px minmax(175px, 1.5fr) repeat(6, minmax(105px, 1fr));
  gap: 7px;
  align-items: center;
  min-width: 960px;
}

.winner-stat-header {
  padding: 0 9px 5px;
  border-bottom: 2px dashed rgba(74, 50, 31, 0.3);
  color: #624a36;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
}

.winner-stat-row {
  min-height: 44px;
  padding: 7px 9px;
  border: 2px solid color-mix(in srgb, var(--player-color) 65%, #654831);
  border-radius: 6px;
  background: color-mix(in srgb, var(--player-color) 12%, #fff9eb);
  text-align: left;
}

.winner-stat-row.champion {
  box-shadow: inset 6px 0 var(--player-color), 0 3px 0 rgba(55, 38, 25, 0.13);
}

.winner-rank {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #60452e;
  background: #efd06e;
  font-size: 0.76rem;
  font-weight: 900;
}

.winner-player {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.winner-player strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner-player-tank {
  width: 66px;
  height: 39px;
}

.winner-stat-cell {
  display: inline-flex;
  justify-content: center;
  gap: 5px;
  align-items: center;
  color: #65513f;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  text-align: center;
}

.category-star {
  color: #e7a928;
  font-size: 1rem;
  line-height: 1;
  text-shadow: 0 1px #7d5a23, 0 0 7px rgba(247, 193, 61, 0.55);
}

.confirm-copy {
  display: grid;
  gap: 18px;
  padding: 22px;
  color: #5f4b3a;
  font-weight: 800;
  text-align: center;
}

.confirm-copy p {
  margin: 0;
  line-height: 1.4;
}

.confirm-copy > div {
  display: flex;
  justify-content: center;
  gap: 9px;
}

.winner-sheet p {
  margin: 0 0 18px;
  color: #5f4b3a;
  font-weight: 900;
}

.winner-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  width: 100%;
}

.winner-actions button {
  min-width: 140px;
}

.preview-sheet {
  width: min(720px, 94vw);
  padding-bottom: 16px;
}

.preview-description {
  margin: 8px 16px 0;
  color: var(--muted);
  font-weight: 800;
}

.preview-description .weapon-stats {
  margin: 10px 0 0;
}

.preview-header {
  border-bottom: 2px dashed rgba(74, 50, 31, 0.24);
}

#previewCanvas {
  width: calc(100% - 32px);
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 16px;
  border: 3px solid rgba(74, 50, 31, 0.24);
  border-radius: 8px;
  background: #91d7e6;
  box-shadow: none;
  cursor: default;
  touch-action: auto;
}

.preview-sheet > p {
  padding: 0 18px;
}

body.is-fullscreen {
  overflow: hidden;
}

body.is-fullscreen .shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  padding: 6px 10px 10px;
}

body.is-fullscreen .topbar {
  min-height: 96px;
}

body.is-fullscreen .brand-logo {
  height: 98px;
}

body.is-fullscreen .game-wrap {
  min-height: 0;
}

body.is-fullscreen .canvas-frame {
  display: grid;
  align-items: center;
  min-height: 0;
}

body.is-fullscreen .panel {
  overflow: hidden;
}

.mobile-hud,
.mobile-panel-close,
.mobile-panel-backdrop,
.orientation-prompt {
  display: none;
}

@media (max-width: 1024px) {
  body.match-active #keyboardBtn {
    display: none !important;
  }

  :root {
    --mobile-command-height: 68px;
  }

  body {
    overflow: hidden;
  }

  body.match-active button,
  body.match-active .mobile-hud,
  body.match-active .map-tools,
  body.match-active .score-list,
  body.match-active .play {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .modal-layer {
    inset: 0 auto auto 0;
    width: 100dvw;
    height: 100dvh;
  }

  .shell {
    display: block;
    width: 100%;
    height: 100dvh;
    padding: 0;
  }

  .topbar {
    display: none;
  }

  .game-wrap {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
  }

  .canvas-frame {
    position: absolute;
    inset: 0 0 var(--mobile-command-height);
    place-items: center;
    background: #80cedd;
  }

  #gameCanvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    border-width: 2px;
    border-radius: 0;
    box-shadow: none;
  }

  .panel {
    position: absolute;
    z-index: 80;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(390px, 88vw);
    height: 100%;
    padding: 10px;
    border-width: 3px;
    border-radius: 8px 0 0 8px;
    box-shadow: -10px 0 28px rgba(34, 29, 24, 0.3);
    transform: translateX(105%);
    transition: transform 220ms ease;
  }

  .panel.mobile-open {
    transform: translateX(0);
  }

  .panel.mobile-weapon-open .score-list,
  .panel.mobile-weapon-open .panel-footer {
    display: none;
  }

  .panel.mobile-weapon-open {
    top: auto;
    bottom: 0;
    height: auto;
    max-height: 100dvh;
    padding-top: 48px;
  }

  .panel.mobile-weapon-open .panel-scroll {
    flex: 0 1 auto;
    overflow: visible;
  }

  .panel.mobile-weapon-open .play > .readout,
  .panel.mobile-weapon-open .play > input[type="range"],
  .panel.mobile-weapon-open .play > .sidebar-aim-control,
  .panel.mobile-weapon-open .play > .preview-command,
  .panel.mobile-weapon-open .play > .button-row {
    display: none;
  }

  .panel.mobile-weapon-open .weapon-menu,
  .panel.mobile-weapon-open .weapon-menu.opens-up {
    top: calc(100% + 5px);
    bottom: auto;
  }

  .mobile-panel-close {
    position: absolute;
    z-index: 5;
    top: 5px;
    right: 5px;
    display: grid;
    width: 38px;
    min-height: 38px;
    place-items: center;
    padding: 0;
    font-size: 1.35rem;
  }

  .panel-scroll {
    padding-top: 38px;
  }

  .mobile-panel-backdrop {
    position: absolute;
    z-index: 70;
    inset: 0;
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(29, 34, 34, 0.4);
    box-shadow: none;
  }

  .mobile-panel-backdrop.hidden {
    display: none;
  }

  body.mobile-weapon-chooser-open .mobile-panel-backdrop {
    bottom: var(--mobile-command-height);
  }

  .mobile-hud {
    position: absolute;
    z-index: 60;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .mobile-status-row {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    display: flex;
    gap: 6px;
    pointer-events: auto;
  }

  .mobile-status-row span {
    padding: 6px 9px;
    border: 2px dashed rgba(69, 45, 29, 0.28);
    border-radius: 999px;
    color: #3d454a;
    background: rgba(255, 248, 229, 0.9);
    box-shadow: 0 3px 0 rgba(45, 31, 20, 0.14);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .mobile-control-bar {
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: minmax(82px, .86fr) 42px minmax(92px, 1.14fr) 44px 48px;
    gap: 7px;
    width: min(46vw, 520px);
    pointer-events: auto;
  }

  .mobile-control-bar button {
    min-height: 48px;
    padding: 0 10px;
    touch-action: manipulation;
  }

  .mobile-weapon-button {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 5px;
    align-items: center;
    width: auto;
    min-width: 0;
    text-align: left;
  }

  .mobile-weapon-button img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }

  .mobile-weapon-button span {
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-stepper {
    display: none;
  }

  .mobile-aim-button {
    display: none;
  }

  .mobile-aim-button span {
    color: var(--muted);
    font-size: .65rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .mobile-aim-button strong {
    overflow: hidden;
    font-size: .78rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-fire {
    min-width: 0;
  }

  .mobile-preview-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    color: #73472f;
    background: #f7e2ad;
    font-size: 1rem;
    font-weight: 1000;
  }

  .mobile-menu-button {
    width: 48px;
    padding: 0;
    font-size: 1.4rem;
  }

  .mobile-audio-button {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .mobile-fullscreen-button {
    display: none !important;
  }

  body:not(.match-active) .mobile-hud {
    display: none;
  }

  .mobile-aim-dock {
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: calc(min(46vw, 520px) + max(16px, env(safe-area-inset-left)));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
    padding: 5px 7px;
    border: 2px solid rgba(74, 50, 31, .28);
    border-radius: 7px;
    background: rgba(255, 247, 232, .94);
    box-shadow: 0 4px 0 rgba(55, 38, 25, .16);
    pointer-events: auto;
  }

  .mobile-aim-dock.hidden {
    display: grid;
  }

  .mobile-aim-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 7px;
    border-bottom: 2px dashed rgba(74, 50, 31, .2);
  }

  .mobile-context-close {
    width: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 1.2rem;
  }

  .mobile-aim-row {
    display: grid;
    grid-template-columns: 50px 30px minmax(34px, 1fr) 30px;
    gap: 5px;
    align-items: center;
    min-width: 0;
    padding: 0;
  }

  .mobile-aim-row label {
    display: grid;
    gap: 1px;
    color: #554231;
    font-size: .62rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .mobile-aim-row output {
    color: #263640;
    font-size: .78rem;
    text-align: left;
    text-transform: none;
  }

  .mobile-aim-row button {
    min-height: 38px;
    padding: 0;
    font-size: 1rem;
  }

  .mobile-aim-row input {
    width: 100%;
    min-height: 38px;
    touch-action: pan-x;
  }

  .map-tools {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, calc((100vw - min(100vw, 177.778dvh)) / 2 + env(safe-area-inset-right) + 8px));
  }

  .minimap-toggle {
    width: 44px;
    min-height: 44px;
  }

  .canvas-zoom-controls .icon-button {
    width: 44px;
    min-height: 40px;
  }

  .panel-footer button {
    min-height: 44px;
  }

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

  .store-header {
    padding: 8px 12px;
  }

  .armory-icon {
    width: 52px;
    height: 52px;
  }

  .armory-icon .stone-armory {
    transform: scale(0.76);
  }

  .store-footer {
    padding: 8px 12px;
  }

  .wallet-panel {
    min-width: 145px;
  }

  .wallet-panel strong {
    font-size: 1.15rem;
  }

  .cash-wad {
    transform: rotate(-4deg) scale(0.82);
    transform-origin: right center;
  }

  .modal-layer {
    padding: 5px;
  }

  .store-sheet {
    width: 100%;
    max-height: calc(100dvh - 10px);
  }
}

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) and (min-height: 540px) {
  .shell {
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr);
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 42vw);
    min-height: 54px;
    height: 54px;
    padding: 3px 8px;
  }

  .brand {
    justify-items: start;
  }

  .brand-logo {
    width: min(270px, 34vw);
    height: 48px;
  }

  .status-stack {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
  }

  .turn-spotlight {
    grid-column: auto;
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 44px;
    padding: 2px 8px;
  }

  .wind-pill {
    min-width: 142px;
    min-height: 44px;
    padding-inline: 7px;
  }

  .turn-spotlight canvas {
    width: 74px;
    height: 38px;
  }

  .turn-spotlight strong {
    font-size: .78rem;
  }

  .turn-spotlight span,
  .wind-pill {
    font-size: .62rem;
  }

  .status-stack > .icon-button {
    display: none;
  }

  .game-wrap {
    height: 100%;
    min-height: 0;
  }

  .mobile-control-bar {
    grid-template-columns: minmax(86px, .7fr) 42px minmax(122px, 1.3fr) 44px 48px;
    gap: 10px;
    width: min(44vw, 500px);
  }

  .mobile-aim-dock {
    left: calc(min(44vw, 500px) + max(18px, env(safe-area-inset-left)));
  }
}

@media (max-width: 1024px) and (orientation: portrait) {
  :root {
    --mobile-command-height: 150px;
  }

  .orientation-prompt:not(.dismissed) {
    position: fixed;
    z-index: 250;
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    display: grid;
    place-items: center;
    pointer-events: none;
  }

  .orientation-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 9px;
    align-items: center;
    width: min(360px, calc(100vw - 16px));
    padding: 8px;
    border: 3px solid rgba(74, 50, 31, 0.28);
    border-radius: 8px;
    background: rgba(255, 247, 232, .96);
    box-shadow: 0 5px 0 rgba(58, 39, 25, 0.16);
    text-align: left;
    pointer-events: auto;
  }

  .orientation-card h2 {
    margin: 0;
    font-size: .9rem;
  }

  .orientation-card p {
    grid-column: 2;
    margin: -5px 0 0;
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.15;
  }

  .rotate-phone {
    position: relative;
    display: block;
    grid-row: 1 / 3;
    width: 22px;
    height: 34px;
    margin: auto;
    border: 3px solid #654a35;
    border-radius: 5px;
    background: #8dd4df;
    animation: phone-rotate 1400ms ease-in-out infinite alternate;
  }

  .rotate-phone::after {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 6px;
    height: 2px;
    border-radius: 2px;
    background: #654a35;
    content: "";
    transform: translateX(-50%);
  }

  @keyframes phone-rotate {
    from { transform: rotate(0); }
    to { transform: rotate(90deg); }
  }

  #portraitContinueBtn {
    grid-column: 3;
    grid-row: 1 / 3;
    width: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 1.2rem;
  }

  .panel {
    width: min(420px, 96vw);
  }

  .mobile-control-bar {
    grid-template-columns: minmax(0, 1fr) 38px 78px 42px 46px;
    width: auto;
  }

  .mobile-aim-dock,
  .mobile-aim-dock.hidden {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(65px, calc(env(safe-area-inset-bottom) + 62px));
    left: max(8px, env(safe-area-inset-left));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orientation-prompt {
    display: none !important;
  }

  .store-category-grid {
    grid-template-columns: 1fr;
  }

  .store-header {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  .store-shopper {
    align-self: center;
  }

  .wallet-panel {
    align-self: stretch;
    justify-items: start;
  }
}

@media (max-width: 1024px) {
  body:not(.match-active) .panel,
  body:not(.match-active) .panel.mobile-open {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(960px, calc(100vw - 16px));
    height: auto;
    max-height: calc(100dvh - 12px);
    transform: translate(-50%, -50%);
  }

  body:not(.match-active) .panel-scroll {
    max-height: calc(100dvh - 58px);
  }

  body:not(.match-active) .player-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.match-active) .mobile-panel-close {
    display: none;
  }

}

@media (max-width: 1024px) and (orientation: portrait) {
  body:not(.match-active) .panel,
  body:not(.match-active) .panel.mobile-open {
    top: calc(50% + 28px);
    max-height: calc(100dvh - 76px);
  }

  body:not(.match-active) .panel-scroll {
    max-height: calc(100dvh - 122px);
  }
}

@media (max-width: 700px) {
  body:not(.match-active) .panel,
  body:not(.match-active) .panel.mobile-open {
    width: min(560px, calc(100vw - 12px));
    padding: 12px;
  }

  body:not(.match-active) .panel-scroll {
    padding-top: 34px;
  }

  body:not(.match-active) .player-rows,
  .setup-pair,
  .rule-settings-row {
    grid-template-columns: 1fr;
  }

  .player-count-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .setup-heading {
    align-items: flex-start;
  }

  .setup-progress i {
    width: 20px;
  }

  .winner-sheet {
    padding: 17px 12px;
  }

  .winner-stat-header,
  .winner-stat-row {
    grid-template-columns: 30px minmax(150px, 1.4fr) repeat(6, minmax(96px, 1fr));
    min-width: 860px;
  }
}

@media (max-width: 1024px) {
  body.match-active .panel {
    top: auto;
    right: auto;
    bottom: 0;
    left: 50%;
    width: min(620px, 96vw);
    height: auto;
    max-height: 100dvh;
    padding: 48px 10px 10px;
    border-radius: 8px 8px 0 0;
    transform: translate(-50%, 105%);
    transition: transform 220ms ease;
  }

  body.match-active .panel.mobile-open {
    transform: translate(-50%, 0);
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open),
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) {
    width: min(420px, 96vw);
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .panel-scroll,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .panel-scroll {
    display: none;
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .score-list,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .score-list {
    flex: 0 1 auto;
    max-height: calc(100dvh - 176px);
    margin-top: 0;
    padding-top: 0;
    overflow-y: auto;
    border-top: 0;
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .panel-footer,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .panel-footer {
    background: transparent;
  }

  body.match-active .panel.mobile-weapon-open {
    bottom: var(--mobile-command-height);
    max-height: calc(100dvh - var(--mobile-command-height) - 8px);
  }

  body.match-active .panel.mobile-weapon-open.mobile-closing {
    transform: translate(-50%, calc(105% + var(--mobile-command-height)));
  }
}

@media (max-width: 520px), (max-width: 1024px) and (max-height: 520px) {
  body.match-active .panel.mobile-open:not(.mobile-weapon-open),
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) {
    top: auto;
    right: 0;
    bottom: 0;
    width: min(390px, 96vw);
    height: auto;
    max-height: 100dvh;
    padding: 48px 10px 10px;
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .panel-scroll,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .panel-scroll {
    display: none;
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .score-list,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .score-list {
    flex: 0 1 auto;
    max-height: calc(100dvh - 176px);
    margin-top: 0;
    padding-top: 0;
    overflow-y: auto;
    border-top: 0;
  }

  body.match-active .panel.mobile-open:not(.mobile-weapon-open) .panel-footer,
  body.match-active .panel.mobile-closing:not(.mobile-weapon-open) .panel-footer {
    background: transparent;
  }

  .mobile-experience-copy {
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 12px;
  }

  .mobile-app-icon {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 350px) {
  .mobile-aim-dock,
  .mobile-aim-dock.hidden {
    gap: 4px;
    padding-inline: 5px;
  }

  .mobile-aim-row {
    grid-template-columns: minmax(56px, 1fr) 30px 30px;
    gap: 4px;
  }

  .mobile-aim-row input {
    display: none;
  }

  .mobile-aim-row label {
    font-size: .58rem;
  }

  .mobile-aim-row output {
    font-size: .76rem;
  }

  .mobile-experience-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  body:not(.match-active) .mobile-install-button {
    display: none !important;
  }

  .panel.mobile-closing {
    pointer-events: none;
  }

  .panel.mobile-weapon-open {
    width: min(620px, 96vw);
    max-height: calc(100dvh - var(--mobile-command-height) - 8px);
  }

  .panel.mobile-weapon-open .panel-scroll {
    flex: 0 1 auto;
    max-height: calc(100dvh - var(--mobile-command-height) - 62px);
    padding-top: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .panel.mobile-weapon-open .play {
    gap: 8px;
  }

  .panel.mobile-weapon-open .weapon-field {
    gap: 0;
  }

  .panel.mobile-weapon-open .weapon-field > .field-label,
  .panel.mobile-weapon-open .weapon-button,
  .panel.mobile-weapon-open .weapon-info {
    display: none;
  }

  .panel.mobile-weapon-open .weapon-menu,
  .panel.mobile-weapon-open .weapon-menu.opens-up {
    position: static;
    display: grid;
    max-height: min(66dvh, 520px);
    padding: 7px;
    overflow-y: auto;
    box-shadow: none;
  }

  .panel.mobile-weapon-open .weapon-menu-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .panel.mobile-weapon-open .weapon-menu-group + .weapon-menu-group {
    margin-top: 7px;
    padding-top: 5px;
    border-top: 2px dashed rgba(74, 50, 31, .18);
  }

  .panel.mobile-weapon-open .weapon-group-label {
    position: static;
    grid-column: 1 / -1;
    padding: 4px 3px 2px;
    border-bottom: 0;
    background: transparent;
  }

  .panel.mobile-weapon-open .weapon-option {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "icon name"
      "icon ammo";
    gap: 2px 6px;
    min-width: 0;
    min-height: 66px;
    padding: 7px;
    border: 2px solid rgba(74, 50, 31, .16);
    border-radius: 7px;
    background: rgba(255, 255, 255, .46);
    box-shadow: 0 3px 0 rgba(45, 31, 20, .1);
  }

  .panel.mobile-weapon-open .weapon-option img {
    grid-area: icon;
    align-self: center;
    width: 42px;
    height: 42px;
  }

  .panel.mobile-weapon-open .weapon-option-name {
    grid-area: name;
    align-self: end;
    overflow: hidden;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .panel.mobile-weapon-open .weapon-option-ammo {
    grid-area: ammo;
    align-self: start;
    justify-self: start;
    min-width: 0;
    padding: 2px 6px;
    border-radius: 999px;
    color: #fffaf0;
    background: #6d513b;
    font-size: .65rem;
    line-height: 1.2;
  }

  .panel.mobile-weapon-open .weapon-option[aria-selected="true"] {
    border-color: #d54f45;
    background: #f8ddb7;
    box-shadow: inset 0 0 0 2px rgba(213, 79, 69, .14), 0 3px 0 rgba(45, 31, 20, .1);
  }

  .panel.mobile-weapon-open .preview-command {
    min-height: 40px;
  }
}

@media (min-width: 600px) and (max-width: 1024px) {
  .panel.mobile-weapon-open .weapon-menu-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .store-sheet {
    width: calc(100dvw - 10px);
    max-width: calc(100dvw - 10px);
  }

  .store-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    align-items: center;
    padding: 7px 10px;
  }

  .store-identity {
    grid-column: 1;
    grid-row: 1;
    gap: 0;
  }

  .store-identity .armory-icon {
    display: none;
  }

  .store-header h2 {
    margin-top: 1px;
    font-size: 1rem;
  }

  .store-kicker {
    font-size: .62rem;
  }

  .store-shopper {
    display: block;
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    min-width: 0;
  }

  #storeTankCanvas {
    display: none;
  }

  #storePlayer {
    margin: 0;
    padding: 3px 7px;
    border-width: 2px;
    font-size: .78rem;
  }

  .wallet-panel {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: end;
    justify-items: end;
    gap: 1px;
    min-width: 0;
  }

  .wallet-panel > span:first-child,
  .wallet-balance .cash-wad {
    display: none;
  }

  .wallet-panel strong {
    font-size: 1.08rem;
  }

  #storeInterest {
    max-width: 126px;
    margin-top: 1px;
    font-size: .62rem;
    text-align: right;
  }

  .store-grid {
    padding: 6px;
  }
}
