:root {
  --ink: #0b0d0c;
  --forest: #102418;
  --moss: #253d2c;
  --reed: #d8d1bd;
  --paper: #e2dac6;
  --paper-deep: #b9ad91;
  --wine: #8b2f3a;
  --gold: #c49a3a;
  --iron: #606867;
  --mist: rgba(226, 218, 198, 0.78);
  --shadow: rgba(0, 0, 0, 0.55);
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--reed);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid rgba(196, 154, 58, 0.75);
  border-radius: 6px;
  background: linear-gradient(180deg, #415d44, #1c3323);
  color: #fff7dc;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

button:hover,
button:focus-visible {
  border-color: #f0cb70;
  outline: 2px solid rgba(196, 154, 58, 0.35);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45) brightness(0.7);
  opacity: 0.7;
}

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

button.secondary {
  background: linear-gradient(180deg, #6f3540, #4b1f2a);
}

button.ghost {
  background: rgba(12, 18, 15, 0.7);
}

.app-shell {
  width: min(1360px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(16, 36, 24, 0.98), rgba(8, 14, 12, 0.98)),
    radial-gradient(circle at 18% 8%, rgba(196, 154, 58, 0.18), transparent 28%);
}

.loading-text,
.empty-text {
  padding: 24px;
  color: var(--mist);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px clamp(12px, 3vw, 24px);
  background: linear-gradient(180deg, rgba(9, 16, 13, 0.98), rgba(15, 33, 22, 0.94));
  border-bottom: 1px solid rgba(196, 154, 58, 0.42);
  box-shadow: 0 10px 24px var(--shadow);
}

.crest {
  width: 48px;
  height: 48px;
}

.game-title {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.55rem);
  letter-spacing: 0;
  color: #fff6dc;
}

.game-subtitle {
  margin: 2px 0 0;
  color: var(--mist);
  font-size: 0.92rem;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions button {
  padding: 8px 12px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: rgba(196, 154, 58, 0.35);
  border-bottom: 1px solid rgba(196, 154, 58, 0.35);
}

.status-item {
  min-width: 0;
  padding: 10px 12px;
  background: rgba(14, 32, 21, 0.9);
}

.status-item span {
  display: block;
  color: rgba(226, 218, 198, 0.66);
  font-size: 0.75rem;
}

.status-item strong {
  display: block;
  overflow: hidden;
  color: #fff7dc;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  margin: 0;
  padding: 10px clamp(12px, 3vw, 24px);
  background: rgba(139, 47, 58, 0.22);
  border-bottom: 1px solid rgba(139, 47, 58, 0.45);
  color: #ffe4e8;
}

.screen {
  display: grid;
  gap: 16px;
  padding: 16px clamp(12px, 3vw, 24px) 28px;
}

.location-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
  align-items: start;
}

.map-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid rgba(196, 154, 58, 0.42);
  border-radius: 8px;
  background: #0d1612;
  box-shadow: 0 18px 36px var(--shadow);
}

.map-stage img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
  display: block;
}

.map-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(11, 13, 12, 0.1), rgba(11, 13, 12, 0.55)),
    radial-gradient(circle at 50% 40%, transparent 0, rgba(0, 0, 0, 0.24) 68%);
  pointer-events: none;
}

.settlement-marker {
  position: absolute;
  min-width: 126px;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.marker-oakfield {
  top: 61%;
  left: 33%;
}

.marker-grayhaven {
  top: 34%;
  left: 70%;
}

.settlement-marker .pin {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: linear-gradient(180deg, #7c3340, #172d20);
  box-shadow: 0 8px 14px var(--shadow);
}

.settlement-marker .pin img {
  width: 34px;
  height: 34px;
  min-height: 0;
}

.settlement-label {
  width: max-content;
  max-width: 170px;
  padding: 4px 10px;
  border: 1px solid rgba(196, 154, 58, 0.7);
  border-radius: 4px;
  background: rgba(9, 14, 12, 0.82);
  color: #fff7dc;
  font-size: 0.86rem;
  text-align: center;
  white-space: normal;
}

.city-map-stage {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid rgba(196, 154, 58, 0.42);
  border-radius: 8px;
  background: #2e3d2d;
  box-shadow: 0 18px 36px var(--shadow);
  isolation: isolate;
}

.city-map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  background: #2e3d2d;
}

.city-map-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 246, 220, 0.05), rgba(0, 0, 0, 0.14)),
    radial-gradient(circle at 50% 45%, transparent 48%, rgba(0, 0, 0, 0.2) 100%);
  pointer-events: none;
}

