:root {
  color-scheme: dark;
  --ink: #f4f1e8;
  --muted: #b7b2a4;
  --panel: rgba(17, 21, 25, 0.82);
  --panel-solid: #15191d;
  --line: rgba(244, 241, 232, 0.16);
  --red: #e85d64;
  --gold: #f2bd5e;
  --green: #63d49c;
  --blue: #68b7ff;
  --violet: #bd8cff;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(rgba(7, 10, 12, 0.64), rgba(7, 10, 12, 0.82)),
    radial-gradient(circle at 22% 12%, rgba(242, 189, 94, 0.22), transparent 28%),
    radial-gradient(circle at 78% 26%, rgba(104, 183, 255, 0.13), transparent 30%),
    radial-gradient(circle at 82% 72%, rgba(99, 212, 156, 0.14), transparent 32%),
    linear-gradient(135deg, #11161a 0%, #231a17 44%, #0f1c1b 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

.shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 46px);
  background:
    linear-gradient(90deg, rgba(242, 189, 94, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(244, 241, 232, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
}

.game-wrap {
  position: relative;
  width: min(94vw, 1540px);
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100vh - clamp(36px, 6vw, 92px));
  background: #0d0f10;
  border: 1px solid rgba(242, 189, 94, 0.28);
  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(244, 241, 232, 0.06) inset,
    0 0 60px rgba(242, 189, 94, 0.1);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.game-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  background: #101214;
}

#scene3d {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: #16251d;
  display: none;
  opacity: 0;
}

#game {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 1;
  mix-blend-mode: normal;
  pointer-events: auto;
}

.hud {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.top-left {
  top: 16px;
  left: 16px;
  width: min(430px, 46vw);
}

.top-right {
  top: 16px;
  right: 16px;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.bottom-left {
  bottom: 18px;
  left: 18px;
  transition: opacity 900ms ease, transform 900ms ease, filter 900ms ease;
}

.brand {
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.hp-hearts {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}

.hp-hearts span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  color: #e85d64;
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 0 16px rgba(232, 93, 100, 0.55), 0 2px 8px rgba(0, 0, 0, 0.7);
}

.hp-hearts .half {
  color: #f2bd5e;
}

.hp-hearts .empty {
  color: rgba(255, 255, 255, 0.22);
  text-shadow: none;
}

.bars {
  display: grid;
  gap: 8px;
}

.bar {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.34);
}

.bar span,
.bar b {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-size: 12px;
  line-height: 1;
}

.bar span {
  left: 8px;
  color: rgba(255, 255, 255, 0.78);
}

.bar b {
  right: 8px;
  font-weight: 700;
}

.bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #c73942, var(--red));
  transform-origin: left center;
}

.bar.mana i {
  background: linear-gradient(90deg, #2478c6, var(--blue));
}

.bar.xp i {
  background: linear-gradient(90deg, #a87a27, var(--gold));
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(104, 183, 255, 0.26);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
}

.stat-chip {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.stat-chip b {
  display: grid;
  place-items: center;
  height: 20px;
  border: 1px solid rgba(242, 189, 94, 0.3);
  color: var(--gold);
  font-size: 10px;
}

.stat-chip span {
  color: var(--muted);
  font-weight: 800;
}

.stat-chip strong {
  color: var(--ink);
  font-size: 13px;
}

.run-meta {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.32);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: right;
}

.relic-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 340px;
  padding: 8px;
  border: 1px solid rgba(242, 189, 94, 0.22);
  background: rgba(0, 0, 0, 0.32);
}

.relic-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(242, 189, 94, 0.7);
  background: radial-gradient(circle, rgba(242, 189, 94, 0.28), rgba(0, 0, 0, 0.5));
  color: var(--gold);
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(242, 189, 94, 0.18);
}

.relic-icon span {
  pointer-events: none;
}

.relic-empty {
  color: var(--muted);
  font-size: 13px;
}

.minimap {
  position: absolute;
  top: 276px;
  right: 0;
  display: block;
  width: 310px;
  padding: 12px;
  border: 2px solid rgba(104, 183, 255, 0.42);
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 0 26px rgba(104, 183, 255, 0.14);
}

