:root {
  color-scheme: dark;
  --cream: #e9e1c9;
  --gold: #e8bb75;
  --ink: #111d28;
  --muted: #b0b6ae;
  --line: #e2c99932;
  --panel: #101d28e8;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111c27;
  color: var(--cream);
  font:
    13px "DM Sans",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  touch-action: manipulation;
  cursor: pointer;
  border: 1px solid var(--line);
  color: var(--cream);
  background: #172731dd;
  border-radius: 4px;
  padding: 11px 17px;
  transition:
    background 0.16s,
    border-color 0.16s;
}
button:hover {
  background: #3a463d;
  border-color: #e8bb7590;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.primary {
  background: #e8bb75;
  color: #1d2c2b;
  border-color: #e8bb75;
  font-weight: 700;
}
.primary:hover {
  background: #f6d293;
}
.text-button {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: 0;
  image-rendering: pixelated;
}
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px #060f1d70;
}
.title-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    90deg,
    #0b1725ed 0%,
    #0d1b2bd9 32%,
    #0c1a2b55 65%,
    #09131c33 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 35px 5vw;
}
.title-top,
.title-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 2px;
  color: #bdc0af;
}
.title-content {
  width: min(100%, 600px);
  max-width: 600px;
  padding: 15px 0;
  align-self: center;
  text-align: center;
}
.overline {
  color: var(--gold);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.5px;
  line-height: 1.7;
}
.title-content > .overline {
  font-size: 9px;
  letter-spacing: 3px;
  margin-bottom: 12px;
}
h1 {
  font:
    500 clamp(54px, 6vw, 84px) / 0.82 "Cormorant Garamond",
    Georgia,
    serif;
  letter-spacing: 8px;
  margin: 0 0 16px;
  color: #f4ebd0;
  text-shadow: 0 4px 45px #0c141c;
}
h1 span {
  font-size: 1.15em;
  letter-spacing: 12px;
}
.title-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  margin-inline: auto;
}
.title-rule p {
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--gold);
}
.title-rule i {
  height: 1px;
  background: #e8bb7566;
  flex: 1;
}
.title-story {
  font: 400 22px/1.5 "Cormorant Garamond";
  color: #c7c8b8;
  margin: 12px 0;
}
.title-actions {
  display: flex;
  flex-direction: column;
  width: min(100%, 340px);
  margin-inline: auto;
  gap: 9px;
}
.title-actions button {
  text-align: center;
  letter-spacing: 0.4px;
}
.small-note {
  font-size: 10px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 600px;
}
.title-content .small-note {
  font-size: 9px;
  margin-top: 20px;
  margin-inline: auto;
}
.icon-button {
  font-size: 10px;
  padding: 8px 12px;
  background: transparent;
}
.hud-top {
  position: fixed;
  top: 22px;
  left: 25px;
  right: 25px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  pointer-events: none;
}
.hud-top > * {
  pointer-events: auto;
}
.player-panel {
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(90deg, #10202be8, #10202b88);
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  min-width: 260px;
  box-shadow: 0 5px 25px #0002;
}
.portrait {
  width: 34px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 26px;
  background: #41534d;
  border: 1px solid #b4b88755;
}
.vitals {
  width: 150px;
}
.vital-label {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 1px;
  margin-bottom: 7px;
}
.vital-label span {
  color: #d7c1a4;
  font-size: 9px;
  letter-spacing: 0;
}
.meter {
  height: 5px;
  background: #0b1620;
  border-radius: 2px;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 100%;
  transition: width 0.12s;
}
.health i {
  background: linear-gradient(90deg, #a85048, #df9b79);
}
.stamina {
  margin-top: 5px;
  height: 3px;
}
.stamina i {
  background: #aec490;
}
.currency {
  margin-left: 7px;
  color: var(--gold);
  font-size: 11px;
  white-space: nowrap;
}
.location-panel {
  text-align: center;
  text-shadow: 0 2px 5px #000;
  min-width: 220px;
}
.location-panel > span:first-child {
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--gold);
}
.location-panel h2 {
  font: 500 28px "Cormorant Garamond";
  margin: 5px 0 3px;
  letter-spacing: 1px;
}
.location-panel #room-name {
  font-size: 9px;
  color: #d1cdbb;
}
.hud-nav {
  display: flex;
  gap: 6px;
}
.hud-nav button {
  background: #12202bcb;
  font-size: 10px;
  padding: 9px 11px;
  backdrop-filter: blur(8px);
}
kbd {
  font: 8px "DM Sans";
  border: 1px solid #d9cd9a44;
  border-radius: 3px;
  padding: 3px 5px;
  color: #dfd5bb;
  margin: 0 3px;
  white-space: nowrap;
}
.quest-panel {
  position: fixed;
  top: 115px;
  left: 27px;
  width: 230px;
  background: linear-gradient(90deg, #0e1c29df, #0e1c2970);
  padding: 16px;
  border-left: 2px solid #d4b67a;
  border-radius: 0 4px 4px 0;
  pointer-events: none;
  text-shadow: 0 1px 3px #0008;
}
/* Soft localized window over the hero (set by app.js updateGuideReveal only
   while the drawn hero overlaps the guide). Masks never change layout/input. */
.quest-panel.hero-reveal {
  --hero-mask: radial-gradient(
    ellipse var(--hero-rx, 0px) var(--hero-ry, 0px) at var(--hero-x, -999px)
      var(--hero-y, -999px),
    #0000001a 0,
    #0000001a var(--hero-inner, 70%),
    #000 100%
  );
  -webkit-mask-image: var(--hero-mask);
  mask-image: var(--hero-mask);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.quest-panel .overline {
  font-size: 8px;
  letter-spacing: 1.8px;
  margin: 0 0 9px;
}
.quest-panel h3 {
  font: 500 19px "Cormorant Garamond";
  margin: 0 0 13px;
}
.check {
  font-size: 9px;
  color: #c2c5b5;
  padding: 5px 0;
  line-height: 1.6;
}
.check.done {
  color: #a5c48f;
}
.check span {
  display: inline-block;
  width: 14px;
  color: var(--gold);
}
#context-hint {
  font-size: 9px;
  line-height: 1.7;
  color: #a7b6b3;
  border-top: 1px solid var(--line);
  margin: 10px 0 0;
  padding-top: 10px;
}
.minimap-panel {
  position: fixed;
  right: 27px;
  top: 108px;
  padding: 7px;
  background: #0e1b29dc;
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px #0005;
}
.minimap-panel canvas {
  display: block;
  width: 144px;
  height: 115px;
  image-rendering: pixelated;
  opacity: 0.85;
}
.minimap-panel span {
  display: block;
  font-size: 7px;
  letter-spacing: 2px;
  text-align: center;
  color: #c5bd9d;
  padding-top: 7px;
}
#boss-ui {
  position: fixed;
  top: 125px;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 50vw);
  text-shadow: 0 2px 4px #000;
  background: #111b27bb;
  padding: 10px 14px;
  border: 1px solid var(--line);
}
#boss-ui > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
  font-family: "Cormorant Garamond";
}
#boss-phase {
  font: 7px "DM Sans";
  letter-spacing: 1px;
  color: var(--gold);
  align-self: center;
}
.boss {
  height: 5px;
}
.boss i {
  background: linear-gradient(90deg, #775d78, #d5a88c);
}
#toast {
  position: fixed;
  bottom: 103px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(680px, 75vw);
  width: max-content;
  min-width: 300px;
  background: #0d1b29e8;
  border: 1px solid #cfb48144;
  padding: 4px 18px;
  border-radius: 5px;
  box-shadow: 0 8px 30px #0003;
  pointer-events: none;
}
.toast-icon {
  color: var(--gold);
  font-size: 20px;
}
#toast p {
  font-size: 11px;
  line-height: 1.6;
  margin: 9px 0;
}
#interact-prompt {
  position: fixed;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  background: #10202bf2;
  border: 1px solid var(--gold);
  padding: 10px 15px;
  border-radius: 5px;
  font-size: 11px;
  pointer-events: none;
  box-shadow: 0 5px 20px #0005;
}
#interact-prompt kbd {
  background: #ead19b;
  color: #1a292a;
  margin-right: 7px;
}
.hud-bottom {
  position: fixed;
  bottom: 20px;
  left: 25px;
  right: 25px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.weapon-bar {
  display: flex;
  gap: 6px;
}
.stamina-value {
  display: block;
  text-align: right;
  color: #a8c09e;
  font-size: 7px;
  line-height: 1.3;
  margin-top: 3px;
}
.weapon-bar button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-width: 55px;
  height: 62px;
  padding: 6px 10px;
  background: #142331e8;
}
.weapon-bar button.active {
  border-color: var(--gold);
  background: #4f503add;
  box-shadow: 0 0 20px #d2a36522;
}
.weapon-bar button.locked {
  opacity: 0.45;
}
.weapon-bar kbd {
  position: absolute;
  left: 3px;
  top: 3px;
  padding: 1px 3px;
  font-size: 6px;
}
.weapon-bar span {
  font-size: 21px;
  color: #e0c996;
}
.weapon-bar small {
  font-size: 8px;
  color: #c0c5b6;
}
.combat-controls {
  display: flex;
  gap: 4px;
  background: #12202bcb;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  backdrop-filter: blur(8px);
}
.combat-controls button {
  border: 0;
  background: transparent;
  font-size: 9px;
  padding: 10px 6px;
}
.combat-controls button:hover {
  background: #57604a80;
}
.save-controls {
  display: flex;
  gap: 5px;
}
.save-controls button {
  font-size: 9px;
  background: #12202bdb;
  padding: 11px;
}
.touch-move {
  display: none;
}
.modal-screen {
  position: fixed;
  inset: 0;
  background: #0c1727b5;
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
}
.pause-card {
  max-width: 520px;
  text-align: center;
  padding: 45px;
  border: 1px solid #dbbc7e55;
  background: #14212be8;
  box-shadow: 0 30px 100px #0005;
}
.pause-card h2,
dialog h2 {
  font: 500 38px/1.1 "Cormorant Garamond";
  margin: 12px 0 20px;
}
.pause-card > p:not(.overline) {
  color: var(--muted);
  line-height: 1.8;
  font-size: 12px;
}
.pause-actions {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}
.pause-actions button {
  font-size: 12px;
}
dialog {
  position: fixed;
  background: #14212bf5;
  border: 1px solid #a38d6488;
  box-shadow: 0 30px 120px #0008;
  color: var(--cream);
  width: min(650px, 92vw);
  max-height: 85vh;
  padding: 35px;
  border-radius: 6px;
  overflow: auto;
}
dialog::backdrop {
  background: #08131f99;
  backdrop-filter: blur(5px);
}
.wide-dialog {
  width: min(900px, 94vw);
}
.close {
  float: right;
  background: transparent;
  border: 0;
  font-size: 24px;
  padding: 0 5px;
  color: #c2bea9;
}
dialog .overline {
  margin-top: 0;
}
.dialogue-text {
  font: 400 22px/1.6 "Cormorant Garamond";
  color: #ddd7c1;
  min-height: 70px;
}
.choice-list {
  display: grid;
  gap: 9px;
  margin: 25px 0 5px;
}
.choice-list button {
  text-align: left;
  font-size: 12px;
  padding: 13px 16px;
}
.dialogue-footnote {
  font-size: 9px;
  color: #99aaa6;
  line-height: 1.8;
}
.journal-tabs {
  display: flex;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.journal-tabs button {
  font-size: 10px;
}
.journal-tabs button.active {
  border-color: var(--gold);
  color: var(--gold);
}
#journal-pages {
  line-height: 1.9;
  font-size: 12px;
  color: #bbc4b7;
}
#journal-pages article {
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
}
#journal-pages h3 {
  font: 500 24px "Cormorant Garamond";
  color: var(--gold);
  margin: 8px 0;
}
#journal-pages .skill-row {
  display: flex;
  align-items: center;
  gap: 15px;
}
.skill-row button {
  margin-left: auto;
  white-space: nowrap;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 25px;
  line-height: 1.9;
  font-size: 12px;
  color: #adbdb2;
}
.guide-grid b {
  display: block;
  color: var(--gold);
  font: 500 24px "Cormorant Garamond";
  margin-bottom: -12px;
}
.guide-grid h3 {
  color: var(--gold);
  font: 500 24px "Cormorant Garamond";
  margin: 8px 0;
}
.guide-grid article p {
  margin: 0 0 12px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.setting-row select {
  background: #20323a;
  color: var(--cream);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.setting-row input {
  accent-color: var(--gold);
}
details {
  margin-top: 20px;
  font-size: 12px;
}
details summary {
  cursor: pointer;
  color: var(--gold);
}
#keybindings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 15px;
}
#keybindings button {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}
.world-node {
  min-width: 0;
  overflow-wrap: anywhere;
  position: relative;
  border: 1px solid var(--line);
  padding: 15px;
  border-radius: 5px;
  text-align: left;
  background: #12202b;
}
/* Read-only cards still explain progression and must remain readable. */
.world-node:disabled {
  opacity: 1;
}
.world-node.current {
  border-color: var(--gold);
}
.world-node.restored {
  background: #273b35;
}
.world-node b {
  display: block;
  font: 500 20px "Cormorant Garamond";
  margin: 7px 0;
}
.world-node small {
  font-size: 8px;
  color: var(--gold);
  letter-spacing: 1px;
}
.world-node p {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.6;
  margin: 6px 0 0;
}
#world-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
#cinematic {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    0deg,
    #0b1426fa 0%,
    #0b1426b3 35%,
    transparent 70%
  );
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.cinema-bars:before,
.cinema-bars:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  background: #050c13;
  height: 7vh;
}
.cinema-bars:before {
  top: 0;
}
.cinema-bars:after {
  bottom: 0;
}
.cinema-caption {
  padding: 25px 40px 12vh;
  text-align: center;
  width: 100%;
  max-width: 820px;
  pointer-events: auto;
}
.cinema-caption h2 {
  font: 500 42px "Cormorant Garamond";
  margin: 15px 0;
}
.cinema-caption > p:not(.overline) {
  font: 400 23px/1.6 "Cormorant Garamond";
  text-shadow: 0 2px 5px #000;
  min-height: 80px;
}
.cinema-caption button {
  font-size: 11px;
  margin: 8px;
}
.cinema-caption .overline {
  font-size: 9px;
}
#scene-number {
  position: absolute;
  bottom: 3vh;
  right: 5vw;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.restoration-flash {
  animation: restoration 2s ease-out;
}
@keyframes restoration {
  0% {
    box-shadow: inset 0 0 0 #e8c38400;
  }
  25% {
    box-shadow: inset 0 0 500px #e8c38488;
  }
  100% {
    box-shadow: inset 0 0 0 #e8c38400;
  }
}
@media (max-width: 1100px) {
  .combat-controls button {
    font-size: 8px;
    padding: 9px 4px;
  }
  .hud-nav kbd {
    display: none;
  }
  .player-panel {
    min-width: 215px;
    padding: 10px;
  }
  .vitals {
    width: 125px;
  }
  .currency {
    font-size: 9px;
  }
  .location-panel h2 {
    font-size: 24px;
  }
  .combat-controls kbd {
    font-size: 7px;
    padding: 2px;
  }
  .hud-bottom {
    gap: 5px;
  }
  .quest-panel {
    width: 195px;
  }
  .quest-panel h3 {
    font-size: 17px;
  }
  .minimap-panel canvas {
    width: 110px;
    height: 88px;
  }
}
@media (max-width: 760px) {
  .title-screen {
    padding: 22px 6vw;
  }
  .title-content {
    padding-bottom: 40px;
  }
  h1 {
    font-size: clamp(48px, 12vw, 70px);
  }
  .title-bottom {
    font-size: 7px;
  }
  .title-content > .overline {
    font-size: 7px;
  }
  .title-rule {
    max-width: 300px;
  }
  .title-rule p {
    font-size: 8px;
    letter-spacing: 3px;
  }
  .title-story {
    font-size: 21px;
  }
  .title-actions {
    width: min(100%, 290px);
  }
  .title-content .small-note {
    max-width: 260px;
  }
  .hud-top {
    left: 10px;
    right: 10px;
    top: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .player-panel {
    min-width: 190px;
    gap: 7px;
    padding: 8px;
  }
  .portrait {
    width: 25px;
    height: 31px;
    font-size: 19px;
  }
  .vitals {
    width: 110px;
  }
  .location-panel {
    order: 3;
    min-width: 0;
    text-align: left;
    width: 100%;
    margin-left: 4px;
  }
  .location-panel h2 {
    font-size: 20px;
    margin: 0;
  }
  .location-panel > span {
    font-size: 7px !important;
  }
  .location-panel #room-name {
    display: none;
  }
  .hud-nav {
    margin-left: auto;
    gap: 4px;
  }
  .hud-nav button {
    font-size: 8px;
    padding: 8px;
  }
  .hud-nav #journal {
    display: none;
  }
  .quest-panel {
    top: 145px;
    left: 12px;
    width: 160px;
    padding: 10px;
  }
  .quest-panel h3 {
    font-size: 16px;
  }
  .check {
    font-size: 8px;
  }
  #context-hint {
    font-size: 8px;
  }
  .minimap-panel {
    top: 145px;
    right: 12px;
    padding: 4px;
  }
  .minimap-panel canvas {
    width: 80px;
    height: 64px;
  }
  .minimap-panel span {
    font-size: 5px;
    letter-spacing: 1px;
  }
  .hud-bottom {
    left: 10px;
    right: 10px;
    bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
  }
  .weapon-bar {
    gap: 4px;
  }
  .weapon-bar button {
    min-width: 40px;
    height: 48px;
    padding: 5px;
  }
  .weapon-bar span {
    font-size: 17px;
  }
  .weapon-bar small {
    font-size: 6px;
  }
  .combat-controls {
    order: 3;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 0;
  }
  .combat-controls button {
    font-size: 8px;
    padding: 10px 4px;
  }
  .combat-controls kbd {
    display: none;
  }
  .save-controls {
    margin-left: auto;
  }
  .save-controls button {
    padding: 8px;
    font-size: 8px;
  }
  .save-controls kbd {
    display: none;
  }
  .touch-move {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(3, 38px);
    gap: 4px;
    left: 15px;
    bottom: 132px;
  }
  .touch-move button {
    padding: 9px;
    font-size: 16px;
    background: #132330be;
    border-color: #a7b39144;
  }
  .touch-move button:nth-child(1) {
    grid-column: 2;
  }
  .touch-move button:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }
  .touch-move button:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }
  .touch-move button:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
  }
  .touch-move button:nth-child(5) {
    grid-column: 3;
    grid-row: 1;
    color: var(--gold);
  }
  /* Keep the native message above the two-row movement pad, rather than
     squeezing it into a strip beside controls that it can cover. The pad is
     86px high at bottom:132px; an 8px gap also clears the combat footer. */
  #toast {
    bottom: 226px;
    width: calc(100vw - 24px);
    max-width: 680px;
    min-width: 0;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 3px 10px;
  }
  #toast p {
    font-size: 10px;
    line-height: 1.5;
    margin: 7px 0;
    overflow-wrap: anywhere;
  }
  .toast-icon {
    display: none;
  }
  #interact-prompt {
    font-size: 10px;
    top: 58%;
    max-width: 220px;
  }
  #boss-ui {
    top: 83px;
    width: 55vw;
    left: 65%;
  }
  #boss-name {
    font-size: 11px;
  }
  #boss-phase {
    display: none;
  }
  .pause-card {
    padding: 25px;
    max-width: 90vw;
  }
  .pause-card h2,
  dialog h2 {
    font-size: 31px;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 25px;
  }
  .cinema-caption {
    padding: 20px 25px 12vh;
  }
  .cinema-caption h2 {
    font-size: 31px;
  }
  .cinema-caption > p:not(.overline) {
    font-size: 19px;
    min-height: 110px;
  }
  #world-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .setting-row {
    font-size: 10px;
  }
  .setting-row select {
    max-width: 160px;
  }
  .journal-tabs {
    gap: 5px;
  }
  .journal-tabs button {
    font-size: 9px;
    padding: 8px;
  }
  .journal-tabs {
    overflow: auto;
  }
  #vignette {
    box-shadow: inset 0 0 60px #06101b66;
  }
}
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#hud button,
#hud .hud-nav,
#hud .weapon-bar,
#hud .save-controls,
#hud .combat-controls,
#hud .touch-move {
  pointer-events: auto;
}
.tracked-quest {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.tracked-quest .overline {
  font-size: 7px;
  letter-spacing: 1.8px;
  margin-bottom: 5px;
}
.tracked-quest > b {
  font-size: 10px;
  font-weight: 500;
}
.tracked-quest > p:not(.overline) {
  font-size: 9px;
  line-height: 1.65;
  margin: 6px 0;
  color: #b8c7b4;
}
.tracked-quest.ready {
  border-top-color: #a9cf9b;
}
.tracked-quest.ready #tracked-progress {
  color: #b9dda4;
}
.tracked-quest.ready #tracked-next {
  color: #e8ce93;
}
.combat-controls .guarding {
  color: #cee8df;
  background: #648e8866;
  box-shadow: 0 0 15px #b9e0d933;
}
.combat-controls .locked {
  opacity: 0.5;
}
.combat-controls .recovering {
  color: #a8b2ae;
  border-bottom-color: #956d4f;
}
.combat-controls small {
  font-size: 7px;
  color: #c9ac7e;
  margin-left: 3px;
}
.currency > span {
  display: inline-block;
  margin-top: 5px;
  color: #b5c8a4;
}
@media (max-width: 760px) {
  .tracked-quest {
    padding-top: 7px;
    margin-top: 8px;
  }
  .tracked-quest > b {
    font-size: 8px;
  }
  .tracked-quest > p:not(.overline) {
    font-size: 7px;
    margin: 4px 0;
  }
  .tracked-quest .overline {
    font-size: 6px;
  }
  .quest-panel #context-hint {
    display: none;
  }
}
.track-button {
  font-size: 10px;
  margin: 6px 6px 0 0;
  padding: 9px 11px;
}
.memory-controls {
  display: flex;
  gap: 7px;
  background: #15283ae8;
  border: 1px solid #b5cbd155;
  padding: 6px;
  border-radius: 5px;
}
.memory-controls button {
  font-size: 10px;
}
.memory-mode .combat-controls,
.memory-mode .weapon-bar,
.memory-mode .minimap-panel {
  display: none;
}
.memory-mode .portrait {
  background: #5c677b;
}
.memory-mode .vitals {
  width: 180px;
}
.memory-mode .quest-panel {
  border-left-color: #a9c8d7;
}
.memory-mode .hud-bottom {
  justify-content: center;
}
@media (max-width: 760px) {
  .memory-controls {
    flex-wrap: wrap;
    max-width: 80vw;
  }
  .memory-controls button {
    font-size: 8px;
    padding: 8px;
  }
  .memory-mode .vitals {
    width: 130px;
  }
  .memory-mode .vital-label span {
    font-size: 6px;
  }
}
#boss-tactic {
  font:
    9px/1.55 "DM Sans",
    sans-serif;
  margin: 8px 0 0;
  color: #c2cbbc;
}
#boss-ui.exposed {
  border-color: #e0c99499;
}
#boss-ui.exposed #boss-phase {
  color: #e6d6a7;
}
#boss-ui.exposed .boss i {
  background: linear-gradient(90deg, #a1bc9b, #e7d4a4);
}
@media (max-width: 760px) {
  #boss-tactic {
    font-size: 7px;
    line-height: 1.4;
    margin-top: 5px;
  }
  #boss-ui {
    top: 85px;
    width: 56vw;
  }
  #boss-ui > div:first-child {
    margin-bottom: 5px;
  }
}
.continue-preview-host {
  overflow-x: hidden;
  overflow-y: auto;
}
.continue-preview-root {
  display: block;
  width: 100%;
  max-width: min(300px, 88vw);
  margin: 6px 0 2px;
}
.continue-preview-card {
  background: linear-gradient(135deg, #10202be8, #132531cc);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  padding: 10px 13px;
  color: var(--cream);
  box-shadow: 0 6px 22px #0004;
  max-width: 100%;
  overflow: hidden;
}
.continue-preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 4px;
}
.continue-preview-kicker {
  margin: 0;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1.4;
  color: var(--gold);
}
.continue-preview-context {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #d8cfa8;
  background: #1c313ecc;
  border: 1px solid #e8bb7540;
  border-radius: 3px;
  padding: 1px 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.continue-preview-context[data-context="memory"] {
  color: #cbe2ec;
  border-color: #a9c8d766;
  background: #183042dd;
}
.continue-preview-context[data-context="sun-key"] {
  color: #f4dca6;
  border-color: #e8bb7588;
  background: #363426dd;
}
.continue-preview-context[data-context="postgame"] {
  color: #cce3be;
  border-color: #a5c48f66;
  background: #21372edd;
}
.continue-preview-heading {
  font:
    500 20px/1.15 "Cormorant Garamond",
    Georgia,
    serif;
  color: #f4ebd0;
  margin: 0;
  letter-spacing: 0.4px;
  overflow-wrap: anywhere;
}
.continue-preview-place {
  margin: 2px 0 8px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.continue-preview-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.continue-preview-stat {
  min-width: 0;
}
.continue-preview-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 2px;
}
.continue-preview-value {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.continue-preview-number {
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.continue-preview-meter {
  height: 4px;
  background: #0b1620;
  border-radius: 2px;
  overflow: hidden;
}
.continue-preview-fill {
  display: block;
  height: 100%;
  width: 0%;
}
.continue-preview-fill-hp {
  background: linear-gradient(90deg, #a85048, #df9b79);
}
.continue-preview-fill-beacons {
  background: linear-gradient(90deg, #b88c4a, #e8bb75);
}
@media (max-width: 760px), (max-height: 520px) {
  .continue-preview-root {
    max-width: min(260px, 88vw);
    margin: 4px 0 2px;
  }
  .continue-preview-card {
    padding: 7px 10px;
  }
  .continue-preview-heading {
    font-size: 17px;
  }
  .continue-preview-place {
    font-size: 9px;
    margin: 1px 0 5px;
  }
  .continue-preview-stats {
    gap: 6px 10px;
    padding-top: 5px;
  }
  .continue-preview-value {
    font-size: 10px;
    gap: 3px;
  }
}
.cooking-root {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 8px 0 4px;
}
.cooking-card {
  background: linear-gradient(135deg, #10202be8, #142532d8);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: 5px;
  padding: 12px 14px;
  color: var(--cream);
  box-shadow: 0 6px 22px #0004;
  max-width: 100%;
  overflow: hidden;
}
.cooking-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.cooking-kicker {
  margin: 0;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1.4;
  color: var(--gold);
}
.cooking-heading {
  font:
    500 22px/1.15 "Cormorant Garamond",
    Georgia,
    serif;
  color: #f4ebd0;
  margin: 2px 0 4px;
  letter-spacing: 0.4px;
}
.cooking-note {
  margin: 0 0 8px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}
.cooking-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #d8cfa8;
  background: #1c313ecc;
  border: 1px solid #e8bb7540;
  border-radius: 3px;
  padding: 2px 7px;
  max-width: 100%;
}
.cooking-badge[data-active="true"] {
  color: #f4dca6;
  border-color: #e8bb7588;
  background: #363426dd;
}
.cooking-active {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #0d1923cc;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.cooking-active-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cream);
}
.cooking-active-time {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.cooking-active-effect {
  margin: 3px 0 6px;
  font-size: 10px;
  line-height: 1.4;
  color: #c2cbbc;
}
.cooking-meter {
  height: 5px;
  background: #0b1620;
  border-radius: 2px;
  overflow: hidden;
}
.cooking-meter-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b88c4a, #e8bb75);
  transition: width 0.12s;
}
.cooking-stocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}
.cooking-stock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 8px;
  background: #132330cc;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  min-width: 0;
}
.cooking-stock-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cooking-icon {
  color: var(--gold);
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}
.cooking-stock-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.cooking-recipes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}
.cooking-recipe {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  background: #12212de0;
  border: 1px solid var(--line);
  border-radius: 4px;
  min-width: 0;
}
.cooking-recipe[data-active="true"] {
  border-color: var(--gold);
  background: #222b29dd;
}
.cooking-recipe-title {
  font:
    600 16px/1.15 "Cormorant Garamond",
    Georgia,
    serif;
  color: var(--gold);
  margin: 0;
}
.cooking-recipe-cost {
  margin: 2px 0 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #d7c1a4;
}
.cooking-recipe-effect {
  margin: 3px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--cream);
}
.cooking-reason {
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1.35;
  color: #c9ac7e;
}
.cooking-button {
  width: 100%;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.cooking-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.cooking-shop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.cooking-shop-info {
  min-width: 0;
  flex: 1 1 180px;
}
.cooking-shop-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--cream);
}
.cooking-shop-detail {
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1.35;
  color: var(--muted);
}
.cooking-buy-button {
  flex: 0 0 auto;
  width: auto;
  padding: 8px 12px;
}
@media (max-width: 760px) {
  .cooking-card {
    padding: 9px 10px;
  }
  .cooking-heading {
    font-size: 19px;
  }
  .cooking-stocks {
    gap: 4px;
  }
  .cooking-stock {
    padding: 4px 6px;
    font-size: 9px;
  }
  .cooking-recipes {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .cooking-buy-button {
    width: 100%;
  }
}

/* Weather remains readable when optional environmental effects are disabled. */
.location-panel #weather-status {
  display: block;
  color: #b6cdd0;
  font-size: 9px;
  letter-spacing: 0.3px;
  max-width: 100%;
}
.location-panel #weather-status[hidden] {
  display: none;
}
@media (max-width: 700px) {
  .location-panel #weather-status {
    font-size: 8px;
    margin-top: 2px;
  }
}

