:root {
  --bg: #090d10;
  --panel: rgba(9, 13, 16, 0.86);
  --panel-border: rgba(160, 132, 83, 0.45);
  --ink: #e4d6bc;
  --muted: #aa9778;
  --accent: #c98e48;
  --cold: #6385a0;
  --danger: #c35c46;
  --forest: #78865b;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(112, 140, 158, 0.16), transparent 34%),
    radial-gradient(circle at left, rgba(45, 78, 66, 0.12), transparent 28%),
    radial-gradient(circle at right, rgba(91, 59, 31, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(12, 20, 24, 0.97), rgba(7, 12, 15, 0.99)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 0, rgba(255, 255, 255, 0.014) 1px, transparent 1px, transparent 64px),
    linear-gradient(rgba(255, 255, 255, 0.014) 0, rgba(255, 255, 255, 0.014) 1px, transparent 1px, transparent 64px);
  background-size: auto, auto, auto, auto, 64px 64px, 64px 64px;
  background-color: var(--bg);
  font-family: "Consolas", "Lucida Console", monospace;
}

body.menu-open .game-hud,
body.menu-open .panel,
body.menu-open .prompt-panel,
body.menu-open .intro {
  opacity: 0.42;
  filter: saturate(0.7);
}

.shell {
  width: 100%;
  max-width: 1900px;
  margin: 0 auto;
  padding: 14px 24px 26px;
}

.mobile-gate {
  display: none;
}

.mobile-gate-card {
  width: calc(100vw - 40px);
  max-width: 420px;
  min-width: 0;
  padding: 24px 22px 22px;
  background:
    linear-gradient(180deg, rgba(14, 19, 22, 0.96), rgba(8, 11, 14, 0.96)),
    radial-gradient(circle at top left, rgba(201, 142, 72, 0.1), transparent 55%);
  border: 1px solid rgba(190, 156, 98, 0.42);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.mobile-gate-card h1 {
  margin: 0 0 14px;
  color: #f0dfbf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.9rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.mobile-gate-card p:not(.eyebrow) {
  margin: 0;
  color: #d5c8af;
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mobile-gate-card span {
  display: block;
  margin-top: 18px;
  color: #f0c66c;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.intro {
  margin: 0 0 10px;
  padding: 9px 12px;
  background: linear-gradient(180deg, rgba(10, 16, 18, 0.76), rgba(6, 10, 12, 0.64));
  border: 1px solid rgba(160, 132, 83, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

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

.monitor-title {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.intro h1 {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
}

.monitor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.monitor-link {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 7px 10px;
  border: 1px solid rgba(190, 156, 98, 0.34);
  background: rgba(8, 12, 14, 0.62);
  color: #e4d4b9;
  font: inherit;
  font-size: 0.7rem;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.monitor-link:hover,
.monitor-link:focus-visible {
  border-color: rgba(213, 170, 99, 0.72);
  background: rgba(25, 35, 38, 0.84);
  color: #f3dfb8;
  outline: none;
}

.monitor-guide {
  grid-column: 1 / -1;
  padding-top: 9px;
  border-top: 1px solid rgba(160, 132, 83, 0.18);
}

.monitor-guide-grid {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 7px 14px;
  color: #d5c2a1;
  font-size: 0.76rem;
  line-height: 1.35;
}

.monitor-guide-grid span {
  color: #b39b79;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.monitor-guide-grid strong {
  color: #e4d4b9;
  font-weight: 400;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 270px);
  gap: 12px;
  align-items: start;
  justify-content: center;
  min-width: 0;
}

.panel,
.prompt-panel {
  min-width: 0;
  background: linear-gradient(180deg, rgba(14, 19, 22, 0.94), rgba(8, 11, 14, 0.92));
  border: 1px solid var(--panel-border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
}

.panel {
  padding: 16px 14px;
  min-height: 100%;
}

.panel-block + .panel-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(160, 132, 83, 0.2);
}

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

.panel-block-head .label {
  margin-bottom: 0;
}

.panel-mini-button {
  appearance: none;
  border: 1px solid rgba(160, 132, 83, 0.42);
  background: rgba(18, 26, 29, 0.74);
  color: #d8c6a8;
  font: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 8px;
  cursor: pointer;
}

.panel-mini-button:hover {
  border-color: rgba(213, 170, 99, 0.72);
  background: rgba(30, 40, 45, 0.88);
}

.panel-right {
  position: sticky;
  top: 14px;
}

.label {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
}

.bar-group {
  display: grid;
  gap: 10px;
}

.bar-row,
.meta-grid,
.inventory-grid {
  display: grid;
  gap: 8px;
  align-items: center;
}

.bar-row {
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  font-size: 0.82rem;
}

.bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 120ms linear;
}

.fill-health {
  background: linear-gradient(90deg, #6e1e1b, #cb5c44);
}

.fill-hunger {
  background: linear-gradient(90deg, #66551d, #d7a341);
}

.fill-warmth {
  background: linear-gradient(90deg, #335e78, #8fbbd4);
}

.fill-fire {
  background: linear-gradient(90deg, #7d2b11, #f19a4b);
}

.meta-grid,
.inventory-grid {
  grid-template-columns: 1fr auto;
  font-size: 0.84rem;
}

.meta-grid span,
.inventory-grid span {
  color: #b5a286;
}

.agent-rank-list,
.zone-pressure-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.agent-rank-list {
  max-height: 214px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 7px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(170, 151, 120, 0.72) rgba(12, 18, 20, 0.62);
  scrollbar-width: thin;
}

.agent-rank-list::-webkit-scrollbar {
  width: 8px;
}

.agent-rank-list::-webkit-scrollbar-track {
  background: rgba(8, 12, 14, 0.7);
  border-left: 1px solid rgba(160, 132, 83, 0.12);
}

.agent-rank-list::-webkit-scrollbar-thumb {
  min-height: 34px;
  background:
    linear-gradient(180deg, rgba(216, 190, 142, 0.78), rgba(116, 101, 78, 0.78));
  border: 1px solid rgba(8, 12, 14, 0.86);
  border-radius: 6px;
}

.agent-rank-list::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(238, 213, 165, 0.9), rgba(144, 121, 88, 0.86));
}

.agent-rank-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.agent-rank,
.zone-pressure {
  display: grid;
  gap: 5px;
  padding: 8px 9px;
  background: linear-gradient(180deg, rgba(17, 27, 28, 0.72), rgba(10, 15, 17, 0.7));
  border: 1px solid rgba(160, 132, 83, 0.16);
  color: #cbb99b;
  font-size: 0.72rem;
  line-height: 1.3;
}

.agent-rank-top,
.zone-pressure-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.agent-rank strong,
.zone-pressure strong {
  color: #eed5a5;
}

.agent-rank-top span,
.zone-pressure-top span {
  color: #f0c66c;
  font-weight: 700;
}

.agent-rank-meta,
.agent-rank small,
.zone-pressure small {
  color: #aebda4;
}

.zone-pressure-bar {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.zone-pressure-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6385a0, #d7a341, #c35c46);
}

.agent-rank-empty,
.zone-pressure-empty {
  color: #8d806c;
  font-size: 0.74rem;
}

.agent-detail-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(17, 27, 28, 0.72), rgba(10, 15, 17, 0.7));
  border: 1px solid rgba(160, 132, 83, 0.18);
  color: #cbb99b;
  font-size: 0.74rem;
}

.agent-detail-empty,
.agent-detail-note {
  margin: 0;
  color: #8d806c;
  line-height: 1.4;
}

.agent-detail-note {
  color: #b7a681;
}

.agent-detail-head,
.agent-detail-xp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agent-detail-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agent-detail-head strong {
  color: #eed5a5;
  font-size: 0.86rem;
}

.agent-detail-head span,
.agent-detail-xp-top {
  color: #aebda4;
}

.agent-detail-head b {
  color: #f0c66c;
  white-space: nowrap;
}

.agent-detail-xp {
  display: grid;
  gap: 5px;
}

.agent-detail-xp-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.agent-detail-xp-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6fa5c5, #f0c66c);
}

.agent-detail-stats {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  line-height: 1.35;
}

.agent-detail-stats span {
  color: #9f9077;
}

.agent-detail-stats strong {
  color: #d8c9af;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-events {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 7px 0 0;
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: rgba(170, 151, 120, 0.72) rgba(12, 18, 20, 0.62);
  scrollbar-width: thin;
}

.agent-events::-webkit-scrollbar {
  width: 8px;
}

.agent-events::-webkit-scrollbar-track {
  background: rgba(8, 12, 14, 0.7);
  border-left: 1px solid rgba(160, 132, 83, 0.12);
}

.agent-events::-webkit-scrollbar-thumb {
  min-height: 34px;
  background:
    linear-gradient(180deg, rgba(216, 190, 142, 0.78), rgba(116, 101, 78, 0.78));
  border: 1px solid rgba(8, 12, 14, 0.86);
  border-radius: 6px;
}

.agent-events::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(238, 213, 165, 0.9), rgba(144, 121, 88, 0.86));
}

.agent-events::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.agent-event {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  background: rgba(15, 22, 24, 0.66);
  border: 1px solid rgba(160, 132, 83, 0.16);
  color: #cbb99b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.agent-event strong {
  color: #eed5a5;
  font-weight: 700;
}

.agent-event span {
  color: #b7c0aa;
}

.agent-event-empty {
  color: #8d806c;
}

.agent-api-card {
  display: grid;
  gap: 10px;
  color: #cbb99b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.agent-api-card p {
  margin: 0;
}

.agent-api-card code {
  color: #f0dfbf;
}

.agent-api-card strong {
  color: #ecd19b;
}

.agent-api-card a {
  display: inline-flex;
  width: fit-content;
  padding: 8px 10px;
  border: 1px solid rgba(190, 156, 98, 0.38);
  color: #ebdbc0;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  background: rgba(18, 26, 29, 0.74);
}

.agent-api-card a:hover {
  border-color: rgba(213, 170, 99, 0.72);
  background: rgba(30, 40, 45, 0.88);
}

.controls {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  color: #d0c2aa;
  font-size: 0.78rem;
  line-height: 1.45;
}

.controls strong {
  color: #f0dfbf;
}

.game-frame {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  align-self: start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: 12px;
  background: linear-gradient(180deg, rgba(13, 18, 21, 0.95), rgba(8, 12, 15, 0.93));
  border: 1px solid rgba(160, 132, 83, 0.22);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #091014;
  border: 1px solid rgba(160, 132, 83, 0.28);
}

.game-hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(170px, 210px);
  gap: 10px;
  pointer-events: none;
}

.hud-card {
  padding: 12px 12px 11px;
  background:
    linear-gradient(180deg, rgba(8, 12, 14, 0.76), rgba(5, 8, 10, 0.82)),
    radial-gradient(circle at top left, rgba(201, 142, 72, 0.08), transparent 56%);
  border: 1px solid rgba(198, 157, 96, 0.34);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(3px);
}

.hud-card .label {
  margin-bottom: 9px;
  font-size: 0.62rem;
}

.hud-card .bar-group {
  gap: 7px;
}

.hud-card .bar-row {
  grid-template-columns: 54px minmax(84px, 1fr) 30px;
  gap: 7px;
  font-size: 0.72rem;
}

.hud-card .bar {
  height: 8px;
}

.hud-card .meta-grid {
  gap: 6px 14px;
  font-size: 0.74rem;
}

.dev-tools {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  width: 210px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(7, 11, 13, 0.72), rgba(4, 7, 9, 0.82)),
    radial-gradient(circle at top right, rgba(121, 167, 128, 0.15), transparent 62%);
  border: 1px solid rgba(160, 132, 83, 0.34);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.dev-tools-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #dfc99d;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dev-agent-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 8px 0;
}

