:root {
  color-scheme: dark;
  --bg: #090d0b;
  --panel: #121914;
  --panel-2: #18211b;
  --border: #2b3a30;
  --text: #e4eadf;
  --muted: #94a197;
  --accent: #a6cb65;
  --accent-strong: #c8eb82;
  --danger: #d66b5d;
  --warning: #d7ad59;
  --success: #75bd7b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(133, 163, 83, 0.11), transparent 32rem),
    linear-gradient(rgba(7, 10, 8, 0.88), rgba(7, 10, 8, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,.015) 80px);
}

button {
  font: inherit;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.noscript {
  padding: 1rem;
  color: white;
  background: #9f382c;
  text-align: center;
}

.game-shell {
  width: min(1540px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  letter-spacing: 0.08em;
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.topbar__actions,
.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel,
.mini-panel {
  border: 1px solid var(--border);
  background: rgba(18, 25, 20, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: var(--radius);
}

.mini-panel {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel-2);
}

.status-bar {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(58px, 0.52fr))
    repeat(6, minmax(96px, 1fr));
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.status-item,
.status-meter {
  min-width: 0;
}

.status-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 7px;
  border-left: 2px solid var(--accent);
}

.status-item span,
.status-meter__label span {
  min-width: 0;
  color: var(--muted);
  font-size: clamp(0.66rem, 0.72vw, 0.75rem);
  white-space: nowrap;
}

.status-item strong {
  font-size: 1.15rem;
}

.status-meter__label {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  margin-bottom: 7px;
  font-size: clamp(0.72rem, 0.8vw, 0.85rem);
}

.status-meter__label strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

progress {
  width: 100%;
  height: 9px;
  appearance: none;
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #080b09;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.status-meter--fatigue small {
  display: block;
  min-height: 1.1em;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.65rem;
}

.status-meter--fatigue[data-level="tired"] progress::-webkit-progress-value,
.status-meter--fatigue[data-level="tired"] progress::-moz-progress-bar {
  background: var(--warning);
}

.status-meter--fatigue[data-level="exhausted"] progress::-webkit-progress-value,
.status-meter--fatigue[data-level="exhausted"] progress::-moz-progress-bar,
.status-meter--fatigue[data-level="critical"] progress::-webkit-progress-value,
.status-meter--fatigue[data-level="critical"] progress::-moz-progress-bar {
  background: var(--danger);
}

.status-meter--fatigue[data-level="critical"] {
  animation: fatigue-pulse 1.7s ease-in-out infinite;
}

@keyframes fatigue-pulse {
  50% {
    opacity: 0.72;
  }
}

.layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.78fr) minmax(420px, 2.4fr) minmax(270px, 1fr);
  gap: 14px;
  align-items: start;
}

.sidebar,
.right-column {
  padding: 16px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.main-column {
  display: grid;
  gap: 14px;
}

.location-card {
  overflow: hidden;
}

.media-placeholder {
  position: relative;
  min-height: 250px;
  background-color: #101611;
  background-image:
    linear-gradient(135deg, rgba(166, 203, 101, 0.08), rgba(0, 0, 0, 0.25)),
    url("assets/images/locations/generic.png");
  background-position: center;
  background-size: cover;
  border-bottom: 1px solid var(--border);
}

.media-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, rgba(7, 10, 8, 0.88));
  pointer-events: none;
}

.location-card__content {
  padding: 20px;
}