#story-thread {
  padding: 18px 20px;
  margin: 12px 0 20px;
  border: 1px solid #b69c6355;
  border-left: 3px solid var(--gold);
  background: linear-gradient(135deg, #213536bb, #13212bdd);
  border-radius: 3px;
}
#story-thread > .overline {
  color: var(--gold);
  letter-spacing: 1.5px;
}
#story-thread > p {
  max-width: 68ch;
}
#story-thread details {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
#story-thread summary {
  cursor: pointer;
  color: #ddc89b;
}
#story-thread article {
  padding: 10px 0;
}
#story-thread article h3 {
  font-size: 20px;
}
#story-thread button {
  white-space: normal;
  text-align: left;
  max-width: 100%;
}
#story-pending-memory {
  display: grid;
  gap: 8px;
}
#story-pending-memory h4 {
  margin: 14px 0 2px;
  color: #d2c9ad;
}
@media (max-width: 760px) {
  #story-thread {
    padding: 12px;
  }
  #story-thread > h3 {
    font-size: 24px;
  }
  .journal-tabs {
    flex-wrap: wrap;
  }
}

/* On phones, the current guardian replaces exploration panels during the fight. */
@media (max-width: 760px) {
  #boss-ui {
    top: 145px;
    left: 50%;
    width: calc(100vw - 24px);
    max-width: none;
  }
  #boss-phase {
    display: inline;
    text-align: right;
  }
  #hud.combat-focus .quest-panel,
  #hud.combat-focus .minimap-panel {
    display: none;
  }
}
@media (min-width: 761px) and (max-width: 1100px) {
  #boss-ui {
    width: min(400px, calc(100vw - 480px));
  }
}

