:root {
  color-scheme: dark;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #080b0d;
  color: #f1ddb2;
  --void: #080b0d;
  --soot: #151515;
  --steel: #242c2b;
  --oxide-dark: #344b45;
  --oxide-light: #65766b;
  --glazed-shadow: #8f846e;
  --cream: #d6c7a3;
  --paper: #f1ddb2;
  --amber: #efa94a;
  --pearl: #f3ead1;
  --echo-cyan: #48c3ca;
  --echo-red: #d15445;
  --enamel: rgba(21, 21, 21, 0.96);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }

body {
  margin: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--void);
}

button, select, input { font: inherit; }

button {
  min-height: 44px;
  border: 1px solid var(--oxide-light);
  border-radius: 1px;
  padding: 7px 12px;
  background: var(--steel);
  color: var(--paper);
  cursor: pointer;
}

button:hover:not(:disabled), button:focus-visible, select:focus-visible, input:focus-visible {
  border-color: var(--amber);
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }
.app-shell { width: min(100%, 960px); }

.system-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  gap: 12px;
  padding: 5px 7px 5px 12px;
  border: 1px solid var(--oxide-light);
  border-bottom: 0;
  background: var(--soot);
  color: var(--cream);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.system-actions { display: flex; gap: 6px; }
.system-actions button { min-height: 32px; padding: 3px 11px; }

.game-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--oxide-light);
  outline: 5px solid var(--soot);
  background: var(--void);
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.28);
}

.game-frame::after {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 4px;
  border: 1px solid rgba(214, 199, 163, 0.2);
  pointer-events: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.panel-lamp {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1px solid var(--cream);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--soot), 0 0 0 3px var(--oxide-dark);
}

.load-panel {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(5px, 1.2vw, 12px);
  padding: 8%;
  background: var(--soot);
  text-align: center;
}

.load-panel h1 {
  margin: 4px 0 0;
  color: var(--paper);
  font-size: clamp(16px, 3vw, 28px);
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.load-panel p { margin: 0; color: var(--cream); font-size: clamp(9px, 1.5vw, 14px); }
.load-panel progress { width: min(70%, 360px); accent-color: var(--amber); }
.load-panel ul { max-height: 7em; margin: 0; padding-left: 22px; overflow: auto; color: var(--echo-red); text-align: left; }
.load-panel button { min-width: 120px; }

.cinematic-panel {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto auto auto 1fr auto;
  justify-items: center;
  align-items: end;
  padding: 7% 9%;
  color: var(--paper);
  text-align: center;
  pointer-events: none;
}

.cinematic-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(8, 11, 13, 0.34);
}

.cinematic-panel > :empty { display: none; }
.cinematic-progress { grid-row: 1; justify-self: end; align-self: start; margin: 0; padding: 2px 5px; background: rgba(8, 11, 13, 0.7); color: var(--cream); font-size: clamp(8px, 1.2vw, 12px); letter-spacing: 0.12em; }
.cinematic-eyebrow { grid-row: 2; margin: 0 0 6px; color: var(--amber); font-size: clamp(8px, 1.3vw, 13px); letter-spacing: 0.2em; text-transform: uppercase; }
.cinematic-panel h1 { grid-row: 3; margin: 0; color: var(--pearl); font-size: clamp(24px, 6vw, 58px); font-weight: 500; letter-spacing: 0.08em; line-height: 0.95; text-shadow: 2px 2px 0 var(--soot); }
.cinematic-subtitle { grid-row: 4; margin: 8px 0 0; color: var(--cream); font-size: clamp(10px, 1.8vw, 18px); }
.cinematic-caption { grid-row: 5; align-self: start; max-width: 62ch; margin: 15px 0 0; padding: 4px 8px; background: rgba(21, 21, 21, 0.78); color: var(--paper); font-size: clamp(9px, 1.5vw, 15px); line-height: 1.45; }
.cinematic-panel button { grid-row: 6; justify-self: end; min-height: 34px; pointer-events: auto; }

.interaction-prompt {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 4.5%;
  margin: 0;
  padding: 5px 10px 5px 22px;
  transform: translateX(-50%);
  border: 1px solid var(--cream);
  background: var(--enamel);
  color: var(--paper);
  font-size: clamp(9px, 1.45vw, 14px);
  white-space: nowrap;
}

