:root {
  color-scheme: dark;
  --bg: #10100e;
  --panel: #171815;
  --panel-soft: #20211d;
  --line: #3b3b34;
  --text: #ece6d6;
  --muted: #aaa28e;
  --gold: #c7a350;
  --red: #a94e44;
  --green: #6f9f63;
  --blue: #536d8e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #24251f;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

button:hover {
  border-color: var(--gold);
  background: #313227;
}

button:active {
  transform: translateY(1px);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.viewport-wrap {
  position: relative;
  min-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid #2b2b27;
  border-radius: 8px;
  background: #050504;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.view-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.compass,
.message {
  position: absolute;
  border: 1px solid rgba(236, 230, 214, 0.18);
  border-radius: 6px;
  background: rgba(11, 11, 9, 0.72);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.compass {
  top: 14px;
  left: 14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 800;
}

.message {
  left: 50%;
  bottom: 16px;
  max-width: min(620px, calc(100% - 32px));
  padding: 9px 12px;
  transform: translateX(-50%);
  color: var(--muted);
  text-align: center;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.brand,
.party,
.controls,
.map-box,
.log {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.level-name {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-actions {
  display: grid;
  gap: 8px;
}

#reset,
.icon-link {
  display: inline-grid;
  min-width: 64px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #24251f;
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

.party {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.hero {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

meter {
  width: 100%;
  height: 14px;
}

meter::-webkit-meter-bar {
  border: 1px solid #313128;
  border-radius: 4px;
  background: #0e0f0d;
}

meter::-webkit-meter-optimum-value {
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--green));
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
}

.controls button {
  aspect-ratio: 1 / 0.68;
  min-width: 0;
  font-size: 1.35rem;
}

.map-box {
  padding: 14px;
}

#map {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #2f302a;
  border-radius: 6px;
  background: #0c0d0b;
}

.log {
  padding: 14px;
}

.log h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.9rem;
}

.log p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

  .viewport-wrap {
    min-height: 58vh;
  }

  .side-panel {
    grid-template-columns: 1fr 1fr;
  }

  .brand,
  .log {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 10px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .viewport-wrap {
    min-height: 52vh;
  }

  .message {
    font-size: 0.86rem;
  }
}
