html,
body {
  height: 100%;
  overflow: hidden;
  width: 100%;
}

body {
  background: rgb(28, 40, 34);
  color: rgb(245, 241, 218);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

:root {
  --wilds-ink: #142723;
  --wilds-deep: #0c1c19;
  --wilds-moss: #66794b;
  --wilds-sun: #f4bd4d;
  --wilds-cream: #f3edda;
  --wilds-paper: #faf6e9;
  --wilds-rust: #ad5e3d;
  --wilds-serif: Georgia, "Times New Roman", serif;
  --wilds-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

#main-menu {
  align-items: center;
  background:
    radial-gradient(ellipse at 72% 18%, rgba(255, 239, 138, 0.9) 0 3.5%, rgba(255, 219, 103, 0.22) 3.7% 7%, transparent 7.3%),
    radial-gradient(ellipse at 12% 82%, rgba(25, 83, 54, 0.85) 0 17%, transparent 17.5%),
    radial-gradient(ellipse at 86% 91%, rgba(18, 67, 47, 0.9) 0 23%, transparent 23.6%),
    linear-gradient(177deg, rgb(69, 151, 191) 0%, rgb(78, 174, 190) 57%, rgb(84, 132, 80) 57.5%, rgb(23, 77, 49) 100%);
  box-sizing: border-box;
  display: flex;
  inset: 0;
  justify-content: center;
  overflow: hidden;
  padding: 1.25rem;
  position: fixed;
}

#main-menu::before,
#main-menu::after {
  background: rgba(246, 241, 216, 0.82);
  border: 3px solid rgba(47, 65, 63, 0.76);
  border-radius: 47% 53% 41% 59% / 58% 46% 54% 42%;
  box-shadow: 38px 8px 0 -5px rgba(246, 241, 216, 0.82), 73px -3px 0 -10px rgba(246, 241, 216, 0.76);
  content: "";
  height: 42px;
  opacity: 0.9;
  position: absolute;
  width: 58px;
}

#main-menu::before {
  left: 8%;
  top: 15%;
}

#main-menu::after {
  right: 15%;
  top: 28%;
  transform: scale(0.72);
}

.menu-card {
  background:
    linear-gradient(108deg, rgba(255, 248, 218, 0.035), transparent 36%, rgba(132, 216, 184, 0.04) 72%, transparent),
    rgba(16, 36, 32, 0.95);
  border: 4px solid rgb(235, 225, 188);
  border-radius: 1.2rem 1.65rem 1.25rem 1.7rem;
  box-shadow: 7px 12px 0 rgba(7, 28, 23, 0.78), 0 28px 60px rgba(5, 15, 12, 0.44);
  box-sizing: border-box;
  max-height: calc(100vh - 2rem);
  max-width: 31rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(1.5rem, 5vw, 2.6rem);
  position: relative;
  text-align: center;
  width: min(100%, 31rem);
  z-index: 1;
}

.menu-card::before {
  border: 2px solid rgba(112, 245, 222, 0.16);
  border-radius: 1rem 1.45rem 1rem 1.5rem;
  content: "";
  inset: 7px 6px 6px 8px;
  pointer-events: none;
  position: absolute;
}

.menu-kicker {
  color: rgb(112, 245, 222);
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  margin: 0 0 0.45rem;
  text-transform: uppercase;
}

#game-title {
  color: rgb(255, 205, 65);
  font-family: var(--wilds-serif);
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  letter-spacing: -0.07em;
  line-height: 0.9;
  margin: 0;
  text-shadow: 2px 2px 0 rgb(119, 73, 22), -1px 3px 0 rgb(119, 73, 22), 0 6px 12px rgba(5, 15, 12, 0.5);
}

.menu-copy {
  color: rgba(245, 241, 218, 0.82);
  line-height: 1.5;
  margin: 1.35rem auto 1.65rem;
  max-width: 26rem;
}

#mode-choice,
.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}

.solo-save-choice {
  background: rgba(112, 245, 222, 0.07);
  border: 1px solid rgba(112, 245, 222, 0.28);
  border-radius: 0.9rem;
  box-sizing: border-box;
  padding: 0.85rem;
  width: 100%;
}

.solo-save-choice h2 {
  color: rgb(255, 205, 65);
  font-size: 1.15rem;
  margin: 0;
}

.solo-save-choice .menu-help { margin: 0.45rem 0 0.8rem; }
.save-error { color: rgb(255, 164, 146) !important; }

#options-menu {
  margin: 1.4rem auto 0;
  max-width: 23rem;
  text-align: left;
}

#options-menu h2 {
  color: rgb(255, 205, 65);
  font-size: 1.45rem;
  margin: 0 0 1.2rem;
  text-align: center;
}

.option-row {
  align-items: baseline;
  display: flex;
  font-weight: bold;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

#music-volume-value,
#effects-volume-value,
#pause-music-volume-value,
#pause-effects-volume-value {
  color: rgb(112, 245, 222);
  font-variant-numeric: tabular-nums;
}

#music-volume,
#effects-volume,
#pause-music-volume,
#pause-effects-volume {
  accent-color: rgb(255, 205, 65);
  cursor: pointer;
  width: 100%;
}

#music-volume:focus-visible,
#effects-volume:focus-visible,
#pause-music-volume:focus-visible,
#pause-effects-volume:focus-visible {
  outline: 3px solid rgb(112, 245, 222);
  outline-offset: 4px;
}

.menu-help {
  color: rgba(245, 241, 218, 0.72);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0.75rem 0 1.2rem;
}

.telemetry-setting {
  border-top: 1px solid rgba(245, 241, 218, 0.2);
  margin-top: 0.25rem;
  padding-top: 1rem;
}

.telemetry-setting label {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: bold;
  gap: 0.65rem;
}

.telemetry-setting input {
  accent-color: rgb(255, 205, 65);
  height: 1.15rem;
  width: 1.15rem;
}

.telemetry-setting input:focus-visible {
  outline: 3px solid rgb(112, 245, 222);
  outline-offset: 3px;
}

#options-back-button {
  display: block;
  margin: 0 auto;
}

