* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

h1, h2, h3 {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; margin-top: 0.5rem; }
h3 { font-size: 1rem; }

.subtitle {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 2.3fr);
  gap: 1rem;
}

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

.panel {
  background: #020617;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.track {
  background: #020617;
  border-radius: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.track-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.track-name {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.track-value {
  font-weight: 600;
}

.track-buttons {
  display: flex;
  gap: 0.25rem;
}

button {
  background: #111827;
  color: #e5e7eb;
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

button:hover {
  background: #1f2937;
  border-color: #4b5563;
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.npc-card {
  background: #020617;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.npc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.npc-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.npc-role {
  font-size: 0.75rem;
  color: #9ca3af;
}

.npc-level {
  font-size: 0.75rem;
  color: #facc15;
}

.npc-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
  font-size: 0.7rem;
}

.npc-stat-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.npc-stat-value {
  font-weight: 600;
  font-size: 0.75rem;
}

.npc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.npc-notes {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid #1f2937;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: #9ca3af;
  background: #020617;
}

select {
  background: #020617;
  color: #e5e7eb;
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.section-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.log {
  max-height: 80vh;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.3;
}

.log-entry {
  border-bottom: 1px dashed #1f2937;
  padding: 0.35rem 0;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.log-time {
  font-size: 0.7rem;
  color: #4b5563;
  margin-left: 0.2rem;
}

.ok {
  color: #4ade80;
}

.danger {
  color: #fb7185;
}