.minimap svg {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(244, 241, 232, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.minimap-caption {
  margin-top: 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.mm-door {
  filter: drop-shadow(0 0 2px rgba(242, 189, 94, 0.9));
}

.mm-enemy {
  filter: drop-shadow(0 0 1.5px rgba(232, 93, 100, 0.8));
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  max-width: 900px;
  padding: 16px 18px;
  border: 2px solid rgba(242, 189, 94, 0.34);
  background: rgba(0, 0, 0, 0.58);
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.38);
}

.hints-faded .bottom-left {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(2px);
}

.hints-faded .sound-toggle {
  opacity: 0.18;
}

.hints-faded .sound-toggle:hover {
  opacity: 1;
}

.controls b {
  color: var(--gold);
  font-size: 22px;
  margin-right: 4px;
}

kbd {
  min-width: 54px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.42);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 10, 0.42);
  backdrop-filter: blur(6px);
}

#upgradePanel,
.shop-panel {
  place-items: center end;
  padding-right: 26px;
  background: linear-gradient(90deg, rgba(6, 8, 10, 0.08), rgba(6, 8, 10, 0.72));
}

#upgradePanel {
  inset: 0;
  width: auto;
  min-height: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 10, 0.5);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}

#upgradePanel .panel-inner {
  pointer-events: auto;
  border-color: rgba(242, 189, 94, 0.38);
  background: linear-gradient(180deg, rgba(25, 29, 33, 0.96), rgba(7, 9, 12, 0.94));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
}