/* Equipment and story remain reachable on touch-only screens. */
@media (max-width: 760px) {
  .hud-nav #journal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
  }
  .hud-nav #journal::before {
    content: "▤";
    font-size: 12px;
  }
}
@media (max-width: 350px) {
  .player-panel {
    min-width: 174px;
  }
  .vitals {
    width: 96px;
  }
}
@media (max-width: 350px) {
  .hud-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }
  .player-panel {
    min-width: 0;
  }
  .hud-nav button {
    padding: 6px;
  }
  .location-panel {
    grid-column: 1 / -1;
    width: auto;
  }
}
/* Shared rooms: launcher choices, room-code entry and in-game room panel. */
.title-actions .coop-launch small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--muted);
}
.coop-join {
  width: 340px;
  max-width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  background: #10202bd9;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: 0 4px 4px 0;
}
.coop-join label {
  display: block;
  font-size: 9px;
  letter-spacing: 2.5px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.coop-code-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.coop-code-row input {
  width: 108px;
  padding: 10px 11px;
  font:
    600 15px "DM Sans",
    monospace;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cream);
  background: #0b1520;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.coop-code-row input[aria-invalid="true"] {
  border-color: #d98a6a;
}
.coop-code-row button {
  padding: 10px 12px;
  white-space: nowrap;
}
/* The extra launch choices must stay reachable on short screens. */
.title-screen {
  overflow-y: auto;
}
.coop-join .small-note {
  margin: 8px 0 0;
}
.coop-status {
  max-width: 380px;
  margin: 14px 0 0;
  padding: 10px 13px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--cream);
  background: #10202bd9;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.coop-status.problem {
  border-color: #d98a6a80;
}
.coop-code {
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold);
}
.coop-panel {
  position: fixed;
  pointer-events: auto;
  right: 27px;
  --coop-panel-top: 272px;
  top: var(--coop-panel-top);
  max-height: calc(
    100dvh - var(--coop-panel-top) - var(--coop-footer-reserve, 112px)
  );
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  width: 196px;
  padding: 11px 13px;
  font-size: 10px;
  line-height: 1.5;
  background: #0e1b29dc;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 4px 20px #0005;
}
.coop-panel .overline {
  margin: 0 0 4px;
  font-size: 8px;
}
.coop-panel .coop-code {
  font-size: 11px;
}
.coop-panel ul {
  list-style: none;
  margin: 6px 0;
  padding: 0;
}
.coop-panel li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 0;
  color: #c2c5b5;
}
.coop-panel li.you {
  color: var(--cream);
}
.coop-panel li .away {
  color: #e2a27d;
}
.coop-connection {
  margin: 4px 0;
  color: #a5c48f;
}
.coop-connection.problem {
  color: #e2a27d;
}
.coop-downed {
  margin: 6px 0;
  padding: 6px 8px;
  color: #f4ebd0;
  background: #5a2a2280;
  border-left: 2px solid #d98a6a;
}
.coop-note {
  margin: 6px 0;
  font-size: 9px;
  color: var(--muted);
}
.coop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.coop-actions button {
  font-size: 9px;
  padding: 6px 8px;
}
#hud.coop-mode #save {
  display: none;
}
@media (max-width: 760px) {
  .coop-join {
    width: 260px;
  }
  .coop-code-row {
    flex-wrap: wrap;
  }
  .coop-panel {
    --coop-panel-top: 232px;
    --coop-footer-reserve: 164px;
    right: 10px;
    width: 156px;
    padding: 8px 10px;
  }
  .coop-panel .coop-note,
  .coop-panel #coop-you {
    display: none;
  }
}