.location-description {
  color: #c0c9c1;
  line-height: 1.7;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading--wide {
  align-items: flex-start;
}

.badge,
.danger-level {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #0c110e;
  font-size: 0.72rem;
  white-space: nowrap;
}

.danger-level[data-level="high"] {
  color: #ffc0b7;
  border-color: rgba(214, 107, 93, 0.5);
}

.danger-level[data-level="medium"] {
  color: #ffe0a1;
  border-color: rgba(215, 173, 89, 0.5);
}

.danger-level[data-level="low"] {
  color: #bce2a8;
  border-color: rgba(117, 189, 123, 0.45);
}

.locations-list,
.button-stack,
.inventory-list,
.upgrade-list,
.shelter-stats {
  display: grid;
  gap: 8px;
}

.location-button {
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: #0c110e;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.location-button:hover:not(:disabled) {
  transform: translateX(3px);
  border-color: var(--accent);
}

.location-button.is-active {
  border-color: var(--accent);
  background: rgba(166, 203, 101, 0.1);
}

.location-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.location-button strong,
.location-button span {
  display: block;
}

.location-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.button {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  padding: 9px 13px;
  overflow: hidden;
  border: 1px solid rgba(166, 203, 101, 0.55);
  border-radius: 9px;
  color: #0c130b;
  background: var(--accent);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.button--ghost {
  color: var(--text);
  border-color: var(--border);
  background: transparent;
}

.button--danger {
  color: #fff4f2;
  border-color: rgba(214, 107, 93, 0.55);
  background: rgba(214, 107, 93, 0.22);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c110e;
}

.action-card__title {
  font-weight: 800;
}

.action-card__description,
.action-card__cost {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.action-card .button {
  margin-top: 4px;
}

.event-panel {
  padding: 18px;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.event-entry {
  padding: 10px 12px;
  border-left: 3px solid var(--border);
  background: #0c110e;
  color: #c8d1c9;
  font-size: 0.86rem;
  line-height: 1.5;
}

.event-entry--success {
  border-left-color: var(--success);
}

.event-entry--warning {
  border-left-color: var(--warning);
}

.event-entry--danger {
  border-left-color: var(--danger);
}

.event-entry time {
  color: var(--muted);
  margin-right: 8px;
}

.text-button {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.text-button:hover {
  color: var(--text);
}

.inventory-item,
.shelter-stat,
.upgrade-card {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0c110e;
}

.inventory-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.item-placeholder {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px dashed #4c5d50;
  border-radius: 8px;
  color: var(--muted);
  background: #101611;
  font-size: 0.66rem;
  text-align: center;
}

.inventory-item__name {
  display: block;
  font-size: 0.84rem;
}

.inventory-item__type {
  color: var(--muted);
  font-size: 0.7rem;
}

.inventory-item__quantity {
  font-weight: 800;
}

.empty-state {
  padding: 20px 10px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.shelter-stat {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.shelter-stat strong {
  color: var(--text);
}

.upgrade-card {
  display: grid;
  gap: 8px;
}

.upgrade-card.is-built {
  border-color: rgba(117, 189, 123, 0.5);
}

.upgrade-card__header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.upgrade-card__header strong {
  font-size: 0.84rem;
}

.upgrade-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.cost-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cost-chip {
  padding: 3px 6px;
  border-radius: 999px;
  background: #18211b;
  color: #bdc7bf;
  font-size: 0.66rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.75rem;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.modal__content {
  position: relative;
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal__content p {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-column {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .right-column .mini-panel {
    margin-top: 0;
  }

}

@media (max-width: 900px) and (min-width: 761px) {
  .status-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .game-shell {
    width: min(100% - 18px, 1540px);
    padding-top: 12px;
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout,
  .right-column,
  .status-bar {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .right-column {
    position: static;
    max-height: none;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .media-placeholder {
    min-height: 210px;
  }
}

/* --- Survivors, combat and death systems --- */
.right-column > .mini-panel { margin-top: 16px; }
.resident-list { display: grid; gap: 9px; }
.resident-card { display: grid; gap: 9px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: #0c110e; }
.resident-card__header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mini-bars { display: grid; gap: 5px; }
.mini-bar { display: grid; grid-template-columns: 43px minmax(0, 1fr) 28px; gap: 6px; align-items: center; color: var(--muted); font-size: .65rem; }
.mini-bar > div { height: 5px; overflow: hidden; border-radius: 999px; background: #050806; }
.mini-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.mini-bar strong { color: var(--text); text-align: right; }
.modal__content--wide { width: min(760px, 100%); }
.modal__actions--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.character-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: stretch; }
.character-placeholder, .combat-placeholder { min-height: 190px; display: grid; place-items: center; padding: 18px; border: 1px dashed #4c5d50; border-radius: 12px; color: var(--muted); background: linear-gradient(135deg, rgba(166,203,101,.08), rgba(0,0,0,.25)), repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,.025) 15px 16px); text-align: center; font-weight: 800; letter-spacing: .08em; line-height: 1.5; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.stat-card { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: #0c110e; }
.stat-card span { color: var(--muted); font-size: .68rem; }
.stat-card strong { font-size: 1.05rem; }
.notice { padding: 10px 12px; border-left: 3px solid var(--warning); background: rgba(215,173,89,.08); color: #d4ddd5; line-height: 1.5; }
.modal--combat { overflow: auto; place-items: start center; }
.combat-panel { position: relative; width: min(960px, 100%); margin: 18px 0; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.combat-header, .combat-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.combatants { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 14px; align-items: center; margin: 18px 0; }
.combatant { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #0c110e; }
.combatant h3 { margin-top: 12px; }
.combat-placeholder { min-height: 135px; }
.combat-versus { color: var(--danger); font-size: 1.5rem; font-weight: 900; text-align: center; }
.combat-log { display: grid; gap: 5px; min-height: 108px; max-height: 190px; overflow: auto; margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #070a08; color: #c8d1c9; font-size: .82rem; line-height: 1.45; }
.combat-actions { justify-content: flex-start; margin-bottom: 18px; }
.weapon-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.weapon-button { min-width: 0; display: grid; grid-template-rows: auto auto auto; align-content: start; gap: 5px; padding: 12px; border: 1px solid rgba(166,203,101,.45); border-radius: 10px; color: var(--text); background: #0c110e; text-align: left; cursor: pointer; overflow: hidden; }
.weapon-button:hover:not(:disabled) { border-color: var(--accent-strong); background: rgba(166,203,101,.08); }
.weapon-button:disabled { opacity: .35; cursor: not-allowed; }
.weapon-button span { color: var(--muted); font-size: .72rem; }
.death-screen[hidden] { display: none; }
.death-screen { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at center, rgba(120,25,20,.22), transparent 34rem), #050605; }
.death-screen__content { width: min(620px, 100%); text-align: center; }
.death-screen h1 { color: #f1d7d3; font-size: clamp(3rem, 10vw, 7rem); letter-spacing: .08em; }
.death-screen p:not(.eyebrow) { margin: 20px auto 28px; color: #b8aaa7; font-size: 1.05rem; }
.death-screen .modal__actions { justify-content: center; }
body.is-dead .game-shell, body.is-dead .modal:not(#saveManagerModal) { display: none !important; }
@media (max-width: 760px) {
  .character-layout, .combatants { grid-template-columns: 1fr; }
  .combat-versus { transform: rotate(90deg); }
  .stat-grid, .modal__actions--grid, .weapon-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) { .stat-grid, .modal__actions--grid, .weapon-grid { grid-template-columns: 1fr; } }


/* --- Expeditions and multi-slot saves --- */
.notice--danger {
  border-left-color: var(--danger);
  background: rgba(214, 107, 93, .1);
  color: #f0c7c1;
}

.resident-away-message {
  padding: 9px 10px;
  border: 1px solid rgba(215, 173, 89, .42);
  border-radius: 9px;
  color: #ead29d;
  background: rgba(215, 173, 89, .08);
  font-size: .75rem;
  line-height: 1.45;
}

.save-manager-modal {
  z-index: 1200;
  overflow: auto;
  place-items: start center;
}

.modal__content--save {
  width: min(860px, 100%);
  margin: 24px 0;
}

.save-manager-help {
  color: var(--muted);
  line-height: 1.55;
}

.save-slots-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.save-slot-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c110e;
}

.save-slot-card--auto {
  border-color: rgba(166, 203, 101, .48);
  background: rgba(166, 203, 101, .055);
}

.save-slot-card__info {
  min-width: 0;
}

.save-slot-card__info strong {
  display: block;
  margin-bottom: 5px;
}

.save-slot-card__meta {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.save-slot-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

@media (max-width: 680px) {
  .save-slot-card {
    grid-template-columns: 1fr;
  }

  .save-slot-card__actions {
    justify-content: flex-start;
  }
}


/* --- Replaceable image asset files --- */
.item-image {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: cover;
  border: 1px solid #4c5d50;
  border-radius: 8px;
  background: #101611;
}

.character-image {
  width: 100%;
  min-height: 190px;
  max-height: 360px;
  display: block;
  object-fit: cover;
  border: 1px solid #4c5d50;
  border-radius: 12px;
  background: #101611;
}

.combat-image {
  width: 100%;
  height: 180px;
  display: block;
  object-fit: cover;
  border: 1px solid #4c5d50;
  border-radius: 10px;
  background: #101611;
}

.resident-card__identity {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.resident-avatar {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: cover;
  border: 1px solid #4c5d50;
  border-radius: 9px;
  background: #101611;
}

.weapon-image {
  width: 100%;
  height: 112px;
  display: block;
  object-fit: contain;
  object-position: center;
  box-sizing: border-box;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 3px;
  background: #080d0a;
}


/* --- Character creation and persistent player profile --- */
.player-profile-section { margin-bottom: 16px; }
.player-profile-card { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: #0c110e; }
.player-profile-image { width: 66px; height: 82px; display: block; object-fit: cover; border: 1px solid #4c5d50; border-radius: 9px; background: #101611; }
.player-profile-card strong { display: block; margin-bottom: 5px; font-size: .88rem; }
.player-profile-card p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.player-attributes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.player-attribute { display: flex; justify-content: space-between; gap: 7px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #0c110e; color: var(--muted); font-size: .68rem; }
.player-attribute strong { color: var(--text); }
.character-creation-modal { z-index: 1400; overflow: auto; place-items: start center; }
.modal__content--creation { width: min(820px, 100%); margin: 22px 0; }
.creation-adult-note { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.creation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-field { display: grid; gap: 6px; color: var(--muted); font-size: .76rem; }
.form-field select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: #0c110e; font: inherit; }
.creation-body-options { margin-top: 12px; }
.creation-preview { margin: 16px 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #0c110e; }
.creation-preview > p { color: var(--muted); line-height: 1.55; }
.player-attributes--preview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 680px) { .creation-grid, .player-attributes--preview { grid-template-columns: 1fr; } }


.character-appearance-details {
  margin: 10px 0 12px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0c110e;
  color: var(--muted);
  font-size: .75rem;
}

.character-appearance-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.character-appearance-details p {
  margin: 8px 0 0;
  line-height: 1.55;
}



/* --- Character overview menu --- */
.character-overview-button {
  width: 100%;
  margin-top: 10px;
}

.modal__content--character-overview {
  width: min(1040px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.character-overview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.character-overview-summary {
  margin-bottom: 18px;
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: rgba(166, 203, 101, .07);
  color: #c7d0c8;
  line-height: 1.55;
}

.character-overview-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.character-overview-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c110e;
}

.character-overview-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: cover;
  background: #101611;
}

.character-overview-card__content {
  display: grid;
  gap: 9px;
  padding: 11px;
}

.character-overview-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.character-overview-card__heading h3 {
  margin: 0;
}


@media (max-width: 820px) {
  .character-overview-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .character-overview-gallery {
    grid-template-columns: 1fr;
  }
}


/* --- Crafting modal --- */
.crafting-help {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.crafting-recipe-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

@media (max-width: 680px) {
  .crafting-recipe-list {
    grid-template-columns: 1fr;
  }
}


/* --- Cheat code menu --- */
.button--cheat {
  border-color: rgba(216, 183, 91, .62);
  color: #efd981;
  background: rgba(132, 103, 37, .12);
}

.button--cheat:hover {
  border-color: #d7b85b;
  background: rgba(132, 103, 37, .22);
}

.cheat-modal {
  padding: clamp(14px, 3vw, 34px);
}

.cheat-modal .modal__backdrop {
  background:
    radial-gradient(circle at 50% 12%, rgba(176, 142, 54, .13), transparent 31rem),
    rgba(0, 0, 0, .82);
  backdrop-filter: blur(8px);
}

.modal__content--cheat {
  width: min(1120px, 100%);
  max-height: calc(100vh - clamp(28px, 6vw, 68px));
  overflow: auto;
  padding: clamp(24px, 4vw, 40px);
  border-color: rgba(166, 203, 101, .34);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(31, 42, 34, .97), rgba(13, 19, 15, .99) 58%),
    var(--panel);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, .56),
    inset 0 1px 0 rgba(255, 255, 255, .035);
  scrollbar-color: #5d714d #0a0f0c;
  scrollbar-width: thin;
}

.modal__content--cheat::-webkit-scrollbar {
  width: 10px;
}

.modal__content--cheat::-webkit-scrollbar-track {
  background: #0a0f0c;
}

.modal__content--cheat::-webkit-scrollbar-thumb {
  border: 2px solid #0a0f0c;
  border-radius: 999px;
  background: #5d714d;
}

.modal__content--cheat > .section-heading {
  align-items: center;
  gap: 24px;
  margin-bottom: clamp(22px, 3vw, 34px);
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(166, 203, 101, .2);
}

.modal__content--cheat > .section-heading h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: .035em;
}

.modal__content--cheat > .section-heading .eyebrow {
  margin-bottom: 7px;
}

.modal__content--cheat > .section-heading .text-button {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
}

.modal__content--cheat > .section-heading .text-button:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, .035);
}

.cheat-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.cheat-access {
  width: min(610px, 100%);
  margin: clamp(8px, 4vh, 44px) auto clamp(4px, 3vh, 28px);
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid rgba(215, 184, 91, .3);
  border-radius: 17px;
  background:
    linear-gradient(150deg, rgba(118, 91, 31, .11), rgba(11, 16, 13, .86) 56%),
    #0c110e;
  box-shadow:
    0 20px 46px rgba(0, 0, 0, .22),
    inset 0 1px 0 rgba(255, 255, 255, .025);
}

.cheat-access-intro {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 25px;
}

.cheat-access-intro strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 1.08rem;
}

.cheat-access-mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid rgba(215, 184, 91, .52);
  border-radius: 16px;
  color: #efd981;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(215, 184, 91, .09) 0 7px,
      transparent 7px 14px
    ),
    #12170f;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .14em;
  box-shadow: inset 0 0 22px rgba(215, 184, 91, .06);
}

.cheat-code-field {
  gap: 9px;
}

.cheat-code-field > span {
  color: #c9d1ca;
  font-weight: 700;
}

.cheat-modal .form-field {
  gap: 8px;
}

.cheat-modal .form-field > span {
  padding-left: 2px;
  color: #aeb9b0;
  font-size: .76rem;
  font-weight: 700;
}

.cheat-modal input[type="number"],
.cheat-modal input[type="password"] {
  width: 100%;
  min-height: 47px;
  padding: 11px 13px;
  border: 1px solid #35463a;
  border-radius: 10px;
  color: var(--text);
  background: rgba(7, 11, 8, .9);
  font: inherit;
  font-size: .91rem;
  transition:
    border-color .16s ease,
    background .16s ease,
    box-shadow .16s ease;
}

.cheat-modal input[type="password"] {
  min-height: 52px;
  padding-inline: 16px;
  letter-spacing: .08em;
}

.cheat-modal input[type="number"]:hover,
.cheat-modal input[type="password"]:hover {
  border-color: #536955;
  background: #0a100c;
}

.cheat-modal input[type="number"]:focus,
.cheat-modal input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  background: #0b120d;
  box-shadow: 0 0 0 3px rgba(166, 203, 101, .12);
}

.cheat-access .modal__actions {
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(215, 184, 91, .14);
}

.cheat-access .button {
  min-width: 170px;
}

.cheat-editor {
  display: grid;
  gap: 22px;
}

.cheat-editor[hidden],
.cheat-access[hidden] {
  display: none;
}

.cheat-editor-note {
  padding: 14px 16px;
  border: 1px solid rgba(215, 173, 89, .25);
  border-left: 4px solid var(--warning);
  border-radius: 11px;
  background: rgba(215, 173, 89, .07);
  color: #c8c2aa;
}

.cheat-section {
  display: grid;
  gap: 17px;
  padding: clamp(18px, 2.5vw, 25px);
  border: 1px solid rgba(63, 82, 68, .8);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(21, 30, 24, .9), rgba(10, 15, 12, .94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

.cheat-section + .cheat-section {
  padding-top: clamp(18px, 2.5vw, 25px);
  border-top: 1px solid rgba(63, 82, 68, .8);
}

.cheat-section > .section-heading {
  min-height: 31px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(166, 203, 101, .12);
}

.cheat-section > .section-heading h3 {
  margin: 0;
  color: #dce5dd;
  font-size: .98rem;
  letter-spacing: .025em;
}

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

.cheat-field-grid .form-field {
  padding: 12px;
  border: 1px solid rgba(51, 68, 57, .8);
  border-radius: 11px;
  background: rgba(7, 11, 8, .42);
}

.cheat-field-grid .form-field:focus-within {
  border-color: rgba(166, 203, 101, .43);
  background: rgba(10, 16, 12, .75);
}

.cheat-loot-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.cheat-loot-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 94px;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 10px 11px;
  border: 1px solid rgba(55, 72, 61, .82);
  border-radius: 12px;
  background: rgba(7, 11, 8, .55);
  transition:
    border-color .16s ease,
    background .16s ease,
    transform .16s ease;
}

.cheat-loot-row:hover {
  border-color: rgba(166, 203, 101, .38);
  background: rgba(13, 20, 15, .88);
  transform: translateY(-1px);
}

.cheat-loot-row img {
  width: 50px;
  height: 50px;
  display: block;
  object-fit: cover;
  border: 1px solid #334237;
  border-radius: 9px;
  background: #101611;
}

.cheat-loot-row span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.cheat-loot-row strong {
  overflow: hidden;
  color: #e2e8e3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cheat-loot-row small {
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}

.cheat-loot-row input {
  width: 100%;
  min-width: 0;
  text-align: center;
  font-weight: 800;
}

#cheatLootWeight {
  padding: 6px 10px;
  border-color: rgba(166, 203, 101, .28);
  color: var(--accent-strong);
  background: rgba(166, 203, 101, .08);
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(214, 107, 93, .32);
  border-radius: 9px;
  color: #ef9a8d;
  background: rgba(214, 107, 93, .08);
  font-weight: 700;
}

.form-success {
  min-height: 1.4em;
  margin: 0;
  padding: 0 2px;
  color: var(--success);
  font-weight: 700;
}

.cheat-apply-actions {
  position: sticky;
  bottom: -1px;
  justify-content: flex-end;
  margin: 0 -4px -4px;
  padding: 17px 4px 4px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(13, 19, 15, .96) 30%,
    rgba(13, 19, 15, .99)
  );
}

.cheat-apply-actions .button {
  min-width: min(260px, 100%);
  min-height: 48px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .modal__content--cheat {
    padding: 22px 18px;
    border-radius: 15px;
  }

  .cheat-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cheat-loot-list {
    grid-template-columns: 1fr;
  }

  .cheat-access {
    padding: 22px;
  }
}

@media (max-width: 520px) {
  .cheat-modal {
    padding: 8px;
  }

  .modal__content--cheat {
    max-height: calc(100vh - 16px);
    padding: 18px 13px;
  }

  .modal__content--cheat > .section-heading {
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 15px;
  }

  .cheat-access {
    margin-top: 4px;
    padding: 18px 15px;
  }

  .cheat-access-intro {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cheat-access-mark {
    width: 64px;
    height: 64px;
  }

  .cheat-field-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .cheat-section {
    padding: 15px 12px;
  }

  .cheat-loot-row {
    grid-template-columns: 44px minmax(0, 1fr) 78px;
    gap: 9px;
    min-height: 64px;
    padding: 8px;
  }

  .cheat-loot-row img {
    width: 44px;
    height: 44px;
  }

  .cheat-access .button,
  .cheat-apply-actions .button {
    width: 100%;
    min-width: 0;
  }
}


/* --- Clothing, equipment and shelter storage --- */
.player-profile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.player-profile-actions .character-overview-button {
  margin-top: 0;
}

.storage-access-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
}

.inventory-item {
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
}

.inventory-transfer-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #121a14;
  cursor: pointer;
}

.inventory-transfer-button:hover {
  border-color: var(--accent);
  background: rgba(166, 203, 101, .09);
}

.equipment-modal {
  padding: clamp(10px, 2vw, 28px);
}

.modal__content--equipment {
  width: min(1260px, 100%);
  max-height: calc(100vh - clamp(20px, 4vw, 56px));
  overflow: auto;
  padding: clamp(18px, 3vw, 30px);
  border-radius: 18px;
}

.equipment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
}

.equipment-meta p {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
}

.equipment-status {
  min-height: 1.4em;
  margin: 0 0 12px;
  color: var(--success);
  font-size: .78rem;
  font-weight: 700;
}

.equipment-status.is-error {
  color: var(--danger);
}

.equipment-layout {
  display: grid;
  grid-template-columns: minmax(230px, .85fr) minmax(330px, 1.15fr) minmax(230px, .85fr);
  gap: 15px;
  align-items: start;
}

.equipment-source-panel,
.equipment-character-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0b100d;
}

.equipment-source-panel {
  min-height: 560px;
  transition: border-color .15s ease, background .15s ease;
}

.equipment-source-panel.is-locked {
  opacity: .58;
}

.equipment-source-panel.is-drop-target,
.equipment-slot.is-drop-target {
  border-color: var(--accent);
  background: rgba(166, 203, 101, .08);
  box-shadow: inset 0 0 0 2px rgba(166, 203, 101, .12);
}

.equipment-storage-message {
  min-height: 2.8em;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.45;
}

.equipment-item-list {
  display: grid;
  gap: 8px;
  max-height: 500px;
  overflow: auto;
  padding-right: 3px;
}

.equipment-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #304137;
  border-radius: 10px;
  background: #101711;
  cursor: grab;
  overflow: hidden;
}

.equipment-item:active,
.equipment-slot.is-equipped:active {
  cursor: grabbing;
}

.equipment-item.is-dragging,
.equipment-slot.is-dragging {
  opacity: .42;
}

.equipment-item.is-incompatible {
  opacity: .56;
}

.equipment-item__image {
  width: 64px;
  height: 64px;
  display: block;
  box-sizing: border-box;
  padding: 5px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #080d0a;
}

.equipment-item > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.equipment-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .78rem;
}

.equipment-item small {
  color: var(--muted);
  font-size: .65rem;
}

.equipment-item .text-button {
  grid-column: 2 / -1;
  justify-self: start;
  padding: 2px 0;
  font-size: .68rem;
}

.equipment-character-panel {
  display: grid;
  gap: 13px;
}


.equipment-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.equipment-slot {
  min-height: 150px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 9px;
  border: 1px dashed #4c5d50;
  border-radius: 11px;
  background: #0d130f;
  transition: border-color .15s ease, background .15s ease;
}

.equipment-slot.is-equipped {
  border-style: solid;
  cursor: grab;
}

.equipment-slot__label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.equipment-slot__label strong {
  color: var(--accent-strong);
}

.equipment-slot__body {
  width: 100%;
  min-width: 0;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 7px;
}

.equipment-slot__item-image,
.equipment-slot__placeholder-image {
  width: 100%;
  height: clamp(128px, 15vw, 178px);
  display: block;
  box-sizing: border-box;
  padding: 8px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #080d0a;
}

.equipment-slot__body strong {
  font-size: .76rem;
}

.equipment-slot__empty {
  min-height: 75px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: .68rem;
}

.equipment-slot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.equipment-slot__actions .text-button {
  padding: 0;
  font-size: .65rem;
}

@media (max-width: 980px) {
  .equipment-layout {
    grid-template-columns: 1fr 1.2fr;
  }

  .equipment-storage-panel,
  #equipmentStoragePanel {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .equipment-item-list {
    max-height: 320px;
  }
}

@media (max-width: 680px) {
  .modal__content--equipment {
    padding: 15px 11px;
  }

  .equipment-layout {
    grid-template-columns: 1fr;
  }

  .equipment-character-panel {
    grid-row: 1;
  }

  .equipment-source-panel {
    min-height: 0;
  }

  .equipment-slots {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  .inventory-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .inventory-transfer-button {
    grid-column: 2 / -1;
    width: 100%;
    height: 27px;
  }

  .equipment-slots {
    grid-template-columns: 1fr;
  }
}


.equipment-slot__placeholder-image {
  filter: grayscale(.78) contrast(.88);
  opacity: .48;
  border-style: dashed;
}

.equipment-slot__empty-label {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 700;
  text-align: center;
}

.equipment-slot.is-empty:hover .equipment-slot__placeholder-image,
.equipment-slot.is-drop-target .equipment-slot__placeholder-image {
  filter: grayscale(.35) contrast(.95);
  opacity: .72;
}


.equipment-slot[data-equipment-slot="backpack"].is-empty .equipment-slot__body {
  min-height: 112px;
  align-content: center;
  justify-items: center;
}

.equipment-slot__empty-label--backpack {
  padding: 12px;
}


/* --- Arousal and voluntary intimacy systems --- */
.status-meter--arousal progress::-webkit-progress-value {
  background: linear-gradient(90deg, #986a72, #d692a2);
}

.status-meter--arousal progress::-moz-progress-bar {
  background: linear-gradient(90deg, #986a72, #d692a2);
}

.modal__content--private-moment {
  width: min(820px, 100%);
  padding: clamp(22px, 4vw, 36px);
}

.private-moment-media {
  display: grid;
  place-items: center;
  min-height: 340px;
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #090e0b;
}

.private-moment-media img,
.private-moment-media video {
  width: 100%;
  max-height: 520px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
}

.modal__content--intimacy {
  width: min(1040px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: clamp(22px, 4vw, 38px);
}

.intimacy-consent-note {
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid rgba(166, 203, 101, .24);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(166, 203, 101, .06);
  line-height: 1.55;
}

.intimacy-meter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.intimacy-meter-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c120e;
}

.intimacy-meter-card progress {
  width: 100%;
}

.intimacy-media-gallery[hidden] {
  display: none;
}

.intimacy-media-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  min-height: 180px;
  margin: 16px 0;
}

.intimacy-media-gallery video {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #090e0b;
}

.intimacy-media-gallery .empty-state {
  grid-column: 1 / -1;
}

.intimacy-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.intimacy-action-card {
  display: grid;
  gap: 7px;
  min-height: 136px;
  padding: 14px;
  border: 1px solid #3b4d40;
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  background: linear-gradient(145deg, #151e18, #0b100d);
  cursor: pointer;
}

.intimacy-action-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: #18221b;
}

.intimacy-action-card:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.intimacy-action-card strong {
  color: var(--accent-strong);
}

.intimacy-action-card span,
.intimacy-action-card small {
  color: var(--muted);
}

.intimacy-action-card em {
  color: var(--warning);
  font-size: .72rem;
  font-style: normal;
}

@media (max-width: 760px) {
  .intimacy-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intimacy-media-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .intimacy-meter-grid,
  .intimacy-action-grid {
    grid-template-columns: 1fr;
  }

  .modal__content--private-moment,
  .modal__content--intimacy {
    padding: 18px 13px;
  }
}


/* --- Medical inventory actions --- */
.inventory-item {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.inventory-item--medical {
  border-color: rgba(117, 189, 123, .34);
  background:
    linear-gradient(145deg, rgba(28, 52, 35, .34), rgba(12, 17, 14, .96));
}

.inventory-item__actions {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 2px;
}

.inventory-use-button,
.inventory-transfer-button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: .68rem;
  font-weight: 800;
  cursor: pointer;
}

.inventory-use-button {
  min-width: 102px;
  padding: 6px 10px;
  color: #d9efdc;
  background: rgba(75, 125, 82, .22);
}

.inventory-use-button:hover:not(:disabled) {
  border-color: var(--success);
  background: rgba(75, 125, 82, .36);
}

.inventory-use-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.inventory-item__actions .inventory-transfer-button {
  width: 34px;
  height: 30px;
}

@media (max-width: 430px) {
  .inventory-item__actions {
    grid-column: 1 / -1;
  }

  .inventory-use-button {
    flex: 1;
  }

  .inventory-item__actions .inventory-transfer-button {
    grid-column: auto;
    width: 42px;
    height: 30px;
  }
}


.equipment-slots-heading {
  margin-bottom: 1px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(166, 203, 101, .12);
}

.equipment-character-panel {
  align-content: start;
}


/* --- Mandatory language selection --- */
body.language-selection-required {
  overflow: hidden;
}

.language-gate {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 20%, rgba(166, 203, 101, .12), transparent 34rem),
    rgba(4, 8, 6, .96);
  backdrop-filter: blur(14px);
}

.language-gate[hidden] {
  display: none;
}

.language-gate__panel {
  width: min(680px, 100%);
  padding: clamp(26px, 5vw, 46px);
  border: 1px solid rgba(166, 203, 101, .42);
  border-radius: 22px;
  color: var(--text);
  text-align: center;
  background: linear-gradient(145deg, rgba(23, 34, 27, .98), rgba(8, 13, 10, .99));
  box-shadow: 0 32px 90px rgba(0, 0, 0, .66);
}

.language-gate__panel h2 {
  margin: 8px 0 14px;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
}

.language-gate__panel > p:not(.eyebrow) {
  margin: 6px auto;
  max-width: 540px;
  color: var(--muted);
  line-height: 1.55;
}

.language-gate__english {
  font-size: .9rem;
}

.language-gate__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.language-option {
  min-height: 124px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 20px;
  border: 1px solid #435847;
  border-radius: 15px;
  color: var(--text);
  background: #101812;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.language-option:hover,
.language-option:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(166, 203, 101, .11);
  outline: none;
}

.language-option strong {
  color: var(--accent-strong);
  font-size: 1.25rem;
}

.language-option span {
  color: var(--muted);
  font-size: .78rem;
}

.language-gate__close {
  margin-top: 22px;
}

@media (max-width: 560px) {
  .language-gate__actions {
    grid-template-columns: 1fr;
  }

  .language-option {
    min-height: 96px;
  }
}


/* --- Basement, post-combat outcomes, loot and critical warnings --- */
.critical-warnings {
  position: fixed;
  z-index: 1300;
  top: 14px;
  left: 14px;
  display: grid;
  width: min(320px, calc(100vw - 28px));
  gap: 8px;
  pointer-events: none;
}

.critical-warning {
  display: grid;
  gap: 2px;
  padding: 10px 13px;
  border: 1px solid rgba(238, 104, 92, .75);
  border-left-width: 5px;
  border-radius: 10px;
  background: rgba(38, 10, 10, .94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .38);
  animation: critical-warning-pulse 1.4s ease-in-out infinite alternate;
}

.critical-warning strong { color: #ffb2a9; font-size: .8rem; }
.critical-warning span { color: #f5d9d4; font-size: .7rem; }

@keyframes critical-warning-pulse {
  from { transform: translateY(0); box-shadow: 0 8px 28px rgba(0, 0, 0, .38); }
  to { transform: translateY(1px); box-shadow: 0 8px 34px rgba(173, 39, 29, .34); }
}

.basement-panel {
  border-color: rgba(126, 115, 91, .38);
  background: linear-gradient(145deg, rgba(27, 24, 18, .96), rgba(10, 13, 11, .98));
}

.basement-resident-card { border-color: rgba(145, 119, 80, .4); }

.modal__content--post-combat {
  width: min(840px, 100%);
  padding: clamp(22px, 4vw, 38px);
}

.modal__content--loot {
  width: min(1180px, 100%);
  max-height: calc(100vh - 34px);
  overflow: auto;
  padding: clamp(20px, 3vw, 34px);
}

.post-combat-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 14px;
}

.post-combat-actions .button { min-height: 64px; }

.loot-inventory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin: 18px 0;
}

.loot-inventory-panel {
  min-width: 0;
  min-height: 430px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0a100c;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.loot-inventory-panel.is-drop-target {
  border-color: var(--accent);
  background: rgba(166, 203, 101, .08);
  box-shadow: inset 0 0 0 2px rgba(166, 203, 101, .12);
}

.loot-transfer-indicator {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
}

.loot-inventory-list {
  display: grid;
  gap: 9px;
  max-height: min(500px, 58vh);
  overflow: auto;
  padding-right: 3px;
}

.loot-inventory-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #304137;
  border-radius: 11px;
  background: #0d130f;
  cursor: grab;
}

.loot-inventory-item:active { cursor: grabbing; }
.loot-inventory-item.is-dragging { opacity: .42; }
.loot-inventory-item.is-fixed { cursor: default; }

.loot-inventory-item img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.loot-inventory-item__info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.loot-inventory-item__info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loot-inventory-item small { color: var(--muted); }
.loot-returnable { color: var(--accent) !important; }

.loot-choice-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.loot-choice-actions .button {
  padding: 8px 10px;
  font-size: .68rem;
}

@media (max-width: 820px) {
  .post-combat-actions { grid-template-columns: 1fr; }

  .loot-inventory-layout {
    grid-template-columns: 1fr;
  }

  .loot-transfer-indicator {
    min-height: 28px;
    transform: rotate(90deg);
  }

  .loot-inventory-panel {
    min-height: 270px;
  }

  .loot-inventory-list {
    max-height: 340px;
  }

  .critical-warnings { top: 8px; left: 8px; width: calc(100vw - 16px); }
}

@media (max-width: 480px) {
  .loot-inventory-item {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .loot-inventory-item img {
    width: 50px;
    height: 50px;
  }

  .loot-choice-actions {
    justify-content: stretch;
  }

  .loot-choice-actions .button {
    flex: 1;
  }
}


@media (max-width: 760px) {
  .weapon-image {
    height: 100px;
  }
}

@media (max-width: 480px) {
  .weapon-image {
    height: 132px;
  }
}


.equipment-durability {
  display: grid;
  width: 100%;
  gap: 4px;
  margin-top: 3px;
}

.equipment-durability span {
  color: var(--muted);
  font-size: .66rem;
}

.equipment-durability progress {
  width: 100%;
  height: 7px;
}

.equipment-durability--worn span {
  color: #d8c58d;
}

.equipment-durability--critical span {
  color: #e79b91;
}

.modal__content--quest-journal{width:min(900px,100%);max-height:calc(100vh - 34px);overflow:auto;padding:clamp(22px,4vw,38px)}.quest-tabs{display:flex;gap:8px;margin:18px 0;border-bottom:1px solid var(--border)}.quest-tab{padding:11px 18px;border:0;border-bottom:3px solid transparent;color:var(--muted);background:transparent;cursor:pointer}.quest-tab.is-active{border-bottom-color:var(--accent);color:var(--text)}.quest-list{display:grid;gap:14px}.quest-card{display:grid;gap:12px;padding:17px;border:1px solid var(--border);border-radius:14px;background:#0b110d}.quest-card--completed{opacity:.88}.quest-card__heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}.quest-card h3{margin:3px 0 0}.quest-card p{margin:0;color:var(--muted)}.quest-objectives{display:grid;gap:8px;margin:0;padding:0;list-style:none}.quest-objectives li{display:flex;justify-content:space-between;gap:16px;padding:9px 11px;border-radius:9px;background:#111a14}.quest-objectives li.is-complete{color:var(--accent)}.modal__content--quest-scene{width:min(1180px,calc(100vw - 32px));max-height:calc(100vh - 28px);overflow:auto;padding:clamp(18px,3vw,34px)}.quest-scene-heading{margin-bottom:14px}.quest-scene-heading h2{margin:4px 0 0}.quest-scene-media{width:100%}.quest-scene-media img,.quest-scene-media video{display:block;width:100%;max-width:none;aspect-ratio:16/9;object-fit:contain;border:1px solid var(--border);border-radius:14px;background:#070b08}.quest-scene-text{max-width:900px;margin:22px auto;color:var(--text);font-size:clamp(1rem,1.7vw,1.22rem);line-height:1.65;text-align:center}.quest-scene-text:empty{display:none}.quest-scene-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.quest-scene-actions .button{min-width:170px}@media(max-width:620px){.quest-card__heading{display:grid}.quest-scene-actions{display:grid;grid-template-columns:1fr}.quest-scene-actions .button{width:100%}}


@media (max-width: 680px) {
  .equipment-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
  }

  .equipment-item__image {
    width: 58px;
    height: 58px;
  }

  .equipment-slot__item-image,
  .equipment-slot__placeholder-image {
    height: 150px;
  }
}

@media (max-width: 430px) {
  .equipment-item {
    grid-template-columns: 54px minmax(0, 1fr) auto;
  }

  .equipment-item__image {
    width: 54px;
    height: 54px;
  }

  .equipment-slot__item-image,
  .equipment-slot__placeholder-image {
    height: 190px;
  }
}




/* --- Unified profile action icons --- */
.player-profile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.player-profile-action-button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  text-align: left;
}

.player-profile-action-button .button-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: block;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  box-shadow: none;
  background: transparent;
}

.player-profile-action-button > span:not(.badge) {
  min-width: 0;
  align-self: center;
  line-height: 1.2;
}

.character-overview-button,
.equipment-button,
.quest-journal-button {
  margin-top: 0;
}

.quest-journal-button {
  grid-column: auto;
}

.quest-journal-badge {
  min-width: 24px;
  justify-self: end;
  text-align: center;
}

.modal-heading-with-icon {
  display: inline-grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-heading-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: block;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  box-shadow: none;
  background: transparent;
}

.modal-heading-with-icon > span {
  min-width: 0;
  line-height: 1.15;
}

@media (max-width: 560px) {
  .player-profile-action-button {
    min-height: 48px;
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .modal-heading-with-icon {
    grid-template-columns: 30px minmax(0, 1fr);
  }
}


/* --- Discard inventory and storage items --- */
.inventory-discard-button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(205, 112, 96, .52);
  border-radius: 8px;
  color: #efb2a8;
  background: rgba(112, 38, 31, .2);
  font: inherit;
  font-size: .66rem;
  font-weight: 800;
  cursor: pointer;
}

.inventory-discard-button:hover:not(:disabled) {
  border-color: var(--danger);
  color: #ffd1ca;
  background: rgba(142, 48, 39, .36);
}

.inventory-discard-button--all {
  border-style: dashed;
}

.inventory-discard-button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

@media (max-width: 430px) {
  .inventory-discard-button {
    flex: 1 1 auto;
  }
}


/* --- Quest cutscene: lock both side menus --- */
.quest-scene-active #leftSidebar,
.quest-scene-active #rightSidebar,
#leftSidebar.is-quest-scene-locked,
#rightSidebar.is-quest-scene-locked {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  touch-action: none;
  filter: grayscale(.45) brightness(.58);
  opacity: .48;
  cursor: not-allowed;
}

.quest-scene-active #leftSidebar *,
.quest-scene-active #rightSidebar *,
#leftSidebar.is-quest-scene-locked *,
#rightSidebar.is-quest-scene-locked * {
  pointer-events: none !important;
}

.quest-scene-active #leftSidebar::after,
.quest-scene-active #rightSidebar::after,
#leftSidebar.is-quest-scene-locked::after,
#rightSidebar.is-quest-scene-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
  background: rgba(4, 8, 6, .28);
}


/* --- Age gate, language order and story prologue --- */
body.startup-pending .game-shell {
  visibility: hidden;
}

body.age-gate-active,
body.age-exit-active,
body.story-intro-active {
  overflow: hidden;
}

body.age-gate-active .game-shell,
body.age-exit-active .game-shell,
body.story-intro-active .game-shell {
  display: none;
}

.age-gate,
.age-exit-screen,
.story-intro {
  position: fixed;
  inset: 0;
  z-index: 110000;
  overflow: auto;
  padding: clamp(16px, 3vw, 34px);
  background:
    radial-gradient(circle at 50% 12%, rgba(151, 188, 104, .13), transparent 34rem),
    rgba(3, 7, 5, .98);
}

.age-gate[hidden],
.age-exit-screen[hidden],
.story-intro[hidden] {
  display: none;
}

.age-gate,
.age-exit-screen {
  display: grid;
  place-items: center;
}

.age-gate__panel,
.age-exit-screen__panel {
  width: min(720px, 100%);
  padding: clamp(25px, 5vw, 48px);
  border: 1px solid rgba(166, 203, 101, .42);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(23, 34, 27, .99), rgba(8, 13, 10, .99));
  box-shadow: 0 34px 100px rgba(0, 0, 0, .72);
}

.age-gate__panel {
  text-align: center;
}

.age-gate__panel h2,
.age-exit-screen__panel h2 {
  margin: 7px 0 18px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

.age-gate__primary,
.age-gate__secondary,
.age-gate__notice,
.age-exit-screen__panel p {
  max-width: 590px;
  margin: 10px auto;
  color: var(--muted);
  line-height: 1.65;
}

.age-gate__secondary {
  font-size: .88rem;
}

.age-gate__notice {
  color: #d4dfd1;
  font-weight: 700;
}

.age-gate__actions {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(130px, .65fr);
  gap: 12px;
  margin-top: 28px;
}

.age-gate__actions .button {
  min-height: 48px;
}

.story-intro {
  display: block;
}

.story-intro__panel {
  width: min(1520px, 100%);
  min-height: calc(100vh - clamp(32px, 6vw, 68px));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 38px);
  border: 1px solid rgba(166, 203, 101, .3);
  border-radius: 20px;
  background: rgba(9, 15, 11, .97);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .62);
}

.story-intro__panel h2 {
  margin: 0 0 4px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.story-intro__image {
  width: 100%;
  max-width: none;
  aspect-ratio: 18 / 7.6;
  display: block;
  object-fit: contain;
  object-position: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #070b08;
}

.story-intro__text {
  width: min(980px, 100%);
  display: grid;
  gap: 12px;
  color: #d1d9d1;
  font-size: clamp(.96rem, 1.35vw, 1.12rem);
  line-height: 1.72;
}

.story-intro__text p {
  margin: 0;
}

.story-intro__text strong {
  color: var(--accent-strong);
}

.story-intro__start {
  min-width: min(330px, 100%);
  min-height: 52px;
  margin-top: 8px;
  font-size: 1rem;
}

@media (max-width: 620px) {
  .age-gate__actions {
    grid-template-columns: 1fr;
  }

  .story-intro__panel {
    align-content: start;
  }

  .story-intro__image {
    aspect-ratio: 16 / 9;
  }
}


/* --- Hard visibility guarantee for the age disclaimer --- */
body.age-gate-active > #ageGate.is-active:not([hidden]) {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body.age-gate-active > #ageGate.is-active:not([hidden]) > .age-gate__panel {
  display: block;
  visibility: visible;
  opacity: 1;
}


/* --- The World After Silence: creation, treatment and training UX --- */
.footer--status-only {
  justify-content: flex-end;
}

.modal__content--creation {
  width: min(1120px, calc(100% - 24px));
  max-height: calc(100vh - 28px);
  margin: 14px 0;
  padding: 0;
  overflow: auto;
  border-color: rgba(166, 203, 101, .35);
  background:
    radial-gradient(circle at 90% 0%, rgba(166, 203, 101, .08), transparent 22rem),
    linear-gradient(155deg, #141d17, #0a0f0c 70%);
}

.creation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--border);
}

.creation-header h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.creation-header__description {
  max-width: 680px;
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.creation-step-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(166, 203, 101, .34);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(166, 203, 101, .08);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .1em;
}

.creation-warning {
  margin: 18px 28px 0;
}

.creation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 20px;
  padding: 20px 28px 24px;
}

.creation-form-column {
  display: grid;
  gap: 16px;
}

.creation-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(8, 13, 10, .62);
}

.creation-section__heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.creation-section__heading h3,
.creation-section__heading p {
  margin: 0;
}

.creation-section__heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.45;
}

.creation-section__number {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(166, 203, 101, .42);
  border-radius: 9px;
  color: var(--accent-strong);
  background: rgba(166, 203, 101, .08);
  font-size: .72rem;
  font-weight: 900;
}

.creation-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.creation-grid--primary .creation-field:nth-child(2) {
  grid-column: span 2;
}

.creation-field {
  padding: 11px;
  border: 1px solid rgba(84, 105, 91, .55);
  border-radius: 11px;
  background: rgba(12, 18, 14, .88);
}

.creation-field > span {
  color: #c8d2c8;
  font-weight: 700;
}

.creation-field select {
  min-height: 45px;
  border-color: rgba(120, 148, 125, .55);
  background: #080d0a;
}

.creation-field select:focus {
  outline: 2px solid rgba(166, 203, 101, .32);
  outline-offset: 2px;
}

.creation-body-options {
  margin: 0;
}

.creation-adult-note {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid rgba(166, 203, 101, .5);
  background: rgba(166, 203, 101, .05);
}

.creation-preview {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 20px;
  border-color: rgba(166, 203, 101, .36);
  background: linear-gradient(160deg, rgba(24, 36, 27, .98), rgba(9, 15, 11, .98));
}

.creation-preview h3,
.creation-preview p {
  margin: 0;
}

.creation-preview__eyebrow,
.creation-preview__label {
  color: var(--accent);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.creation-preview__description {
  color: var(--muted);
  line-height: 1.55;
}

.creation-preview__summary {
  margin: 0;
  line-height: 1.55;
}

.player-attributes--preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.creation-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: rgba(8, 13, 10, .96);
  backdrop-filter: blur(10px);
}

.creation-actions__primary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.creation-actions__primary span {
  max-width: 310px;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
  text-align: right;
}

.creation-start-button {
  min-width: 210px;
  min-height: 46px;
}

.resident-treatment-panel {
  margin: 16px 0;
  padding: 15px;
  border: 1px solid rgba(107, 151, 115, .38);
  border-radius: 13px;
  background: rgba(16, 25, 19, .86);
}

.resident-treatment-panel .section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .72rem;
}

.resident-treatment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.resident-treatment-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b110d;
}

.resident-treatment-card img {
  width: 46px;
  height: 46px;
  padding: 4px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070b08;
}

.resident-treatment-card__body {
  display: grid;
  gap: 3px;
}

.resident-treatment-card__body span {
  color: var(--muted);
  font-size: .7rem;
}

.modal__content--training {
  width: min(1060px, 100%);
  max-height: calc(100vh - 34px);
  overflow: auto;
}

.training-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(166, 203, 101, .05);
}

.training-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.training-status {
  min-height: 1.3em;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: .78rem;
}

.training-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.training-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(155deg, rgba(18, 28, 21, .96), rgba(9, 14, 11, .96));
}