.menu-button {
  background: rgb(245, 241, 218);
  border: 3px solid rgb(5, 15, 12);
  border-radius: 0.58rem 0.78rem 0.6rem 0.82rem;
  box-shadow: 3px 5px 0 rgb(5, 15, 12);
  color: rgb(16, 31, 29);
  cursor: pointer;
  font: bold 1rem var(--wilds-sans);
  min-height: 3.2rem;
  padding: 0.65rem 1.15rem;
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.menu-button:hover,
.menu-button:focus-visible {
  transform: translateY(-2px);
}

.menu-button:active {
  box-shadow: 0 2px 0 rgb(5, 15, 12);
  transform: translateY(3px);
}

.menu-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.menu-button-primary {
  background: rgb(255, 205, 65);
}

.menu-button-quiet {
  background: rgb(152, 180, 175);
}

#multiplayer-form {
  margin: 1.4rem auto 0;
  max-width: 23rem;
  text-align: left;
}

#multiplayer-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  margin: 0.9rem 0 0.35rem;
  text-transform: uppercase;
}

#multiplayer-form input {
  background: rgb(255, 252, 232);
  border: 3px solid rgb(5, 15, 12);
  border-radius: 0.6rem;
  box-sizing: border-box;
  color: rgb(16, 31, 29);
  font: bold 1rem Arial, sans-serif;
  padding: 0.75rem;
  width: 100%;
}

#multiplayer-form input:focus {
  outline: 3px solid rgb(112, 245, 222);
  outline-offset: 2px;
}

#multiplayer-error {
  color: rgb(255, 151, 125);
  min-height: 1.3em;
  text-align: center;
}

canvas {
  cursor: crosshair;
  display: block;
  height: 100vh;
  width: 100vw;
}

.controls {
  background: rgba(16, 31, 29, 0.86);
  border: 2px solid rgba(245, 241, 218, 0.28);
  border-radius: 999px;
  bottom: max(1rem, env(safe-area-inset-bottom));
  font-size: 0.9rem;
  left: 50%;
  letter-spacing: 0.02em;
  margin: 0;
  max-width: calc(100vw - 2rem);
  padding: 0.55rem 0.8rem;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  width: max-content;
}

.control-group {
  display: inline-block;
  white-space: nowrap;
}

.hud-panel {
  background:
    repeating-linear-gradient(2deg, rgba(245, 241, 218, 0.025) 0 1px, transparent 1px 6px),
    linear-gradient(145deg, rgba(35, 55, 47, 0.78), rgba(10, 27, 23, 0.68));
  border: 2px solid rgba(235, 225, 188, 0.42);
  border-radius: 0.8rem 1rem 0.72rem 1.05rem;
  box-shadow:
    inset 0 0 0 1px rgba(5, 15, 12, 0.55),
    0 8px 22px rgba(5, 15, 12, 0.28);
  box-sizing: border-box;
  pointer-events: none;
  position: fixed;
  z-index: 3;
}

.inventory-card h2,
.character-card h2,
.shop-card h2,
.pause-card h2,
#biome-status {
  font-family: var(--wilds-serif);
}

@media (prefers-reduced-motion: reduce) {
  .menu-button,
  .hud-meter-fill { transition: none; }
}

@supports (backdrop-filter: blur(8px)) {
  .hud-panel {
    backdrop-filter: blur(8px) saturate(1.12);
  }
}

#player-status {
  border-radius: 0.9rem;
  left: max(0.75rem, env(safe-area-inset-left));
  padding: 0.72rem;
  top: max(0.75rem, env(safe-area-inset-top));
  width: clamp(17.5rem, 29vw, 21rem);
}

.hud-meter-row {
  align-items: center;
  display: flex;
  gap: 0.62rem;
}

.hud-meter-row + .hud-meter-row,
#progression {
  margin-top: 0.62rem;
}

.hud-meter-icon,
.level-badge {
  align-items: center;
  display: flex;
  flex: 0 0 2.15rem;
  height: 2.15rem;
  justify-content: center;
}

.health-icon {
  color: rgb(255, 118, 106);
  font-size: 1.65rem;
  text-shadow: 0 2px 0 rgb(104, 35, 38);
}

.level-badge {
  background: rgb(255, 205, 65);
  border: 2px solid rgb(75, 49, 20);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 245, 168, 0.5), 0 2px 0 rgba(5, 15, 12, 0.7);
  color: rgb(50, 37, 19);
  font-size: 0.92rem;
  font-weight: bold;
}

.hud-meter-block {
  flex: 1 1 auto;
  min-width: 0;
}

.hud-meter-label {
  align-items: baseline;
  display: flex;
  font-size: 0.65rem;
  font-weight: bold;
  justify-content: space-between;
  letter-spacing: 0.09em;
  margin-bottom: 0.26rem;
  text-transform: uppercase;
}

.hud-meter-label strong {
  color: rgba(245, 241, 218, 0.88);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.hud-meter {
  background: rgba(5, 15, 12, 0.82);
  border: 2px solid rgba(245, 241, 218, 0.24);
  border-radius: 0.28rem;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.42);
  height: 0.78rem;
  overflow: hidden;
}

.hud-meter-fill {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 180ms ease-out;
  width: 0;
}

.health-meter .hud-meter-fill {
  background: linear-gradient(90deg, rgb(196, 53, 55), rgb(255, 126, 101));
  box-shadow: inset 0 2px 0 rgba(255, 214, 181, 0.35);
  width: 100%;
}

.experience-meter .hud-meter-fill {
  background: linear-gradient(90deg, rgb(44, 178, 168), rgb(112, 245, 222));
  box-shadow: inset 0 2px 0 rgba(220, 255, 245, 0.35);
}

.wealth-row {
  align-items: center;
  border-bottom: 1px solid rgba(245, 241, 218, 0.16);
  border-top: 1px solid rgba(245, 241, 218, 0.16);
  display: flex;
  margin-top: 0.7rem;
  min-height: 2.75rem;
  padding: 0.2rem 0.1rem;
}

.wealth-row strong {
  color: rgb(255, 222, 91);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-left: 0.55rem;
  text-shadow: 0 2px 0 rgb(93, 55, 22);
}

.wealth-label {
  color: rgba(245, 241, 218, 0.62);
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  margin-left: 0.42rem;
  text-transform: uppercase;
}

.coin-stack {
  height: 1.9rem;
  position: relative;
  width: 2.35rem;
}