/* Keep personal health readable beside the longer cooperative identity. */
#hud.coop-mode .vital-label > span {
  white-space: nowrap;
  flex-shrink: 0;
}
#coop-checkpoint-status {
  display: block;
}
@media (max-width: 760px) {
  .coop-panel .coop-actions {
    gap: 4px;
  }
  .coop-panel .coop-actions button {
    padding: 5px 6px;
  }
  #coop-checkpoint-status {
    font-size: 8px;
    line-height: 1.35;
  }
}

.coop-wait {
  width: min(420px, 90vw);
  margin: 12px auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #0e1b29ed;
  border-radius: 5px;
  text-align: left;
}
.coop-wait .overline {
  margin: 0 0 6px;
}
#coop-wait-code {
  color: var(--gold);
  letter-spacing: 0.2em;
  user-select: all;
}
#coop-recovery-input,
#coop-recovery-code {
  width: 100%;
  min-width: 0;
  font: inherit;
  color: var(--cream);
  background: #111f2b;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px;
}
#coop-resume-form {
  max-width: 440px;
  width: min(90vw, 440px);
}
#coop-recovery-label {
  display: block;
  overflow-wrap: anywhere;
}
#coop-recovery-label[hidden],
.coop-wait[hidden] {
  display: none;
}
#coop-recover {
  margin: 8px 0 0;
}