.training-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.training-card__header > div {
  display: grid;
  gap: 4px;
}

.training-card__header span:not(.badge),
.training-card p {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}

.training-card p {
  margin: 0;
}

.training-card__costs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.training-card__costs span {
  padding: 5px 7px;
  border: 1px solid rgba(91, 118, 98, .52);
  border-radius: 999px;
  color: #bac8bb;
  background: rgba(7, 12, 9, .72);
  font-size: .64rem;
}

.training-card .button {
  align-self: end;
  width: 100%;
  margin-top: auto;
}

@media (max-width: 820px) {
  .creation-layout {
    grid-template-columns: 1fr;
  }

  .creation-preview {
    position: static;
  }

  .training-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .creation-header,
  .creation-actions,
  .creation-actions__primary,
  .training-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .creation-header {
    padding: 20px;
  }

  .creation-warning {
    margin-inline: 20px;
  }

  .creation-layout {
    padding: 16px 20px 20px;
  }

  .creation-grid,
  .creation-grid--primary .creation-field:nth-child(2),
  .player-attributes--preview {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .creation-actions {
    padding: 14px 20px;
  }

  .creation-actions__primary span {
    max-width: none;
    text-align: left;
  }

  .creation-start-button,
  .creation-cancel-button {
    width: 100%;
  }

  .resident-treatment-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .resident-treatment-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }
}