.coin-stack i {
  background: linear-gradient(180deg, rgb(255, 230, 101), rgb(224, 154, 39));
  border: 2px solid rgb(108, 65, 22);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 245, 168, 0.48), 0 2px 0 rgba(5, 15, 12, 0.45);
  height: 1.22rem;
  position: absolute;
  width: 1.22rem;
}

.coin-stack i:nth-child(1) { left: 0.02rem; top: 0.47rem; }
.coin-stack i:nth-child(2) { left: 0.72rem; top: 0.07rem; }
.coin-stack i:nth-child(3) { left: 1.05rem; top: 0.64rem; }

.hud-stats {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 0.85fr 0.85fr 1.3fr;
  margin: 0.58rem 0 0;
}

.hud-stats div {
  min-width: 0;
}

.hud-stats dt {
  color: rgba(245, 241, 218, 0.54);
  font-size: 0.56rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-stats dd {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: bold;
  margin: 0.13rem 0 0;
  white-space: nowrap;
}

.hud-stats small {
  color: rgb(112, 245, 222);
  font-size: 0.58rem;
  font-weight: normal;
}

#equipment-hud {
  border-radius: 0.75rem;
  bottom: max(5.75rem, calc(env(safe-area-inset-bottom) + 5.75rem));
  padding: 0.55rem 0.62rem 0.65rem;
  right: max(0.75rem, env(safe-area-inset-right));
  width: 15rem;
}

#equipment-title {
  border-bottom: 1px solid rgba(255, 205, 65, 0.38);
  color: rgb(255, 222, 91);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  margin: 0 0 0.48rem;
  padding: 0 0 0.38rem;
  text-align: center;
  text-transform: uppercase;
}

.equipment-layout {
  align-items: center;
  display: grid;
  gap: 0.38rem;
  grid-template-columns: 4.25rem 4.25rem 4.25rem;
  grid-template-rows: 4.7rem 4.7rem;
  justify-content: center;
}

.equipment-slot {
  align-items: center;
  align-self: stretch;
  background: rgba(5, 15, 12, 0.52);
  border: 1px solid rgba(245, 241, 218, 0.32);
  border-radius: 0.42rem;
  box-shadow: inset 0 0 0 1px rgba(5, 15, 12, 0.7);
  color: rgb(245, 241, 218);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.equipment-slot:not(.is-empty) {
  border-color: rgba(255, 205, 65, 0.56);
  box-shadow: inset 0 0 12px rgba(255, 205, 65, 0.08);
}

.weapon-slot { grid-column: 1; grid-row: 1; }
.charm-slot { grid-column: 3; grid-row: 1; }
.boots-slot { grid-column: 2; grid-row: 2; }
.off-hand-slot { grid-column: 3; grid-row: 2; }

.slot-label {
  color: rgba(245, 241, 218, 0.48);
  font-size: 0.48rem;
  font-weight: bold;
  left: 0;
  letter-spacing: 0.08em;
  position: absolute;
  right: 0;
  text-align: center;
  text-transform: uppercase;
  top: 0.25rem;
}

.slot-name {
  bottom: 0.24rem;
  font-size: 0.51rem;
  font-weight: bold;
  left: 0.12rem;
  overflow: hidden;
  position: absolute;
  right: 0.12rem;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.slot-icon {
  fill: none;
  height: 2.35rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  width: 2.35rem;
}

.is-empty .slot-icon,
.equipment-slot.is-empty .slot-name {
  color: rgba(245, 241, 218, 0.38);
}

.weapon-shape,
.charm-equipped,
.boots-winged {
  display: none;
}

#weapon-slot[data-item="none"] .weapon-shape-empty,
#weapon-slot[data-item="sword"] .weapon-shape-sword,
#weapon-slot[data-item="gun"] .weapon-shape-gun,
#weapon-slot[data-item="quickdrawGun"] .weapon-shape-gun,
#weapon-slot[data-item="machineGun"] .weapon-shape-machine-gun,
#weapon-slot[data-item="bow"] .weapon-shape-bow,
#weapon-slot[data-item="crossbow"] .weapon-shape-crossbow,
#weapon-slot[data-item="longsword"] .weapon-shape-longsword,
#weapon-slot[data-item="warhammer"] .weapon-shape-warhammer,
#charm-slot[data-item="magnet"] .charm-equipped,
#boots-slot[data-item="winged"] .boots-winged {
  display: inline;
}

#charm-slot[data-item="magnet"] .charm-empty,
#boots-slot[data-item="winged"] .boots-standard {
  display: none;
}

.equipment-avatar {
  align-items: center;
  display: flex;
  grid-column: 2;
  grid-row: 1;
  height: 100%;
  justify-content: center;
}

.equipment-avatar svg {
  fill: rgba(245, 241, 218, 0.58);
  filter: drop-shadow(0 2px 0 rgba(5, 15, 12, 0.75));
  height: 4.4rem;
  width: 3.1rem;
}

.potion-icon {
  background: linear-gradient(160deg, rgb(255, 121, 145) 0 56%, rgb(174, 43, 77) 57% 100%);
  border: 2px solid rgb(58, 24, 38);
  border-radius: 0.28rem 0.28rem 0.5rem 0.5rem;
  box-shadow: inset 0.18rem 0.12rem 0 rgba(255, 233, 224, 0.48), 0 0.2rem 0 rgba(5, 15, 12, 0.42);
  display: inline-block;
  height: 1.65rem;
  margin-top: 0.08rem;
  position: relative;
  width: 1.42rem;
}

.potion-icon::before {
  background: rgb(222, 188, 129);
  border: 2px solid rgb(58, 24, 38);
  border-bottom: 0;
  border-radius: 0.18rem 0.18rem 0 0;
  content: "";
  height: 0.42rem;
  left: 0.28rem;
  position: absolute;
  top: -0.55rem;
  width: 0.62rem;
}

.potion-icon i {
  background: rgba(255, 245, 230, 0.72);
  border-radius: 999px;
  height: 0.48rem;
  left: 0.27rem;
  position: absolute;
  top: 0.3rem;
  transform: rotate(24deg);
  width: 0.2rem;
}

.is-empty .potion-icon,
#off-hand-slot[data-item="none"] .potion-icon {
  display: none;
}

#inventory-window {
  align-items: center;
  background: rgba(5, 15, 12, 0.62);
  box-sizing: border-box;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  position: fixed;
  z-index: 18;
}