/* Extra campaign actions and waiting states remain reachable on short screens. */
.title-screen {
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 22px;
}
.title-top,
.title-content,
.title-bottom {
  flex-shrink: 0;
}

/* Saved-party return choices remain legible and keyboard reachable on phones. */
.coop-resume-mode {
  min-width: 0;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.coop-resume-mode legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.4px;
}
.coop-join .coop-resume-mode label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  color: var(--cream);
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: none;
}
.coop-resume-mode input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--gold);
}
.coop-archived[hidden] {
  display: none;
}
.coop-archived {
  border-top: 1px solid var(--line);
  padding-top: 7px;
  margin-top: 7px;
}
#coop-archived-roster {
  padding: 0;
  margin: 5px 0 8px;
  list-style: none;
}
#coop-archived-roster li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.coop-panel .coop-archived .coop-note {
  display: block;
}

.gamepad-hint {
  display: block;
  margin-top: 3px;
  font-size: 7px;
  line-height: 1.3;
  color: var(--muted);
}
.gamepad-hint[hidden] {
  display: none;
}
.gamepad-instructions {
  margin: 16px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.gamepad-instructions summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 12px;
}
.gamepad-instructions p {
  font-size: 11px;
  line-height: 1.6;
}
.gamepad-controls {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    10px/1.7 "DM Sans",
    sans-serif;
  color: var(--cream);
}

/* Gamepad polling is not a keyboard event, so show explicit focus without
   relying on the browser's last-pointer :focus-visible heuristic. */
.gamepad-focus {
  outline: 2px solid var(--gold) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #e8bb7526;
}

#shared-memory-banner {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, calc(100vw - 32px));
  padding: 10px 14px;
  background: rgba(19, 26, 42, 0.94);
  border: 1px solid #9aa8be;
  color: #e9e1c9;
  pointer-events: none;
  font-size: 13px;
  text-align: center;
}
#shared-memory-banner strong,
#shared-memory-banner span {
  display: block;
}
#shared-memory-banner span {
  margin-top: 4px;
}

.roadwork-offers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.roadwork-offers article {
  min-width: 0;
  padding: 14px;
  border: 1px solid #72664d;
  background: #172b2bd9;
}
.roadwork-offers button {
  max-width: 100%;
  white-space: normal;
}
.roadwork-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
#roadwork-progress {
  color: #d7c38a;
}
@media (max-width: 760px) {
  .roadwork-offers {
    grid-template-columns: 1fr;
  }
  .roadwork-offers article {
    padding: 10px;
  }
}

#playhouse-banner {
  position: fixed;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(32vh, 240px);
  overflow-y: auto;
  padding: 12px 16px;
  background: #172b2bef;
  border: 1px solid #ac9872;
  color: #e9e1c9;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
#playhouse-banner strong,
#playhouse-banner span,
#playhouse-banner small {
  display: block;
}
#playhouse-banner strong {
  color: #e4c58f;
}
#playhouse-banner span {
  margin-top: 5px;
}
#playhouse-banner small {
  margin-top: 7px;
  color: #bdc8b8;
}
@media (max-width: 600px) {
  #playhouse-banner {
    top: 94px;
    font-size: 12px;
    padding: 9px 12px;
  }
}

@media (max-width: 600px) {
  #hud.playhouse-performance .location-panel,
  #hud.playhouse-performance .quest-panel {
    display: none;
  }
}

#garden-status {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #9da67a66;
}
#garden-stage {
  display: block;
  color: #d1d8aa;
  font-size: 12px;
  font-weight: 600;
}
#garden-hint {
  display: block;
  margin-top: 5px;
  color: #c4cdba;
  font-size: 10px;
  line-height: 1.4;
}

@media (max-width: 600px) {
  #garden-status {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  #garden-stage {
    font-size: 10px;
    line-height: 1.35;
  }
  #garden-hint {
    margin-top: 4px;
    font-size: 9px;
  }
}

/* Keep the road ahead above the phone's movement and combat controls. Full
   checklists and promise directions remain available in the journal. */
@media (max-width: 600px) {
  .quest-panel {
    padding: 8px 10px;
  }
  .quest-panel #checklist,
  .quest-panel #tracked-next {
    display: none;
  }
  .quest-panel > .overline {
    margin-bottom: 4px;
    font-size: 7px;
  }
  .quest-panel h3 {
    margin-bottom: 5px;
    font-size: 15px;
    line-height: 1.15;
  }
  .quest-panel #context-hint {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: 8px;
    line-height: 1.35;
    margin: 4px 0;
  }
  .quest-panel h3,
  .quest-panel #tracked-title,
  .quest-panel #tracked-progress {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .quest-panel .tracked-quest {
    margin-top: 6px;
    padding-top: 5px;
  }
  .quest-panel #tracked-title {
    font-size: 8px;
    line-height: 1.3;
  }
  .quest-panel #tracked-progress {
    margin: 3px 0 0;
    font-size: 8px;
    line-height: 1.3;
  }
  /* A collected promise still needs an explicit hand-in. Keep that next
     action visible on phones instead of leaving only a completed counter. */
  .quest-panel .tracked-quest.ready #tracked-next {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin: 4px 0 0;
    font-size: 8px;
    line-height: 1.35;
  }
}

#sky-survey {
  position: fixed;
  right: 24px;
  top: 275px;
  width: 270px;
  max-height: calc(100vh - 395px);
  overflow: auto;
  padding: 12px;
  background: #142633f2;
  border: 1px solid #b99e70;
  border-radius: 5px;
  pointer-events: auto;
  font-size: 11px;
  z-index: 12;
}
#sky-survey p {
  line-height: 1.4;
  margin: 7px 0;
}
#sky-canvas {
  width: 100%;
  height: auto;
  display: block;
}
.sky-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.sky-controls button {
  padding: 7px 9px;
  font-size: 10px;
}
@media (max-width: 600px) {
  #sky-survey {
    top: 145px;
    right: 10px;
    width: 190px;
    max-height: calc(100vh - 460px);
    padding: 8px;
    font-size: 10px;
  }
  #sky-canvas {
    max-height: 110px;
    object-fit: contain;
  }
}

@media (max-width: 600px) {
  #hud.sky-observing .quest-panel {
    display: none;
  }
}

#local-chart-section {
  margin: 18px 0 24px;
  border: 1px solid #b59c6755;
  padding: 14px;
  background: #14232ddd;
  border-radius: 5px;
}
#local-chart-section h3 {
  font: 500 23px "Cormorant Garamond";
  margin: 0 0 8px;
}
#local-chart {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  aspect-ratio: 5 / 4;
  margin: 12px auto;
  image-rendering: pixelated;
}
#local-chart-objective,
.atlas-legend {
  font-size: 11px;
  line-height: 1.6;
  color: #d1c7ab;
}
.atlas-legend {
  font-size: 10px;
  color: #b6c9c9;
}
@media (max-width: 600px) {
  #local-chart-section {
    padding: 9px;
    margin-top: 12px;
  }
  #local-chart-section h3 {
    font-size: 20px;
  }
  #local-chart-objective,
  .atlas-legend {
    font-size: 10px;
  }
}

#map-notes {
  border-top: 1px solid #b59c6755;
  margin-top: 14px;
  padding-top: 12px;
}
#map-notes h4 {
  margin: 0 0 7px;
  color: #dfc58e;
}
#map-notes-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
}
#map-notes input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 9px;
  background: #11232c;
  border: 1px solid #958565;
  color: #e6dfcc;
  border-radius: 3px;
}
.note-coordinates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 9px 0;
}
.note-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
#map-notes button {
  padding: 8px 10px;
  font-size: 11px;
}
#map-notes-status {
  font-size: 11px;
  line-height: 1.5;
  color: #dfc58e;
}
#map-notes-list {
  padding: 0;
  list-style: none;
}
#map-notes-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  border-top: 1px solid #9b956733;
}
#map-notes-list span {
  flex: 1 1 230px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .note-coordinates {
    gap: 7px;
  }
  #map-notes button {
    min-height: 38px;
  }
  #map-notes-list span {
    flex-basis: 100%;
  }
}

/* Backup review stays in the scrollable launcher; it never interrupts play. */
.save-tools {
  margin: 14px 0;
  max-width: 460px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #10202bd9;
}
.save-tools summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 12px;
  padding: 4px 0;
}
.save-tools .small-note {
  line-height: 1.65;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.backup-actions label {
  font-size: 11px;
  color: var(--cream);
}
.backup-actions input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 11px;
  color: var(--cream);
}
.backup-actions button {
  min-height: 44px;
}
#backup-review {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 8px;
}
#backup-preview .continue-preview-root {
  max-width: 100%;
}