#upgradePanel .panel-inner {
  width: min(820px, calc(100vw - 36px));
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.shop-panel .panel-inner {
  width: min(410px, calc(100vw - 28px));
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.hidden {
  display: none !important;
}

.panel-inner {
  width: min(720px, 92vw);
  padding: 30px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(25, 29, 33, 0.95), rgba(12, 14, 16, 0.95));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.start-panel .panel-inner {
  height: min(790px, calc(100vh - 64px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.panel-inner.compact {
  width: min(820px, 94vw);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(44px, 7vw, 82px);
  line-height: 0.95;
}

h2 {
  font-size: clamp(32px, 5vw, 54px);
}

h2 small {
  color: var(--gold);
  font-size: 18px;
  vertical-align: middle;
}

.lead {
  max-width: 560px;
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.class-grid,
.upgrade-grid {
  display: grid;
  gap: 12px;
}

.class-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 20px;
}

.name-login {
  display: grid;
  gap: 7px;
  margin: 0 0 16px;
  color: var(--gold);
  font-weight: 900;
}

.name-login input {
  width: min(360px, 100%);
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(242, 189, 94, 0.42);
  background: rgba(0, 0, 0, 0.34);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.name-login input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 189, 94, 0.12);
}

.leaderboard {
  margin: 14px 0 18px;
  border: 1px solid rgba(104, 183, 255, 0.22);
  background: rgba(0, 0, 0, 0.25);
}

.leader-head,
.leader-row {
  display: grid;
  grid-template-columns: 48px 1fr 96px 118px;
  align-items: center;
  gap: 10px;
}

.leader-head {
  grid-template-columns: 1fr auto;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.leader-head strong {
  color: var(--blue);
}

.leader-head button {
  min-height: 30px;
  border: 1px solid rgba(104, 183, 255, 0.38);
  background: rgba(104, 183, 255, 0.1);
  color: var(--ink);
  cursor: pointer;
}

.leader-list {
  display: grid;
}

.start-board .leader-list {
  height: 114px;
  overflow-y: auto;
  align-content: start;
  scrollbar-color: rgba(104, 183, 255, 0.55) rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
}

.start-board .leader-list::-webkit-scrollbar {
  width: 8px;
}

.start-board .leader-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.start-board .leader-list::-webkit-scrollbar-thumb {
  background: rgba(104, 183, 255, 0.55);
}

.leader-row {
  min-height: 38px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.leader-row:last-child {
  border-bottom: 0;
}

.leader-row b {
  color: var(--gold);
}

.leader-row strong {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-row span {
  color: var(--green);
  font-weight: 900;
  text-align: right;
}

.leader-row small {
  text-align: right;
}

.leader-row.muted {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.pause-panel {
  z-index: 12;
}

.mode-card,
.class-card,
.upgrade-card,
.primary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

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

.mode-card,
.class-card {
  min-height: 94px;
  padding: 14px;
  text-align: left;
}

.mode-card strong,
.class-card strong,
.upgrade-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.mode-card span,
.class-card span,
.upgrade-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mode-card:hover,
.mode-card.selected,
.class-card:hover,
.class-card.selected,
.upgrade-card:hover {
  border-color: rgba(242, 189, 94, 0.75);
  background: rgba(242, 189, 94, 0.11);
}

.primary {
  min-height: 46px;
  padding: 0 20px;
  background: linear-gradient(90deg, #d98436, var(--gold));
  color: #1b1206;
  font-weight: 900;
}

.primary:hover {
  filter: brightness(1.08);
}

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

.secondary {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid rgba(104, 183, 255, 0.42);
  background: rgba(104, 183, 255, 0.1);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.secondary:hover {
  border-color: rgba(104, 183, 255, 0.75);
  background: rgba(104, 183, 255, 0.18);
}

.upgrade-grid {
  grid-template-columns: 1fr;
  margin-top: 20px;
}

.reroll-button {
  width: 100%;
  min-height: 42px;
  margin-top: 16px;
  border: 1px solid rgba(104, 183, 255, 0.52);
  background: linear-gradient(90deg, rgba(104, 183, 255, 0.18), rgba(189, 140, 255, 0.12));
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.reroll-button.locked,
.reroll-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.upgrade-card {
  min-height: 116px;
  padding: 16px;
  text-align: left;
}

.upgrade-card em {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.element-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #101216;
  background: var(--element);
  box-shadow: 0 0 18px color-mix(in srgb, var(--element), transparent 42%);
  font-style: normal;
  font-size: 16px;
  line-height: 1;
}

.upgrade-card[class*="element-"] {
  border-color: color-mix(in srgb, var(--gold), transparent 28%);
}

.upgrade-card.blue {
  border-color: rgba(104, 183, 255, 0.56);
  background: linear-gradient(135deg, rgba(104, 183, 255, 0.13), rgba(255, 255, 255, 0.04));
}

.upgrade-card.orange {
  border-color: rgba(242, 189, 94, 0.72);
  background: linear-gradient(135deg, rgba(242, 189, 94, 0.2), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 26px rgba(242, 189, 94, 0.1);
}

.upgrade-card.red {
  border-color: rgba(232, 93, 100, 0.9);
  background:
    linear-gradient(135deg, rgba(232, 93, 100, 0.25), rgba(242, 189, 94, 0.12)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 32px rgba(232, 93, 100, 0.24), inset 0 0 30px rgba(232, 93, 100, 0.14);
}

.upgrade-card.locked {
  opacity: 0.48;
  cursor: wait;
}

.price {
  display: inline-block;
  margin-top: 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.upgrade-card em {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--green);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.upgrade-card.blue em {
  color: var(--blue);
}

.upgrade-card.orange em {
  color: var(--gold);
}

.upgrade-card.red em {
  color: var(--red);
}

.message {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  max-width: min(620px, 90vw);
  padding: 12px 16px;
  border: 1px solid rgba(242, 189, 94, 0.4);
  background: rgba(0, 0, 0, 0.58);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.mobile-controls {
  display: none;
}

.ability-strip {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 170px));
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.ability-card {
  position: relative;
  overflow: hidden;
  min-height: 64px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.22));
  box-shadow: inset 0 0 24px rgba(104, 183, 255, 0.08);
}

.ability-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(99, 212, 156, 0.14), transparent 55%);
}

.ability-card.special::before {
  background: linear-gradient(90deg, rgba(242, 189, 94, 0.17), transparent 60%);
}

.ability-card span,
.ability-card strong,
.ability-card i {
  position: relative;
  z-index: 1;
}

.ability-card span {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.ability-card strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.ability-card i {
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: var(--green);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.sound-toggle,
.fullscreen-toggle,
.bag-toggle {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  min-width: 104px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.42);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.fullscreen-toggle {
  right: 132px;
  bottom: 18px;
  min-width: 86px;
  border-color: rgba(104, 183, 255, 0.48);
  color: var(--blue);
  transition: opacity 500ms ease, filter 500ms ease;
}

.bag-toggle {
  top: 218px;
  right: 18px;
  bottom: auto;
  min-width: 156px;
  height: 64px;
  border-color: rgba(242, 189, 94, 0.5);
  color: var(--gold);
  font-size: 20px;
  background: rgba(0, 0, 0, 0.64);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.42), 0 0 24px rgba(242, 189, 94, 0.14);
}

.bag-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 8px;
  border: 1px solid rgba(242, 189, 94, 0.55);
  background: radial-gradient(circle, rgba(242, 189, 94, 0.28), rgba(0, 0, 0, 0.5));
  color: var(--gold);
}

.sound-toggle.on {
  border-color: rgba(99, 212, 156, 0.6);
  color: var(--green);
  box-shadow: 0 0 20px rgba(99, 212, 156, 0.18);
}

.bag-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.bag-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(242, 189, 94, 0.28);
  background: rgba(255, 255, 255, 0.055);
}

.bag-item-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(242, 189, 94, 0.68);
  background: radial-gradient(circle, rgba(242, 189, 94, 0.25), rgba(0, 0, 0, 0.56));
  color: var(--gold);
  font-size: 24px;
  font-weight: 900;
}

.bag-item strong {
  display: block;
  color: var(--gold);
  margin-bottom: 6px;
}

.bag-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.stick {
  position: absolute;
  left: 24px;
  bottom: 28px;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  z-index: 6;
  pointer-events: none;
}

.stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(242, 189, 94, 0.78);
  transform: translate(-50%, -50%);
}

.mobile-actions {
  position: absolute;
  right: 22px;
  bottom: 28px;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(2, 58px);
  gap: 12px;
}

.mobile-actions button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.36);
  color: var(--ink);
  font-weight: 900;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.stat-box {
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.stat-box b {
  display: block;
  color: var(--gold);
  font-size: 24px;
}

.stat-box span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .shell {
    padding: 8px;
  }

  .game-wrap {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(242, 189, 94, 0.28);
  }

  .top-left {
    width: calc(100vw - 128px);
    top: 10px;
    left: 10px;
  }

  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 330px;
    padding: 7px;
  }

  .stat-chip {
    grid-template-columns: 28px 1fr auto;
    gap: 5px;
    font-size: 11px;
  }

  .top-right {
    top: 10px;
    right: 10px;
  }

  .brand {
    font-size: 18px;
  }

  .run-meta {
    display: none;
  }

  .minimap {
    top: 210px;
    right: 0;
    width: 178px;
    padding: 7px;
  }

  .minimap-caption {
    font-size: 11px;
  }

  .bottom-left {
    display: none;
  }

  .ability-strip {
    bottom: 98px;
    grid-template-columns: repeat(2, minmax(112px, 1fr));
    width: calc(100vw - 160px);
  }

  .ability-card {
    min-height: 48px;
    padding: 8px 10px;
  }

  .sound-toggle {
    right: 18px;
    bottom: 92px;
    min-width: 88px;
  }

  .fullscreen-toggle {
    right: 112px;
    bottom: 92px;
    min-width: 74px;
  }

  .bag-toggle {
    top: 156px;
    right: 10px;
    bottom: auto;
    min-width: 116px;
    height: 52px;
    font-size: 16px;
  }

  .mobile-controls {
    display: block;
  }

  .panel {
    padding: 14px;
  }

  #upgradePanel,
  .shop-panel {
    place-items: end center;
    padding: 14px;
  }

  #upgradePanel {
    inset: 0;
    width: auto;
    padding: 14px;
  }

  .panel-inner {
    padding: 20px;
  }

  .class-grid,
  .upgrade-grid,
  .end-stats {
    grid-template-columns: 1fr;
  }

  .leader-head,
  .leader-row {
    grid-template-columns: 38px minmax(0, 1fr) 72px;
  }

  .leader-row small {
    display: none;
  }
}