.inventory-card {
  background: linear-gradient(145deg, rgb(35, 82, 55), rgb(16, 38, 31));
  border: 4px solid rgb(245, 241, 218);
  border-radius: 1.35rem;
  box-shadow: 0 1.2rem 3rem rgba(5, 15, 12, 0.62), inset 0 0 0 2px rgba(5, 15, 12, 0.62);
  box-sizing: border-box;
  max-width: 64rem;
  max-height: calc(100vh - 2rem);
  overflow-x: hidden;
  overflow-y: auto;
  width: min(64rem, 100%);
}

.field-equipment { align-self: start; }

.field-kit-body {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(19rem, 0.9fr) minmax(22rem, 1.1fr);
  padding: 1rem 1.15rem 0;
}

.field-equipment,
.backpack-panel,
.weapon-roll {
  min-width: 0;
}

.field-equipment h3,
.backpack-panel h3,
.weapon-roll h3 {
  color: rgb(255, 222, 91);
  font: bold 0.76rem/1.2 Arial, sans-serif;
  letter-spacing: 0.13em;
  margin: 0 0 0.55rem;
  text-transform: uppercase;
}

.field-equipment h3 small,
.backpack-panel h3 small,
.weapon-roll h3 small {
  color: rgba(245, 241, 218, 0.58);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.field-mannequin {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 214, 91, 0.12), transparent 42%),
    linear-gradient(145deg, rgba(17, 48, 38, 0.96), rgba(9, 29, 25, 0.96));
  border: 2px solid rgba(245, 241, 218, 0.22);
  border-radius: 1rem;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) 5.6rem minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(4.25rem, auto));
  min-height: 15rem;
  padding: 0.7rem;
  position: relative;
}

.painted-figure {
  align-self: center;
  filter: drop-shadow(0 0.3rem 0 rgba(5, 15, 12, 0.48));
  grid-column: 2;
  grid-row: 1 / 4;
  height: 11.5rem;
  justify-self: center;
  position: relative;
  width: 5.2rem;
}

.painted-figure i { display: block; position: absolute; }
.figure-head { background: rgb(232, 180, 109); border: 3px solid rgb(47, 35, 31); border-radius: 50%; height: 2.7rem; left: 1.1rem; top: 0.25rem; width: 2.7rem; }
.figure-body { background: linear-gradient(90deg, rgb(216, 125, 45), rgb(241, 166, 59)); border: 3px solid rgb(47, 35, 31); border-radius: 1rem 1rem 0.6rem 0.6rem; height: 4.9rem; left: 0.75rem; top: 2.65rem; width: 3.4rem; }
.figure-arm { background: rgb(232, 180, 109); border: 3px solid rgb(47, 35, 31); border-radius: 999px; height: 4.2rem; top: 3rem; width: 0.75rem; }
.figure-arm.left { left: 0.1rem; transform: rotate(12deg); }
.figure-arm.right { right: 0.1rem; transform: rotate(-12deg); }
.figure-leg { background: rgb(31, 113, 75); border: 3px solid rgb(47, 35, 31); border-radius: 0 0 0.7rem 0.7rem; height: 3.8rem; top: 7.1rem; width: 1.3rem; }
.figure-leg.left { left: 1.05rem; }
.figure-leg.right { right: 1.05rem; }

.field-equipment-slot {
  background: rgba(5, 15, 12, 0.68);
  border: 2px solid rgba(245, 241, 218, 0.3);
  border-radius: 0.65rem;
  color: rgb(245, 241, 218);
  cursor: pointer;
  min-height: 4.25rem;
  padding: 0.5rem;
  position: relative;
  text-align: left;
}

.field-equipment-slot span { color: rgba(245, 241, 218, 0.52); display: block; font: bold 0.56rem/1.2 Arial, sans-serif; letter-spacing: 0.1em; text-transform: uppercase; }
.field-equipment-slot strong { display: block; font: bold 0.73rem/1.2 Arial, sans-serif; margin-top: 0.28rem; overflow-wrap: anywhere; }
.field-equipment-slot.main-hand { grid-column: 1; grid-row: 1; }
.field-equipment-slot.field-off-hand { grid-column: 3; grid-row: 1; }
.field-equipment-slot.field-armor { grid-column: 1; grid-row: 2; }
.field-equipment-slot.field-charm { grid-column: 3; grid-row: 2; }
.field-equipment-slot.field-boots { grid-column: 2; grid-row: 3; }

.field-equipment-slot.is-filled { border-color: rgba(255, 205, 65, 0.75); box-shadow: inset 0 0 1rem rgba(255, 205, 65, 0.1); }
.field-equipment-slot:hover,
.field-equipment-slot:focus-visible,
.weapon-roll-item:hover,
.weapon-roll-item:focus-visible { background: rgba(30, 78, 58, 0.96); outline: 2px solid rgb(255, 222, 91); outline-offset: 1px; }

.backpack-panel .backpack-shell {
  margin: 0;
  max-width: none;
}

.inventory-header {
  align-items: center;
  background: rgba(5, 15, 12, 0.32);
  border-bottom: 2px solid rgba(255, 205, 65, 0.4);
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.15rem 0.9rem;
}

.inventory-header .menu-kicker {
  margin-bottom: 0.22rem;
}

#inventory-title {
  color: rgb(255, 222, 91);
  font-size: 1.65rem;
  margin: 0;
}

#inventory-close {
  background: rgba(5, 15, 12, 0.5);
  border: 2px solid rgba(245, 241, 218, 0.5);
  border-radius: 999px;
  color: rgb(245, 241, 218);
  cursor: pointer;
  font: bold 1.45rem/1 Arial, sans-serif;
  height: 2.3rem;
  width: 2.3rem;
}

#inventory-close:hover,
#inventory-close:focus-visible {
  border-color: rgb(255, 222, 91);
  outline: none;
}

.backpack-shell {
  background: linear-gradient(145deg, rgb(105, 63, 37), rgb(67, 39, 27));
  border: 3px solid rgb(43, 27, 21);
  border-radius: 1.2rem 1.2rem 1.65rem 1.65rem;
  box-shadow: inset 0 0 0 2px rgba(222, 171, 100, 0.24), inset 0 -1rem 2rem rgba(26, 16, 14, 0.3);
  margin: 1.2rem auto;
  max-width: 25rem;
  padding: 1rem;
  position: relative;
}

