:root {
  color-scheme: dark;
  --bg: #10180f;
  --panel: #172416;
  --panel-2: #23331f;
  --text: #f6f0d8;
  --muted: #c8bd96;
  --accent: #9bd36a;
  --gold: #e0b84f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #284020, var(--bg));
  color: var(--text);
}

.game-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.title-card,
.panel {
  width: min(720px, 100%);
  max-width: 100%;
  min-width: 0;
  border: 2px solid rgba(224, 184, 79, 0.55);
  background: linear-gradient(180deg, rgba(35, 51, 31, 0.95), rgba(23, 36, 22, 0.98));
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  margin: 0 0 12px;
}

h1 {
  max-width: 100%;
  font-size: clamp(2.65rem, 10vw, 6rem);
  line-height: 0.9;
  margin: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin: 8px 0 16px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.tagline,
#panel-copy {
  color: var(--muted);
  font-size: 1.1rem;
}

button {
  appearance: none;
  max-width: 100%;
  border: 0;
  background: var(--gold);
  color: #1c1404;
  font-weight: 800;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  filter: brightness(1.08);
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 16px;
  margin: 24px 0;
}

.starter-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  text-align: left;
  border-radius: 18px;
  padding: 18px;
  min-height: 160px;
  background: rgba(155, 211, 106, 0.12);
  color: var(--text);
  border: 1px solid rgba(155, 211, 106, 0.35);
}

.starter-card strong {
  font-size: 1.2rem;
  color: var(--gold);
}

.starter-card span,
.starter-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.result-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  margin: 24px 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(224, 184, 79, 0.14);
  border: 1px solid rgba(224, 184, 79, 0.45);
}

.map-label {
  color: var(--accent);
  font-weight: 700;
  margin: 18px 0 8px;
}

.map-grid {
  --tile-size: 24px;
  display: grid;
  grid-template-columns: repeat(var(--map-width), var(--tile-size));
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  overscroll-behavior-inline: contain;
}

.map-tile {
  width: var(--tile-size);
  height: var(--tile-size);
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(155, 211, 106, 0.12);
  color: var(--gold);
  font-size: 0.9rem;
}

.player-tile {
  background: rgba(224, 184, 79, 0.85);
  color: #1c1404;
  font-weight: 900;
}

.npc-tile {
  background: rgba(155, 211, 106, 0.45);
  color: #f6f0d8;
  font-weight: 900;
}

.object-tile {
  background: rgba(98, 172, 217, 0.35);
  color: #f6f0d8;
  font-weight: 900;
}

.blocked-tile {
  background: rgba(0, 0, 0, 0.35);
}

.movement-controls {
  display: grid;
  max-width: 100%;
  min-width: 0;
  justify-items: center;
  gap: 8px;
  margin: 16px 0;
}

.movement-controls div {
  display: flex;
  max-width: 100%;
  gap: 8px;
}

.movement-controls button {
  min-width: 78px;
}

.encounter-controls {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin: 18px 0;
}

.helper-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.hidden {
  display: none;
}

pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(0, 0, 0, 0.28);
  padding: 16px;
  border-radius: 14px;
  color: #d7f2c2;
  overflow: auto;
}

@media (max-width:640px) {
  .game-shell { padding: 12px; }
  .title-card,
  .panel { padding: 20px; }
  .movement-controls div { flex-wrap: wrap; justify-content: center; }
  .movement-controls button { min-width: 68px; }
}

/* DTFSeeds integration navigation */
.hub-back{position:fixed;z-index:50;top:14px;left:14px;padding:9px 12px;border:1px solid rgba(180,224,190,.38);border-radius:999px;background:rgba(5,16,10,.86);color:#eaf6ec;text-decoration:none;font:800 13px/1 system-ui,sans-serif;backdrop-filter:blur(8px)}
.hub-back:hover,.hub-back:focus-visible{border-color:#b7e4bf;background:#102c1a;outline:none}