/* --- Resident interaction modal redesign --- */
.resident-modal {
  z-index: 1350;
  padding: clamp(8px, 2vw, 20px);
}

.modal__content--resident {
  width: min(1120px, 100%);
  height: min(900px, calc(100vh - clamp(16px, 4vw, 40px)));
  max-height: calc(100vh - clamp(16px, 4vw, 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0;
  overflow: hidden;
  border-color: rgba(166, 203, 101, .38);
  background:
    radial-gradient(circle at 86% 0%, rgba(166, 203, 101, .08), transparent 25rem),
    linear-gradient(155deg, rgba(21, 31, 24, .99), rgba(8, 13, 10, .99));
}

.resident-modal__header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px 17px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 18, 14, .96);
}

.resident-modal__header h2,
.resident-modal__header p {
  margin: 0;
}

.resident-modal__header h2 {
  margin-top: 3px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.resident-modal__subtitle {
  max-width: 680px;
  margin-top: 7px !important;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

.resident-modal__close {
  flex: 0 0 auto;
}

.resident-modal__scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 18px 24px 22px;
}

.resident-modal__layout {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(0, 1.55fr);
  gap: 18px;
  align-items: start;
}

.resident-profile-panel,
.resident-status-panel,
.resident-treatment-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(10, 16, 12, .86);
}