.backpack-shell::before {
  border: 4px solid rgb(43, 27, 21);
  border-bottom: 0;
  border-radius: 2rem 2rem 0 0;
  content: "";
  height: 2.2rem;
  left: 50%;
  position: absolute;
  top: -1.1rem;
  transform: translateX(-50%);
  width: 7rem;
  z-index: -1;
}

#backpack-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.backpack-slot {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(16, 31, 29, 0.74);
  border: 2px solid rgba(245, 241, 218, 0.34);
  border-radius: 0.65rem;
  color: rgb(245, 241, 218);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font: bold 0.74rem Arial, sans-serif;
  justify-content: center;
  min-height: 5.25rem;
  padding: 0.55rem;
  position: relative;
}

.backpack-slot:not(.is-empty) {
  border-color: rgba(255, 205, 65, 0.7);
}

.backpack-slot.is-equipped {
  box-shadow: 0 0 0 3px rgb(112, 245, 222), inset 0 0 1rem rgba(112, 245, 222, 0.18);
}

.backpack-slot:hover:not(.is-empty),
.backpack-slot:focus-visible:not(.is-empty) {
  background: rgba(30, 78, 58, 0.95);
  outline: none;
}

.backpack-slot.is-empty {
  color: rgba(245, 241, 218, 0.34);
  cursor: pointer;
}

.inventory-item-icon {
  align-items: center;
  background: rgba(255, 222, 91, 0.12);
  border: 2px solid currentColor;
  border-radius: 0.45rem;
  color: rgb(255, 222, 91);
  display: flex;
  font: bold 0.68rem/1 Arial, sans-serif;
  height: 1.85rem;
  justify-content: center;
  margin-top: 0.1rem;
  transform: rotate(-2deg);
  width: 1.85rem;
}

.backpack-slot.is-empty .inventory-item-icon { border-style: dashed; color: rgba(245, 241, 218, 0.2); }
.backpack-slot[data-item="potion"] .inventory-item-icon { background: linear-gradient(160deg, rgb(255, 121, 145), rgb(174, 43, 77)); border-radius: 0.28rem 0.28rem 0.65rem 0.65rem; color: rgb(58, 24, 38); }
.backpack-slot[data-item^="armor"] .inventory-item-icon::before { content: "ARM"; }
.backpack-slot[data-item="wingedBoots"] .inventory-item-icon::before { content: "BOOT"; font-size: 0.52rem; }
.backpack-slot[data-item="magnetCharm"] .inventory-item-icon::before { content: "U"; font-size: 1.1rem; }

.inventory-source-selected {
  box-shadow: 0 0 0 3px rgb(112, 245, 222), inset 0 0 1rem rgba(112, 245, 222, 0.2) !important;
}

.inventory-compatible-target {
  border-color: rgb(112, 245, 222) !important;
  box-shadow: inset 0 0 1.15rem rgba(112, 245, 222, 0.14);
}

.weapon-roll {
  border-top: 1px solid rgba(245, 241, 218, 0.16);
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
}

#weapon-roll-list {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.weapon-roll-item {
  background: rgba(5, 15, 12, 0.58);
  border: 2px solid rgba(245, 241, 218, 0.25);
  border-radius: 0.55rem;
  color: rgb(245, 241, 218);
  cursor: pointer;
  font: bold 0.7rem/1.25 Arial, sans-serif;
  min-height: 2.9rem;
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.weapon-roll-item kbd { margin-right: 0.35rem; }
.weapon-roll-item[aria-pressed="true"] { border-color: rgb(255, 205, 65); box-shadow: inset 0 0 1rem rgba(255, 205, 65, 0.14); color: rgb(255, 222, 91); }
.weapon-roll-empty { color: rgba(245, 241, 218, 0.58); font-size: 0.75rem; grid-column: 1 / -1; margin: 0.2rem 0; }

.slot-number {
  color: rgba(245, 241, 218, 0.38);
  font-size: 0.58rem;
  left: 0.38rem;
  position: absolute;
  top: 0.28rem;
}

.backpack-slot-name {
  margin-top: 0.45rem;
}

.backpack-slot-count {
  background: rgb(255, 205, 65);
  border: 2px solid rgb(43, 27, 21);
  border-radius: 999px;
  bottom: 0.25rem;
  color: rgb(16, 31, 29);
  font-size: 0.72rem;
  min-width: 1rem;
  padding: 0.08rem 0.18rem;
  position: absolute;
  right: 0.25rem;
}

.backpack-slot.is-empty .backpack-slot-count {
  display: none;
}

.inventory-footer {
  background: rgba(5, 15, 12, 0.3);
  border-top: 1px solid rgba(245, 241, 218, 0.18);
  padding: 0.9rem 1.15rem 1.1rem;
}

.inventory-footer p {
  color: rgba(245, 241, 218, 0.72);
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0.65rem 0 0;
}

.inventory-off-hand {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.inventory-off-hand span {
  color: rgb(152, 180, 175);
  font-size: 0.68rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inventory-off-hand strong {
  color: rgb(112, 245, 222);
}

#biome-status {
  background: rgba(16, 31, 29, 0.72);
  border: 1px solid rgba(245, 241, 218, 0.26);
  border-radius: 999px;
  font: bold 0.82rem Arial, sans-serif;
  left: 50%;
  letter-spacing: 0.04em;
  margin: 0;
  padding: 0.42rem 0.78rem;
  pointer-events: none;
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  transform: translateX(-50%);
}

#biome-status span {
  color: rgb(152, 180, 175);
  font-size: 0.67rem;
  letter-spacing: 0.09em;
  margin-right: 0.35rem;
  text-transform: uppercase;
}

#time-status {
  align-items: center;
  background: rgba(16, 31, 29, 0.86);
  border: 2px solid rgba(255, 230, 151, 0.62);
  border-radius: 999px;
  color: rgb(245, 241, 218);
  display: flex;
  font: 0.78rem Arial, sans-serif;
  gap: 0.65rem;
  left: 50%;
  margin: 0;
  padding: 0.42rem 0.8rem;
  position: fixed;
  top: max(3.6rem, calc(env(safe-area-inset-top) + 3.6rem));
  transform: translateX(-50%);
  z-index: 3;
}

#time-status strong { color: rgb(255, 210, 83); }
#time-value { color: rgb(181, 231, 231); }