.dev-agent-button {
  border: 1px solid rgba(190, 156, 98, 0.38);
  background: rgba(19, 28, 30, 0.78);
  color: #ead7b0;
  font: inherit;
  font-size: 0.68rem;
  padding: 5px 0;
  cursor: pointer;
}

.dev-agent-button:hover,
.dev-agent-button.is-busy {
  border-color: rgba(221, 180, 103, 0.76);
  background: rgba(39, 52, 49, 0.88);
}

.debug-overlay {
  margin: 0;
  white-space: pre-wrap;
  color: #abc6a7;
  font-size: 0.62rem;
  line-height: 1.35;
}

.home-menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 4;
}

.home-menu[hidden] {
  display: none;
}

.home-menu-bg,
.home-menu-scrim {
  position: absolute;
  inset: 0;
}

.home-menu-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-menu-scrim {
  background:
    linear-gradient(180deg, rgba(5, 9, 11, 0.2), rgba(5, 9, 11, 0.7)),
    radial-gradient(circle at center, rgba(219, 166, 96, 0.12), rgba(4, 7, 9, 0.86));
}

.home-menu-card {
  position: relative;
  width: min(680px, calc(100% - 72px));
  padding: 28px 34px 26px;
  text-align: center;
  background: linear-gradient(180deg, rgba(10, 14, 17, 0.9), rgba(6, 10, 12, 0.88));
  border: 1px solid rgba(198, 157, 96, 0.46);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(6px);
}