/* Section jumps expose the beacon roads without crossing the notebook form. */
.map-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.map-sections button {
  min-height: 44px;
  padding: 9px 12px;
  font-size: 11px;
}
#local-chart-section,
#map-notes,
#world-map-section {
  scroll-margin-top: 76px;
}
#world-map-section h3 {
  font: 500 23px "Cormorant Garamond";
  margin: 0 0 8px;
}
#local-chart-section:focus-visible,
#map-notes:focus-visible,
#world-map-section:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* A touch player can close the map after jumping down to the beacon roads. */
#map-dialog > .close {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 44px;
  min-height: 44px;
  background: #14232c;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Long field notes keep a full-width close bar above scrolling text. */
#guide,
#journal-dialog {
  scroll-padding-top: 76px;
}
.dialog-close-bar {
  position: sticky;
  top: 0;
  min-height: 44px;
  z-index: 4;
  background: #14232c;
  margin-bottom: 12px;
}
.dialog-close-bar > .close {
  min-width: 44px;
  min-height: 44px;
  background: #14232c;
  border: 1px solid var(--line);
  border-radius: 4px;
}
#guide .guide-grid article,
#journal-pages > article,
#journal-pages .charms-card {
  scroll-margin-top: 76px;
}

/* Brief personal receipts leave movement, interaction and audio unchanged. */
#pickup-feedback {
  position: fixed;
  top: 250px;
  right: 27px;
  width: min(270px, 42vw);
  display: grid;
  gap: 6px;
  pointer-events: none;
}
#pickup-feedback[hidden] {
  display: none;
}
.pickup-receipt {
  padding: 8px 10px;
  background: #11232ce8;
  border: 1px solid #b89b6555;
  border-left: 2px solid #d2b77f;
  border-radius: 4px;
}
.pickup-receipt strong {
  display: block;
  font-size: 10px;
  color: #ead5ac;
}
.pickup-receipt p {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: #d8dfd5;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  #pickup-feedback {
    top: 238px;
    right: 12px;
    /* Keep a 12px gutter beside the 160px quest panel on narrow phones. */
    width: min(190px, 48vw, calc(100vw - 196px));
  }
  .pickup-receipt {
    padding: 6px 8px;
  }
  .pickup-receipt strong,
  .pickup-receipt p {
    font-size: 9px;
  }
}

/* Native practice coaching stays separate from the story and touch controls. */
#parry-practice {
  position: fixed;
  top: 250px;
  right: 27px;
  width: min(270px, 42vw);
  padding: 9px 11px;
  border: 1px solid #a9bdad66;
  border-left: 2px solid #b4ccba;
  border-radius: 4px;
  background: #11232cef;
  pointer-events: none;
}
#parry-practice[hidden] {
  display: none;
}
#practice-title {
  display: block;
  font-size: 12px;
  color: #e6d4ae;
}
#practice-status,
#practice-hint {
  font-size: 10px;
  line-height: 1.5;
  margin: 5px 0 0;
  color: #d3dfd6;
}
#practice-hint {
  color: #b6c6c8;
}
#practice-countdown {
  display: block;
  margin-top: 5px;
  color: #e9c992;
  font-size: 11px;
}
#practice-progress {
  width: 100%;
  height: 5px;
  accent-color: #b9cdb9;
}
#parry-practice[data-stage="guard"] {
  border-left-color: #edcf92;
}
#parry-practice[data-stage="guard"] #practice-title {
  color: #f1d49b;
}
#hud.practice-coaching #pickup-feedback {
  display: none;
}
@media (max-width: 600px) {
  #parry-practice {
    top: 238px;
    right: 12px;
    width: min(190px, 48vw, calc(100vw - 196px));
    padding: 7px 8px;
  }
  #practice-title {
    font-size: 10px;
  }
  #practice-status,
  #practice-hint,
  #practice-countdown {
    font-size: 9px;
  }
}

.wildlife-habitat-status {
  border-left: 2px solid #9bb7aa;
  padding-left: 10px;
  color: #c9d8c8;
  font-size: 11px;
  line-height: 1.6;
}

.courier-village-questions {margin-top:8px;}
.courier-village-questions summary {cursor:pointer;padding:12px 10px;color:var(--gold,#dfbb78);font-size:12px;line-height:1.4;}
.courier-village-questions button {width:100%;margin-top:8px;}
@media(max-width:600px){.quest-panel .tracked-quest > .overline{display:block;font-size:7px;line-height:1.3;margin:0 0 3px;}}

/* ==========================================================================
   Compact HUD overrides (.hud-compact)
   Preserves dark navy & brass serif aesthetic, native controls, and a11y.
   ========================================================================== */
#hud.hud-compact {
  --hud-footer-height: 54px;
}

.hud-compact .hud-action-label {
  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;
}

.hud-compact .hud-icon,
.hud-compact .hud-icon svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  flex-shrink: 0;
}

/* Slim top HUD & location heading: keep region name & weather, drop redundancy */
.hud-compact .hud-top {
  top: 14px;
  left: 18px;
  right: 18px;
  gap: 10px;
}

.hud-compact .player-panel {
  padding: 8px 11px;
  gap: 9px;
  min-width: 220px;
}

.hud-compact .portrait {
  width: 30px;
  height: 36px;
  font-size: 22px;
}

.hud-compact .location-panel {
  min-width: 0;
  padding: 2px 8px;
}

.hud-compact .location-panel #chapter,
.hud-compact .location-panel #room-name {
  display: none;
}

.hud-compact .location-panel h2 {
  font: 600 22px/1.1 "Cormorant Garamond", Georgia, serif;
  margin: 0;
  letter-spacing: 0.8px;
  color: #f4ebd0;
}

.hud-compact .location-panel #weather-status:not([hidden]) {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.25;
}

/* Compact icon navigation buttons with keycaps */
.hud-compact .hud-nav {
  gap: 5px;
  align-items: center;
}

.hud-compact .hud-nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 36px;
  height: 34px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--cream);
  border: 1px solid var(--line);
}

.hud-compact .hud-nav #journal::before {
  content: none !important;
  display: none !important;
}

.hud-compact .hud-nav .hud-icon svg {
  width: 15px;
  height: 15px;
  color: #e8c788;
}

.hud-compact .hud-nav kbd {
  margin: 0;
  padding: 1px 4px;
  font-size: 7px;
  line-height: 1.1;
}

/* Disclosure toggle button shared by quest & coop panels */
.hud-compact .hud-details-toggle {
  pointer-events: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 1;
  color: var(--gold);
  background: #152634e6;
  border: 1px solid #e8bb7555;
  border-radius: 3px;
}

.hud-compact .hud-details-toggle:hover,
.hud-compact .hud-details-toggle[aria-expanded="true"] {
  background: #2c3c39ee;
  border-color: var(--gold);
  color: #f6dfb0;
}

.hud-compact #objective-details[aria-expanded="true"] {
  transform: rotate(180deg);
}

/* Compact quest panel: heading + brief summary by default, full details on expand */
.hud-compact .quest-panel {
  top: 90px;
  left: 18px;
  width: 216px;
  padding: 9px 11px;
  background: linear-gradient(90deg, #0e1c29eb, #0e1c2999);
}

.hud-compact:not(.quest-expanded) .quest-panel:not(.quest-expanded) > #quest-label {
  display: none;
}

.hud-compact .quest-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.hud-compact .quest-heading h3 {
  margin: 0;
  font: 600 17px/1.15 "Cormorant Garamond", Georgia, serif;
  color: #f4ebd0;
  flex: 1 1 auto;
  min-width: 0;
}

.hud-compact .objective-summary:not([hidden]) {
  margin: 5px 0 0;
  font-size: 9.5px;
  line-height: 1.4;
  color: #cfd8c7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.hud-compact:not(.quest-expanded) .quest-panel:not(.quest-expanded) #quest-detail-copy {
  display: none !important;
}

/* Expanded quest panel: bounded scroll above controls, full checklist & hint even on phone */
.hud-compact.quest-expanded .quest-panel,
.hud-compact .quest-panel.quest-expanded {
  pointer-events: auto;
  width: min(268px, calc(100vw - 36px));
  max-height: calc(100dvh - 104px - var(--hud-footer-height, 58px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: #0e1c29f2;
  border: 1px solid var(--line);
  border-left: 2px solid #d4b67a;
  z-index: 14;
}

.hud-compact.quest-expanded .quest-panel > #quest-label,
.hud-compact .quest-panel.quest-expanded > #quest-label {
  display: block;
  margin-bottom: 4px;
}

.hud-compact.quest-expanded .quest-panel #quest-detail-copy:not([hidden]),
.hud-compact .quest-panel.quest-expanded #quest-detail-copy:not([hidden]),
.hud-compact.quest-expanded .quest-panel #checklist,
.hud-compact .quest-panel.quest-expanded #checklist {
  display: block;
  margin-top: 6px;
}

.hud-compact.quest-expanded .quest-panel #context-hint,
.hud-compact .quest-panel.quest-expanded #context-hint {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  font-size: 9px;
  line-height: 1.55;
  margin-top: 8px;
  padding-top: 8px;
}