#village-prompt {
  background: rgba(16, 31, 29, 0.92);
  border: 3px solid rgb(255, 210, 83);
  border-radius: 0.8rem;
  bottom: max(5.2rem, calc(env(safe-area-inset-bottom) + 5.2rem));
  color: rgb(245, 241, 218);
  font: bold 0.95rem Arial, sans-serif;
  left: 50%;
  margin: 0;
  padding: 0.65rem 1rem;
  position: fixed;
  transform: translateX(-50%);
  z-index: 6;
}

#tutorial-beat {
  background: rgba(16, 31, 29, 0.94);
  border: 2px solid rgba(112, 245, 222, 0.78);
  border-radius: 0.72rem;
  bottom: max(5.4rem, calc(env(safe-area-inset-bottom) + 5.4rem));
  box-shadow: 0 4px 18px rgba(5, 15, 12, 0.42);
  color: rgb(245, 241, 218);
  font: bold 0.84rem/1.4 Arial, sans-serif;
  left: 50%;
  margin: 0;
  max-width: min(32rem, 82vw);
  padding: 0.58rem 0.82rem;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  z-index: 7;
}

#tutorial-beat:empty { display: none; }

#village-prompt:empty,
#progression-toast:empty,
#bounty-status:empty {
  display: none;
}

.inventory-armor {
  align-items: center;
  display: flex;
  gap: 0.55rem;
}

.inventory-armor span { color: rgb(181, 231, 231); font-size: 0.74rem; text-transform: uppercase; }
.inventory-armor strong { color: rgb(255, 210, 83); }

#armor-slot[data-item="armor1"] { background: linear-gradient(145deg, rgba(91, 117, 91, 0.94), rgba(48, 69, 57, 0.94)); }
#armor-slot[data-item="armor2"] { background: linear-gradient(145deg, rgba(116, 91, 78, 0.96), rgba(58, 51, 57, 0.96)); }
#armor-slot[data-item="armor3"] { background: linear-gradient(145deg, rgba(92, 119, 137, 0.98), rgba(40, 52, 70, 0.98)); }

#shop-window,
#inn-window {
  align-items: center;
  background: rgba(5, 15, 12, 0.76);
  box-sizing: border-box;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 24;
}

#bounty-status {
  background: rgba(72, 39, 24, 0.92);
  border: 2px solid rgb(255, 210, 83);
  border-radius: 0.65rem;
  color: rgb(245, 241, 218);
  font: bold 0.78rem Arial, sans-serif;
  left: 50%;
  margin: 0;
  max-width: min(34rem, 84vw);
  padding: 0.5rem 0.75rem;
  position: fixed;
  text-align: center;
  top: max(6.5rem, calc(env(safe-area-inset-top) + 6.5rem));
  transform: translateX(-50%);
  z-index: 4;
}

.inn-card { max-width: 35rem; }
.inn-actions { display: grid; gap: 0.65rem; margin-top: 1rem; }
.inn-actions button {
  background: rgba(233, 220, 174, 0.1);
  border: 2px solid rgba(233, 220, 174, 0.48);
  border-radius: 0.7rem;
  color: rgb(245, 241, 218);
  cursor: pointer;
  font-weight: bold;
  padding: 0.85rem;
}
.inn-actions button:disabled { cursor: default; opacity: 0.45; }
.skill-capstone { box-shadow: inset 0 0 0 2px rgba(153, 89, 36, 0.2); }
.skill-capstone.is-locked { filter: grayscale(0.8); }

#touch-controls { display: none; }

#touch-weapon-belt {
  display: flex;
  gap: 0.35rem;
  left: 50%;
  max-width: min(92vw, 34rem);
  overflow-x: auto;
  pointer-events: auto;
  position: fixed;
  top: max(0.45rem, env(safe-area-inset-top));
  transform: translateX(-50%);
}

#touch-weapon-belt button[aria-pressed="true"] {
  background: rgba(153, 89, 36, 0.96);
  border-color: rgb(255, 230, 151);
}

@media (hover: none) and (pointer: coarse) {
  .controls { display: none; }
  #touch-controls {
    align-items: end;
    bottom: max(0.45rem, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    left: max(0.45rem, env(safe-area-inset-left));
    pointer-events: none;
    position: fixed;
    right: max(0.45rem, env(safe-area-inset-right));
    z-index: 18;
  }
  #touch-controls button {
    background: rgba(16, 31, 29, 0.88);
    border: 2px solid rgba(255, 230, 151, 0.74);
    border-radius: 0.75rem;
    color: white;
    font-weight: bold;
    min-height: 3rem;
    min-width: 3rem;
    pointer-events: auto;
    touch-action: none;
  }
  .touch-movement, .touch-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .touch-movement { max-width: 13rem; }
  .touch-actions { justify-content: end; max-width: 17rem; }
  .touch-actions button { font-size: 0.68rem; min-width: 3.6rem; }
  #equipment-hud { bottom: max(7rem, calc(env(safe-area-inset-bottom) + 7rem)); }
  #village-prompt { bottom: max(8rem, calc(env(safe-area-inset-bottom) + 8rem)); }
  #tutorial-beat { bottom: max(10.9rem, calc(env(safe-area-inset-bottom) + 10.9rem)); }
}

.shop-card {
  background: linear-gradient(160deg, rgba(34, 54, 44, 0.99), rgba(16, 31, 29, 0.99));
  border: 4px solid rgb(235, 205, 139);
  border-radius: 1.25rem;
  box-shadow: 0 12px 0 rgba(5, 15, 12, 0.7), 0 26px 65px rgba(5, 15, 12, 0.72);
  box-sizing: border-box;
  color: rgb(245, 241, 218);
  max-height: calc(100vh - 2rem);
  max-width: 58rem;
  overflow-y: auto;
  padding: 1.3rem;
  width: 100%;
}

