/* ===== 末日公路 - Last Road ===== */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0a; }
body { font-family: "Consolas", "微软雅黑", monospace; color: #d8c8a0; }

#game-container { position: relative; width: 100vw; height: 100vh; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; }

.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a0e0a 0%, #000 80%);
  z-index: 100; text-align: center;
}
.splash-inner { padding: 40px; max-width: 720px; }
.title { font-size: 64px; letter-spacing: 8px; color: #b8732d; text-shadow: 0 0 24px #b8732d, 4px 4px 0 #2a0e0a; margin-bottom: 8px; }
.death-title { color: #8a2020; text-shadow: 0 0 24px #8a2020; }
.subtitle { color: #806040; font-size: 16px; margin-bottom: 24px; letter-spacing: 2px; }
.hint { color: #604030; font-size: 13px; margin-top: 16px; }

.splash-controls {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
  margin: 24px auto; max-width: 520px; text-align: left;
  font-size: 13px; color: #a08868;
}
.ctrl-row { display: flex; align-items: center; gap: 12px; }
.key {
  display: inline-block; min-width: 64px; padding: 2px 8px; text-align: center;
  background: #2a1a10; border: 1px solid #604030; border-radius: 3px;
  color: #e0c080; font-size: 12px; font-weight: bold;
}

.btn {
  background: linear-gradient(#a85a20, #6a3810); border: 2px solid #d09040;
  color: #fff; padding: 10px 28px; font-size: 16px; font-family: inherit;
  cursor: pointer; letter-spacing: 2px; border-radius: 2px;
  box-shadow: 0 4px 0 #2a0e0a; transition: transform 0.05s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2a0e0a; }
.btn.small { padding: 4px 10px; font-size: 12px; letter-spacing: 1px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.hidden { display: none !important; }

/* ===== HUD ===== */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-top-left { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 4px; }
.stat { display: flex; align-items: center; gap: 6px; background: rgba(10,8,6,0.6); padding: 3px 8px; border-radius: 3px; }
.stat-icon { font-size: 14px; width: 16px; text-align: center; }
.bar { width: 140px; height: 10px; background: #1a1410; border: 1px solid #403020; border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; transition: width 0.3s; }
.bar-fill.hp { background: linear-gradient(#c03030, #802020); }
.bar-fill.fuel { background: linear-gradient(#c0a020, #806010); }
.bar-fill.water { background: linear-gradient(#3080c0, #205080); }
.bar-fill.food { background: linear-gradient(#a0c030, #608010); }
.stat-txt { font-size: 11px; color: #c0a080; min-width: 28px; text-align: right; }

.hud-top-right { position: absolute; top: 12px; right: 12px; text-align: right; display: flex; flex-direction: column; gap: 4px; }
.clock, .weather, .biome { background: rgba(10,8,6,0.6); padding: 4px 10px; font-size: 13px; color: #d8c080; border-radius: 3px; letter-spacing: 1px; }
.clock { color: #e0c060; }
.weather { color: #a0c0d0; }
.biome { color: #80a060; }

.hud-bottom-left { position: absolute; bottom: 12px; left: 12px; }
.weapon-info { background: rgba(10,8,6,0.6); padding: 6px 12px; border-radius: 3px; font-size: 14px; color: #e0c080; display: flex; gap: 12px; }
#wpn-ammo { color: #c0a060; }

.hud-bottom-center { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); }
.notify { background: rgba(10,8,6,0.85); padding: 8px 16px; border-radius: 3px; color: #e0c080; font-size: 14px; opacity: 0; transition: opacity 0.3s; max-width: 600px; text-align: center; }
.notify.show { opacity: 1; }

.hud-bottom-right { position: absolute; bottom: 12px; right: 12px; }
.key-hint { background: rgba(10,8,6,0.6); padding: 6px 10px; border-radius: 3px; font-size: 12px; color: #a08868; }
.key-hint .key { min-width: 20px; font-size: 11px; padding: 1px 4px; }

/* ===== 面板 ===== */
.panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 90%; max-width: 1100px; height: 80%; max-height: 640px;
  background: linear-gradient(#1a1208, #0a0804); border: 2px solid #604020;
  border-radius: 4px; box-shadow: 0 0 40px rgba(0,0,0,0.8); z-index: 50;
  display: flex; flex-direction: column;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #403020; background: #2a1a10; }
.panel-head h2 { color: #e0c080; font-size: 18px; letter-spacing: 2px; }
.close-btn { background: none; border: none; color: #c06030; font-size: 24px; cursor: pointer; line-height: 1; }
.close-btn:hover { color: #e08040; }
.panel-body { flex: 1; overflow: hidden; padding: 12px; }

.inv-layout { display: grid; grid-template-columns: 1fr 1fr 320px; gap: 12px; height: 100%; }
.inv-section { display: flex; flex-direction: column; min-height: 0; }
.inv-section h3 { color: #c0a060; font-size: 14px; margin-bottom: 8px; border-bottom: 1px solid #403020; padding-bottom: 4px; }
.muted { color: #604030; font-size: 12px; }
.small { font-size: 11px; }

.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; flex: 1; overflow-y: auto; padding: 4px; background: #0a0604; border: 1px solid #201810; }
.grid::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-track { background: #0a0604; }
.grid::-webkit-scrollbar-thumb { background: #403020; }

.slot {
  aspect-ratio: 1; background: #15100a; border: 1px solid #201810; position: relative;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 18px;
}
.slot:hover { border-color: #604020; background: #201408; }
.slot.selected { border-color: #e0c060; background: #302408; box-shadow: 0 0 6px #806020; }
.slot.empty { opacity: 0.4; }
.slot .count { position: absolute; bottom: 1px; right: 2px; font-size: 10px; color: #e0c080; text-shadow: 1px 1px 0 #000; }

.item-detail { background: #0a0604; border: 1px solid #201810; padding: 8px; flex: 1; overflow-y: auto; font-size: 13px; }
.item-detail .iname { color: #e0c060; font-size: 15px; margin-bottom: 4px; }
.item-detail .itype { color: #806040; font-size: 11px; margin-bottom: 6px; }
.item-detail .idesc { color: #a08868; line-height: 1.4; }
.item-detail .istat { color: #c0a060; font-size: 12px; margin-top: 4px; }
.rarity-common { color: #c0c0c0; }
.rarity-uncommon { color: #60c060; }
.rarity-rare { color: #60a0e0; }
.rarity-epic { color: #c060e0; }
.rarity-legend { color: #e0a020; }

.inv-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }

/* 制造 */
.craft-layout { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: 100%; }
.craft-list-wrap { display: flex; flex-direction: column; min-height: 0; }
.search { padding: 6px 8px; background: #0a0604; border: 1px solid #403020; color: #d8c0a0; font-family: inherit; font-size: 13px; margin-bottom: 8px; border-radius: 2px; }
.craft-list { flex: 1; overflow-y: auto; background: #0a0604; border: 1px solid #201810; padding: 4px; }
.craft-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; border: 1px solid transparent; }
.craft-item:hover { background: #201408; border-color: #403020; }
.craft-item.selected { background: #302408; border-color: #e0c060; }
.craft-item .ico { font-size: 18px; width: 22px; text-align: center; }
.craft-item .nm { flex: 1; font-size: 13px; color: #d8c0a0; }
.craft-item .can { font-size: 11px; color: #60c060; }
.craft-item .cant { font-size: 11px; color: #c06040; }

/* 建造 */
.build-layout { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: 100%; }
.build-list { overflow-y: auto; background: #0a0604; border: 1px solid #201810; padding: 4px; }
.car-slots { margin-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.car-slot { background: #15100a; border: 1px solid #403020; padding: 8px; font-size: 11px; text-align: center; cursor: pointer; min-height: 60px; }
.car-slot:hover { background: #201408; border-color: #604020; }
.car-slot.filled { border-color: #60c060; }
.car-slot .slot-name { color: #c0a060; font-size: 12px; }
.car-slot .slot-installed { color: #80a060; font-size: 11px; }

#notify { pointer-events: none; }

.death-stats { color: #a08868; margin-bottom: 20px; }