.resident-profile-panel {
  position: sticky;
  top: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.resident-profile-panel__image {
  min-height: 260px;
  max-height: 360px;
  aspect-ratio: 4 / 5;
  object-position: center top;
}

.resident-profile-panel__summary {
  margin: 0;
  font-size: .75rem;
}

.resident-profile-panel__appearance {
  margin: 0;
}

.resident-care-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.resident-status-panel,
.resident-treatment-panel {
  margin: 0;
  padding: 16px;
}

.resident-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.resident-section-heading h3,
.resident-section-heading p {
  margin: 0;
}

.resident-section-heading h3 {
  margin-top: 3px;
}

.resident-section-heading > div > p:not(.resident-section-label) {
  margin-top: 5px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
}

.resident-section-label,
.resident-action-group__title {
  color: var(--accent);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.resident-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.resident-stat-grid .stat-card {
  min-width: 0;
}

.resident-treatment-list {
  margin-top: 0;
}

.resident-treatment-card {
  grid-template-columns: 52px minmax(0, 1fr) minmax(118px, auto);
  min-width: 0;
  padding: 10px;
}

.resident-treatment-card img {
  width: 52px;
  height: 52px;
}

.resident-treatment-card__body {
  min-width: 0;
}

.resident-treatment-card__body strong,
.resident-treatment-card__body span {
  overflow-wrap: anywhere;
}

.resident-action-dock {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1.3fr .75fr;
  gap: 10px;
  padding: 13px 18px 15px;
  border-top: 1px solid var(--border);
  background: rgba(7, 11, 8, .97);
  box-shadow: 0 -16px 34px rgba(0, 0, 0, .24);
}

.resident-action-group {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(80, 102, 85, .48);
  border-radius: 11px;
  background: rgba(14, 21, 16, .82);
}

.resident-action-group--danger {
  border-color: rgba(214, 107, 93, .3);
  background: rgba(70, 24, 20, .12);
}

.resident-action-group__title {
  margin: 0;
}

.resident-action-group--danger .resident-action-group__title {
  color: #e5a39a;
}

.resident-action-group__buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.resident-action-group:first-child .resident-action-group__buttons,
.resident-action-group:nth-child(2) .resident-action-group__buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resident-action-group__buttons .button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 8px;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.22;
  font-size: clamp(.67rem, .75vw, .78rem);
}

.resident-action-group__buttons .button[hidden] {
  display: none;
}

@media (max-width: 960px) {
  .resident-action-dock {
    grid-template-columns: 1fr 1fr;
    max-height: 38vh;
    overflow: auto;
  }

  .resident-action-group--danger {
    grid-column: 1 / -1;
  }

  .resident-action-group--danger .resident-action-group__buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .resident-modal {
    padding: 0;
    place-items: stretch;
  }

  .modal__content--resident {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .resident-modal__header {
    padding: 15px 16px 13px;
  }

  .resident-modal__subtitle {
    display: none;
  }

  .resident-modal__scroll {
    padding: 14px 16px 18px;
  }

  .resident-modal__layout {
    grid-template-columns: 1fr;
  }

  .resident-profile-panel {
    position: static;
    grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr);
    align-items: start;
  }

  .resident-profile-panel__image {
    grid-row: span 2;
    min-height: 160px;
    max-height: 230px;
    aspect-ratio: 4 / 5;
  }

  .resident-profile-panel__appearance {
    align-self: start;
  }

  .resident-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resident-action-dock {
    grid-template-columns: 1fr;
    max-height: 42dvh;
    padding: 10px 12px 12px;
    overflow: auto;
  }

  .resident-action-group--danger {
    grid-column: auto;
  }

  .resident-action-group:first-child .resident-action-group__buttons,
  .resident-action-group:nth-child(2) .resident-action-group__buttons,
  .resident-action-group--danger .resident-action-group__buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .resident-profile-panel {
    grid-template-columns: 1fr;
  }

  .resident-profile-panel__image {
    grid-row: auto;
    width: min(220px, 100%);
    justify-self: center;
  }

  .resident-treatment-card {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .resident-treatment-card img {
    width: 46px;
    height: 46px;
  }

  .resident-treatment-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .resident-action-group:first-child .resident-action-group__buttons,
  .resident-action-group:nth-child(2) .resident-action-group__buttons,
  .resident-action-group--danger .resident-action-group__buttons {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 680px) and (min-width: 761px) {
  .modal__content--resident {
    height: calc(100vh - 12px);
    max-height: calc(100vh - 12px);
  }

  .resident-modal {
    padding-block: 6px;
  }

  .resident-modal__header {
    padding-block: 13px 11px;
  }

  .resident-modal__scroll {
    padding-block: 12px;
  }

  .resident-profile-panel__image {
    min-height: 200px;
    max-height: 260px;
  }

  .resident-action-dock {
    max-height: 34vh;
    overflow: auto;
  }
}


/* --- Patreon support CTA --- */
.patreon-button {
  position: relative;
  isolation: isolate;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-inline: 15px;
  overflow: hidden;
  border-color: rgba(255, 92, 77, .9);
  color: #fff;
  background:
    linear-gradient(135deg, #ff424d, #e62f49 58%, #c81e3d);
  box-shadow:
    0 8px 24px rgba(230, 47, 73, .3),
    inset 0 1px 0 rgba(255, 255, 255, .22);
  font-weight: 900;
  text-decoration: none;
}

.patreon-button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, .24) 48%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .45s ease;
}

.patreon-button:hover {
  border-color: #ff897f;
  color: #fff;
  background:
    linear-gradient(135deg, #ff5861, #f23852 58%, #dc2444);
  box-shadow:
    0 11px 30px rgba(230, 47, 73, .42),
    inset 0 1px 0 rgba(255, 255, 255, .28);
  transform: translateY(-1px);
}

.patreon-button:hover::before {
  transform: translateX(120%);
}

.patreon-button:focus-visible {
  outline: 3px solid rgba(255, 128, 119, .48);
  outline-offset: 3px;
}

.patreon-button__icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  fill: currentColor;
}

@media (max-width: 760px) {
  .topbar__actions {
    width: 100%;
  }

  .patreon-button {
    order: -1;
    justify-content: center;
    width: 100%;
  }
}

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


@media (max-width: 1180px) and (min-width: 761px) {
  .resident-action-dock {
    grid-template-columns: 1fr 1fr;
  }

  .resident-action-group--danger {
    grid-column: 1 / -1;
  }

  .resident-action-group:first-child .resident-action-group__buttons,
  .resident-action-group:nth-child(2) .resident-action-group__buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resident-action-group--danger .resident-action-group__buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* --- Mobile off-canvas sidebars --- */
.mobile-sidebar-controls,
.mobile-sidebar-header,
.mobile-sidebar-backdrop {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --mobile-toggle-width: 38px;
    --mobile-toggle-gap: 10px;
    --mobile-drawer-width: min(
      88vw,
      360px,
      calc(100vw - var(--mobile-toggle-width) - var(--mobile-toggle-gap))
    );
  }

  body.mobile-sidebar-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .layout {
    display: block;
  }

  .main-column {
    width: 100%;
  }

  .mobile-sidebar-controls {
    display: block;
  }

  .mobile-sidebar-toggle {
    position: fixed;
    z-index: 96;
    top: 50%;
    width: var(--mobile-toggle-width);
    height: 74px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(166, 203, 101, .68);
    color: var(--accent-strong);
    background:
      linear-gradient(145deg, rgba(25, 38, 29, .98), rgba(8, 13, 10, .98));
    box-shadow: 0 12px 34px rgba(0, 0, 0, .48);
    cursor: pointer;
    transform: translateY(-50%);
    transition:
      left .24s ease,
      right .24s ease,
      transform .16s ease,
      background .16s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-sidebar-toggle:hover,
  .mobile-sidebar-toggle:focus-visible {
    color: #f2ffe1;
    background:
      linear-gradient(145deg, rgba(49, 70, 51, .99), rgba(13, 21, 16, .99));
  }

  .mobile-sidebar-toggle:focus-visible {
    outline: 3px solid rgba(166, 203, 101, .34);
    outline-offset: 2px;
  }

  .mobile-sidebar-toggle--left {
    left: 0;
    border-left: 0;
    border-radius: 0 13px 13px 0;
  }

  .mobile-sidebar-toggle--right {
    right: 0;
    border-right: 0;
    border-radius: 13px 0 0 13px;
  }

  body.mobile-left-sidebar-open .mobile-sidebar-toggle--left {
    left: calc(var(--mobile-drawer-width) - var(--mobile-toggle-width));
  }

  body.mobile-right-sidebar-open .mobile-sidebar-toggle--right {
    right: calc(var(--mobile-drawer-width) - var(--mobile-toggle-width));
  }

  body.mobile-left-sidebar-open .mobile-sidebar-toggle--right,
  body.mobile-right-sidebar-open .mobile-sidebar-toggle--left {
    z-index: 98;
  }

  .mobile-sidebar-toggle__icon {
    display: block;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    z-index: 88;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, .68);
    backdrop-filter: blur(3px);
    transition: opacity .22s ease;
  }

  body.mobile-sidebar-open .mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  #leftSidebar,
  #rightSidebar {
    position: fixed;
    z-index: 92;
    top: 0;
    bottom: 0;
    width: var(--mobile-drawer-width);
    max-width: var(--mobile-drawer-width);
    height: 100dvh;
    max-height: 100dvh;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 14px calc(24px + env(safe-area-inset-bottom));
    margin: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 50% 0%, rgba(166, 203, 101, .08), transparent 23rem),
      rgba(12, 18, 14, .99);
    box-shadow: 0 0 42px rgba(0, 0, 0, .62);
    visibility: hidden;
    transition:
      transform .24s ease,
      visibility 0s linear .24s;
  }

  #leftSidebar {
    left: 0;
    border-width: 0 1px 0 0;
    transform: translateX(-104%);
  }

  #rightSidebar {
    right: 0;
    border-width: 0 0 0 1px;
    transform: translateX(104%);
  }

  #leftSidebar.is-mobile-open,
  #rightSidebar.is-mobile-open {
    visibility: visible;
    transform: translateX(0);
    transition:
      transform .24s ease,
      visibility 0s linear 0s;
  }

  .mobile-sidebar-header {
    position: sticky;
    z-index: 2;
    top: 0;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 -14px 15px;
    padding:
      calc(12px + env(safe-area-inset-top))
      14px
      12px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 16, 12, .97);
    backdrop-filter: blur(9px);
  }

  .mobile-sidebar-header strong {
    color: var(--text);
    font-size: .86rem;
    letter-spacing: .035em;
  }

  .mobile-sidebar-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, .035);
    font: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-sidebar-close:hover,
  .mobile-sidebar-close:focus-visible {
    border-color: var(--accent);
    color: var(--accent-strong);
    background: rgba(166, 203, 101, .08);
  }

  .mobile-sidebar-close:focus-visible {
    outline: 3px solid rgba(166, 203, 101, .28);
    outline-offset: 2px;
  }

  #leftSidebar > .mini-panel:first-of-type,
  #rightSidebar > section:first-of-type {
    margin-top: 0;
  }

  body.is-dead .mobile-sidebar-controls,
  body.age-gate-active .mobile-sidebar-controls,
  body.age-exit-active .mobile-sidebar-controls,
  body.story-intro-active .mobile-sidebar-controls,
  body.startup-pending .mobile-sidebar-controls {
    display: none;
  }
}