.shop-balance { align-items: center; display: flex; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.shop-balance strong { color: rgb(255, 210, 83); font-size: 1.4rem; }

.shop-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shop-grid button,
.forge-grid button {
  background: rgba(233, 220, 174, 0.1);
  border: 2px solid rgba(233, 220, 174, 0.38);
  border-radius: 0.75rem;
  color: rgb(245, 241, 218);
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
  min-height: 6.6rem;
  padding: 0.75rem;
  text-align: left;
}

.shop-grid button:hover, .shop-grid button:focus-visible,
.forge-grid button:hover, .forge-grid button:focus-visible { background: rgba(255, 210, 83, 0.16); border-color: rgb(255, 210, 83); outline: none; }
.shop-grid button:disabled, .forge-grid button:disabled { cursor: default; filter: grayscale(0.7); opacity: 0.45; }
.shop-grid button strong, .forge-grid button strong { color: rgb(255, 220, 116); font-size: 1rem; }
.shop-grid button span, .forge-grid button span { color: rgb(198, 224, 207); font-size: 0.76rem; }
.shop-grid button em, .forge-grid button em { color: rgb(255, 210, 83); font-size: 0.78rem; font-style: normal; font-weight: bold; }

.forge-panel {
  border-top: 1px solid rgba(112, 245, 222, 0.3);
  margin-top: 1rem;
  padding-top: 1rem;
}
.forge-panel header { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.forge-panel h3 { color: rgb(255, 220, 116); margin: 0; }
.forge-panel header > strong { color: rgb(112, 245, 222); font-size: 0.82rem; }
.forge-panel > p { color: rgb(198, 224, 207); font-size: 0.8rem; margin: 0.45rem 0 0.75rem; }
.forge-grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.forge-grid button { min-height: 5.5rem; }
#shop-message { color: rgb(198, 224, 207); margin: 1rem 0 0; min-height: 1.2rem; }

#network-status {
  background: rgba(16, 31, 29, 0.82);
  border: 2px solid rgba(245, 241, 218, 0.24);
  border-radius: 999px;
  color: rgb(245, 241, 218);
  font-size: 0.82rem;
  padding: 0.45rem 0.7rem;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  text-decoration: none;
  top: max(0.75rem, env(safe-area-inset-top));
}

#network-status[data-mode="shared"] {
  border-color: rgba(112, 245, 222, 0.65);
  color: rgb(152, 255, 235);
}

.inventory-footer .inventory-action-status {
  color: rgb(112, 245, 222);
  font-weight: bold;
  margin-top: 0.35rem;
}

#utility-status-stack {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  top: max(0.75rem, env(safe-area-inset-top));
  z-index: 4;
}

#utility-status-stack > #network-status,
#utility-status-stack > #music-toggle,
#utility-status-stack > #network-diagnostics-toggle,
#utility-status-stack > .save-status {
  position: static;
}

.save-status {
  background: rgba(16, 31, 29, 0.82);
  border: 1px solid rgba(112, 245, 222, 0.5);
  border-radius: 999px;
  color: rgb(152, 255, 235);
  font: bold 0.72rem Arial, sans-serif;
  margin: 0;
  padding: 0.35rem 0.6rem;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  top: max(8.55rem, calc(env(safe-area-inset-top) + 8.55rem));
  z-index: 4;
}

#network-status[data-mode="connecting"],
#network-status[data-mode="reconnecting"] {
  color: rgb(255, 222, 91);
}

#music-toggle {
  background: rgba(16, 31, 29, 0.82);
  border: 2px solid rgba(245, 241, 218, 0.24);
  border-radius: 999px;
  color: rgb(245, 241, 218);
  cursor: pointer;
  font: bold 0.82rem Arial, sans-serif;
  padding: 0.45rem 0.7rem;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  top: max(3.35rem, calc(env(safe-area-inset-top) + 3.35rem));
  z-index: 2;
}

#music-toggle[aria-pressed="false"] {
  color: rgb(152, 180, 175);
}

#music-toggle:hover,
#music-toggle:focus-visible {
  border-color: rgba(112, 245, 222, 0.65);
}

#pause-menu {
  align-items: center;
  background: rgba(5, 15, 12, 0.72);
  box-sizing: border-box;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  position: fixed;
  z-index: 20;
}

#runtime-recovery {
  align-items: center;
  background: rgba(5, 15, 12, 0.86);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 60;
}

#runtime-recovery[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

.pause-card {
  background: rgba(16, 31, 29, 0.97);
  border: 4px solid rgb(245, 241, 218);
  border-radius: 1.35rem;
  box-shadow: 0 10px 0 rgba(5, 15, 12, 0.78), 0 22px 55px rgba(5, 15, 12, 0.62);
  box-sizing: border-box;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: clamp(1.35rem, 5vw, 2.25rem);
  text-align: center;
  width: min(100%, 27rem);
}

#pause-title {
  color: rgb(255, 205, 65);
  font-size: clamp(2rem, 8vw, 3.2rem);
  margin: 0 0 1.35rem;
  text-shadow: 0 4px 0 rgb(119, 73, 22);
}

#pause-actions {
  display: grid;
  gap: 0.8rem;
}

#pause-main-menu-button {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  text-decoration: none;
}

#pause-settings {
  text-align: left;
}

#pause-settings h3 {
  color: rgb(255, 205, 65);
  font-size: 1.35rem;
  margin: 0 0 1.15rem;
  text-align: center;
}

#pause-settings-back-button {
  display: block;
  margin: 0 auto;
}

.brushbound-paused canvas {
  cursor: default;
}

#network-diagnostics-toggle {
  background: rgba(16, 31, 29, 0.82);
  border: 2px solid rgba(245, 241, 218, 0.24);
  border-radius: 999px;
  color: rgb(152, 255, 235);
  cursor: pointer;
  font: bold 0.82rem Arial, sans-serif;
  padding: 0.45rem 0.7rem;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  top: max(5.95rem, calc(env(safe-area-inset-top) + 5.95rem));
  z-index: 2;
}

#network-diagnostics-toggle:hover,
#network-diagnostics-toggle:focus-visible,
#network-diagnostics-toggle[aria-expanded="true"] {
  border-color: rgba(112, 245, 222, 0.72);
  outline: none;
}

#network-diagnostics {
  background: rgba(5, 15, 12, 0.9);
  border: 2px solid rgba(112, 245, 222, 0.55);
  border-radius: 0.8rem;
  color: rgb(245, 241, 218);
  font: bold 0.74rem/1.55 monospace;
  padding: 0.65rem 0.75rem;
  pointer-events: none;
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  top: max(8.55rem, calc(env(safe-area-inset-top) + 8.55rem));
  white-space: pre;
  z-index: 2;
}