.home-menu-card::before,
.home-menu-card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(198, 157, 96, 0.55);
}

.home-menu-card::before {
  top: 14px;
  left: 14px;
  border-right: 0;
  border-bottom: 0;
}

.home-menu-card::after {
  right: 14px;
  bottom: 14px;
  border-left: 0;
  border-top: 0;
}

.home-menu-crest {
  width: 132px;
  height: 132px;
  margin-bottom: 8px;
  image-rendering: pixelated;
}

.home-menu-kicker {
  margin: 0 0 10px;
  color: #b8a17d;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 0.72rem;
}

.home-menu h2 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
}

.home-menu-copy {
  max-width: 520px;
  margin: 14px auto 0;
  color: #dac8ab;
  line-height: 1.55;
  font-size: 0.92rem;
}

.home-menu-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.home-button {
  min-width: 188px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid rgba(190, 156, 98, 0.5);
  background: rgba(18, 26, 29, 0.94);
  color: #ebdbc0;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.home-button:hover {
  transform: translateY(-1px);
  background: rgba(30, 40, 45, 0.96);
  border-color: rgba(213, 170, 99, 0.78);
}

.home-button-primary {
  background: linear-gradient(180deg, rgba(171, 111, 52, 0.92), rgba(113, 63, 28, 0.95));
  border-color: rgba(225, 182, 108, 0.78);
  color: #fff3da;
}

