:root {
  color-scheme: dark;
  --bg: #101115;
  --panel: #1a201f;
  --panel2: #252e2b;
  --line: #3f4c47;
  --text: #f2f5fb;
  --muted: #aab3c5;
  --gold: #e9c46a;
  --red: #ef6f6c;
  --blue: #74b9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #171c29;
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.app {
  width: 100%;
  height: 100%;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.meter {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.meter strong {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 20px;
  overflow-wrap: anywhere;
}

#pauseStamina { font-size: 13px; white-space: nowrap; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 120ms ease, border-color 120ms ease;
}

button .lucide { width: 18px; height: 18px; flex: 0 0 18px; }
strong, progress { font-variant-numeric: tabular-nums; }

button:hover {
  border-color: #8ee58b;
  background: #2d363c;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

button:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.gold-meter strong { color: #ffd66c; }

.loadout-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

#armourStatus { margin-right: auto; }

.loadout-bar select {
  min-height: 36px;
  min-width: 125px;
  padding: 5px 28px 5px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
}

.shop-dialog, .pause-dialog, .death-dialog {
  width: min(850px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0 24px;
  overflow-y: auto;
  scroll-padding: 150px 0 95px;
  border: 1px solid #536077;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

.shop-dialog::backdrop { background: rgba(4, 7, 12, 0.82); }
.pause-dialog::backdrop, .death-dialog::backdrop { background: rgba(4, 7, 12, 0.68); }
.pause-dialog, .death-dialog { width: min(490px, calc(100% - 24px)); padding: 24px; }
.pause-dialog h2, .death-dialog h2 { margin: 0 0 18px; font-size: 28px; }
.death-dialog p { margin-bottom: 20px; }
.menu-actions { display: grid; gap: 10px; }
.menu-actions button { min-height: 44px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.dialog-heading h2 { margin: 0; }
.difficulty-badge { color: #8ee58b; font-size: 12px; padding: 6px 0 6px 12px; border-left: 2px solid #8ee58b; }
.death-records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 18px 0; margin: 0 0 24px; border-block: 1px solid var(--line); }
.death-records span { display: block; color: var(--muted); font-size: 12px; }
.death-records strong { display: block; margin-top: 6px; font-size: 24px; overflow-wrap: anywhere; }
#deathGold { color: var(--gold); }

.shop-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

.shop-heading h2 {
  margin: 6px 0 0;
  font-size: 26px;
}

.shop-result { color: var(--muted); }
.shop-wallet { text-align: right; min-width: 70px; max-width: 50%; overflow-wrap: anywhere; }
.shop-wallet span { display: block; font-size: 12px; color: var(--muted); }
.shop-wallet strong { display: block; font-size: 30px; color: var(--gold); }

.shop-items { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.shop-top { position: sticky; top: 0; z-index: 2; background: var(--panel); }
.shop-top .shop-heading { position: static; padding: 18px 0 12px; border-bottom: 0; }
.shop-tabs { display: flex; gap: 8px; padding: 12px 0 0; border-bottom: 1px solid var(--line); }
.shop-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.shop-tabs button[aria-selected="true"] { color: #8ee58b; border-bottom-color: #8ee58b; }

.shop-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-content: start;
  gap: 9px 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.upgrade-icon svg { display: block; width: 34px; height: 34px; }
.upgrade-details h3 { margin: 0 0 5px; font-size: 16px; }
.upgrade-details p { margin: 0; line-height: 1.45; min-height: 38px; }
.upgrade-rank { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: #b7c7c1; font-size: 12px; }
.rank-track { display: inline-flex; gap: 3px; }
.rank-track span { display: block; width: 15px; height: 4px; background: var(--line); }
.rank-track .is-filled { background: #8ee58b; }
.shop-item[data-state="equipped"] .upgrade-rank { color: #8ee58b; }
.shop-item[data-state="equipped"] .upgrade-icon { filter: brightness(1.2); }
.shop-item button { grid-column: 2; justify-self: start; min-width: 120px; font-size: 13px; }

.shop-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.shop-footer [role="status"] { flex: 1; font-size: 13px; color: #8ee58b; }
.primary-button { border-color: #8ee58b; background: #8ee58b; color: #101a16; font-weight: 700; }
.primary-button:hover { background: #acf0a9; border-color: #acf0a9; }

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

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #11141c;
  cursor: crosshair;
  touch-action: none;
}

.stamina-hud {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  width: min(240px, calc(100% - 100px));
  pointer-events: none;
  color: var(--text);
  text-shadow: 0 1px 3px #000;
}
.hud-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 20px; margin-bottom: 14px; }
.hud-heading > span:first-child { color: #b9c7c0; font-size: 10px; font-weight: 700; }
.hud-ammo { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.hud-ammo .lucide { width: 14px; height: 14px; }
.hud-vital { margin-top: 12px; }
.hud-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 18px; margin-bottom: 6px; font-size: 11px; }
.hud-label > span { display: inline-flex; align-items: center; gap: 6px; color: #c4cfc9; }
.hud-label .lucide { width: 12px; height: 12px; }
.hud-label strong { font-size: 12px; font-weight: 600; white-space: nowrap; }
.stamina-hud progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 2px; overflow: hidden; background: #34413c; accent-color: #8ee58b; }
.stamina-hud progress::-webkit-progress-bar { background: #34413c; }
.stamina-hud progress::-webkit-progress-value { background: #8ee58b; }
.stamina-hud progress::-moz-progress-bar { background: #8ee58b; }
.health-vital progress { accent-color: #ef8e86; }
.health-vital progress::-webkit-progress-value { background: #ef8e86; }
.health-vital progress::-moz-progress-bar { background: #ef8e86; }
.health-vital .lucide { color: #ef8e86; }
.friendly-edition .health-vital progress { accent-color: #68cbd2; }
.friendly-edition .health-vital progress::-webkit-progress-value { background: #68cbd2; }
.friendly-edition .health-vital progress::-moz-progress-bar { background: #68cbd2; }
.friendly-edition .health-vital .lucide { color: #68cbd2; }
.stamina-hud > .bow-draw-hud { margin-top: 18px; }
.bow-draw-hud progress { accent-color: #e9c46a; }
.bow-draw-hud progress::-webkit-progress-value { background: #e9c46a; }
.bow-draw-hud progress::-moz-progress-bar { background: #e9c46a; }
.bow-draw-hud.is-ready progress { accent-color: #8ee58b; }
.bow-draw-hud.is-ready progress::-webkit-progress-value { background: #8ee58b; }
.bow-draw-hud.is-ready progress::-moz-progress-bar { background: #8ee58b; }
.bow-draw-hud.is-ready strong { color: #8ee58b; }
.stamina-hud.is-low #staminaBar { accent-color: #ff9d65; }
.stamina-hud.is-low #staminaBar::-webkit-progress-value { background: #ff9d65; }
.stamina-hud.is-low #staminaBar::-moz-progress-bar { background: #ff9d65; }
.game-menu-button { position: absolute; top: max(18px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); width: 42px; height: 42px; padding: 0; background: rgba(26, 32, 31, 0.85); }
.run-hud { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 20px; pointer-events: none; text-shadow: 0 1px 3px #000; }
.hud-level { display: flex; align-items: baseline; gap: 8px; font-size: 10px; color: #c4cfc9; }
.hud-level strong { font-size: 24px; color: var(--text); }
.hud-targets { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #b9c7c0; white-space: nowrap; }
.hud-targets strong { color: var(--text); }
.hud-targets .lucide { width: 14px; height: 14px; color: #ef8e86; }
[hidden] { display: none !important; }
.main-upgrades { width: 100%; margin-top: 10px; min-height: 46px; background: transparent; border-color: #62736a; }
.main-secondary-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.main-secondary-actions .main-upgrades { grid-row: auto; margin: 0; min-height: 58px; padding: 8px 4px; font-size: 12px; gap: 4px; flex-direction: column; }
.main-play { width: 100%; margin-top: 22px; min-height: 52px; font-size: 18px; }

.saves-dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; scroll-padding: 84px 0 90px; padding: 0 24px; border: 1px solid #536077; border-radius: 8px; color: var(--text); background: var(--panel); }
.saves-dialog::backdrop { background: rgba(4, 7, 12, 0.82); }
.saves-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 18px; position: sticky; top: 0; z-index: 2; background: var(--panel); }
.saves-heading h2 { margin: 0; font-size: 26px; }
.save-format { color: var(--muted); font: 12px ui-monospace, monospace; }
.save-tabs { padding-top: 0; }
.save-panel { padding: 20px 0 10px; }
.save-records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.save-records span { display: block; color: var(--muted); font-size: 12px; }
.save-records strong { display: block; margin-top: 6px; font-size: 24px; overflow-wrap: anywhere; }
#saveGold { color: var(--gold); }
.save-panel label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.save-code-label { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.save-code-label label { margin: 0; }
.icon-button { width: 38px; height: 38px; padding: 0; flex-shrink: 0; }
.save-code { display: block; width: 100%; min-height: 108px; max-height: 240px; resize: vertical; padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 4px; background: #111715; color: #d9e4de; font: 12px/1.6 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; }
.save-code:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.save-code[aria-invalid="true"] { border-color: #ef8e86; }
.load-preview { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.load-preview h3 { margin: 0 0 16px; font-size: 17px; }
.save-preview-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.save-preview-records dt { color: var(--muted); font-size: 12px; }
.save-preview-records dd { margin: 5px 0 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.save-warning { margin: 16px 0; color: var(--gold); line-height: 1.6; font-size: 12px; }
.save-notice { min-height: 34px; margin: 0; padding: 12px 0; color: #8ee58b; line-height: 1.5; overflow-wrap: anywhere; }
.save-notice[data-kind="error"] { color: #ef8e86; }
.saves-footer { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); background: var(--panel); }
#closeSaves { margin-left: auto; }
.reset-button { color: #ef8e86; background: transparent; }
.reset-button:hover { border-color: #ef8e86; background: #3a2928; }
.danger-button { background: #ef8e86; border-color: #ef8e86; color: #201312; font-weight: 700; }
.danger-button:hover { background: #ffb1a9; border-color: #ffb1a9; }
.reset-confirmation { padding: 24px 0 12px; }
.reset-confirmation h3 { margin: 0 0 12px; font-size: 20px; }
.reset-confirmation p { line-height: 1.6; font-size: 13px; }
.reset-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.settings-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; scroll-padding: 84px 0 90px; padding: 0 24px; border: 1px solid #536077; border-radius: 8px; color: var(--text); background: var(--panel); }
.settings-dialog::backdrop { background: rgba(4, 7, 12, 0.82); }
.settings-panel { padding-block: 8px; }
.settings-panel h3 { margin: 24px 0 8px; font-size: 12px; text-transform: uppercase; color: #8ee58b; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 54px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.setting-row label, .setting-slider label { font-size: 13px; }
.setting-row select { max-width: 52%; min-width: 124px; min-height: 34px; padding: 5px 10px; font: inherit; font-size: 13px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; }
.setting-row input[type="checkbox"] { appearance: none; flex: 0 0 38px; width: 38px; height: 22px; margin: 0; padding: 3px; background: #425248; border: 0; border-radius: 11px; cursor: pointer; }
.setting-row input[type="checkbox"]::before { content: ""; display: block; width: 16px; height: 16px; background: #d1dcd5; border-radius: 50%; transform: translateX(0); }
.setting-row input[type="checkbox"]:checked { background: #8ee58b; }
.setting-row input[type="checkbox"]:checked::before { background: #17251c; transform: translateX(16px); }
.setting-row input:focus-visible, .setting-slider input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.setting-slider { padding-block: 16px; border-bottom: 1px solid var(--line); }
.setting-slider > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.setting-slider output { font-size: 13px; color: var(--gold); font-variant-numeric: tabular-nums; }
.setting-slider input { display: block; width: 100%; height: 18px; margin: 0; accent-color: #8ee58b; cursor: pointer; }
.fps-counter { font: 11px ui-monospace, monospace; color: #8ee58b; white-space: nowrap; }

.menu-screen {
  position: absolute;
  inset: 0;
  color: #f3f2eb;
}

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

.menu-panel {
  width: 100%;
  height: 100%;
  padding: 24px 28px 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto 20px;
  gap: 20px;
}
.arena-menu-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid #646560; }
.menu-panel h1 { font-family: Impact, "Arial Narrow", sans-serif; font-size: 36px; font-weight: 700; line-height: 1.1; text-transform: uppercase; }
.menu-eyebrow { display: block; color: #ffc561; font-size: 10px; font-weight: 800; margin-bottom: 6px; }
.menu-records { display: flex; gap: 30px; min-width: 0; }
.menu-records span { display: block; color: #b9bbb6; font-size: 11px; }
.menu-records strong { display: block; font-size: 23px; margin-top: 4px; overflow-wrap: anywhere; }
#menuGold { color: #ffd66c; }
.arena-menu-content { display: grid; grid-template-columns: minmax(190px, 1.35fr) minmax(210px, 1fr) minmax(110px, 0.75fr) minmax(150px, 0.75fr); gap: 26px; min-height: 0; }
.arena-menu-content section { min-width: 0; min-height: 0; }
.arena-menu-content h2 { margin: 16px 0 28px; font-size: 16px; font-weight: 900; text-transform: uppercase; }
.menu-archer { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; text-align: center; border-right: 1px solid #555752; padding-right: 24px; }
.menu-archer h2 { color: #c9cbc4; }
.menu-archer-stage { min-height: 0; }
.preview-vitals { display: flex; justify-content: center; gap: 8px; padding: 12px 0 24px; }
.preview-vitals > span { display: inline-flex; gap: 8px; align-items: center; justify-content: center; width: 90px; height: 30px; border-radius: 2px; background: #ea5559; font-size: 13px; }
.preview-vitals .preview-stamina { background: #4e8ee7; }
.preview-vitals .lucide { width: 14px; height: 14px; }
.arena-equipment, .arena-arrows { align-self: center; }
#menuEquipment, #menuArrows { display: grid; gap: 12px; }
.arena-upgrade { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; border: 0; border-radius: 0; padding: 0; width: 100%; background: none; text-align: left; min-height: 52px; }
.arena-upgrade:disabled, .arena-arrow:disabled { opacity: 1; }
.arena-price { display: flex; align-items: center; justify-content: center; gap: 6px; align-self: stretch; border-radius: 3px; background: #e0e1db; color: #41433e; font-weight: 900; font-size: 17px; }
.arena-upgrade:disabled .arena-price { background: #767873; color: #d8dad3; }
.arena-upgrade-name { display: block; color: var(--item-color); font-size: 13px; font-weight: 800; text-transform: uppercase; overflow-wrap: anywhere; }
.arena-upgrade-name > .lucide { display: none; }
.arena-upgrade-name small { display: flex; gap: 10px; align-items: center; font-size: 12px; margin-top: 5px; }
.arena-rank { color: var(--item-color); font-family: monospace; font-size: 17px; }
.arena-rank > span { color: #73766e; }
.arena-upgrade:not(:disabled):hover { background: #4a4d45; }
.arena-upgrade:not(:disabled):hover .arena-price { background: #ffce76; }
.arena-opponent { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; text-align: center; padding: 36px 0 70px; }
.arena-mode { color: #ffc561; font-size: 12px; font-weight: 900; }
.arena-round { color: #aeb1a6; font-size: 11px; }
.arena-arrow { display: grid; align-content: center; justify-content: stretch; width: 100%; min-height: 65px; gap: 6px; padding: 9px 12px; border-color: #777a70; border-radius: 2px; background: #53564f; color: #f0f1e9; text-align: left; }
.arena-arrow > span:first-child { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; font-weight: 900; text-transform: uppercase; }
.arena-arrow .lucide { width: 14px; height: 14px; flex-basis: 14px; }
.arena-arrow small { font-size: 9px; color: #c4c8bc; }
.arena-arrow[aria-pressed="true"] { background: #f5bd59; border-color: #ffda93; color: #31342e; }
.arena-arrow[aria-pressed="true"] small { color: #424637; }
.menu-arrow-shaft { position: relative; display: block; height: 3px; background: var(--item-color); margin: 2px 5px; }
.arena-arrow[aria-pressed="true"] .menu-arrow-shaft { background: #f9f7e8; }
.menu-arrow-shaft::before { content: ""; position: absolute; left: -4px; top: -3px; border-block: 4px solid transparent; border-right: 12px solid #e5e7dc; }
.menu-arrow-shaft::after { content: ""; position: absolute; right: 0; top: -3px; width: 18px; height: 9px; background: var(--item-color); transform: skewX(35deg); }
.arena-menu-footer { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.7fr) minmax(280px, 1.25fr); align-items: end; gap: 30px; padding-top: 16px; border-top: 1px solid #646560; }
.arena-menu-footer .main-play { margin: 0; min-height: 48px; border: 0; background: #f5bd59; color: #30352b; text-transform: uppercase; font-size: 17px; }
.arena-menu-footer .main-secondary-actions { margin: 0; gap: 6px; }
.arena-menu-footer .main-upgrades { min-height: 48px; padding: 7px; background: #52564e; border-color: #74796c; }
.menu-panel .arena-notice { margin: 0; text-align: center; font-size: 11px; color: #c9e6a2; min-height: 16px; }
.difficulty-select { margin: 0; padding: 0; border: 0; }
.difficulty-select legend { margin-bottom: 6px; padding: 0; font-size: 10px; color: #c1c5b8; text-transform: uppercase; }

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.difficulty-choice { position: relative; display: grid; align-content: center; height: 48px; border: 1px solid #777c70; padding: 8px 10px; background: #4a4f44; cursor: pointer; text-align: center; }
.difficulty-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.difficulty-choice span { font-size: 13px; font-weight: 700; }
.difficulty-choice small { font-size: 12px; color: var(--muted); }
.difficulty-choice:has(input:checked) { border-color: #8ee58b; background: #243b2d; }
.difficulty-choice:has(input[data-difficulty="medium"]:checked) { border-color: #e9c46a; background: #353425; }
.difficulty-choice:has(input[data-difficulty="hard"]:checked) { border-color: #ef8e86; background: #3a2928; }
.difficulty-choice:has(input:focus-visible) { outline: 2px solid #e9c46a; outline-offset: 3px; }

@media (max-width: 760px) {
  .meters {
    grid-template-columns: repeat(3, 1fr);
  }

  .loadout-bar { flex-wrap: wrap; gap: 8px; }
  #armourStatus { width: 100%; }
  .loadout-bar button { margin-left: auto; }
  .shop-dialog { padding: 0 16px; }
  .saves-dialog { padding: 0 16px; }
  .settings-dialog { padding: 0 16px; }
  .shop-heading h2 { font-size: 22px; }
  .shop-items { grid-template-columns: 1fr; }
  .upgrade-details p { min-height: 0; }
  .shop-footer { flex-wrap: wrap; }
  .shop-footer [role="status"] { flex-basis: 100%; }
  .pause-dialog, .death-dialog { padding: 20px; }
  .difficulty-choice { padding: 10px; }
  .difficulty-choice span { font-size: 14px; }
  .difficulty-choice small { font-size: 11px; }
}

@media (max-width: 840px) {
  .run-hud { top: 78px; right: max(18px, env(safe-area-inset-right)); left: auto; transform: none; display: grid; justify-items: end; gap: 10px; }
  .hud-level { display: grid; justify-items: end; gap: 2px; }
  .hud-target-label { display: none; }
}

@media (max-width: 1100px) and (min-width: 700px) {
  .menu-panel { padding: 16px 20px 8px; gap: 12px; }
  .arena-menu-content { grid-template-columns: minmax(170px, 1fr) minmax(190px, 1fr) minmax(140px, 0.8fr); gap: 20px; }
  .arena-opponent { display: none; }
  .arena-menu-footer { grid-template-columns: 1fr 0.7fr 1.2fr; gap: 14px; }
}
@media (max-width: 699px) {
  .menu-panel { padding: 14px 14px 6px; gap: 10px; }
  .arena-menu-header { display: block; padding-bottom: 10px; }
  .menu-panel h1 { font-size: 26px; }
  .menu-eyebrow { font-size: 9px; }
  .menu-records { gap: 24px; margin-top: 12px; }
  .menu-records span { font-size: 10px; }
  .menu-records strong { font-size: 17px; margin-top: 2px; }
  .arena-menu-content { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; overflow: auto; align-content: start; }
  .arena-menu-content .menu-archer { grid-column: 1 / -1; grid-template-columns: 1fr auto; grid-template-rows: 24px 150px; height: 174px; min-height: 174px; padding: 0; border: 0; }
  .menu-archer h2 { grid-column: 1 / -1; margin: 4px 0; font-size: 12px; }
  .preview-vitals { flex-direction: column; padding: 0; justify-content: center; }
  .preview-vitals > span { width: 60px; }
  .arena-opponent { display: none; }
  .arena-menu-content h2 { font-size: 12px; margin: 8px 0 14px; }
  .arena-equipment, .arena-arrows { align-self: start; padding-bottom: 10px; }
  #menuEquipment, #menuArrows { gap: 10px; }
  .arena-upgrade { grid-template-columns: 43px minmax(0, 1fr); gap: 7px; min-height: 55px; }
  .arena-price { font-size: 12px; gap: 2px; }
  .arena-price .lucide { width: 12px; height: 12px; flex-basis: 12px; }
  .arena-upgrade-name { font-size: 10px; }
  .arena-arrow { min-height: 55px; padding: 7px 9px; }
  .arena-arrow > span:first-child { font-size: 11px; }
  .arena-menu-footer { grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 10px; }
  .arena-menu-footer .main-secondary-actions { grid-column: 1 / -1; }
  .arena-menu-footer .main-upgrades { flex-direction: row; font-size: 11px; min-height: 34px; }
  .arena-menu-footer .main-play { min-height: 36px; }
  .difficulty-choice { height: 36px; padding: 4px; }
  .difficulty-choice span { font-size: 11px; }
  .arena-menu-footer .difficulty-select legend { margin-bottom: 4px; font-size: 9px; }
}
@media (max-height: 500px) and (min-width: 700px) {
  .menu-panel { gap: 8px; padding-block: 10px 4px; grid-template-rows: auto minmax(0, 1fr) auto 14px; }
  .menu-panel h1 { font-size: 26px; }
  .menu-eyebrow { display: none; }
  .arena-menu-header { padding-bottom: 8px; }
  .menu-records strong { font-size: 16px; }
  .menu-records span { font-size: 9px; }
  .arena-menu-content h2 { margin: 2px 0 10px; font-size: 12px; }
  #menuEquipment, #menuArrows { gap: 5px; }
  .arena-upgrade { min-height: 29px; grid-template-columns: 58px minmax(0, 1fr); }
  .arena-price { font-size: 12px; }
  .arena-upgrade-name { font-size: 10px; }
  .arena-upgrade-name small { margin-top: 0; font-size: 9px; }
  .arena-rank { font-size: 11px; }
  .arena-arrow { min-height: 30px; padding: 4px 8px; gap: 3px; }
  .arena-arrow > span:first-child { font-size: 10px; }
  .arena-arrow small { display: none; }
  .preview-vitals { padding-block: 0; }
  .preview-vitals > span { height: 20px; font-size: 10px; }
  .arena-menu-footer { padding-top: 6px; }
  .arena-menu-footer .main-play, .arena-menu-footer .main-upgrades, .difficulty-choice { min-height: 34px; height: 34px; }
  .arena-menu-footer .main-upgrades { flex-direction: row; }
}

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

.loadout-tabs { display: flex; gap: 4px; border-bottom: 1px solid #62665d; margin: -12px 0 14px; }
.loadout-tabs button { flex: 1; padding: 5px; min-height: 30px; font-size: 11px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; }
.loadout-tabs [aria-selected="true"] { color: #f5bd59; border-bottom-color: #f5bd59; }
.equipment-choice { display: grid; grid-template-columns: 22px 1fr 18px; gap: 10px; padding: 9px 12px; min-height: 52px; text-align: left; background: #50544b; border-color: #747b69; }
.equipment-choice[aria-pressed="true"] { border-color: var(--item-color); background: #3e493b; }
.equipment-choice:disabled { opacity: 0.6; }
.equipment-choice strong { display: block; font-size: 13px; color: var(--item-color); }
.equipment-choice small { display: block; margin-top: 4px; color: #c9cfbd; font-size: 9px; }
.equipment-swatch { width: 18px; height: 18px; border-radius: 50%; background: var(--item-color); border: 2px solid #e1e7d4; }
.online-dialog { padding: 22px; width: min(640px, calc(100% - 24px)); }
.online-dialog h2 { margin: 0; font-size: 24px; }
.online-dialog h3 { font-size: 14px; margin: 22px 0 10px; }
.online-dialog label { display: block; margin-bottom: 7px; color: #c5cdbf; font-size: 12px; }
.online-dialog input { min-width: 0; width: 100%; height: 40px; background: #111a15; color: #f2f5ed; border: 1px solid #64725d; border-radius: 3px; padding: 8px 10px; font: inherit; font-size: 13px; }
.online-connection { display: grid; gap: 5px; border-bottom: 1px solid var(--line); margin-bottom: 20px; padding-bottom: 18px; }
.online-connection > span { font-size: 12px; color: #e9c46a; margin-bottom: 10px; }
.online-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 22px; }
.online-actions button { font-size: 12px; padding: 8px 10px; min-height: 44px; }
.join-code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#joinCode { text-transform: uppercase; font-family: ui-monospace, monospace; }
.public-lobbies { display: grid; gap: 7px; min-height: 32px; }
.public-lobbies p { font-size: 12px; }
.public-lobbies button { justify-content: space-between; font-size: 12px; min-height: 40px; }
.room-ticket { display: flex; align-items: center; gap: 12px; padding: 20px 0; flex-wrap: wrap; }
.room-ticket > span { font-size: 10px; color: var(--muted); }
.room-ticket strong { font: 700 24px ui-monospace, monospace; color: #f5bd59; }
.room-ticket button { padding: 0; width: 36px; }
.online-dialog .saves-footer { gap: 8px; padding-bottom: 0; }
.online-dialog .saves-footer button { font-size: 12px; padding: 8px 12px; }
.duel-hud { position: absolute; inset: 18px 18px auto; display: grid; grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr); gap: 24px; pointer-events: none; }
.duel-fighter { max-width: 270px; display: grid; gap: 7px; font-size: 12px; }
.duel-fighter:last-child { justify-self: end; width: 100%; text-align: right; }
.duel-fighter strong { overflow-wrap: anywhere; }
.duel-fighter > span { font-size: 10px; color: #c4cfbf; }
.duel-fighter progress { appearance: none; width: 100%; height: 5px; border: 0; background: #34413c; accent-color: #ed777b; }
.duel-fighter progress::-webkit-progress-bar { background: #34413c; }
.duel-fighter progress::-webkit-progress-value { background: #ed777b; }
.duel-fighter progress[id*="Stamina"]::-webkit-progress-value { background: #8ee58b; }
.duel-center { display: grid; justify-items: center; gap: 6px; font-size: 11px; text-align: center; }
.duel-center strong { color: #ffce76; font-size: 14px; }
.duel-center #duelClock { font: 700 18px ui-monospace, monospace; }
.duel-center #duelPing { color: #bacdb5; }
.duel-center button { pointer-events: auto; min-height: 32px; width: 34px; padding: 0; }
@media (max-width: 699px) {
  .equipment-choice { padding: 8px 6px; grid-template-columns: 14px 1fr 12px; gap: 5px; }
  .equipment-choice strong { font-size: 10px; }
  .equipment-choice .lucide { width: 12px; height: 12px; }
  .equipment-swatch { width: 13px; height: 13px; }
  .loadout-tabs { margin-top: 0; gap: 0; }
  .loadout-tabs button { font-size: 10px; padding: 3px; }
  .arena-menu-footer .main-upgrades { font-size: 10px; padding: 6px 2px; gap: 4px; }
  .arena-menu-footer .main-upgrades .lucide { width: 14px; height: 14px; flex-basis: 14px; }
  .online-dialog { padding: 16px; }
  .online-actions { grid-template-columns: 1fr; }
  .duel-hud { gap: 12px; grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1fr); }
  .duel-fighter { font-size: 11px; }
  .duel-center strong { font-size: 12px; }
}
@media (max-height: 500px) and (min-width: 700px) {
  .loadout-tabs { margin-top: -4px; margin-bottom: 6px; }
  .loadout-tabs button { min-height: 25px; font-size: 10px; }
  .equipment-choice { min-height: 28px; padding-block: 4px; }
  .equipment-choice strong { font-size: 11px; }
  .equipment-choice small { margin-top: 1px; }
}

.arena-brand { min-width: 0; }
.mobile-mode-switch { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; flex-shrink: 0; font-size: 12px; cursor: pointer; }
.mobile-mode-switch .lucide { width: 18px; height: 18px; }
.mobile-mode-switch input { appearance: none; width: 38px; height: 22px; margin: 0; border: 1px solid #859184; border-radius: 12px; background: #252e2b; cursor: pointer; }
.mobile-mode-switch input::before { content: ""; display: block; width: 14px; height: 14px; margin: 3px; border-radius: 50%; background: #c1c9bd; }
.mobile-mode-switch input:checked { background: #78cbb6; border-color: #a2e6d1; }
.mobile-mode-switch input:checked::before { transform: translateX(15px); background: #172b23; }
.mobile-mode-switch input:focus-visible { outline: 2px solid #ffe08a; outline-offset: 3px; }
.touch-controls { position: absolute; inset: auto max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); display: flex; align-items: end; justify-content: space-between; pointer-events: none; z-index: 5; }
.touch-controls button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.touch-actions { display: flex; gap: 12px; }
.touch-actions button { width: 58px; height: 58px; padding: 0; flex-direction: column; gap: 3px; background: #263a34; border-color: #93b7a0; }
.touch-actions button span { font-size: 11px; }
.touch-actions .lucide { width: 23px; height: 23px; }
.touch-aim { position: relative; display: grid; justify-items: center; align-content: center; gap: 5px; width: 112px; height: 112px; min-width: 112px; border-radius: 50%; padding: 18px; border: 2px solid #e9c46a; background: #263a34; box-shadow: 0 0 0 6px #17271f80; }
.touch-aim > .lucide { width: 26px; height: 26px; }
.touch-aim strong { font-size: 15px; }
.touch-aim progress { width: 64px; height: 4px; accent-color: #e9c46a; }
.touch-thumb { position: absolute; inset: 42px; border: 1px solid #f4d68c; border-radius: 50%; opacity: 0.65; pointer-events: none; }
.touch-reticle { position: absolute; width: 30px; height: 30px; transform: translate(-50%, -50%); color: #fff0af; pointer-events: none; z-index: 4; filter: drop-shadow(0 1px 2px #111); }
.touch-reticle .lucide { width: 30px; height: 30px; }
.mobile-mode { overscroll-behavior: none; }
.mobile-mode .arena-menu-content { overflow: auto; overscroll-behavior: contain; }
.mobile-mode .arena-equipment, .mobile-mode .arena-arrows { align-self: start; }
.mobile-mode .arena-menu-content button, .mobile-mode .main-secondary-actions button, .mobile-mode .difficulty-choice { min-height: 44px; height: auto; }
.mobile-mode .loadout-tabs button { font-size: 12px; }
.mobile-mode .arena-upgrade-name, .mobile-mode .arena-arrow > span:first-child, .mobile-mode .equipment-choice strong { font-size: 12px; }
.mobile-mode .game-menu-button { width: 48px; min-height: 48px; top: max(12px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }
.mobile-mode .stamina-hud { width: 178px; padding: 10px 12px; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
.mobile-mode .stamina-hud .hud-heading { margin-bottom: 8px; }
.mobile-mode .hud-vital { margin-top: 7px; }
.mobile-mode .hud-label { font-size: 10px; }
.mobile-mode .stamina-hud > .bow-draw-hud { margin-top: 8px; }
.mobile-mode .run-hud { top: max(76px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); left: auto; transform: none; display: flex; gap: 10px; font-size: 10px; }
.mobile-mode .duel-center button { width: 44px; min-height: 44px; }
.mobile-mode dialog button, .mobile-mode dialog select, .mobile-mode dialog input { min-height: 44px; }
@media (max-width: 1100px) {
  .arena-menu-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
  .menu-records { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 450px) {
  .mobile-mode-switch { gap: 5px; font-size: 11px; }
  .mobile-mode-switch > .lucide { display: none; }
  .arena-menu-header h1 { font-size: 24px; }
  .mobile-mode .arena-menu-content .menu-archer { height: 132px; min-height: 132px; grid-template-rows: 22px 110px; }
  .mobile-mode .arena-upgrade { grid-template-columns: 38px minmax(0, 1fr); }
}
@media (max-height: 500px) and (min-width: 700px) {
  .arena-menu-header { display: flex; }
  .mobile-mode .menu-panel { gap: 6px; }
  .mobile-mode .arena-menu-footer .main-play { min-height: 44px; }
  .mobile-mode .arena-menu-content h2 { margin-bottom: 7px; }
  .touch-aim { width: 96px; height: 96px; min-width: 96px; }
  .touch-thumb { inset: 34px; }
}
@media (max-height: 650px) and (max-width: 699px) {
  .mobile-mode .arena-menu-content .menu-archer { height: 90px; min-height: 90px; grid-template-rows: 18px 72px; }
}
