:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #111310;
  color: #e8e9e3;
  font-synthesis: none;
  --surface: #1a1d19;
  --surface-2: #222620;
  --line: #3b4038;
  --muted: #92998e;
  --green: #9bc46b;
  --amber: #e5b85c;
  --red: #df6a5e;
  --blue: #6fa8dc;
  --cell-size: 48px;
  --cell-height: var(--cell-size);
  --view-cols: 8;
  --view-rows: 8;
}

* { box-sizing: border-box; }
 .map-loading { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #111410; color: #dfe5d9; }
 .map-loading[hidden] { display: none; }
 .map-loading-panel { width: min(320px, calc(100% - 40px)); display: grid; justify-items: center; gap: 9px; padding: 28px 22px; border: 1px solid #596051; background: #171a16; box-shadow: 0 18px 60px rgba(0, 0, 0, .48); text-align: center; }
 .map-loading-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--green); color: var(--green); font-size: 22px; font-weight: 800; }
 .map-loading-panel strong { font-size: 16px; }
 .map-loading-panel small { color: var(--muted); font-size: 10px; }
 .map-loading-panel i { width: 150px; height: 3px; overflow: hidden; background: #293126; }
 .map-loading-panel i::after { content: ""; display: block; width: 45%; height: 100%; background: var(--green); animation: map-loading-progress 900ms ease-in-out infinite alternate; }
 @keyframes map-loading-progress { from { transform: translateX(-100%); } to { transform: translateX(230%); } }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #111310;
  background-size: 100% 4px;
}