.hud-compact.quest-expanded .quest-panel h3,
.hud-compact .quest-panel.quest-expanded h3,
.hud-compact.quest-expanded .quest-panel #tracked-title,
.hud-compact .quest-panel.quest-expanded #tracked-title,
.hud-compact.quest-expanded .quest-panel #tracked-progress,
.hud-compact .quest-panel.quest-expanded #tracked-progress,
.hud-compact.quest-expanded .quest-panel #tracked-next,
.hud-compact .quest-panel.quest-expanded #tracked-next {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Optional tracked promise: compact when collapsed; READY #tracked-next always visible (up to 3 lines) */
.hud-compact .tracked-quest {
  margin-top: 7px;
  padding-top: 6px;
}

.hud-compact:not(.quest-expanded) .quest-panel:not(.quest-expanded) .tracked-quest > .overline {
  display: none !important;
}

.hud-compact .tracked-quest > #tracked-title {
  display: inline;
  font-size: 9px;
  font-weight: 600;
  color: #ece4ce;
}

.hud-compact .tracked-quest > #tracked-progress {
  display: inline;
  font-size: 8.5px;
  margin: 0 0 0 6px;
  color: #b8c7b4;
}

.hud-compact:not(.quest-expanded) .quest-panel:not(.quest-expanded) .tracked-quest:not(.ready) #tracked-next {
  display: none !important;
}

.hud-compact .quest-panel .tracked-quest.ready #tracked-next {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 8.5px;
  line-height: 1.35;
  color: #e8ce93;
}

/* Compact minimap */
.hud-compact .minimap-panel {
  top: 90px;
  right: 18px;
  padding: 5px;
}

.hud-compact .minimap-panel canvas {
  width: 112px;
  height: 90px;
}

/* Shared room / party panel: compact essentials collapsed, full disclosure when .party-expanded */
.hud-compact .coop-panel {
  right: 18px;
  --coop-panel-top: 214px;
  top: var(--coop-panel-top);
  max-height: calc(
    100dvh - var(--coop-panel-top) - var(--coop-footer-reserve, calc(var(--hud-footer-height, 58px) + 28px))
  );
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px 11px;
  width: 192px;
}

.hud-compact .coop-panel #party-details {
  float: right;
  margin: -2px -2px 2px 6px;
}

.hud-compact .coop-panel #coop-you {
  display: block;
  font-size: 9px;
  color: #dfd6be;
}

.hud-compact .coop-panel #coop-downed:not([hidden]),
.hud-compact .coop-panel #coop-revive-status:not([hidden]),
.hud-compact .coop-panel #coop-connection:not([hidden]) {
  display: block;
}

.hud-compact:not(.party-expanded) .coop-panel:not(.party-expanded) #coop-archived,
.hud-compact:not(.party-expanded) .coop-panel:not(.party-expanded) .coop-note:not(#coop-revive-status),
.hud-compact:not(.party-expanded) .coop-panel:not(.party-expanded) #coop-checkpoint-status,
.hud-compact:not(.party-expanded) .coop-panel:not(.party-expanded) #coop-recovery-label {
  display: none !important;
}

.hud-compact:not(.party-expanded) .coop-panel:not(.party-expanded) #coop-actions > button:not(#coop-save):not(#coop-revive):not(#coop-reconnect) {
  display: none !important;
}

.hud-compact.party-expanded .coop-panel .coop-note:not([hidden]),
.hud-compact .coop-panel.party-expanded .coop-note:not([hidden]),
.hud-compact.party-expanded .coop-panel #coop-checkpoint-status:not([hidden]),
.hud-compact .coop-panel.party-expanded #coop-checkpoint-status:not([hidden]),
.hud-compact.party-expanded .coop-panel #coop-recovery-label:not([hidden]),
.hud-compact .coop-panel.party-expanded #coop-recovery-label:not([hidden]) {
  display: block;
}

/* Compact centered desktop action toolbar & icon buttons */
.hud-compact .hud-bottom {
  left: 50%;
  right: auto;
  bottom: 14px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* Hide locked weapons and locked lantern abilities until native unlock */
.hud-compact .weapon-bar button.locked,
.hud-compact .combat-controls button.locked {
  display: none !important;
}

.hud-compact .weapon-bar {
  gap: 4px;
  background: #12202bcb;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  backdrop-filter: blur(8px);
}

.hud-compact .combat-controls {
  gap: 4px;
  padding: 4px;
  align-items: center;
}

.hud-compact .save-controls {
  gap: 4px;
  background: #12202bcb;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  backdrop-filter: blur(8px);
}

.hud-compact .weapon-bar button,
.hud-compact .combat-controls button,
.hud-compact .save-controls button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #e2c99928;
  border-radius: 4px;
  background: #152532dd;
  color: #e5d2a4;
}

.hud-compact .weapon-bar button:hover,
.hud-compact .combat-controls button:hover,
.hud-compact .save-controls button:hover {
  background: #2f3e3be0;
  border-color: #e8bb7599;
  color: #f6e3b4;
}

.hud-compact .weapon-bar button.active {
  border-color: var(--gold);
  background: #464936e8;
  color: #f9e6b3;
  box-shadow: 0 0 14px #d2a36533;
}

.hud-compact .combat-controls button.guarding {
  color: #dff5ee;
  background: #3d6863e6;
  border-color: #9fe0d4;
  box-shadow: 0 0 14px #8bd8c944;
}

.hud-compact .combat-controls button.recovering {
  color: #8c9895;
  background: #121c25cc;
  border-color: #956d4f77;
  opacity: 0.72;
}

.hud-compact .weapon-bar .hud-icon svg,
.hud-compact .combat-controls .hud-icon svg,
.hud-compact .save-controls .hud-icon svg {
  width: 17px;
  height: 17px;
}

.hud-compact .weapon-bar kbd,
.hud-compact .combat-controls kbd,
.hud-compact .save-controls kbd {
  position: absolute;
  top: 2px;
  left: 2px;
  margin: 0;
  padding: 0 3px;
  font-size: 6.5px;
  line-height: 1.25;
  background: #0d1822cc;
  border: 1px solid #d9cd9a38;
  color: #dfd5bb;
  pointer-events: none;
}

.hud-compact .combat-controls .hud-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 0 3px;
  font-size: 7.5px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--gold);
  background: #0d1822e6;
  border: 1px solid #e8bb7555;
  border-radius: 3px;
  pointer-events: none;
}

.hud-compact #toast {
  bottom: calc(var(--hud-footer-height, 54px) + 24px);
}

/* Mobile & narrow viewports (320px / 390px / <=760px) */
@media (max-width: 760px) {
  #hud.hud-compact {
    --hud-footer-height: 88px;
  }

  .hud-compact .hud-top {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 4px 6px;
  }

  .hud-compact .player-panel {
    min-width: 0;
    flex: 1 1 auto;
    padding: 5px 7px;
    gap: 6px;
  }

  .hud-compact .portrait {
    width: 22px;
    height: 28px;
    font-size: 16px;
  }

  .hud-compact .vitals {
    width: 96px;
  }

  .hud-compact .vital-label {
    margin-bottom: 3px;
    font-size: 7.5px;
    gap: 4px;
  }

  .hud-compact .vital-label b {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .hud-compact .currency {
    font-size: 9px;
    margin-left: 3px;
  }

  .hud-compact .currency > span {
    margin-top: 2px;
  }

  .hud-compact .hud-nav {
    gap: 3px;
  }

  .hud-compact .hud-nav button {
    min-width: 30px;
    height: 30px;
    padding: 4px;
  }

  .hud-compact .hud-nav kbd {
    display: none;
  }

  .hud-compact .location-panel {
    order: 3;
    width: 100%;
    padding: 0 2px;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
  }

  .hud-compact .location-panel h2 {
    font-size: 14px;
    line-height: 1.05;
  }

  .hud-compact .location-panel #weather-status:not([hidden]) {
    font-size: 7.5px;
    margin: 0;
  }

  .hud-compact .quest-panel {
    top: 84px;
    left: 8px;
    width: min(162px, calc(100vw - 156px));
    padding: 6px 8px;
  }

  .hud-compact .quest-heading h3 {
    font-size: 13.5px;
    line-height: 1.12;
  }

  .hud-compact .hud-details-toggle {
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    font-size: 11px;
  }

  .hud-compact .objective-summary:not([hidden]) {
    margin-top: 3px;
    font-size: 8px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
  }

  .hud-compact .tracked-quest {
    margin-top: 4px;
    padding-top: 4px;
  }

  .hud-compact .tracked-quest > #tracked-title,
  .hud-compact .tracked-quest > #tracked-progress {
    font-size: 7.5px;
  }

  .hud-compact .quest-panel .tracked-quest.ready #tracked-next {
    font-size: 7.5px;
    line-height: 1.25;
    margin-top: 2px;
  }

  .hud-compact.quest-expanded .quest-panel,
  .hud-compact .quest-panel.quest-expanded {
    width: min(246px, calc(100vw - 16px));
    max-height: calc(100dvh - 88px - var(--hud-footer-height, 88px) - 116px);
  }

  .hud-compact .minimap-panel {
    top: 84px;
    right: 8px;
    padding: 3px;
  }

  .hud-compact .minimap-panel canvas {
    width: 64px;
    height: 50px;
  }

  .hud-compact .minimap-panel span {
    font-size: 5px;
    padding-top: 3px;
  }

  .hud-compact .coop-panel {
    --coop-panel-top: 152px;
    right: 8px;
    width: 136px;
    padding: 6px 8px;
    font-size: 9px;
  }

  .hud-compact.party-expanded .coop-panel,
  .hud-compact .coop-panel.party-expanded {
    width: min(204px, calc(100vw - 16px));
    z-index: 14;
  }

  #pickup-feedback,
  #parry-practice {
    top: 142px;
    right: 8px;
    width: min(176px, calc(100vw - 190px));
  }

  /* Mobile footer: compact weapon + save row above ergonomic 36-38px combat row */
  .hud-compact .hud-bottom {
    left: 8px;
    right: 8px;
    bottom: 8px;
    transform: none;
    width: auto;
    max-width: none;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
  }

  .hud-compact .weapon-bar {
    gap: 3px;
    padding: 3px;
  }

  .hud-compact .save-controls {
    margin-left: auto;
    gap: 3px;
    padding: 3px;
  }

  .hud-compact .weapon-bar button,
  .hud-compact .save-controls button {
    min-width: 32px;
    width: 32px;
    height: 32px;
  }

  .hud-compact .combat-controls {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    padding: 3px;
  }

  .hud-compact .combat-controls button {
    min-width: 37px;
    width: 37px;
    height: 37px;
  }

  .hud-compact .weapon-bar kbd,
  .hud-compact .combat-controls kbd,
  .hud-compact .save-controls kbd {
    display: inline-block;
    font-size: 6px;
    padding: 0 2px;
  }

  .hud-compact .touch-move {
    left: 10px;
    bottom: calc(var(--hud-footer-height, 88px) + 16px);
    grid-template-columns: repeat(3, 36px);
    gap: 3px;
  }

  .hud-compact .touch-move button {
    padding: 7px;
    font-size: 15px;
  }

  .hud-compact #interact-prompt {
    left: auto;
    right: 10px;
    top: auto;
    bottom: calc(var(--hud-footer-height, 88px) + 16px);
    transform: none;
    max-width: calc(100vw - 140px);
    padding: 7px 10px;
    font-size: 9.5px;
  }

  .hud-compact #toast {
    bottom: calc(var(--hud-footer-height, 88px) + 102px);
    width: calc(100vw - 20px);
    padding: 2px 10px;
  }

  .hud-compact #toast p {
    font-size: 10px;
    line-height: 1.4;
    margin: 5px 0;
  }

  .hud-compact.memory-mode .hud-bottom {
    justify-content: center;
  }
}