kbd {
  background: rgb(255, 205, 65);
  border: 2px solid rgb(5, 15, 12);
  border-radius: 0.35rem;
  box-shadow: 0 2px 0 rgb(5, 15, 12);
  color: rgb(16, 31, 29);
  display: inline-block;
  font: bold 0.8rem Arial, sans-serif;
  min-width: 1.2rem;
  padding: 0.2rem 0.4rem;
  text-align: center;
}

@media (max-width: 760px) {
  .field-kit-body { grid-template-columns: 1fr; }
  .field-mannequin { min-height: 13.5rem; }
  #weapon-roll-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  #mode-choice,
  .menu-actions {
    flex-direction: column;
  }

  #options-menu {
    max-width: none;
  }

  .pause-card {
    padding: 1.25rem;
  }

  .controls {
    bottom: max(0.55rem, env(safe-area-inset-bottom));
    font-size: 0.72rem;
    padding: 0.4rem 0.55rem;
  }

  #player-status,
  #biome-status,
  #network-status,
  #music-toggle,
  #network-diagnostics-toggle {
    font-size: 0.7rem;
  }

  #player-status {
    padding: 0.55rem;
    width: 15.25rem;
  }

  #biome-status,
  #time-status {
    left: auto;
    right: max(0.65rem, env(safe-area-inset-right));
    transform: none;
  }

  #biome-status { top: 8.8rem; }
  #time-status { top: 11.6rem; }

  #utility-status-stack {
    gap: 0.4rem;
    max-width: calc(100vw - 1.3rem);
  }

  #equipment-hud {
    bottom: max(5.3rem, calc(env(safe-area-inset-bottom) + 5.3rem));
    padding: 0.45rem;
    width: 12rem;
  }

  .equipment-layout {
    gap: 0.28rem;
    grid-template-columns: 3.35rem 3.35rem 3.35rem;
    grid-template-rows: 4rem 4rem;
  }

  .shop-grid, .forge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-card { padding: 0.9rem; }

  .inventory-card {
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }

  .field-kit-body { gap: 0.75rem; padding: 0.8rem; }
  .field-mannequin { grid-template-columns: minmax(0, 1fr) 4.6rem minmax(0, 1fr); padding: 0.45rem; }
  .field-equipment-slot { min-height: 3.8rem; padding: 0.4rem; }
  .painted-figure { transform: scale(0.86); }
  .weapon-roll { margin-top: 0.75rem; padding: 0.75rem 0.8rem; }

  .backpack-shell {
    margin: 1rem;
  }

  .backpack-slot {
    min-height: 4.5rem;
  }

  .wealth-row {
    min-height: 2.35rem;
  }

  .wealth-row strong {
    font-size: 1.5rem;
  }

  #network-diagnostics {
    font-size: 0.66rem;
  }

  kbd {
    font-size: 0.68rem;
    min-width: 1rem;
    padding: 0.15rem 0.3rem;
  }
}

@media (max-width: 560px) and (hover: none) and (pointer: coarse) {
  #equipment-hud { bottom: max(7.4rem, calc(env(safe-area-inset-bottom) + 7.4rem)); }
}

@media (max-height: 500px) {
  #equipment-hud {
    transform: scale(0.82);
    transform-origin: bottom right;
  }

  .field-kit-card { max-height: calc(100vh - 0.5rem); overflow-y: auto; }
  .field-kit-body { grid-template-columns: minmax(18rem, 0.9fr) minmax(20rem, 1.1fr); }
  .field-mannequin { min-height: 12rem; }
  #weapon-roll-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

#character-window {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 25, 29, 0.78);
  backdrop-filter: blur(4px);
}

#character-window[hidden] { display: none; }

.character-card {
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
  border: 4px solid #352c27;
  border-radius: 18px;
  color: #29241f;
  background: linear-gradient(145deg, #f5e8c6, #d8bd82);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 3px rgba(255,255,255,.28);
}

.character-summary, .character-footer div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.character-summary {
  margin: 10px 0 18px;
  padding: 12px 15px;
  border-radius: 10px;
  background: rgba(61, 49, 39, .1);
}

.attribute-panel h3, .skill-panel h3 { margin: 14px 0 8px; }
.attribute-panel h3 small, .skill-panel h3 small { font-weight: normal; opacity: .68; }
.attribute-grid, .skill-paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.attribute-grid button, .skill-path button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 11px;
  border: 2px solid #66513d;
  border-radius: 9px;
  color: inherit;
  text-align: left;
  background: rgba(255, 250, 224, .72);
  cursor: pointer;
}
.attribute-grid button:hover:not(:disabled), .skill-path button:hover:not(:disabled) { transform: translateY(-1px); background: #fff7d7; }
.attribute-grid button:disabled, .skill-path button:disabled { cursor: not-allowed; opacity: .52; }
.attribute-grid em { color: #7a3f25; font-size: 11px; font-style: normal; font-weight: bold; text-transform: uppercase; }
.skill-path { padding: 10px; border-radius: 11px; background: rgba(83, 66, 49, .1); }
.skill-path h4 { margin: 0 0 8px; text-align: center; }
.skill-path button { margin-top: 8px; min-height: 64px; }
.skill-path button.is-unlocked { border-color: #3e7650; color: #214b31; background: rgba(142, 196, 132, .5); opacity: 1; }
.character-footer { margin-top: 16px; padding-top: 12px; border-top: 2px solid rgba(70,55,42,.28); }
.character-footer p { margin: 0 0 8px; }
#progression-toast { position: fixed; top: 18%; left: 50%; z-index: 40; transform: translateX(-50%); padding: 10px 18px; border: 2px solid #f5d886; border-radius: 999px; color: white; background: rgba(38, 49, 43, .92); box-shadow: 0 5px 18px rgba(0,0,0,.35); }

@media (max-width: 760px) {
  .attribute-grid, .skill-paths { grid-template-columns: 1fr; }
  .character-card { padding: 14px; }
}

@media (max-height: 300px) {
  .controls {
    display: none;
  }

  #music-toggle,
  #network-diagnostics-toggle {
    display: none;
  }

  #player-status {
    transform: scale(0.78);
    transform-origin: top left;
  }

  #equipment-hud {
    bottom: max(0.65rem, env(safe-area-inset-bottom));
    transform: scale(0.62);
    transform-origin: bottom right;
  }
}
