:root {
  --bg: #0d0f12;
  --surface: #161a20;
  --border: #2a323c;
  --text: #e8eaed;
  --muted: #8b949e;
  --rust: #c45c26;
  --iron: #6b7c8f;
  --toxic: #5a9e6e;
  --danger: #c94c4c;
  --accent: #d4a574;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.08em;
  margin: 0;
  color: var(--accent);
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
}

.panel h2,
.panel h3 {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  margin: 0 0 0.65rem;
  font-weight: 400;
  color: var(--iron);
  font-size: 1.35rem;
}

.panel h2 {
  color: var(--accent);
  font-size: 1.75rem;
}

.location-desc {
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.story-log {
  font-size: 0.95rem;
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.story-log p {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.55rem;
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--rust);
  border-radius: 0 4px 4px 0;
}

.story-log p.system {
  border-left-color: var(--iron);
  color: var(--muted);
}

.story-log p.danger {
  border-left-color: var(--danger);
}

.story-log p.win {
  border-left-color: var(--toxic);
}

.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.35rem 1rem;
  font-size: 0.9rem;
}

.stats li strong {
  color: var(--accent);
  font-weight: 600;
}

.derby-badge {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(196, 92, 38, 0.15);
  border: 1px solid var(--rust);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.derby-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.derby-tier {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--rust);
}

.btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1e242d;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #252d38;
  border-color: var(--iron);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: rgba(196, 92, 38, 0.25);
  border-color: var(--rust);
  color: var(--accent);
}

.btn--danger {
  background: rgba(201, 76, 76, 0.2);
  border-color: var(--danger);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
}

.combat-status {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
}

.inventory {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.inventory li {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.inventory li:last-child {
  border-bottom: none;
}

.footer {
  margin-top: 1.5rem;
  text-align: center;
}

[hidden] {
  display: none !important;
}

.map-hint {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.map-scroll {
  overflow: auto;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0a0c0f;
}

.map-mount {
  min-width: 480px;
  min-height: 260px;
}

.map-mount svg {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.map-edge {
  fill: none;
  stroke-linecap: round;
}

.map-edge--far {
  stroke: rgba(107, 124, 143, 0.35);
  stroke-width: 0.28;
}

.map-edge--here {
  stroke: var(--rust);
  stroke-width: 0.55;
  opacity: 0.95;
}

.map-node {
  cursor: pointer;
  transition: filter 0.15s;
}

.map-node:focus {
  outline: none;
}

.map-node circle {
  fill: #252d38;
  stroke: var(--iron);
  stroke-width: 0.4;
}

.map-node--adjacent circle {
  stroke: var(--accent);
  stroke-width: 0.55;
}

.map-node--here circle {
  fill: rgba(196, 92, 38, 0.45);
  stroke: var(--rust);
  stroke-width: 0.7;
}

.map-node--disabled circle {
  fill: #1a1e24;
  stroke: #3d4550;
  opacity: 0.55;
}

.map-node:not(.map-node--disabled):hover circle {
  filter: brightness(1.15);
}

.map-label {
  font-family: var(--font-body);
  font-size: 1.85px;
  fill: rgba(139, 148, 158, 0.92);
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.map-label--here {
  fill: var(--accent);
  font-weight: 700;
}

.panel--dialogue {
  border-color: var(--rust);
  background: linear-gradient(180deg, #1a1f26 0%, var(--surface) 100%);
}

.dialogue-text {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text);
}

.dialogue-choices {
  flex-direction: column;
  align-items: stretch;
}

.dialogue-choices .btn {
  text-align: left;
  justify-content: flex-start;
}