.home-guide {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(198, 157, 96, 0.24);
}

.home-guide-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px 16px;
  text-align: left;
  font-size: 0.8rem;
}

.home-guide-grid span {
  color: #b39b79;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.home-guide-grid strong {
  color: #e4d4b9;
  font-weight: 400;
}

.inventory-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(13, 18, 21, 0.26), rgba(6, 10, 12, 0.84));
  backdrop-filter: blur(4px);
}

.inventory-panel[hidden] {
  display: none;
}

.inventory-card {
  width: min(880px, calc(100% - 52px));
  padding: 22px 22px 18px;
  background: linear-gradient(180deg, rgba(11, 15, 18, 0.94), rgba(7, 10, 13, 0.95));
  border: 1px solid rgba(198, 157, 96, 0.42);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}

.inventory-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.inventory-kicker {
  margin: 0 0 6px;
  color: #b59d78;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
}

.inventory-card h3 {
  margin: 0;
  font-size: 1.5rem;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: 0.04em;
}

.inventory-status {
  margin: 12px 0 0;
  color: #d7c8ae;
  font-size: 0.82rem;
  line-height: 1.45;
}

.inventory-close {
  appearance: none;
  border: 1px solid rgba(190, 156, 98, 0.5);
  background: rgba(18, 26, 29, 0.94);
  color: #ebdbc0;
  font: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
}

.inventory-close:hover {
  background: rgba(30, 40, 45, 0.96);
  border-color: rgba(213, 170, 99, 0.78);
}

.inventory-card-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 16px;
  margin-top: 18px;
}

.inventory-section {
  min-height: 100%;
  padding: 14px 14px 12px;
  background: rgba(12, 18, 21, 0.74);
  border: 1px solid rgba(160, 132, 83, 0.22);
}