/* Read-only optional exploration records use the map's existing card palette. */
#cave-ledger { margin-top: 24px; scroll-margin-top: 76px; }
#cave-ledger-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr)); gap: 12px; }
.cave-ledger-card { border: 1px solid var(--line); padding: 14px; min-width: 0; }
.cave-ledger-card h4 { color: var(--gold); margin: 0 0 8px; }
.cave-ledger-card p,.cave-ledger-card ul { font-size: 12px; line-height: 1.65; margin: 8px 0; }
.cave-ledger-card ul { list-style: none; padding: 0; }
.cave-ledger-card button { width: 100%; }

/* Short attack-specific Stag guidance stays legible on compact screens. */
#boss-ui.hearthglass-stag #boss-tactic { font-size: 11px; line-height: 1.45; }

#boss-ui.wickkeeper #boss-tactic { font-size: 11px; line-height: 1.45; }

#boss-ui.pumphouse #boss-tactic { font-size: 11px; line-height: 1.45; }

.player-name-field { display:grid; gap:6px; width:min(100%,340px); margin:14px auto; color:#d4c9ab; font-size:12px; text-align:left; }
.player-name-field input { width:100%; box-sizing:border-box; border:1px solid #77847888; border-radius:5px; padding:9px 11px; background:#13252ccc; color:#f1e4bf; font:inherit; font-size:15px; }
.player-name-field input:focus-visible { outline:2px solid #cab982; outline-offset:2px; }
.player-name-field small { color:#a9b5ae; font-size:10px; line-height:1.4; }
.player-presence { display:block; max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#b5c7c1; font-size:9px; line-height:1.35; }
.party-count { margin:5px 0; color:#cbbd9e; font-size:11px; }
#coop-roster li span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:480px) { .player-name-field { margin:9px auto; gap:4px; max-width:290px; } .player-name-field input { padding:7px 10px; } .player-presence { max-width:150px; font-size:8px; } }

/* Physical controller prompts replace the virtual movement pad; a touch or
   mouse press restores the normal controls through the same device switch. */
body[data-input-device="controller"] .touch-move,
body[data-input-device="controller"] #save kbd { display: none; }

/* A readable current cue; the full guardian reference lives in the guide. */
.boss-title { display:flex; align-items:center; gap:5px; min-width:0; }
#boss-info { display:inline-flex; align-items:center; justify-content:center; flex:none; min-width:24px; min-height:24px; padding:0; border:1px solid #b2ad7780; border-radius:50%; background:#18282dbb; color:#e0cea1; font:14px/1 sans-serif; cursor:pointer; pointer-events:auto; }
#boss-info:focus-visible { outline:2px solid #e0cea1; outline-offset:2px; }
#boss-ui #boss-tactic,
#boss-ui.hearthglass-stag #boss-tactic,
#boss-ui.wickkeeper #boss-tactic,
#boss-ui.pumphouse #boss-tactic { font:11px/1.45 "DM Sans",sans-serif; }
#guardian-guide { margin:20px 0; padding:14px; border:1px solid #b2ad7766; background:#21353b66; }
#guardian-guide h3 { margin:0 0 10px; font-size:18px; }
#guardian-guide-detail,#guardian-guide-warning { font-size:14px; line-height:1.7; }

/* Keep the centered launch controls visible on short landscape displays. */
@media (max-height: 500px) {
  .title-screen { padding: 12px 5vw; gap: 8px; }
  .title-content { padding: 0 0 20px; }
  .title-content > .overline { margin: 0 0 6px; font-size: 7px; }
  .title-content h1 { font-size: 40px; margin-bottom: 6px; }
  .title-rule p { margin-block: 6px; }
  .title-story { font-size: 18px; line-height: 1.2; margin: 6px 0; }
  .player-name-field { margin: 6px auto; gap: 4px; }
  .player-name-field input { padding: 6px 10px; }
  .title-actions { gap: 6px; }
}

/* One centered launch rail. The name field, saved Continue preview, play
   actions and the closed Checkpoint backups disclosure share the same edges;
   the opened backup tools widen symmetrically around that rail. */
.title-content { --launch-rail: 340px; }
@media (max-width: 760px) {
  .title-content { --launch-rail: 290px; }
}
.title-content .player-name-field,
.title-content .title-actions,
.title-content #continue-preview.continue-preview-root,
.title-content .save-tools {
  width: min(100%, var(--launch-rail));
  max-width: 100%;
  margin-inline: auto;
}
.title-content .save-tools[open] { width: min(100%, var(--launch-wide)); }
/* Keep the disclosure label on the same centerline as the play labels.
   Native list markers otherwise take space from only the left side. */
.title-content .save-tools > summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: -12px;
  padding: 10px 32px;
  list-style: none;
  line-height: 1.5;
}
.title-content .save-tools > summary::-webkit-details-marker { display: none; }
.title-content .save-tools > summary::before {
  content: "";
  position: absolute;
  left: 16px;
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
}
.title-content .save-tools[open] > summary { margin-bottom: 12px; }
.title-content .save-tools[open] > summary::before { transform: rotate(45deg); }
.title-content .save-tools > summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.title-content #backup-preview.continue-preview-root {
  width: min(100%, var(--launch-rail));
  max-width: 100%;
  margin-inline: auto;
}
.title-content .save-tools .backup-actions { justify-content: center; }

/* Room code, campaign recovery, shared-resume wait and launch status boxes
   center on the same title column. The room-code form and status message use
   the launch rail; the recovery form uses the wider panel width of the opened
   backups so the 43-character code and both actions fit. */
.title-content { --launch-wide: 460px; }
.title-content #coop-join-form,
.title-content #coop-status {
  width: min(100%, var(--launch-rail));
  max-width: 100%;
  margin-inline: auto;
}
.title-content #coop-resume-form {
  width: min(100%, var(--launch-wide));
  max-width: 100%;
  margin-inline: auto;
}
.title-content #coop-wait {
  width: min(100%, 420px);
  max-width: 100%;
  margin-inline: auto;
}
.title-content .coop-join .coop-code-row { justify-content: center; }
/* Keep the saved checkpoint distinct from the action directly beneath it. */
.title-content #continue-preview.continue-preview-root { margin-bottom: 12px; }
.title-content .save-tools #backup-file {
  display: block;
  width: min(100%, var(--launch-rail));
  margin-inline: auto;
  min-height: 32px;
}

/* Recorded discoveries form a compact notebook, without a list of missing sites. */
#journal-pages [data-discovery-note] {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
#journal-pages [data-discovery-note] > summary {
  min-height: 36px;
  padding: 10px 2px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#journal-pages [data-discovery-note] > summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
#journal-pages .discovery-note-place {
  color: var(--muted);
  font-size: 11px;
  margin: 3px 0 8px;
}
#journal-pages .discovery-note-text {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