.interaction-prompt::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  transform: translateY(-50%);
}

.field-feedback {
  position: absolute;
  z-index: 6;
  top: 48px;
  left: 50%;
  width: min(82%, 580px);
  margin: 0;
  padding: 7px 10px;
  transform: translateX(-50%);
  border: 1px solid var(--echo-red);
  background: rgba(21, 21, 21, 0.96);
  color: var(--paper);
  font-size: clamp(9px, 1.4vw, 13px);
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 3px 0 rgba(8, 11, 13, 0.72);
  pointer-events: none;
}

.field-feedback[data-tone="success"] {
  border-color: var(--echo-cyan);
  color: var(--pearl);
}

.bark-panel {
  position: absolute;
  z-index: 4;
  left: 4%;
  bottom: 9%;
  max-width: min(72%, 520px);
  padding: 6px 9px;
  border-left: 3px solid var(--echo-cyan);
  background: rgba(8, 11, 13, 0.88);
  color: var(--paper);
  font-size: clamp(9px, 1.5vw, 14px);
  line-height: 1.4;
  box-shadow: 2px 2px 0 rgba(8, 11, 13, 0.7);
  pointer-events: none;
}

.bark-panel strong { margin-right: 0.45em; color: var(--amber); letter-spacing: 0.05em; text-transform: uppercase; }

.field-objective {
  position: absolute;
  z-index: 3;
  top: 7px;
  left: 8px;
  max-width: 58%;
  margin: 0;
  padding: 4px 7px 4px 9px;
  border-left: 2px solid var(--amber);
  background: rgba(8, 11, 13, 0.82);
  color: var(--paper);
  font-size: clamp(8px, 1.25vw, 11px);
  line-height: 1.3;
  letter-spacing: 0.025em;
  box-shadow: 2px 2px 0 rgba(8, 11, 13, 0.55);
  pointer-events: none;
}

.field-objective::before {
  content: "ROUTE  ";
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.11em;
}

.dialogue-panel {
  position: absolute;
  z-index: 5;
  left: 3%;
  right: 3%;
  bottom: 4%;
  min-height: 31%;
  display: flex;
  gap: 12px;
  padding: clamp(8px, 1.6vw, 16px) clamp(12px, 2vw, 20px);
  border: 1px solid var(--paper);
  outline: 3px solid var(--soot);
  background: var(--enamel);
  box-shadow: inset 0 0 0 2px var(--oxide-dark), 0 5px 0 rgba(0, 0, 0, 0.7);
}