.city-map-label-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.city-map-label {
  position: absolute;
  max-width: 138px;
  transform: translate(-50%, -100%);
  padding: 4px 9px;
  border: 1px solid rgba(196, 154, 58, 0.75);
  border-radius: 4px;
  background: rgba(9, 14, 12, 0.9);
  color: #fff7dc;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.42);
}

.city-map-label-gate,
.city-map-label-guard {
  border-color: rgba(184, 73, 78, 0.82);
}

.city-map-caption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 4;
  display: grid;
  gap: 2px;
  min-width: 190px;
  max-width: min(360px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(196, 154, 58, 0.54);
  border-radius: 8px;
  background: rgba(10, 15, 12, 0.82);
  color: #fff7dc;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
}

.city-map-caption strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-map-caption span {
  color: rgba(226, 218, 198, 0.76);
  font-size: 0.82rem;
}

.city-map-kicker {
  text-transform: uppercase;
}

.city-map-error {
  position: absolute;
  inset: auto 16px 16px;
  z-index: 5;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(139, 47, 58, 0.7);
  border-radius: 6px;
  background: rgba(20, 10, 12, 0.9);
  color: #ffe4e8;
}

.panel {
  border: 1px solid rgba(196, 154, 58, 0.45);
  border-radius: 8px;
  background: rgba(226, 218, 198, 0.94);
  color: #172018;
  box-shadow: 0 12px 28px var(--shadow);
}

.panel-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(37, 61, 44, 0.28);
}

.panel-header h2,
.section-title {
  margin: 0;
  font-size: 1.18rem;
  color: #172018;
}

.panel-header p {
  margin: 4px 0 0;
  color: #3c4f43;
}

.panel-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.npc-list,
.action-list,
.interaction-list,
.service-list,
.rumor-list,
.log-list {
  display: grid;
  gap: 10px;
}

.npc-button {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  text-align: left;
}

.npc-button img,
.portrait img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.npc-name {
  display: block;
  color: #fff7dc;
  font-weight: 700;
}

.npc-meta {
  display: block;
  color: rgba(255, 247, 220, 0.78);
  font-size: 0.86rem;
}

.relation-pill,
.tag-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(196, 154, 58, 0.18);
  color: #fff1c1;
  font-size: 0.8rem;
}

.action-list button {
  width: 100%;
  padding: 11px 12px;
}

.interaction-button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 74px;
  padding: 11px 12px;
  text-align: left;
}

.service-button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 74px;
  padding: 11px 12px;
  text-align: left;
}

.interaction-title {
  color: #fff7dc;
  font-weight: 700;
}

.service-title {
  color: #fff7dc;
  font-weight: 700;
}

.interaction-description,
.interaction-meta,
.service-description,
.service-meta {
  color: rgba(255, 247, 220, 0.78);
  font-size: 0.86rem;
}

.conversation-screen {
  max-width: 780px;
  margin: 0 auto;
}

.dialogue-panel {
  overflow: hidden;
}

.dialogue-scene {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px;
  background: linear-gradient(180deg, rgba(16, 36, 24, 0.95), rgba(32, 44, 35, 0.95));
  color: var(--reed);
}

.portrait {
  display: grid;
  place-items: center;
}

.dialogue-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dialogue-copy h2 {
  margin: 0;
  color: #fff7dc;
}

.dialogue-copy p {
  margin: 0;
  line-height: 1.55;
}

.ambient {
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  color: #e9ddb8;
}

.option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.option-list button {
  min-height: 56px;
  padding: 10px 12px;
}

.journal-layout {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.rumor-item,
.log-item {
  padding: 12px;
  border-left: 3px solid var(--wine);
  background: rgba(16, 36, 24, 0.08);
}

.rumor-item p,
.log-item p {
  margin: 0;
}

.rumor-item small,
.log-item small {
  display: block;
  margin-top: 6px;
  color: #536557;
}

@media (max-width: 760px) {
  .top-bar {
    grid-template-columns: 44px 1fr;
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .location-grid,
  .journal-layout {
    grid-template-columns: 1fr;
  }

  .map-stage,
  .map-stage img,
  .city-map-stage,
  .city-map-canvas {
    min-height: 330px;
  }

  .option-list {
    grid-template-columns: 1fr;
  }

  .dialogue-scene {
    grid-template-columns: 58px 1fr;
  }

  .npc-button {
    grid-template-columns: 48px 1fr;
  }

  .npc-button .relation-pill {
    grid-column: 2;
    width: fit-content;
  }
}