.inventory-weapon-list,
.inventory-detail-list {
  display: grid;
  gap: 10px;
}

.inventory-weapon-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(160, 132, 83, 0.24);
  background: rgba(17, 24, 27, 0.76);
  color: #ebdeca;
  cursor: pointer;
  text-align: left;
}

.inventory-weapon-btn:hover {
  border-color: rgba(201, 142, 72, 0.54);
  background: rgba(28, 36, 40, 0.88);
}

.inventory-weapon-btn.is-active {
  border-color: rgba(209, 167, 100, 0.76);
  background: linear-gradient(180deg, rgba(53, 38, 21, 0.96), rgba(28, 22, 16, 0.96));
}

.inventory-weapon-main {
  display: grid;
  gap: 4px;
}

.inventory-weapon-name {
  color: #f0dfbf;
  font-size: 0.84rem;
}

.inventory-weapon-meta {
  color: #b39d7c;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.inventory-weapon-state {
  color: #cfb27d;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.inventory-detail-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(160, 132, 83, 0.12);
  color: #ddcdb2;
  font-size: 0.8rem;
}

.inventory-detail-row:last-child {
  border-bottom: 0;
}

.inventory-detail-row span {
  color: #b39d7c;
}

#game {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  max-height: none;
  display: block;
  background: #0b1013;
  image-rendering: pixelated;
}

.prompt-panel {
  width: 100%;
  max-width: 100%;
  align-self: start;
  padding: 12px 14px 14px;
  box-shadow: none;
}

.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-panel p {
  margin: 0;
  color: #d5c8af;
  min-height: 22px;
  line-height: 1.5;
  font-size: 0.8rem;
}

