:root {
  color-scheme: dark;
  --bg: #101312;
  --panel: rgba(25, 29, 28, 0.92);
  --panel-2: rgba(43, 39, 30, 0.94);
  --line: rgba(232, 211, 166, 0.22);
  --text: #fff4df;
  --muted: #c9bda8;
  --gold: #e1ad48;
  --green: #6f9c65;
  --red: #c65c52;
  --blue: #5f879f;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(11, 14, 13, 0.78), rgba(11, 14, 13, 0.92)),
    url("/assets/city-gate.png") center / cover fixed,
    #111512;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(225, 173, 72, 0.28), rgba(118, 86, 34, 0.28));
  color: var(--text);
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.36);
  min-width: 116px;
  text-align: center;
}

.scene-hero {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(11, 12, 10, 0.88), rgba(11, 12, 10, 0.48), rgba(11, 12, 10, 0.24)),
    url("/assets/city-gate.png") center / cover;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.scene-hero.forest {
  background:
    linear-gradient(90deg, rgba(8, 13, 10, 0.9), rgba(8, 13, 10, 0.5), rgba(8, 13, 10, 0.26)),
    url("/assets/forest-path.png") center / cover;
}

.scene-hero.hills {
  background:
    linear-gradient(90deg, rgba(15, 13, 10, 0.9), rgba(15, 13, 10, 0.5), rgba(15, 13, 10, 0.26)),
    url("/assets/rocky-hills.png") center / cover;
}

.scene-copy {
  width: min(620px, 100%);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.78);
}

.scene-copy h2 {
  font-size: 34px;
  margin: 0 0 8px;
}

.scene-copy p:last-child {
  margin-bottom: 0;
  color: #f3ddba;
  line-height: 1.45;
}

#primaryActionBtn {
  min-width: 180px;
  background: linear-gradient(180deg, #e1ad48, #8f5e24);
  color: #17120a;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.hero-map,
.side-panel,
.journal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-surface {
  position: relative;
  min-height: 470px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(rgba(19, 22, 18, 0.58), rgba(19, 22, 18, 0.72)),
    url("/assets/city-gate.png") center / cover,
    #25261f;
  background-size: 34px 34px, 34px 34px, auto, cover, auto;
}

.map-surface.forest {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(rgba(11, 19, 13, 0.54), rgba(11, 19, 13, 0.75)),
    url("/assets/forest-path.png") center / cover,
    #172018;
  background-size: 34px 34px, 34px 34px, auto, cover, auto;
}

.map-surface.hills {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(rgba(28, 24, 16, 0.54), rgba(28, 24, 16, 0.76)),
    url("/assets/rocky-hills.png") center / cover,
    #2a251a;
  background-size: 34px 34px, 34px 34px, auto, cover, auto;
}

.map-grid {
  position: absolute;
  inset: 18px;
}

.tile {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(241, 234, 219, 0.18);
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(1px);
}

.tile.player {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(225, 173, 72, 0.24), 0 0 24px rgba(225, 173, 72, 0.6);
}

.tile.city {
  background: rgba(198, 92, 82, 0.88);
}

.tile.road {
  background: rgba(225, 173, 72, 0.56);
}

.tile.forest {
  background: rgba(80, 132, 77, 0.72);
}

.tile.hills {
  background: rgba(158, 122, 70, 0.72);
}

.tile.water {
  background: rgba(95, 135, 159, 0.78);
}

.map-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 14, 13, 0.78);
  backdrop-filter: blur(8px);
}

.map-overlay p {
  margin-bottom: 2px;
  color: var(--muted);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
}

.move-pad {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.move-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.side-panel {
  min-height: 594px;
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.tabs button {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  background: rgba(225, 173, 72, 0.22);
  color: var(--text);
}

.tab-page {
  display: none;
  padding: 14px;
}

.tab-page.active {
  display: block;
}

.city-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.district {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.place-grid,
.npc-select,
.action-grid,
.stat-grid,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.place {
  min-height: 58px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.place b {
  display: block;
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
}

.npc-select button.active {
  border-color: rgba(225, 173, 72, 0.9);
  background: rgba(225, 173, 72, 0.24);
}

.chat-log {
  height: 282px;
  margin: 12px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.msg {
  margin-bottom: 10px;
  line-height: 1.38;
}

.msg.user {
  color: #e7c889;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 104px;
  gap: 8px;
}

input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
}

.enemy {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.stat-grid {
  margin-bottom: 12px;
}

.stat,
.item {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
}

.stat b {
  display: block;
  font-size: 20px;
}

.journal {
  margin-top: 14px;
  padding: 14px;
}

.journal-entry {
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.journal-entry:first-child {
  border-top: 0;
  color: var(--text);
}

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

  .side-panel {
    min-height: auto;
  }

  .map-surface {
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 10px;
  }

  h1 {
    font-size: 23px;
  }

  .scene-hero {
    min-height: 300px;
    display: block;
  }

  .scene-copy h2 {
    font-size: 29px;
  }

  #primaryActionBtn {
    width: 100%;
    margin-top: 16px;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .place-grid,
  .npc-select,
  .action-grid,
  .stat-grid,
  .inventory-grid {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}