@media (max-width: 420px) {
  :root {
    --mobile-toggle-width: 34px;
    --mobile-drawer-width: min(
      91vw,
      350px,
      calc(100vw - var(--mobile-toggle-width) - var(--mobile-toggle-gap))
    );
  }

  .mobile-sidebar-toggle {
    height: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-sidebar-toggle,
  .mobile-sidebar-backdrop,
  #leftSidebar,
  #rightSidebar {
    transition: none !important;
  }
}


/* --- Cumulative quest scene timeline --- */
.quest-scene-timeline {
  display: grid;
  gap: 0;
  width: 100%;
}

.quest-scene-step {
  position: relative;
  width: 100%;
  padding: 8px 0 30px;
  scroll-margin-top: 10px;
  outline: none;
}

.quest-scene-step + .quest-scene-step {
  padding-top: 30px;
  border-top: 1px solid rgba(166, 203, 101, .22);
}

.quest-scene-step.is-complete {
  opacity: .82;
}

.quest-scene-step.is-current {
  opacity: 1;
}

.quest-scene-step:focus-visible {
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(166, 203, 101, .58);
}

.quest-scene-step:last-child {
  padding-bottom: 4px;
}

.quest-scene-step .quest-scene-actions {
  margin-bottom: 0;
}


/* --- Quest cutscene action spacing --- */
.quest-scene-actions {
  margin: 26px 0 14px;
  padding: 6px 12px;
}

