:root {
  --bg: #132124;
  --panel: #1b2c30;
  --text: #e8eeeb;
  --muted: #a1b5b7;
  --accent: #e9be78;
  --cyan: #84c7be;
  --line: #3e5555;
  --danger: #e59280;
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  scrollbar-color: #647f7e var(--bg);
  scrollbar-width: thin;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  background: #24383c;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 14px;
  min-height: 42px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover:not(:disabled) {
  background: #385052;
  border-color: #92ada4;
}
button:active:not(:disabled) {
  background: #40595a;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
button.primary {
  background: var(--accent);
  color: #233235;
  border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover {
  background: #f1cd93;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1,
h2,
p {
  margin: 0;
}
kbd {
  font:
    10px ui-monospace,
    SFMono-Regular,
    monospace;
  border: 1px solid #82908a66;
  border-radius: 3px;
  padding: 2px 5px;
  background: #263e4166;
  white-space: nowrap;
}
::selection {
  background: var(--accent);
  color: var(--bg);
}
[hidden] {
  display: none !important;
}
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: #647f7e;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #8aaba1;
}
::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}
.topbar {
  height: 64px;
  flex: 0 0 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  z-index: 5;
  background: #17282c;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  letter-spacing: 3px;
}
.brand-symbol {
  color: var(--accent);
  font-size: 31px;
}
.brand small {
  display: block;
  font:
    8px ui-monospace,
    monospace;
  letter-spacing: 2.5px;
  color: var(--muted);
  margin-top: 4px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 12px;
}
.header-actions .sector {
  color: var(--muted);
}
.header-actions button {
  width: 38px;
  min-height: 38px;
  padding: 5px;
}
.header-actions button + button {
  margin-left: -12px;
}
.header-actions a {
  font-size: 11px;
}
#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline-offset: -3px;
}
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.hud button,
.hud .touch-controls {
  pointer-events: auto;
}
.eyebrow {
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}
.mission {
  position: absolute;
  top: 22px;
  left: 24px;
  width: 255px;
  padding: 17px 18px;
  background: #14272ce8;
  border: 1px solid #5b78746b;
  border-radius: 6px;
  box-shadow: 0 8px 20px #07151a15;
}
.mission .eyebrow {
  display: flex;
  justify-content: space-between;
  letter-spacing: 1px;
}
.mission .eyebrow span {
  color: var(--muted);
}
.mission .eyebrow #mission-label {
  color: var(--accent);
}
.indoors .mission ol {
  display: none;
}
#interior-task {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}
.cache-legend.exit-legend {
  color: var(--cyan);
}
.building-progress {
  padding: 0;
  margin: 0 0 14px;
  list-style: none;
}
.building-progress li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 12px;
}
.building-progress small {
  color: var(--muted);
  white-space: nowrap;
}
.mission h1 {
  font-size: 17px;
  font-weight: 500;
  margin: 12px 0 16px;
  letter-spacing: 1px;
}
.mission ol {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.mission li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #99afad;
}
.mission i {
  display: grid;
  place-items: center;
  border: 1px solid #617b6c;
  width: 17px;
  height: 17px;
  font:
    9px ui-monospace,
    monospace;
  border-radius: 50%;
  font-style: normal;
}
.mission li.active {
  color: #e1d2a8;
}
.mission li.done {
  color: var(--cyan);
}
.mission li.done i {
  background: #5e8272;
  color: #e5ecce;
}
.mission li b {
  font:
    11px ui-monospace,
    monospace;
  margin-left: auto;
}
.mission-report {
  width: 100%;
  margin-top: 15px;
  padding: 8px 9px;
  min-height: 38px;
  font-size: 10px;
  text-align: left;
  color: var(--cyan);
}
.mission-report.needs-attention {
  color: var(--accent);
  border-color: var(--accent);
}
.cache-legend {
  color: var(--danger);
  white-space: nowrap;
}
.minimap-panel {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 184px;
  padding: 11px;
  background: #14272ce8;
  border: 1px solid #5b78746b;
  border-radius: 6px;
}
.minimap-panel > div {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
}
.minimap-panel canvas {
  width: 160px;
  height: 128px;
  display: block;
}
.minimap-panel p {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.player-dot {
  color: var(--cyan);
}
.objective-dot {
  color: var(--accent);
  margin-left: 5px;
}
#distance {
  margin-left: auto;
}
.vitals {
  position: absolute;
  left: 24px;
  bottom: 20px;
  width: 255px;
  background: #14272ced;
  border: 1px solid #5b78746b;
  border-radius: 6px;
  padding: 14px 16px;
}
.survivor-id {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #557567;
  font-family: "Songti SC", serif;
  color: #e7d3a5;
}
.survivor-id strong {
  font-size: 13px;
  font-weight: 500;
}
.survivor-id small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
#kills {
  font:
    10px ui-monospace,
    monospace;
  margin-left: auto;
  color: var(--muted);
}
.stat {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  margin-bottom: 10px;
}
.stat > span {
  color: var(--muted);
}
.stat > div {
  flex: 1;
  background: #405856;
  height: 4px;
}
.stat i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--cyan);
  transition: width 0.1s;
}
.stat.stamina i {
  background: var(--accent);
}
.stat b {
  font:
    11px ui-monospace,
    monospace;
  width: 25px;
  text-align: right;
}
.needs {
  display: flex;
  gap: 12px;
  font-size: 9px;
  color: var(--muted);
  margin: 11px 0;
}
.needs b {
  color: #d1d8b9;
  font-weight: 400;
}
#save-state {
  font-size: 8px;
  margin-left: auto;
}
.vitals button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 35px;
  padding: 7px 9px;
  font-size: 10px;
}
.vitals button span {
  font: 9px monospace;
  color: var(--muted);
}
.interaction {
  position: absolute;
  left: 50%;
  bottom: 45px;
  transform: translateX(-50%);
  min-width: 190px;
  max-width: 40%;
  pointer-events: auto;
}
.interaction button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 45px;
  font-size: 12px;
  background: #203b3eeb;
  border-color: #a5b287;
  box-shadow: 0 4px 25px #10282a55;
}
.interaction kbd {
  font-size: 13px;
  color: var(--accent);
}
#interaction-progress {
  height: 3px;
  margin-top: 4px;
  background: #415854;
  overflow: hidden;
  border-radius: 3px;
}
#interaction-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
}
.event-feed {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 240px;
  font-size: 11px;
  line-height: 1.9;
  color: #d1ddce;
  text-shadow: 0 1px 4px #071619;
}
.event-feed p {
  border-left: 2px solid #a2b08e;
  padding: 7px 10px;
  background: #182f32ce;
  margin-top: 7px;
}
.event-feed small {
  display: block;
  color: #9db5a5;
  font-size: 8px;
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.zoom-controls {
  position: absolute;
  right: 25px;
  top: 235px;
  display: flex;
  gap: 5px;
}
.zoom-controls button {
  padding: 0;
  min-height: 30px;
  width: 31px;
  font-size: 18px;
  background: #163036e0;
}
.touch-controls {
  display: none;
}
#toolbar {
  height: 57px;
  flex: 0 0 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: #17282c;
  border-top: 1px solid var(--line);
  z-index: 5;
}
.key-hints {
  display: flex;
  gap: 17px;
  font-size: 10px;
  color: var(--muted);
}
.key-hints kbd {
  font-size: 9px;
}
.loadout {
  display: flex;
  align-items: center;
  gap: 8px;
}
.loadout button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 10px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.loadout button b {
  color: var(--accent);
  font: 11px monospace;
}
.loadout #weapon {
  color: var(--cyan);
  min-width: 104px;
  justify-content: space-between;
}
.loadout #ammo {
  font: 10px monospace;
  color: var(--muted);
  min-width: 88px;
}
.story-intro {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}
.story-options {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}
.story-option {
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 12px;
}
.story-option strong {
  color: var(--accent);
}
.difficulty-default {
  border-color: var(--accent);
}
.craft-materials {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 0;
  border-block: 1px solid var(--line);
}
.craft-materials span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.craft-materials strong {
  font:
    20px/1.7 ui-monospace,
    monospace;
  color: var(--accent);
}
.story-option:disabled {
  opacity: 1;
  border-style: dashed;
  background: var(--panel);
}
.story-option:disabled strong {
  color: var(--muted);
}
.story-option span,
.story-option small {
  font-size: 12px;
  line-height: 1.7;
}
.story-option small {
  color: var(--muted);
}
.clue-entry {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.clue-entry summary {
  cursor: pointer;
  color: var(--cyan);
  padding: 5px 0;
}
.clue-entry summary:hover {
  color: var(--accent);
}
.clue-entry summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.clue-entry p {
  padding: 10px 0 0;
}
.story-options button:focus-visible {
  outline-offset: -3px;
}
.loadout kbd {
  font-size: 8px;
}
.intro {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #102328f7 0%, #142a2ccc 30%, #142a2c11 72%);
}
.intro-content {
  width: 580px;
  padding: 24px 0 38px 7.5%;
}
.intro-content > .eyebrow {
  letter-spacing: 4px;
  font-size: 11px;
}
.intro-title {
  font:
    84px/1.16 "Songti SC",
    "STSong",
    serif;
  letter-spacing: 12px;
  margin: 23px 0 18px;
  color: #e7e8d6;
}
.intro-title span {
  color: var(--accent);
  margin-left: -5px;
}
.intro-sub {
  font-size: 17px;
  letter-spacing: 3px;
  color: #c8d6ca;
}
.intro-story {
  font-size: 12px;
  line-height: 2.2;
  color: #a1b8b3;
  margin-top: 24px;
}
.intro-buttons {
  display: flex;
  gap: 10px;
  margin: 30px 0 24px;
}
.intro-buttons button {
  min-width: 180px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 49px;
  font-size: 13px;
}
.intro-controls {
  font-size: 10px;
  color: #b4c1b3;
  white-space: nowrap;
}
.intro-note {
  font-size: 9px;
  color: #879f98;
  margin-top: 13px;
  letter-spacing: 1px;
}
.intro-stamp {
  position: absolute;
  right: 6%;
  bottom: 7%;
  font:
    10px/1.8 ui-monospace,
    monospace;
  color: #b0c3ac80;
  text-align: center;
  border: 1px solid #9daf9466;
  padding: 18px 20px;
  letter-spacing: 2px;
  transform: rotate(-5deg);
}
.intro-stamp strong {
  display: block;
  font:
    48px ui-monospace,
    monospace;
  color: #c8d0a5b0;
}
.intro-stamp span {
  font-size: 7px;
}
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: 85dvh;
  overflow: auto;
  padding: 25px;
  background: #1b3035;
  color: var(--text);
  border: 1px solid #6b8780;
  border-radius: 8px;
  box-shadow: 0 20px 70px #00101499;
}
dialog::backdrop {
  background: #071a20b8;
  backdrop-filter: blur(4px);
}
dialog[open] {
  display: flex;
  flex-direction: column;
}
.modal-header,
#modal-actions {
  flex-shrink: 0;
}
#modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.upgrade-choices {
  display: grid;
  gap: 9px;
}
.upgrade-choice {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  width: 100%;
  padding: 14px;
  text-align: left;
  border-left: 3px solid var(--accent);
}
.upgrade-choice strong {
  color: var(--text);
  font-size: 15px;
}
.upgrade-choice span {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.upgrade-choice small {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  font-size: 10px;
  color: var(--accent);
}
.upgrade-choice:focus-visible {
  outline-offset: -3px;
}
#modal-body .upgrade-footnote {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.upgrade-pending {
  color: var(--accent);
}
.earned-upgrades {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.earned-upgrades li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.earned-upgrades strong {
  display: block;
  font-size: 13px;
  color: var(--cyan);
}
.earned-upgrades span {
  font-size: 12px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 15px;
}
.modal-header h2 {
  font:
    27px "Songti SC",
    serif;
  letter-spacing: 2px;
}
.modal-header button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 20px;
}
#modal-body {
  font-size: 13px;
  line-height: 2;
  color: #c0d0c8;
}
#modal-body p {
  margin: 0 0 14px;
}
#modal-body h3 {
  font-size: 14px;
  color: var(--accent);
  margin: 18px 0 9px;
}
#modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
#modal-actions button {
  font-size: 12px;
  min-width: 105px;
}
.inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.inventory-row strong {
  font-size: 13px;
  font-weight: 400;
}
.inventory-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.inventory-row button {
  font-size: 11px;
}
.result-stats {
  display: flex;
  gap: 28px;
  margin-top: 23px;
}
.result-stats strong {
  display: block;
  color: var(--accent);
  font: 28px monospace;
}
.result-stats span {
  font-size: 10px;
  color: var(--muted);
}
#toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #284740;
  border: 1px solid #7b9e82;
  border-radius: 5px;
  font-size: 12px;
  max-width: 90vw;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#toast.visible {
  opacity: 1;
}
@media (max-width: 1120px) {
  .key-hints {
    gap: 10px;
  }
  .key-hints span:nth-child(4) {
    display: none;
  }
  .mission,
  .vitals {
    width: 225px;
  }
  .event-feed {
    width: 200px;
  }
  .intro-content {
    padding-left: 6%;
  }
}
@media (max-width: 760px), (max-width: 900px) and (max-height: 500px) {
  .topbar {
    height: 56px;
    flex-basis: 56px;
    padding: 0 15px;
  }
  .brand {
    font-size: 18px;
    letter-spacing: 2px;
  }
  .brand-symbol {
    font-size: 25px;
  }
  .brand small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .header-actions {
    gap: 12px;
  }
  .header-actions .sector {
    display: none;
  }
  .header-actions button {
    width: 32px;
    min-height: 34px;
  }
  .header-actions a {
    font-size: 9px;
  }
  .mission {
    top: 12px;
    left: 12px;
    width: 205px;
    padding: 11px 12px;
  }
  .mission h1 {
    font-size: 13px;
    margin: 8px 0;
  }
  .mission ol {
    gap: 5px;
  }
  .mission li {
    font-size: 9px;
  }
  .mission i {
    width: 13px;
    height: 13px;
    font-size: 7px;
  }
  .mission .eyebrow {
    font-size: 8px;
  }
  .minimap-panel {
    width: 106px;
    right: 12px;
    top: 12px;
    padding: 7px;
  }
  .minimap-panel > div {
    font-size: 7px;
  }
  .minimap-panel canvas {
    width: 90px;
    height: 72px;
  }
  .minimap-panel p {
    font-size: 6px;
    gap: 3px;
  }
  .minimap-panel #distance {
    display: none;
  }
  .zoom-controls {
    right: 12px;
    top: 136px;
  }
  .zoom-controls button {
    width: 29px;
    min-height: 29px;
  }
  .vitals {
    left: 12px;
    bottom: 146px;
    width: 172px;
    padding: 9px 11px;
  }
  .survivor-id {
    margin-bottom: 8px;
    gap: 6px;
  }
  .avatar {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }
  .survivor-id strong {
    font-size: 11px;
  }
  .survivor-id small {
    font-size: 8px;
  }
  .stat {
    margin-bottom: 6px;
    font-size: 8px;
    gap: 6px;
  }
  .stat b {
    font-size: 9px;
  }
  .needs {
    font-size: 8px;
    gap: 10px;
    margin: 7px 0;
  }
  .vitals #save-state {
    display: none;
  }
  .vitals button {
    font-size: 9px;
    min-height: 30px;
    padding: 5px 7px;
  }
  #kills {
    font-size: 8px;
  }
  .event-feed {
    right: 12px;
    bottom: 198px;
    width: 160px;
    font-size: 9px;
    line-height: 1.65;
  }
  .event-feed p {
    padding: 7px 9px;
  }
  .event-feed p:not(:last-child) {
    display: none;
  }
  .interaction {
    bottom: 137px;
    left: auto;
    right: 12px;
    transform: none;
    min-width: 155px;
    max-width: 55%;
  }
  .interaction button {
    font-size: 10px;
    min-height: 37px;
    padding: 6px 9px;
  }
  .interaction kbd {
    display: none;
  }
  .touch-controls {
    display: flex;
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    justify-content: space-between;
    align-items: center;
  }
  .touch-controls #joystick {
    width: 105px;
    height: 105px;
    border-radius: 50%;
    border: 1px solid #a3bca780;
    background: #1e3d4055;
    touch-action: none;
    position: relative;
    box-shadow: inset 0 0 0 25px #78948511;
  }
  #stick {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #7baca08c;
    border: 1px solid #b3d1b4;
    left: 32px;
    top: 32px;
    pointer-events: none;
  }
  .touch-actions {
    display: grid;
    grid-template-columns: 44px 44px 64px;
    gap: 6px;
    align-items: end;
  }
  .touch-actions button {
    font-size: 10px;
    background: #274847b8;
    min-height: 43px;
    padding: 5px;
    touch-action: none;
  }
  .touch-actions #touch-fire {
    grid-column: 3;
    grid-row: 1/3;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    align-self: center;
    border-color: #d2ba88;
    color: var(--accent);
    font-size: 13px;
  }
  .touch-actions #touch-weapon {
    grid-column: 2;
    grid-row: 1;
  }
  .touch-actions #touch-reload {
    grid-column: 1;
    grid-row: 2;
  }
  .touch-actions #touch-dodge {
    grid-column: 2;
    grid-row: 2;
  }
  .loadout #reload {
    display: none;
  }
  #toolbar {
    height: 49px;
    flex-basis: 49px;
    padding: 0 10px;
    justify-content: center;
  }
  .key-hints {
    display: none;
  }
  .loadout {
    gap: 5px;
    width: 100%;
    justify-content: space-between;
  }
  .loadout button {
    font-size: 8px;
    min-height: 33px;
    padding: 5px 6px;
    gap: 4px;
  }
  .loadout #weapon {
    min-width: 64px;
  }
  .loadout #ammo {
    font-size: 8px;
    min-width: 64px;
  }
  .loadout kbd {
    display: none;
  }
  .loadout button b {
    font-size: 10px;
  }
  .intro {
    background: linear-gradient(90deg, #11282be8, #12272b77);
  }
  .intro-content {
    width: 100%;
    padding: 20px 27px 40px;
  }
  .intro-title {
    font-size: 65px;
    letter-spacing: 9px;
    margin: 16px 0;
  }
  .intro-content > .eyebrow {
    font-size: 10px;
  }
  .intro-sub {
    font-size: 14px;
  }
  .intro-story {
    font-size: 11px;
    margin-top: 20px;
  }
  .intro-buttons {
    margin: 23px 0 19px;
    flex-wrap: wrap;
  }
  .intro-buttons button {
    min-width: 160px;
    min-height: 45px;
  }
  .intro-controls {
    font-size: 9px;
    white-space: normal;
    line-height: 2.7;
    max-width: 310px;
  }
  .intro-stamp {
    right: 25px;
    bottom: 30px;
    opacity: 0.5;
    padding: 8px;
    transform: rotate(-5deg);
    display: none;
  }
  .intro-note {
    font-size: 8px;
  }
  #toast {
    bottom: 70px;
    font-size: 11px;
  }
  dialog {
    padding: 21px;
  }
  .modal-header h2 {
    font-size: 23px;
  }
}
@media (max-height: 650px) and (min-width: 761px) {
  .intro-title {
    font-size: 60px;
  }
  .intro-content {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .intro-story {
    margin-top: 13px;
  }
  .intro-buttons {
    margin: 18px 0;
  }
  .mission {
    top: 15px;
    padding: 12px 15px;
  }
  .mission h1 {
    margin: 9px 0;
  }
  .mission ol {
    gap: 8px;
  }
  .minimap-panel {
    top: 15px;
  }
  .vitals {
    padding: 10px 13px;
    bottom: 12px;
  }
  .survivor-id {
    margin-bottom: 8px;
  }
  .event-feed {
    bottom: 12px;
  }
  .interaction {
    bottom: 30px;
  }
  .intro-note {
    margin-top: 5px;
  }
}
@media (max-height: 500px) and (max-width: 900px) {
  .topbar {
    height: 48px;
    flex-basis: 48px;
  }
  .mission {
    top: 8px;
    left: 10px;
    width: 195px;
  }
  .mission ol {
    display: none;
  }
  .minimap-panel {
    top: 8px;
    right: 10px;
    width: 98px;
  }
  .minimap-panel canvas {
    width: 82px;
    height: 65px;
  }
  .vitals {
    left: 130px;
    bottom: 13px;
    width: 168px;
  }
  .survivor-id {
    display: none;
  }
  .vitals button {
    display: none;
  }
  .event-feed {
    display: none;
  }
  .touch-controls {
    bottom: 12px;
  }
  .interaction {
    bottom: 18px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: 33%;
  }
  .intro-title {
    font-size: 45px;
    line-height: 1.1;
    margin: 10px 0;
  }
  .intro-title br {
    display: none;
  }
  .intro-story {
    margin-top: 10px;
  }
  .intro-buttons {
    margin: 15px 0;
  }
  .intro-content {
    padding: 10px 30px;
  }
  .intro-controls {
    display: none;
  }
  .intro-note {
    margin-top: 8px;
  }
  .zoom-controls {
    top: 125px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  :root {
    scrollbar-color: auto;
  }
  button {
    border: 1px solid ButtonText;
  }
  .stat > div {
    border: 1px solid CanvasText;
  }
}

/* Mobile: reserve the play field for the character, not persistent panels. */
#mobile-report,
#mobile-event {
  display: none;
}
.report-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 5px 0;
}
.report-stats span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.report-stats strong {
  display: block;
  font:
    18px/1.7 ui-monospace,
    monospace;
  color: var(--text);
}
.report-events p {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  overflow-wrap: anywhere;
}
.report-events small {
  display: block;
  color: var(--accent);
  font:
    10px/1.8 ui-monospace,
    monospace;
  margin-bottom: 4px;
}
@media (max-width: 760px), (max-width: 900px) and (max-height: 500px) {
  .mission-report {
    display: none;
  }
  .mission {
    width: min(205px, calc(100% - 142px));
  }
  .mission li:not(:first-child) {
    display: none;
  }
  .vitals {
    top: 138px;
    left: 12px;
    right: 12px;
    bottom: auto;
    width: auto;
    padding: 4px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
    gap: 12px;
    align-items: center;
    background: #14272cc9;
  }
  .vitals .survivor-id,
  .vitals .needs,
  .vitals #inventory {
    display: none;
  }
  .vitals .stat {
    margin: 0;
    font-size: 10px;
    gap: 6px;
    min-width: 0;
  }
  .vitals .stat > div {
    min-width: 8px;
  }
  .vitals .stat b {
    font-size: 10px;
    width: 23px;
    flex: none;
  }
  .vitals #mobile-report {
    display: block;
    min-height: 44px;
    width: 44px;
    padding: 3px;
    font-size: 10px;
    border-color: #698b80;
    background: #203c3e;
  }
  .vitals #mobile-report.needs-attention {
    color: var(--accent);
    border-color: var(--accent);
  }
  .event-feed {
    display: none;
  }
  #mobile-event {
    display: block;
    position: absolute;
    left: 12px;
    right: 84px;
    top: 200px;
    max-height: 42px;
    padding: 5px 8px;
    background: #163036c9;
    border-left: 2px solid var(--accent);
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.6;
    color: var(--text);
    pointer-events: none;
    overflow: hidden;
  }
  .zoom-controls {
    top: 200px;
  }
}
@media (max-width: 900px) and (max-height: 500px) {
  dialog[data-view="craft"] {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }
  .story-options.craft-recipes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  dialog[data-view="craft"] .modal-header {
    margin-bottom: 10px;
  }
  dialog[data-view="craft"] #modal-actions {
    margin-top: 10px;
  }
  dialog[data-view="craft"] #modal-body {
    font-size: 12px;
    line-height: 1.7;
  }
  dialog[data-view="craft"] #modal-body h3 {
    margin: 10px 0 7px;
  }
  dialog[data-view="craft"] .craft-materials {
    padding: 4px 0;
  }
  dialog[data-view="craft"] .craft-materials > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  dialog[data-view="craft"] .craft-materials strong {
    font-size: 18px;
    line-height: 1.4;
  }
  dialog[data-view="difficulty"] {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }
  dialog[data-view="difficulty"] .modal-header {
    margin-bottom: 10px;
  }
  dialog[data-view="difficulty"] #modal-actions {
    margin-top: 10px;
  }
  dialog[data-view="story"] {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }
  dialog[data-view="story"] .modal-header {
    margin-bottom: 10px;
  }
  dialog[data-view="story"] #modal-actions {
    margin-top: 10px;
  }
  dialog[data-view="story"] #modal-body {
    font-size: 12px;
    line-height: 1.7;
  }
  .story-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .story-option {
    padding: 9px;
  }
  .story-option span,
  .story-option small {
    font-size: 11px;
    line-height: 1.55;
  }
  dialog[data-view="upgrades"] {
    width: min(760px, calc(100vw - 32px));
    padding: 16px;
  }
  dialog[data-view="upgrades"] .modal-header {
    margin-bottom: 10px;
  }
  dialog[data-view="upgrades"] #modal-actions {
    margin-top: 10px;
  }
  dialog[data-view="upgrades"] #modal-body > p {
    margin-bottom: 8px;
  }
  .upgrade-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .upgrade-choice {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    padding: 10px;
  }
  .upgrade-choice strong {
    font-size: 13px;
  }
  .upgrade-choice span {
    font-size: 11px;
    line-height: 1.6;
  }
  .upgrade-choice small {
    grid-column: 1;
    grid-row: 3;
  }
  #modal-body .upgrade-footnote {
    margin-top: 8px;
  }
  .mission {
    width: 195px;
  }
  .vitals {
    top: 8px;
    left: 220px;
    right: 122px;
    gap: 8px;
    padding: 2px 7px;
  }
  .vitals .stat {
    font-size: 8px;
    gap: 4px;
  }
  .vitals #mobile-report {
    min-height: 40px;
  }
  #mobile-event {
    top: 63px;
    left: 220px;
    right: 122px;
  }
  .zoom-controls {
    top: 125px;
  }
}