button { font: inherit; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 22px 28px;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--amber);
  color: #151711;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 22px;
  font-weight: 900;
  border: 1px solid #f1cc7d;
}
.brand-block h1 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: 0; }
.brand-block p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.raid-clock { text-align: right; }
.raid-clock span { display: block; color: var(--muted); font-size: 11px; }
.raid-clock strong { font: 700 24px/1.2 Consolas, monospace; color: var(--amber); }
.raid-meta { display: flex; align-items: center; gap: 20px; }
.combat-readout { display: flex; align-items: center; gap: 14px; }
.combat-readout div { min-width: 54px; }
.combat-readout span { display: block; color: var(--muted); font-size: 9px; }
.combat-readout strong { display: block; margin-top: 3px; font-size: 11px; color: #d9ddd4; }
.top-objective-btn { min-width: 38px; height: 30px; padding: 3px 6px; border: 1px solid var(--line); background: #20251f; color: var(--amber); font-size: 10px; font-weight: 800; cursor: pointer; }
.top-objective-btn:hover { background: var(--surface-2); }

.chat-bar {
  min-height: 42px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 230px;
  align-items: center;
  gap: 9px;
  margin: 10px 0 8px;
  padding: 5px 7px;
  border-block: 1px solid var(--line);
  background: #151814;
}
.chat-channel-select { width: 44px; height: 29px; border: 1px solid var(--line); background: #20251f; color: var(--green); font-size: 11px; font-weight: 800; text-align: center; cursor: pointer; }
.chat-channel-select:focus { outline: 1px solid var(--amber); outline-offset: 1px; }
.chat-messages { min-width: 0; height: 54px; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; overflow-y: auto; white-space: normal; color: #aeb5a9; font-size: 11px; line-height: 16px; scrollbar-width: thin; scrollbar-color: #4a5245 transparent; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #4a5245; }
.chat-system, .chat-message { flex: 0 0 16px; width: 100%; min-height: 16px; padding-left: 8px; border-left: 1px solid var(--line); line-height: 16px; text-align: left; }
.chat-system { color: #737b70; }
.chat-message b { color: var(--amber); font-weight: 650; margin-right: 4px; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 5px; }
.chat-form input {
  min-width: 0;
  height: 29px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: #0e100d;
  color: #e2e5de;
  font: 11px "Microsoft YaHei", sans-serif;
}
.chat-form input:focus { border-color: #6a7b5e; outline: none; }
.chat-form button { height: 29px; border: 1px solid #69765f; background: #293126; color: var(--green); font-size: 10px; cursor: pointer; }

.mission-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 22px;
  margin-bottom: 14px;
  padding: 13px 0;
  border-block: 1px solid var(--line);
}
.objective-trigger-row { margin-bottom: 8px; border-block: 1px solid var(--line); }
.objective-trigger {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: #dfe2da;
  text-align: left;
  cursor: pointer;
}
.objective-trigger:hover { background: var(--surface); }
.objective-trigger > span { color: var(--amber); font-size: 10px; }
.objective-trigger > strong { font-size: 12px; }
.objective-trigger > small { color: var(--muted); font-size: 10px; }
.objective-detail-panel .objective-progress { margin: 14px 0 8px; }
.mission-copy { max-width: 690px; }
.mission-copy .section-heading { margin-bottom: 5px; }
.mission-copy p { margin: 0 0 8px; color: #c6c9c1; font-size: 12px; }
.mission-copy .objective-progress { margin-bottom: 5px; }
.utility-actions { display: grid; grid-template-columns: repeat(2, 112px); gap: 8px; }
.utility-btn {
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #dfe2da;
  text-align: left;
  cursor: pointer;
}
.utility-btn > span { grid-row: 1 / -1; color: var(--amber); font-size: 17px; text-align: center; }
.utility-btn b { align-self: end; font-size: 11px; font-weight: 650; }
.utility-btn small { align-self: start; color: var(--muted); font-size: 9px; }
.utility-btn:hover { background: var(--surface-2); border-color: #596051; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.battle-column { min-width: 0; }
.status-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
}
.status-item {
  min-width: 0;
  min-height: 54px;
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.status-item:is(button) { font-family: inherit; text-align: left; background: transparent; color: inherit; cursor: pointer; }
.status-item:is(button):hover { background: var(--surface-2); }
.status-item:last-child { border-right: 0; }
.status-item span { color: var(--muted); font-size: 10px; }
.status-item strong { font: 700 14px/1.2 Consolas, "Microsoft YaHei", sans-serif; }
.status-item span i { font-style: normal; }
.short-label { display: none; }
.status-value { display: flex; align-items: baseline; gap: 3px; }
.status-value small { color: #62685f; font: 10px/1 Consolas, monospace; }
.meter, .objective-progress { height: 5px; background: #0c0e0c; overflow: hidden; }
.meter i, .objective-progress i { display: block; width: 100%; height: 100%; background: var(--green); transition: width 160ms linear; }
.health-status .meter i { background: var(--red); }
.stamina-status .meter i { background: var(--blue); }
.satiety-status .meter i { background: #d69b63; }
.hydration-status .meter i { background: var(--blue); }

.board-wrap {
  position: relative;
  min-height: calc(var(--cell-height) * var(--view-rows) + 18px);
  display: grid;
  place-items: center;
  padding: 9px;
  overflow: hidden;
  background: #0c0e0c;
  border: 1px solid var(--line);
}

.game-board {
  display: grid;
  grid-template-columns: repeat(var(--view-cols), var(--cell-size));
  grid-template-rows: repeat(var(--view-rows), var(--cell-height));
  user-select: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  font-family: "Microsoft YaHei", "Noto Sans Mono CJK SC", monospace;
}
.game-board.scoped { outline: 1px solid rgba(229, 184, 92, 0.65); outline-offset: 3px; }
.game-board.crouched .tile.player { box-shadow: inset 0 -4px 0 rgba(111, 168, 220, .38); color: #dbeaf6; }
.game-board.extracting { outline: 2px solid var(--green); outline-offset: 3px; animation: extraction-frame 800ms ease-in-out infinite alternate; }
.board-toolbar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.weapon-quickbar { min-width: 0; display: flex; align-items: center; gap: 4px; }
.weapon-quick-slot, .weapon-current { min-height: 30px; border: 1px solid var(--line); background: #20251f; color: #dfe5d9; cursor: pointer; }
.weapon-quick-slot { max-width: 88px; padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.weapon-quick-slot.active { border-color: var(--amber); background: #39301b; color: var(--amber); }
.weapon-quick-slot:disabled { opacity: .42; cursor: default; }
.weapon-current { min-width: 86px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 3px 6px; text-align: left; }
.weapon-current span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.weapon-current strong { color: var(--amber); font: 9px Consolas, monospace; }
.weapon-current.reloading { border-color: var(--amber); }
.scope-controls { position: static; width: auto; flex: 0 0 auto; z-index: 12; display: flex; flex-direction: row; justify-content: flex-end; align-items: center; gap: 5px; margin: 0; padding: 4px 5px; border: 1px solid rgba(105, 113, 100, .8); background: rgba(16, 19, 15, .98); }
.scope-controls button { width: 34px; height: 30px; display: grid; place-items: center; padding: 2px; border: 1px solid var(--line); background: #20251f; color: var(--amber); cursor: pointer; }
.scope-controls button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scope-controls button.active { border-color: var(--amber); background: #39301b; }
.scope-controls button:disabled { opacity: .45; cursor: default; }
.scope-controls input { display: block; width: 96px; height: 16px; accent-color: var(--amber); }
.scope-controls output { display: block; min-width: 24px; color: var(--muted); font: 8px Consolas, monospace; text-align: right; }

.tile {
  width: var(--cell-size);
  height: var(--cell-height);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.025);
  background: #171a16;
  color: #62685f;
  overflow: hidden;
  font-size: 17px;
  line-height: var(--cell-height);
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  transition: color 100ms linear, background-color 100ms linear;
}
.tile.hidden { color: transparent; background: #090a09; border-color: #0b0c0b; }
.tile.remembered { color: #343933; background: #10120f; }
.tile.visible { color: #7b8277; }
.tile.wall.visible { color: #8b9187; background: #252923; }
.tile.door.visible { color: var(--amber); background: #29261b; }
.tile.cover.visible { color: #ab8870; background: #211d19; }
.tile.statue.visible, .tile.table.visible, .tile.sofa.visible, .tile.chair.visible, .tile.television.visible { color: #c59a68; background: #29241d; }
.tile.pool.visible { color: #6fa8dc; background: #172832; }
.tile.fence.visible { color: #b0b7a9; background: #252923; }
.tile.car.visible { color: #d87968; background: #30221e; }
.tile.bicycle.visible { color: #d6b85f; background: #292619; }
.tile.container.visible { color: var(--blue); background: #17212a; cursor: pointer; }
.tile.extraction.visible { color: var(--green); background: #1a2618; }
.tile.player { color: #10140d; background: var(--green); font-weight: 900; z-index: 4; }
.tile.player.extracting { box-shadow: inset 0 0 0 3px #e7f6d4, 0 0 12px rgba(155, 196, 107, 0.9); animation: extraction-player 600ms ease-in-out infinite alternate; }
.tile.enemy { color: #fff0ed; background: #9f3d36; font-weight: 900; z-index: 3; cursor: crosshair; }
.tile.enemy.selected { outline: 2px solid var(--amber); outline-offset: -3px; box-shadow: inset 0 0 0 1px #20120f; }
.tile.aimed { outline: 1px dashed var(--amber); outline-offset: -3px; }
.tile.enemy.hit { animation: hit-flash 160ms 2; }
.tile.loot-drop.visible { color: var(--amber); background: #2a2417; cursor: pointer; }
.tile.sound::after {
  content: "响";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--amber);
  animation: sound-pulse 700ms ease-out forwards;
}

.impact-mark {
  position: absolute;
  z-index: 7;
  left: 2px;
  right: 2px;
  display: block;
  pointer-events: none;
  animation: impact-flash 720ms ease-out forwards;
}
.impact-mark.hit-head {
  top: 2px;
  height: 34%;
  background: #f04438;
  box-shadow: 0 0 8px rgba(240, 68, 56, 0.8);
}
.impact-mark.hit-torso {
  top: 33%;
  height: 38%;
  background: rgba(232, 88, 72, 0.72);
  box-shadow: 0 0 6px rgba(232, 88, 72, 0.55);
}
.impact-mark.hit-legs {
  bottom: 2px;
  height: 32%;
  background: rgba(211, 112, 94, 0.48);
  box-shadow: 0 0 5px rgba(211, 112, 94, 0.38);
}
.impact-mark.miss {
  inset: 3px;
  height: auto;
  border: 2px solid #f0c875;
  background: transparent;
  box-shadow: inset 0 0 6px rgba(240, 200, 117, 0.32), 0 0 7px rgba(240, 200, 117, 0.42);
}
.impact-mark.cover {
  inset: 2px;
  height: auto;
  border: 2px solid #fff0b8;
  background: rgba(229, 184, 92, 0.2);
  box-shadow: inset 0 0 8px rgba(255, 230, 158, 0.55), 0 0 10px rgba(229, 184, 92, 0.75);
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(155, 196, 107, 0.12);
  box-shadow: 0 0 8px rgba(155, 196, 107, 0.2);
  animation: scan 5s linear infinite;
  pointer-events: none;
}

.intel-section { padding: 15px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.section-heading h2 { margin: 0; font-size: 13px; letter-spacing: 0; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.objective-section p { margin: 0 0 12px; color: #c6c9c1; font-size: 13px; line-height: 1.7; }
.objective-progress { margin-bottom: 8px; }
.objective-progress i { width: 0; background: var(--amber); }
.objective-values { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.objective-values strong { color: var(--amber); font-family: Consolas, monospace; }

.loot-panel, .inventory-list { display: grid; gap: 6px; max-height: min(58vh, 480px); overflow-y: auto; }
.loot-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
.loot-slot {
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  grid-template-rows: 1fr auto auto;
  place-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid #454b42;
  background: #1d211c;
  color: #dfe2da;
  cursor: pointer;
}
.loot-float .loot-slot[data-loot-detail] { touch-action: none; }
.loot-slot .slot-glyph { align-self: end; font-size: 18px; color: var(--amber); }
.loot-slot strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; text-align: center; }
.loot-slot small { min-height: 11px; color: var(--muted); font: 8px/1 Consolas, monospace; }
.loot-slot.unknown { border-style: dashed; color: #6c7268; cursor: default; }
.loot-slot.unknown .slot-glyph { color: #62685f; }
.loot-slot.empty { color: #5e645b; cursor: default; }
.loot-slot.empty .slot-glyph { color: #565c53; }
.loot-slot.rare { border-color: var(--blue); }
.loot-slot.precious { border-color: #bd82c5; }
.loot-slot.high { border-color: var(--amber); }
.loot-slot.taken { opacity: 0.42; cursor: default; }
.loot-slot.selected { outline: 2px solid var(--amber); outline-offset: -3px; }
.loot-slot.searching { border-color: var(--amber); background: #292518; }
.slot-name-btn {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  cursor: pointer;
}
.loot-row, .inventory-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: var(--surface);
  border-left: 2px solid #6f756c;
}
.inventory-row { grid-template-columns: minmax(0, 1fr) auto; }
.loot-row.rare, .inventory-row.rare { border-left-color: var(--blue); }
.loot-row.precious, .inventory-row.precious { border-left-color: #bd82c5; }
.loot-row.high, .inventory-row.high { border-left-color: var(--amber); }
.loot-meta strong, .inventory-meta strong { display: block; font-size: 12px; font-weight: 650; }
.loot-meta span, .inventory-meta span { color: var(--muted); font-size: 10px; }
.inventory-meta { min-width: 0; }
.inventory-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-name-btn {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e5e7e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.item-name-btn:hover, .slot-name-btn:hover { color: var(--amber); }
.item-actions { display: flex; align-items: center; gap: 5px; }
.take-btn {
  min-width: 52px;
  min-height: 28px;
  border: 1px solid #5d6756;
  background: #2a3126;
  color: var(--green);
  cursor: pointer;
}
.take-btn:disabled { opacity: 0.4; cursor: default; }
.discard-btn { border-color: #65443f; background: #2b211e; color: #d98a80; }
.empty-state { color: #676d64; font-size: 12px; padding: 10px 2px; }

.event-log {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
  max-height: 154px;
  overflow: hidden;
}
.event-log li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; color: #aeb3a9; font-size: 11px; line-height: 1.45; }
.event-log time { color: #60665d; font-family: Consolas, monospace; }
.event-log .danger { color: #ef8b80; }
.event-log .reward { color: #e8c77d; }

.icon-btn, .control-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: #c9cdc4;
  cursor: pointer;
}
.icon-btn { width: 40px; height: 40px; font-size: 20px; }
.icon-btn.small { width: 28px; height: 28px; font-size: 16px; }

.mobile-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding: 12px 0;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}
.control-btn { width: 44px; height: 44px; }
.control-btn { font-size: 12px; font-weight: 700; }
.control-btn:active, .icon-btn:active { background: #353c31; }
.control-btn.up { grid-column: 2; grid-row: 1; }
.control-btn.left { grid-column: 1; grid-row: 2; }
.control-btn.center { grid-column: 2; grid-row: 2; color: var(--amber); }
.control-btn.right { grid-column: 3; grid-row: 2; }
.control-btn.down { grid-column: 2; grid-row: 3; }
.action-controls { display: flex; align-items: center; gap: 8px; }
.action-btn {
  min-width: 86px;
  min-height: 46px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: #e1e4dc;
  cursor: pointer;
}
.action-btn.fire { border-color: #81443e; color: #f1a39b; background: #2e1e1b; }
.action-btn span { margin-right: 5px; }
.reload-text-btn {
  min-width: 68px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: #dfe2da;
  font-weight: 700;
  cursor: pointer;
}
.reload-text-btn:active { background: #353c31; }

.result-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 7, 0.82);
  backdrop-filter: blur(3px);
}
.result-dialog[hidden], .item-dialog[hidden], .loot-float[hidden] { display: none; }

.loot-float {
  position: absolute;
  z-index: 10;
  right: 10px;
  bottom: 10px;
  width: min(370px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #697164;
  background: rgba(19, 22, 18, 0.96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.52);
}
.loot-float-heading { position: sticky; top: -8px; z-index: 2; display: flex; align-items: center; justify-content: space-between; margin: -8px -8px 7px; padding: 8px; border-bottom: 1px solid var(--line); background: rgba(19, 22, 18, .98); }
.loot-float-heading span { color: var(--muted); font-size: 9px; }
.loot-float-heading h2 { margin: 2px 0 0; font-size: 12px; letter-spacing: 0; }
.loot-close-btn { width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface-2); color: #dfe2da; cursor: pointer; }
.loot-float .loot-panel { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: none; }
.loot-float .loot-slot { aspect-ratio: 1; }
.loot-storage-panel { display: grid; gap: 4px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.loot-storage-section { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 5px; }
.storage-inventory-panel, .loot-storage-panel { gap: 0; }
.storage-inventory-panel .loot-storage-section, .loot-storage-panel .loot-storage-section { padding: 10px 0; border-bottom: 1px solid var(--line); }
.storage-inventory-panel .loot-storage-section:first-child, .loot-storage-panel .loot-storage-section:first-child { border-top: 1px solid var(--line); }
.loot-storage-section header { min-width: 0; }
.loot-storage-section header b, .loot-storage-section header span { display: block; }
.loot-storage-section header b { color: #dfe4d8; font-size: 9px; }
.loot-storage-section header span { margin-top: 2px; color: var(--muted); font: 8px Consolas, monospace; }
.storage-board { position: relative; display: grid; grid-template-columns: repeat(var(--storage-cols), 44px); grid-template-rows: repeat(var(--storage-rows), 44px); gap: 4px; }
.storage-cell, .storage-item { min-width: 0; min-height: 0; display: grid; place-items: center; align-content: center; padding: 1px; }
.storage-cell { border: 1px dashed #444c40; background: #191d18; color: #565e52; cursor: pointer; }
.storage-cell.placement-valid { border-color: #8ecf72; background: rgba(100, 170, 92, .28); box-shadow: inset 0 0 0 1px #8ecf72; }
.storage-cell.placement-blocked { border-color: #e06c60; background: rgba(184, 66, 60, .34); box-shadow: inset 0 0 0 1px #e06c60; }
.storage-item { z-index: 1; border: 1px solid #66705f; background: #23291f; color: var(--amber); cursor: grab; overflow: hidden; user-select: none; -webkit-user-drag: none; touch-action: none; }
.storage-cell { touch-action: pan-y; }
.storage-item.touch-dragging { opacity: .32; }
.touch-drag-ghost { position: fixed; z-index: 100; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--amber); background: #302b1d; color: var(--amber); font-size: 19px; pointer-events: none; transform: translate(-50%, -50%); }
.touch-drag-ghost.pending { opacity: 0; }
.storage-item:hover { border-color: var(--amber); background: #352f1d; }
.storage-cell.drag-over { border-style: solid; border-color: var(--amber); background: #352f1d; }
.storage-cell b, .storage-item b { font-size: 11px; line-height: 1; }
.storage-item small { width: 100%; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 6px; text-align: center; }

.use-float {
  position: absolute;
  z-index: 11;
  left: 10px;
  bottom: 10px;
  width: min(260px, calc(100% - 20px));
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 8px;
  padding: 30px 8px 8px;
  border: 1px solid #697164;
  background: rgba(19, 22, 18, 0.96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.52);
}
.use-float::before { content: "当前动作"; position: absolute; top: 7px; left: 8px; color: var(--muted); font-size: 9px; }
.use-float[hidden] { display: none; }
.use-glyph { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--amber); color: var(--amber); font-size: 17px; }
.use-float small { display: block; color: var(--muted); font-size: 8px; }
.use-float strong { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.use-float > b { color: var(--amber); font: 700 12px/1 Consolas, monospace; }
.use-float > button { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border: 1px solid var(--line); background: var(--surface-2); color: #dfe2da; cursor: pointer; }
.use-float.extraction { border-color: var(--green); }
.use-float.extraction .use-glyph { border-color: var(--green); background: #26351f; color: #dff0ca; }
.use-float.extraction > b { color: var(--green); }

.loot-dock {
  padding: 14px;
  border: 1px solid #596051;
  background: #171a16;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.loot-dock .dialog-heading { margin-bottom: 12px; padding-bottom: 10px; }
.loot-dock .loot-panel { max-height: 360px; }

.item-dialog {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 7, 0.72);
  backdrop-filter: blur(2px);
}
#detail-dialog { z-index: 16; }
.item-panel {
  width: min(480px, 100%);
  max-height: min(680px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 18px;
  border: 1px solid #596051;
  background: #171a16;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.48);
}
.dialog-heading { position: sticky; top: -18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; margin: -18px -18px 16px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); background: #171a16; }
.dialog-heading span { color: var(--muted); font-size: 9px; }
.dialog-heading h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: 0; }
.detail-body { display: grid; gap: 14px; }
.detail-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.detail-summary div { min-width: 0; padding: 10px 7px; border-right: 1px solid var(--line); }
.detail-summary div:last-child { border-right: 0; }
.detail-summary span { display: block; color: var(--muted); font-size: 9px; margin-bottom: 4px; }
.detail-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.detail-description { margin: 0; color: #b9beb4; font-size: 12px; line-height: 1.65; }
.placement-item { width: min(150px, 42%); aspect-ratio: 1; justify-self: center; display: grid; place-items: center; align-content: center; gap: 5px; border: 1px solid #697160; background: #20251f; color: #e4e8de; cursor: grab; }
.placement-item.selected { outline: 2px solid var(--amber); outline-offset: 2px; background: #2b2a1d; }
.placement-item b { color: var(--amber); font-size: 25px; }
.placement-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.placement-item small { color: var(--muted); font-size: 9px; }
.placement-storages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.placement-storage { min-width: 0; min-height: 74px; display: grid; align-content: center; gap: 5px; padding: 7px 5px; border: 1px dashed #596353; background: #1d211c; color: #dfe5d9; cursor: pointer; }
.placement-storage:hover, .placement-storage.drag-over { border-style: solid; border-color: var(--amber); background: #302b1c; }
.placement-storage.full { opacity: .4; cursor: default; }
.placement-storage b, .placement-storage span, .placement-storage small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placement-storage b { font-size: 11px; }
.placement-storage span { color: var(--amber); font: 10px Consolas, monospace; }
.placement-storage small { color: var(--muted); font-size: 8px; }
.equipment-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.equipment-slot {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px dashed #535a50;
  background: #1d201c;
}
.equipment-slot > span { color: var(--muted); font-size: 9px; }
.equipment-slot > strong { font-size: 12px; }
.equipment-slot > small { color: var(--amber); font-size: 9px; }
.weapon-switch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.weapon-switch-slot { min-width: 0; min-height: 70px; display: grid; align-content: center; gap: 3px; padding: 7px 5px; border: 1px solid #434b40; background: #1b1f1a; color: #cfd5c8; cursor: pointer; text-align: left; }
.weapon-switch-slot:hover, .weapon-switch-slot.active { border-color: var(--amber); background: #2b2a1d; }
.weapon-switch-slot:disabled { opacity: .42; cursor: default; }
.weapon-switch-slot b { color: var(--amber); font: 700 11px/1 Consolas, monospace; }
.weapon-switch-slot span { font-size: 10px; }
.weapon-switch-slot small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.armor-equipment-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.armor-equipment-slot { min-height: 58px; padding: 6px 4px; align-content: center; }
.armor-equipment-slot b { color: var(--amber); font-size: 15px; }
.armor-equipment-slot small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.storage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.protection-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.protection-slot { min-width: 0; min-height: 54px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: 1fr 1fr; align-items: center; padding: 6px; border: 1px solid #555f50; background: #20251f; color: #dce3d3; text-align: left; cursor: pointer; }
.protection-slot.combined { border-color: #806f4c; }
.protection-slot b { grid-row: 1 / 3; color: var(--amber); font-size: 17px; text-align: center; }
.protection-slot span, .protection-slot small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.protection-slot span { font-size: 10px; }
.protection-slot small { color: var(--muted); font-size: 8px; }
.storage-card { min-width: 0; padding: 8px 6px; border: 1px solid #414a3d; background: #1b1f1a; }
.storage-card.safe { border-color: #75613f; }
.storage-card b, .storage-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-card b { color: #dce3d3; font-size: 10px; }
.storage-card span { margin-top: 4px; color: var(--muted); font: 9px Consolas, monospace; }
.detail-action-btn { min-height: 38px; padding: 7px 14px; border: 1px solid #69765f; background: #293126; color: var(--green); cursor: pointer; }
.detail-action-btn:disabled { opacity: 0.45; cursor: default; }
.secondary-detail-action { border-color: var(--line); background: var(--surface-2); color: #dfe2da; }
.result-panel {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid #596051;
  background: #191c18;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.48);
}
.result-kicker { color: var(--green); font-size: 12px; }
.result-panel h2 { margin: 8px 0 22px; font-size: 24px; letter-spacing: 0; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin-bottom: 22px; }
.result-stats div { padding: 14px 8px; border-right: 1px solid var(--line); }
.result-stats div:last-child { border-right: 0; }
.result-stats span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.result-stats strong { font: 700 15px/1.2 Consolas, "Microsoft YaHei", sans-serif; }
.primary-btn {
  width: 100%;
  min-height: 46px;
  border: 1px solid #b5d58e;
  background: var(--green);
  color: #14180f;
  font-weight: 800;
  cursor: pointer;
}

@keyframes scan { from { top: 0; } to { top: 100%; } }
@keyframes sound-pulse { 0% { opacity: 1; transform: scale(0.75); } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes hit-flash { 50% { background: #f2d0a4; color: #541b16; } }
@keyframes impact-flash {
  0% { opacity: 1; transform: scale(0.76); }
  45% { opacity: 0.92; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes extraction-frame { from { box-shadow: 0 0 0 rgba(155, 196, 107, 0); } to { box-shadow: 0 0 18px rgba(155, 196, 107, 0.38); } }
@keyframes extraction-player { from { filter: brightness(0.9); } to { filter: brightness(1.35); } }

@media (max-width: 920px) {
  :root { --cell-size: 26px; }
  .app-shell { max-width: 650px; }
  .game-layout { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  :root { --cell-size: 42px; --cell-height: var(--cell-size); }
  .storage-board { grid-template-columns: repeat(var(--storage-cols), 32px); grid-template-rows: repeat(var(--storage-rows), 32px); gap: 3px; }
  .placement-storages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { padding: 6px 6px 24px; }
  .topbar { min-height: 54px; margin-bottom: 10px; padding-bottom: 10px; }
  .brand-mark { width: 36px; height: 36px; font-size: 19px; }
  .brand-block h1 { font-size: 18px; }
  .brand-block p { font-size: 10px; }
  .raid-clock strong { font-size: 19px; }
  .raid-meta { gap: 9px; }
  .combat-readout { gap: 5px; }
  .combat-readout div { min-width: 38px; }
  .combat-readout strong { font-size: 10px; }
  .chat-bar { grid-template-columns: 54px minmax(0, 1fr); gap: 6px; margin: 6px 0; padding: 4px 0; }
  .board-toolbar { flex-wrap: wrap; gap: 5px; }
  .weapon-quickbar { width: 100%; }
  .weapon-quick-slot { flex: 1 1 0; max-width: none; padding-inline: 3px; }
  .weapon-current { min-width: 62px; flex: 1.2 1 0; }
  .scope-controls { margin-left: auto; }
  .chat-channel-select { width: 44px; }
  .chat-form { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) 54px; }
  .chat-messages { height: 54px; font-size: 10px; }
  .mission-bar { grid-template-columns: 1fr; gap: 10px; margin-bottom: 9px; padding: 10px 0; }
  .mission-copy p { line-height: 1.55; }
  .utility-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .utility-btn { min-height: 48px; grid-template-columns: 28px 1fr; }
  .game-layout { gap: 10px; }
  .status-strip {
    grid-template-columns: minmax(110px, 1fr) 44px 44px 56px 56px;
    grid-template-rows: 34px 38px;
  }
  .status-item { min-height: 0; padding: 5px 7px; overflow: hidden; border-bottom: 1px solid var(--line); }
  .status-item strong { font-size: 12px; white-space: nowrap; }
  .status-value small { display: none; }
  .full-label { display: none; }
  .short-label { display: inline; color: #dfe2da; font-size: 12px; font-weight: 800; }
  .health-status, .stamina-status {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 28px;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 5px;
  }
  .health-status { grid-column: 1 / -1; grid-row: 1; }
  .stamina-status { grid-column: 1; grid-row: 2; }
  .health-status .status-value, .stamina-status .status-value { grid-column: 3; grid-row: 1; }
  .health-status .meter, .stamina-status .meter { grid-column: 2; grid-row: 1; height: 6px; }
  .satiety-status, .hydration-status, .weapon-status, .inventory-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-left: 1px solid var(--line);
  }
  .satiety-status { grid-column: 2; grid-row: 2; }
  .hydration-status { grid-column: 3; grid-row: 2; }
  .weapon-status { grid-column: 4; grid-row: 2; width: auto; flex-direction: column; gap: 1px; }
  .inventory-status { grid-column: 5; grid-row: 2; width: auto; flex-direction: column; gap: 1px; }
  .satiety-status .meter, .hydration-status .meter, .satiety-status small, .hydration-status small { display: none; }
  .satiety-status .status-value, .hydration-status .status-value { display: block; }
  .weapon-status strong { display: block; color: #dfe2da; font-size: 8px; }
  .inventory-status strong { display: block; color: #dfe2da; font-size: 8px; }
  .weapon-status.reloading { flex-direction: column; gap: 1px; }
  .weapon-status.reloading strong { display: block; color: var(--amber); font-size: 8px; }
  .weight-status { display: none !important; }
  .board-wrap { min-height: calc(var(--cell-height) * var(--view-rows) + 10px); padding: 5px; }
  .tile { font-size: 15px; }
  .mobile-controls { width: 100%; margin-top: 20px; padding: 4px 2px; gap: 8px; }
  .dpad { grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 3px; }
  .control-btn { width: 40px; height: 40px; }
  .action-controls { min-width: 0; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 190px; }
  .action-btn { min-width: 76px; min-height: 42px; font-size: 12px; }
  .icon-btn { width: 42px; height: 42px; }
  .intel-section { padding: 12px 0; }
  .loot-float { right: 5px; bottom: 5px; width: calc(100% - 10px); padding: 7px; }
  .loot-float-heading { margin-bottom: 6px; }
  .use-float { left: 5px; bottom: 5px; width: calc(100% - 10px); }
  .item-dialog { padding: 10px; align-items: end; }
  .item-panel { max-height: 78vh; padding: 15px; }
  .loot-panel, .inventory-list { max-height: calc(78vh - 88px); }
  .result-panel { padding: 22px 18px; }
  .result-stats strong { font-size: 13px; }
}

@media (min-width: 500px) and (max-width: 560px) {
  :root { --cell-size: 50px; --cell-height: var(--cell-size); }
}

@media (max-width: 370px) {
  :root { --cell-size: 40px; --cell-height: var(--cell-size); }
  .brand-block p { display: none; }
  .action-btn { min-width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* The carrying view is a full-screen work surface, independent of compact item dialogs. */
#inventory-dialog { padding: 0; align-items: stretch; background: #111410; backdrop-filter: none; }
#inventory-dialog .item-panel { width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); border: 0; box-shadow: none; }
#inventory-dialog .dialog-heading, #inventory-dialog .storage-inventory-panel { width: min(760px, 100%); margin-inline: auto; }
#inventory-dialog .storage-inventory-panel { max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; align-content: start; justify-items: center; }
#inventory-dialog .loot-storage-section { width: max-content; max-width: 100%; grid-template-columns: 70px auto; }

.loot-float .loot-panel { position: relative; grid-template-columns: repeat(5, 44px); grid-template-rows: repeat(5, 44px); justify-content: start; gap: 4px; }
.loot-grid-cell { z-index: 0; display: grid; place-items: center; border: 1px dashed #444c40; background: #191d18; color: #565e52; font-size: 9px; }
.loot-float .loot-slot { z-index: 1; width: auto; height: auto; min-height: 44px; aspect-ratio: auto; padding: 3px; }
.loot-float .loot-slot .slot-glyph { font-size: 13px; }
.loot-float .loot-slot strong { display: block; font-size: 7px; }

/* Searching is a full-screen transfer workspace so loot and carried storage stay reachable. */
.loot-float {
  position: fixed;
  inset: 0;
  z-index: 14;
  width: auto;
  max-height: none;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: hidden;
  background: #111410;
  box-shadow: none;
}
.loot-float-heading { grid-column: 1 / -1; position: static; margin: 0; padding: 0 0 12px; }
.loot-float .loot-panel { align-self: start; max-height: none; overflow: visible; }
.loot-float .loot-storage-panel { min-height: 0; height: 100%; margin: 0; padding: 0 4px 20px 0; overflow-y: scroll; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.loot-float .loot-storage-section { grid-template-columns: 90px auto; justify-content: start; }

@media (max-width: 560px) {
  .loot-float { right: 0; bottom: 0; width: auto; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .loot-float-heading { grid-column: 1; }
  .loot-float .loot-panel { justify-self: center; }
  .loot-float .loot-storage-panel { width: 100%; }
  .loot-float .loot-storage-section { grid-template-columns: 62px auto; justify-content: center; }
}