.quest-scene-actions .button {
  margin: 4px;
}

@media (max-width: 620px) {
  .quest-scene-actions {
    gap: 12px;
    padding-inline: 4px;
  }

  .quest-scene-actions .button {
    margin: 0;
  }
}


/* --- Full infected portraits in combat --- */
.combat-image.combat-image--infected {
  height: clamp(280px, 46vh, 440px);
  box-sizing: border-box;
  padding: 8px;
  object-fit: contain;
  object-position: center;
  background: #070b08;
}

@media (max-width: 760px) {
  .combat-image.combat-image--infected {
    height: clamp(260px, 52vh, 400px);
  }
}

@media (max-width: 480px) {
  .combat-image.combat-image--infected {
    height: clamp(240px, 48vh, 340px);
    padding: 5px;
  }
}


/* --- Full player portrait in combat --- */
.combat-image.combat-image--player {
  height: clamp(280px, 46vh, 440px);
  box-sizing: border-box;
  padding: 8px;
  object-fit: contain;
  object-position: center;
  background: #070b08;
}

@media (max-width: 760px) {
  .combat-image.combat-image--player {
    height: clamp(260px, 52vh, 400px);
  }
}

@media (max-width: 480px) {
  .combat-image.combat-image--player {
    height: clamp(240px, 48vh, 340px);
    padding: 5px;
  }
}


/* --- Keep the combat backdrop fixed while the combat modal scrolls --- */
.modal--combat > .modal__backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100dvh;
}