.field-briefing-panel {
  display: grid;
  align-self: start;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-height: clamp(260px, 31vh, 420px);
  padding: 18px 18px 16px;
  background:
    linear-gradient(180deg, rgba(13, 19, 21, 0.9), rgba(7, 11, 13, 0.94)),
    linear-gradient(90deg, rgba(111, 165, 197, 0.05), transparent 32%, rgba(201, 142, 72, 0.05));
  border: 1px solid rgba(160, 132, 83, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field-briefing-head {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.field-briefing-head .label {
  margin-bottom: 0;
}

.field-briefing-head strong {
  color: #ead8b9;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.45;
}

.field-briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-self: center;
}

.briefing-card {
  min-height: 116px;
  padding: 14px 14px 13px;
  background: rgba(14, 22, 24, 0.68);
  border: 1px solid rgba(160, 132, 83, 0.18);
}

.briefing-card span {
  display: block;
  margin-bottom: 9px;
  color: #f0c66c;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.briefing-card p {
  margin: 0;
  color: #cbb99b;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.field-briefing-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  align-self: end;
  color: #b9aa8f;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shelter-economy-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(8, 13, 15, 0.72);
  border: 1px solid rgba(160, 132, 83, 0.18);
}

.shelter-economy-empty {
  margin: 0;
  color: #a8997f;
  font-size: 0.78rem;
}

.shelter-economy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.shelter-economy-head strong {
  color: #f0dfbf;
  font-size: 0.88rem;
}

.shelter-economy-head span {
  color: #f0c66c;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.shelter-development {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  background: linear-gradient(180deg, rgba(26, 37, 36, 0.72), rgba(13, 19, 21, 0.72));
  border: 1px solid rgba(139, 171, 112, 0.2);
}

.shelter-development-top,
.shelter-development-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.shelter-development-top strong {
  color: #f0dfbf;
  font-size: 0.86rem;
}

.shelter-development-top span,
.shelter-development-meta span {
  color: #aebd9f;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shelter-development-bar {
  height: 7px;
  overflow: hidden;
  background: rgba(4, 7, 8, 0.78);
  border: 1px solid rgba(160, 132, 83, 0.18);
}

.shelter-development-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #78865b, #d1a764);
}

.shelter-development-meta strong {
  color: #e7d7b7;
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: right;
  overflow-wrap: anywhere;
}

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

.shelter-economy-cell {
  min-width: 0;
  padding: 10px;
  background: rgba(14, 22, 24, 0.62);
  border: 1px solid rgba(160, 132, 83, 0.13);
}

.shelter-economy-cell span {
  display: block;
  margin-bottom: 7px;
  color: #a8997f;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.shelter-economy-cell strong {
  display: block;
  color: #ead8b9;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: rgba(8, 13, 15, 0.72);
  border: 1px solid rgba(160, 132, 83, 0.14);
}

.arc-network-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 11px;
  color: #d9f2ff;
  background:
    linear-gradient(90deg, rgba(44, 119, 160, 0.2), rgba(46, 79, 102, 0.12)),
    rgba(8, 13, 15, 0.72);
  border: 1px solid rgba(105, 194, 238, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 0 18px rgba(80, 166, 214, 0.08);
  white-space: nowrap;
}

.arc-network-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #7fd7ff;
  box-shadow: 0 0 12px rgba(127, 215, 255, 0.8);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.legend-agent {
  background: #7fb4d8;
  color: #7fb4d8;
}

.legend-zone {
  background: #f0c66c;
  color: #f0c66c;
}

.legend-threat {
  background: #c35c46;
  color: #c35c46;
}

.legend-portal {
  background: #c45ce2;
  color: #c45ce2;
}

.sound-toggle {
  appearance: none;
  border: 1px solid rgba(160, 132, 83, 0.5);
  background: rgba(20, 28, 31, 0.92);
  color: #e7d7b7;
  font: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sound-toggle:hover {
  background: rgba(36, 49, 54, 0.95);
  border-color: rgba(201, 142, 72, 0.7);
}

.sound-toggle[aria-pressed="false"] {
  color: #ad9c82;
  border-color: rgba(114, 98, 73, 0.45);
}

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

  .panel-right {
    order: 2;
    position: static;
  }

  .game-frame {
    order: 1;
  }

  .panel {
    display: grid;
    gap: 18px;
  }

  .panel-block + .panel-block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .shell {
    display: none;
  }

  .mobile-gate {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100svh;
    padding: 16px;
    overflow: hidden;
  }

  .mobile-gate-card {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    width: min(calc(100vw - 32px), 326px);
    max-width: 326px;
    padding: 22px 20px 20px;
    transform: translateY(-50%);
  }

  .mobile-gate-card h1 {
    font-size: 1.7rem;
  }

  .shell {
    width: 100vw;
    padding: 18px 14px 24px;
    overflow-x: hidden;
  }

  .intro {
    max-width: calc(100vw - 28px);
    margin-bottom: 10px;
    padding: 10px 14px 12px;
  }

  .monitor-bar {
    grid-template-columns: 1fr;
  }

  .monitor-actions {
    justify-content: flex-start;
  }

  .monitor-guide-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px;
  }

  .game-frame {
    width: 100%;
    max-width: 100%;
    padding: 8px;
  }

  .canvas-wrap,
  .prompt-panel {
    width: 100%;
    max-width: 100%;
  }

  .field-briefing-panel {
    min-height: 0;
    padding: 14px;
  }

  .field-briefing-grid {
    grid-template-columns: 1fr;
  }

  .shelter-economy-grid {
    grid-template-columns: 1fr;
  }

  .briefing-card {
    min-height: 0;
  }

  .game-hud {
    left: 10px;
    right: 10px;
    bottom: 10px;
    grid-template-columns: 1fr;
  }

  .hud-notes {
    display: none;
  }

  .dev-tools {
    right: 10px;
    bottom: 10px;
    width: 176px;
  }

  .home-menu-card {
    width: min(100%, calc(100% - 26px));
    padding: 22px 18px 20px;
  }

  .home-menu h2 {
    font-size: 1.8rem;
  }

  .home-guide-grid {
    grid-template-columns: 1fr;
  }

  .inventory-card {
    width: min(100%, calc(100% - 20px));
    padding: 18px 16px 16px;
  }

  .inventory-card-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .prompt-head {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .prompt-panel p,
  .briefing-card p,
  .field-briefing-head strong,
  .agent-rank-meta,
  .agent-rank small,
  .agent-detail-stats strong {
    max-width: calc(100vw - 64px);
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
