:root {
  --bg: #111216;
  --panel: #1b1e26;
  --panel-border: #2c3240;
  --text: #eff2f7;
  --muted: #abb3c7;
  --accent: #3aa57c;
  --danger: #b54848;
  --warning: #c79031;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, #222836 0%, var(--bg) 50%);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
}

.panel {
  border-right: 1px solid var(--panel-border);
  background: linear-gradient(180deg, #202631 0%, #161a22 100%);
  padding: 16px;
  overflow-y: auto;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 4px 0 14px;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
}

.entity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.entity-title {
  font-weight: 700;
}

.entity-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

button {
  border: 1px solid #2d4d3f;
  border-radius: 8px;
  background: #265c47;
  color: var(--text);
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  border-color: #3a3f4d;
  background: #3a3f4d;
  cursor: not-allowed;
}

.utility-btn {
  width: 100%;
  margin-top: 8px;
}

.danger-btn {
  border-color: #6c2f2f;
  background: #7f3434;
}

.inventory-list {
  margin: 0;
  padding-left: 18px;
}

.inventory-item {
  margin-bottom: 8px;
}

.inventory-actions {
  margin-top: 4px;
}

.inventory-actions button {
  margin-right: 8px;
}

.combat-log {
  margin: 0;
  padding-left: 18px;
  max-height: 160px;
  overflow-y: auto;
  color: #d7dde8;
}

.message {
  color: #d3deef;
  background: rgba(31, 112, 134, 0.26);
  border: 1px solid #27586d;
  border-radius: 8px;
  padding: 8px;
}

.message.warn {
  border-color: #765324;
  background: rgba(128, 88, 33, 0.26);
}

.message.error {
  border-color: #6c2f2f;
  background: rgba(128, 31, 31, 0.22);
}

.entity-map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #0c1117;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  font-size: 18px;
  line-height: 1;
}

.marker-player {
  background: #347cb1;
}

.marker-rat {
  background: #8f3c3c;
}

.marker-sword {
  background: #8a6d2f;
}

.popup-card {
  min-width: 180px;
}

.popup-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.popup-meta {
  color: #4a5568;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.popup-action-btn {
  width: 100%;
  margin-bottom: 6px;
}

.popup-hint {
  color: #5d6678;
  font-size: 0.8rem;
}

.map-wrap,
#map {
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 440px 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }
}
