* { box-sizing: border-box; }
body {
  margin: 0;
  background: #2a1f15;
  color: #e8d9b8;
  font-family: "Segoe UI", "Helvetica", monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
  user-select: none;
  -webkit-user-select: none;
}
#game { display: flex; gap: 8px; }
#world {
  background: #000;
  image-rendering: pixelated;
  border: 2px solid #8b6f47;
  cursor: crosshair;
}
#panel {
  width: 252px;
  background: linear-gradient(#5a4a36, #3b3024);
  border: 2px solid #8b6f47;
  padding: 8px;
  font-size: 13px;
}
#player-vitals {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #8b6f47;
}
.vital-hp-heading {
  font-weight: bold;
  font-size: 15px;
  color: #ffb3b3;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.hp-bar-track {
  height: 14px;
  background: #1a120c;
  border: 1px solid #5c4830;
  border-radius: 2px;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #e84a4a 0%, #9c2020 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: width 0.15s ease-out;
}
.vital-hp-numbers {
  margin-top: 4px;
  font-size: 18px;
  font-weight: bold;
  color: #fff5e8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}
.vital-angel-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #e8e0ff;
}
.vital-angel-emoji {
  font-size: 18px;
  line-height: 1;
}
.vital-angel-bonus {
  font-weight: normal;
  font-size: 12px;
  color: #c9baa3;
}
#tabs { display: flex; gap: 4px; margin-bottom: 8px; }
#tabs button {
  flex: 1;
  background: #5a4a36;
  color: #e8d9b8;
  border: 1px solid #8b6f47;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}
#tabs button.active { background: #8b6f47; color: #fff; }
.tab-content.hidden { display: none; }
#inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 2px;
  margin-bottom: 8px;
}
.inv-slot {
  width: 56px;
  height: 56px;
  background: #2a2018;
  border: 1px solid #8b6f47;
  position: relative;
}
.inv-slot.has-item { cursor: pointer; }
.inv-slot.offered {
  outline: 2px solid #ffe066;
  box-shadow: inset 0 0 0 2px rgba(255, 224, 102, 0.35);
}
.inv-slot img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.inv-slot .label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #ccc;
  text-align: center;
  pointer-events: none;
}
.qty {
  position: absolute;
  top: 2px; left: 2px;
  color: #ffe066;
  font-size: 11px;
  text-shadow: 1px 1px 0 #000;
  font-weight: bold;
}
#equipped { font-size: 12px; margin-bottom: 4px; }
#equip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.equip-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.equip-slot-label { font-size: 11px; color: #c9baa3; }
.equip-slot-box {
  width: 56px;
  height: 56px;
  background: #2a2018;
  border: 1px solid #8b6f47;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.equip-slot-box.has-item { cursor: pointer; }
.equip-slot-box.has-item:hover { outline: 1px solid #ffe066; }
.equip-slot-box img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.equip-slot-empty { color: #5c4830; font-size: 22px; }
.hint { color: #b8a98a; font-size: 11px; margin-top: 4px; line-height: 1.3; }
#skills-list div { padding: 2px 0; border-bottom: 1px solid #5a4a36; }
.window h3 {
  margin: 8px 0 4px;
  font-size: 13px;
  color: #ffe066;
}
.trade-row {
  width: 100%;
  margin: 4px 0;
  padding: 6px;
  background: #5a4a36;
  border: 1px solid #8b6f47;
  color: #e8d9b8;
  cursor: pointer;
  font-family: inherit;
}
.trade-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}
.trade-row:hover { background: #8b6f47; }
.trade-row:disabled {
  opacity: 0.65;
  cursor: default;
}
.trade-row:disabled:hover { background: #5a4a36; }
.window.hidden { display: none; }
.window {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.window-card {
  width: min(720px, calc(100vw - 32px));
  background: linear-gradient(#5a4a36, #3b3024);
  border: 2px solid #c49a5a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  padding: 10px;
}
.window-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffe066;
  font-weight: bold;
  margin-bottom: 8px;
}
.window-card-narrow {
  width: min(440px, calc(100vw - 32px));
}
.angel-dialog {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: #e8d9b8;
}
.hint-block {
  font-size: 13px;
  color: #c9baa3;
}
.angel-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 12px;
}
.angel-btn {
  background: #5a4a36;
  color: #e8d9b8;
  border: 1px solid #8b6f47;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 18px;
  font-size: 14px;
}
.angel-btn:hover {
  background: #8b6f47;
}
#angel-close {
  background: #5a4a36;
  color: #e8d9b8;
  border: 1px solid #8b6f47;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 10px;
  font-size: 13px;
}
#angel-close:hover {
  background: #8b6f47;
}
#trade-close,
#player-trade-close,
#chat-form button {
  background: #5a4a36;
  color: #e8d9b8;
  border: 1px solid #8b6f47;
  cursor: pointer;
  font-family: inherit;
}
.trade-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.trade-row img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  -webkit-user-drag: none;
}
.trade-row .trade-name {
  flex: 1;
}
.trade-row .trade-price {
  color: #ffe066;
  white-space: nowrap;
}
.player-trade-card {
  width: min(620px, calc(100vw - 32px));
}
.trade-stage,
.trade-status {
  color: #d8c6a3;
  font-size: 12px;
  margin: 6px 0;
}
.player-trade-list {
  min-height: 140px;
  background: rgba(26, 20, 16, 0.5);
  border: 1px solid #8b6f47;
  padding: 6px;
}
.player-trade-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(139, 111, 71, 0.5);
}
.player-trade-row img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  -webkit-user-drag: none;
}
.player-trade-row span:nth-child(2) {
  flex: 1;
}
.player-trade-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
#chat-panel {
  width: 988px;
  margin-top: 8px;
  background: #1a1410;
  border: 2px solid #8b6f47;
  padding: 4px;
  user-select: text;
  -webkit-user-select: text;
}
#chat-log {
  height: 150px;
  overflow-y: auto;
  padding: 2px 4px;
  font-size: 12px;
  font-family: monospace;
}
#chat-log div { line-height: 1.3; }
.chat-name { color: #ffe066; }
.chat-system { color: #d8c6a3; }
.chat-system .chat-name { color: #9fd6ff; }
#chat-form {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
#chat-input {
  flex: 1;
  background: #2a2018;
  border: 1px solid #8b6f47;
  color: #e8d9b8;
  padding: 5px;
  font-family: inherit;
}