.dialogue-panel.portrait-right { flex-direction: row-reverse; }
.dialogue-portrait-slot { flex: 0 0 18%; align-self: stretch; min-width: 58px; margin: 0; border-right: 1px solid var(--oxide-light); overflow: hidden; background: var(--steel); }
.portrait-right .dialogue-portrait-slot { border-right: 0; border-left: 1px solid var(--oxide-light); }
.dialogue-portrait-slot img { width: 100%; height: 100%; object-fit: cover; object-position: center top; image-rendering: pixelated; }
.dialogue-copy { flex: 1; min-width: 0; }
.dialogue-speaker { margin: 0 0 6px; color: var(--amber); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.dialogue-text { min-height: 2.5em; margin: 0; color: var(--paper); line-height: 1.5; }
.dialogue-choices { display: grid; gap: 5px; margin-top: 8px; }
.dialogue-choices button { min-height: 30px; padding: 4px 9px; text-align: left; }
.dialogue-choices button[aria-current="true"] { border-color: var(--amber); color: var(--pearl); }
.advance-mark { position: absolute; right: 11px; bottom: 6px; color: var(--amber); }

.combat-panel {
  position: absolute;
  z-index: 4;
  inset: 7px 7px auto auto;
  width: min(54%, 410px);
  padding: 7px;
  border: 1px solid var(--cream);
  outline: 2px solid var(--soot);
  background: var(--enamel);
  color: var(--paper);
  font-size: clamp(8px, 1.3vw, 12px);
  max-height: calc(100% - 14px);
  overflow: auto;
}

.combat-panel h2 { margin: 2px 0 5px; color: var(--amber); font-size: 0.9em; font-weight: 500; letter-spacing: 0.11em; text-transform: uppercase; }
.combat-actor { margin: 0; color: var(--pearl); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.combat-hint { margin: 3px 0 5px; padding-left: 6px; border-left: 2px solid var(--echo-cyan); color: var(--cream); line-height: 1.3; }
.combat-phase { margin: 0 0 5px; color: var(--pearl); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.combat-route-cards { margin-bottom: 6px; }
.combat-route-card-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.combat-route-card {
  min-width: 0;
  padding: 4px 3px 3px;
  border: 1px solid #594e3a;
  border-radius: 1px;
  background: linear-gradient(165deg, #e5d3aa, #bda77a);
  color: #1a1916;
  box-shadow: 1px 1px 0 #080b0d;
  transform: rotate(-0.5deg);
}
.combat-route-card:nth-child(even) { transform: rotate(0.7deg); }
.combat-route-card small, .combat-route-card strong, .combat-route-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combat-route-card small { font-size: 0.68em; letter-spacing: 0.07em; }
.combat-route-card strong { min-height: 2.25em; margin: 2px 0; font-size: 0.72em; line-height: 1.05; text-align: center; white-space: normal; }
.combat-route-card span { font-size: 0.65em; }
.combat-route-card[data-status="spent"] { filter: saturate(0.55); }
.combat-route-card[data-status="dark-siding"] { border-color: #4d5451; background: #171b1b; color: #777d78; box-shadow: inset 0 0 0 1px #080b0d; }
.combat-panel ol { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; min-height: 35px; margin: 0 0 7px; padding: 0; list-style: none; }
.combat-panel ol::before { content: ""; position: absolute; left: 5%; right: 5%; top: 7px; height: 1px; background: var(--oxide-light); }
.combat-panel ol li { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; color: var(--cream); }
.rail-marker { z-index: 1; width: 9px; height: 9px; margin-top: 3px; border: 1px solid var(--cream); border-radius: 50%; background: var(--steel); }
[data-team="enemy"] .rail-marker { border-radius: 0; transform: rotate(45deg); background: var(--glazed-shadow); }
[data-kind="echo"] .rail-marker {
  border-color: var(--pearl);
  border-radius: 50%;
  background: linear-gradient(90deg, var(--echo-cyan) 0 50%, var(--echo-red) 50% 100%);
  transform: none;
  box-shadow: 0 0 0 1px var(--soot);
}
[data-kind="echo"] .rail-label { color: var(--pearl); }
.combat-panel li[aria-current="true"] .rail-marker { border-color: var(--paper); background: var(--amber); box-shadow: 0 0 0 2px var(--soot); }
.rail-label { width: 100%; margin-top: 4px; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.combat-panel ul { max-height: 3.4em; margin: 0 0 6px; padding-left: 18px; overflow: auto; }
.scheduled-echo-intent { color: var(--echo-cyan); }
.combat-target { margin: 3px 0 6px; color: var(--echo-cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combat-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.combat-actions button { min-height: 30px; padding: 3px; overflow: hidden; font-size: inherit; text-overflow: ellipsis; white-space: nowrap; }
.combat-actions button[aria-current="true"] { border-color: var(--amber); }
.combat-actions button:disabled { color: var(--cream); opacity: 0.58; }
.combat-command-reason { display: block; color: var(--echo-red); font-size: 0.78em; font-weight: 400; }
.combat-command-detail { min-height: 4.7em; margin-top: 5px; padding: 6px; border: 1px solid var(--oxide-light); background: rgba(8, 11, 13, 0.82); }
.combat-command-detail strong, .combat-command-detail span { display: block; }
.combat-command-detail strong { color: var(--amber); }
.combat-command-detail span { margin-top: 2px; color: var(--echo-cyan); font-size: 0.88em; }
.combat-command-detail p { margin: 4px 0 0; color: var(--paper); line-height: 1.32; }
.combat-rewards { margin-top: 6px; padding: 6px; border: 1px solid var(--oxide-light); background: rgba(8, 11, 13, 0.9); }
.combat-rewards h2 { color: var(--pearl); }
.combat-rewards ul { max-height: 7.5em; margin-bottom: 0; color: var(--cream); }

.ending-panel {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  padding: 12%;
  background: linear-gradient(rgba(8, 11, 13, 0.78), rgba(8, 11, 13, 0.94));
  color: var(--paper);
  text-align: center;
}

.ending-panel h1 { margin: 0; color: var(--pearl); font-size: clamp(30px, 7vw, 66px); font-weight: 500; letter-spacing: 0.18em; text-shadow: 2px 2px 0 var(--soot); }
.ending-eyebrow { margin: 0; color: var(--amber); letter-spacing: 0.2em; }
.ending-panel p { max-width: 48ch; margin: 0; line-height: 1.45; }
.ending-note { color: var(--cream); font-size: 0.86em; }
.ending-panel button { min-width: 190px; margin-top: 8px; border-color: var(--amber); }

.touch-controls {
  display: none;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 28px;
  margin-top: 14px;
  touch-action: none;
  user-select: none;
}

.touch-dpad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 48px); }
.touch-dpad button:nth-child(1) { grid-column: 2; }
.touch-dpad button:nth-child(2) { grid-row: 2; grid-column: 1; }
.touch-dpad button:nth-child(3) { grid-row: 2; grid-column: 2; }
.touch-dpad button:nth-child(4) { grid-row: 2; grid-column: 3; }
.touch-actions { display: flex; justify-content: flex-end; align-items: end; gap: 8px; }
.touch-actions button { min-width: 54px; min-height: 48px; }
.touch-controls button.is-held { transform: translateY(2px); background: var(--oxide-dark); }

.save-status, .control-help { margin: 8px 0 0; color: var(--oxide-light); font-size: 12px; }
.save-status { min-height: 1.2em; }

.game-menu {
  width: min(94vw, 900px);
  max-height: min(90vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--paper);
  outline: 4px solid var(--soot);
  background: var(--enamel);
}

.game-menu::backdrop { background: rgba(8, 11, 13, 0.9); }
.game-menu-shell { max-height: min(90vh, 760px); padding: clamp(12px, 2vw, 22px); overflow: auto; }
.game-menu-header { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--oxide-light); }
.game-menu-eyebrow { margin: 0 0 3px; color: var(--amber); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
.game-menu h2 { margin: 0 0 12px; color: var(--pearl); font-weight: 500; }
.game-menu h3 { margin: 18px 0 8px; color: var(--amber); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.game-menu h4, .game-menu h5 { margin: 0; color: var(--paper); }
.game-menu h5 { font-size: 12px; font-weight: 500; }
.game-menu p { margin: 4px 0; line-height: 1.4; }
.game-menu-currency { color: var(--amber); white-space: nowrap; }
.game-menu-feedback { min-height: 1.5em; color: var(--echo-cyan); }
.menu-route-notes { padding: 10px 12px 12px; border: 1px solid var(--oxide-light); background: rgba(15, 20, 20, 0.72); }
.menu-route-notes h3 { margin-top: 0; }
.menu-route-location { color: var(--amber); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.menu-route-objective { color: var(--paper); }
.menu-route-recent { margin: 8px 0 0; padding-left: 20px; color: var(--cream); font-size: 11px; }
.menu-route-recent li + li { margin-top: 4px; }
.menu-party-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 9px; }
.menu-party-card, .menu-item-card, .menu-save-card { border: 1px solid var(--oxide-light); background: rgba(36, 44, 43, 0.76); }
.menu-party-card { padding: 10px; }
.menu-party-card > header { display: flex; align-items: center; gap: 10px; }
.menu-party-card > header img { width: 54px; height: 54px; border: 1px solid var(--cream); object-fit: cover; object-position: center top; image-rendering: pixelated; }
.menu-stats { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 3px 7px; margin: 10px 0; font-size: 11px; }
.menu-stats dt { color: var(--oxide-light); }
.menu-stats dd { margin: 0; color: var(--cream); }
.menu-action-list { margin: 7px 0; padding-left: 19px; color: var(--cream); font-size: 11px; }
.menu-loadout { display: grid; gap: 7px; margin-top: 9px; }
.menu-loadout section { padding-top: 6px; border-top: 1px solid rgba(101, 118, 107, 0.45); }
.menu-loadout p { color: var(--oxide-light); font-size: 11px; }
.menu-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; }
.menu-inline-actions button, .menu-save-card button { min-height: 32px; padding: 4px 8px; font-size: 11px; }
.menu-gear-option { display: grid; flex: 1 1 210px; gap: 4px; padding: 6px; border: 1px solid rgba(101, 118, 107, 0.45); background: rgba(8, 11, 13, 0.42); }
.menu-gear-option button { width: 100%; text-align: left; }
.menu-gear-option small { color: var(--cream); font-size: 10px; line-height: 1.35; }
.menu-item-list, .menu-save-list { display: grid; gap: 7px; }
.menu-item-list { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.menu-save-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.menu-item-card, .menu-save-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px; }
.menu-item-card p, .menu-save-card p { color: var(--cream); font-size: 11px; }
.menu-muted { color: var(--oxide-light); font-size: 11px; }
.menu-touch-nav { display: none; position: sticky; bottom: -22px; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 18px -22px -22px; padding: 8px 22px; border-top: 1px solid var(--oxide-light); background: var(--soot); }
.menu-touch-nav button { min-height: 40px; padding: 4px; }

.shop-dialog { width: min(92vw, 720px); max-height: 86vh; padding: 0; overflow: hidden; border: 1px solid var(--paper); background: var(--enamel); }
.shop-dialog::backdrop { background: rgba(8, 11, 13, 0.9); }
.shop-shell { max-height: 86vh; padding: clamp(12px, 2vw, 22px); overflow: auto; }
.shop-header { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--oxide-light); }
.shop-header h2 { margin: 0; color: var(--pearl); }
.shop-header p { margin: 4px 0 10px; color: var(--cream); }
.shop-offers { display: grid; gap: 8px; }
.shop-offer-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 11px; border: 1px solid var(--oxide-light); background: rgba(36, 44, 43, 0.76); }
.shop-offer-card h3 { margin: 0; color: var(--paper); }
.shop-offer-card p { margin: 4px 0; color: var(--cream); font-size: 12px; }
.shop-effect-list { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 7px 0 0; padding-left: 18px; color: var(--echo-cyan); font-size: 11px; }
.shop-offer-card button { min-width: 125px; }
.shop-offer-card button.cannot-afford { border-color: var(--echo-red); color: var(--cream); }

dialog { width: min(92vw, 520px); border: 1px solid var(--cream); border-radius: 1px; background: var(--soot); color: inherit; }
dialog::backdrop { background: rgba(8, 11, 13, 0.86); }
.settings-form { display: grid; gap: 14px; }
.settings-form h2 { margin: 0; color: var(--amber); }
.settings-form label { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.settings-form fieldset { border: 1px solid var(--oxide-light); }
.binding-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.binding-list button { padding: 4px 8px; }

.readable-type { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (pointer: coarse), (max-width: 760px) {
  .touch-controls { display: grid; }
  .control-help { display: none; }
  .menu-touch-nav { display: grid; }
}

@media (max-width: 540px) {
  body { align-items: start; }
  .system-bar { font-size: 11px; }
  .combat-panel { width: 61%; }
  .dialogue-panel { font-size: 11px; }
  .dialogue-portrait-slot { flex-basis: 22%; }
  .game-menu-header { grid-template-columns: 1fr auto; }
  .game-menu-currency { grid-row: 2; }
  .menu-party-list, .menu-item-list, .menu-save-list { grid-template-columns: 1fr; }
  .menu-item-card, .menu-save-card { align-items: flex-start; flex-direction: column; }
  .menu-stats { grid-template-columns: repeat(2, auto 1fr); }
  .shop-header, .shop-offer-card { grid-template-columns: 1fr; }
  .shop-offer-card button { width: 100%; }
  .touch-controls { gap: 10px; }
  .touch-dpad { grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 42px); }
  .touch-actions button { min-width: 46px; min-height: 44px; }
}

@media (max-width: 540px) and (orientation: portrait) {
  .game-frame.combat-active {
    height: min(660px, calc(100svh - 150px));
    min-height: 560px;
    aspect-ratio: auto;
  }

  .game-frame.combat-active #game-canvas {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .game-frame.combat-active .combat-panel {
    inset: calc((100vw - 24px) * 0.5625 + 8px) 7px 7px;
    width: auto;
    max-height: none;
    font-size: 11px;
  }
}

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