* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: Georgia, serif;
  background: #f4f1ea;
  color: #1f2933;
  max-width: 100%;
  overflow-x: hidden;
}

h1 {
  margin-top: 0;
  font-size: 2rem;
}

a {
  color: #0b6e4f;
}

[hidden] {
  display: none;
}

.map-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

#canvas-container {
  height: 75vh;
  width: 100%;
  background: #000;
  position: relative;
  border-bottom: 2px solid #1f2933;
}

#world-map {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.world-map-landmark-hotspot {
  position: absolute;
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 0;
  cursor: pointer;
  background: rgba(249, 251, 246, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(23, 107, 84, 0.24);
  transform: translate(-50%, -50%);
}

.world-map-landmark-hotspot:hover,
.world-map-landmark-hotspot:focus-visible {
  background: rgba(23, 107, 84, 0.22);
  border-color: #ffffff;
  outline: 3px solid #d6bd73;
  outline-offset: 2px;
}

#side-panel {
  flex-grow: 1;
  background: #1a202c;
  color: #fff;
  padding: 1rem;
  overflow-y: auto;
}

#side-panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.simulate-button {
  width: 100%;
  background-color: #3182ce;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 2rem;
}

.simulate-button:hover {
  background-color: #2b6cb0;
}

.version-tag {
  font-size: 0.75rem;
  color: #718096;
  margin-bottom: 1rem;
}

#activity-log {
  list-style: none;
  padding: 0;
  margin: 0;
}

#activity-log li {
  margin-bottom: 0.5rem;
}

.log-entry {
  padding: 0.5rem;
  background-color: #2d3748;
  border-radius: 0.25rem;
  border: 1px solid #4a5568;
}

.log-entry p {
  margin: 0;
  font-size: 0.875rem;
}

.placeholder-text {
  color: #a0aec0;
  font-size: 0.875rem;
}

.gameplay-map-page,
.expedition-map-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1rem;
}

.gameplay-header {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.gameplay-header p {
  max-width: 70ch;
}

.eyebrow {
  color: #6b4f1d;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tactical-map-shell,
.generated-path-panel {
  margin-bottom: 1rem;
}

.map-surface,
.expedition-map-overlay {
  position: relative;
  display: grid;
  min-height: 22rem;
  padding: 1rem;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(42, 100, 80, 0.14), transparent 38%),
    linear-gradient(45deg, rgba(132, 85, 36, 0.14), transparent 48%), #edf0e8;
  border: 1px solid #7a8374;
  border-radius: 8px;
}

.terrain-band {
  position: absolute;
  padding: 0.35rem 0.5rem;
  color: #526052;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #b7bfae;
  border-radius: 999px;
}

.terrain-band-forest {
  bottom: 1rem;
  left: 1rem;
}

.terrain-band-mountain {
  top: 1rem;
  right: 1rem;
}

.poi-marker {
  z-index: 2;
  display: grid;
  gap: 0.35rem;
  width: min(16rem, 100%);
  padding: 0.75rem;
  align-self: end;
  color: #17231e;
  background: #f9fbf6;
  border: 2px solid #74856f;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.12);
}

.poi-marker[aria-selected="true"] {
  background: #eef8f1;
  border-color: #176b54;
}

.poi-ashigara-forest-camp {
  justify-self: start;
  margin-top: 9rem;
}

.poi-hakone-pass {
  justify-self: end;
  margin-bottom: 8rem;
}

.poi-marker-button,
.expedition-opportunity-panel button,
.choice-btn {
  min-height: 2.5rem;
  padding: 0.55rem 0.8rem;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  background: #176b54;
  border: 0;
  border-radius: 6px;
}

.poi-marker-button:hover,
.expedition-opportunity-panel button:hover,
.choice-btn:hover {
  background: #245b7a;
}

.poi-marker-meta,
.expedition-meta,
.detail-grid,
.route-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.poi-marker-meta span,
.expedition-meta span,
.route-preview span,
.node-badge,
.node-depth,
.terminal-badge {
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  background: #e1e7dc;
  border: 1px solid #c1c9b8;
  border-radius: 999px;
}

.map-surface > .route-line,
.route-backdrop {
  position: absolute;
  z-index: 1;
  height: 0.35rem;
  background: repeating-linear-gradient(
    90deg,
    #7c5f29,
    #7c5f29 0.8rem,
    #d6bd73 0.8rem,
    #d6bd73 1.35rem
  );
  border-radius: 999px;
  transform: rotate(-21deg);
  transform-origin: left center;
}

.map-surface > .route-line {
  top: 52%;
  right: 21%;
  left: 21%;
}

.route-backdrop {
  top: 48%;
  right: 13%;
  left: 13%;
  opacity: 0.55;
}

.selected-poi-panel,
.route-preview-panel,
.expedition-opportunity-panel,
.map-context-panel,
.map-expedition-overlay,
.map-interaction-panel,
.map-selection-panel,
.route-context-panel,
.generated-path-panel {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  color: #1f2933;
  background: #fbfcf8;
  border: 1px solid #c6cdbd;
  border-radius: 8px;
}

.selected-poi-panel[hidden],
.route-preview-panel[hidden],
.expedition-opportunity-panel[hidden],
.map-expedition-overlay[hidden],
.map-selection-panel [hidden] {
  display: none;
}

.index-side-panel {
  display: grid;
  gap: 1rem;
}

.world-events-panel {
  display: grid;
  gap: 0.4rem;
}

.selection-status {
  margin: 0;
  color: #526052;
}

.map-expedition-overlay.is-empty {
  background: #f6f8f1;
  border-style: dashed;
}

.detail-grid {
  align-items: stretch;
}

.detail-grid div,
.context-card {
  min-width: min(11rem, 100%);
  padding: 0.6rem;
  background: #f0f4ea;
  border: 1px solid #c6cdbd;
  border-radius: 6px;
}

.detail-grid dt {
  color: #526052;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.route-preview {
  justify-content: space-between;
}

.route-preview-line {
  flex: 1 1 8rem;
  min-width: 5rem;
  height: 0.3rem;
  background: #7c5f29;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.context-card ul {
  margin-left: 1rem;
}

.route-context {
  display: grid;
  gap: 0.4rem;
}

.generated-expedition-path {
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.expedition-node {
  display: grid;
  gap: 0.25rem;
  min-height: 5.5rem;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #9ca58f;
  border-radius: 8px;
}

.expedition-node.is-current {
  background: #eaf7ef;
  border-color: #176b54;
  box-shadow: 0 0 0 3px rgba(23, 107, 84, 0.18);
}

.expedition-node.is-terminal {
  background: #faf2d4;
  border-color: #7c5f29;
}

.choices-section {
  z-index: 2;
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.8rem;
  background: rgba(248, 251, 244, 0.94);
  border: 1px solid #c6cdbd;
  border-radius: 8px;
}

.choices-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem;
}

.choice-branch {
  min-width: 0;
}

.choice-btn {
  width: 100%;
}

.terminal-status {
  padding: 0.75rem;
  background: #faf2d4;
  border: 1px solid #d4ba62;
  border-radius: 6px;
}

.current-node-section {
  margin-top: 1rem;
}

.node-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 640px) {
  .gameplay-map-page,
  .expedition-map-page {
    padding: 0.75rem;
  }

  .index-map-container {
    height: auto;
    overflow: visible;
  }

  .index-map-container #canvas-container {
    height: min(62vh, 32rem);
    min-height: 22rem;
  }

  .map-surface,
  .expedition-map-overlay {
    min-height: auto;
  }

  .terrain-band {
    position: static;
    width: max-content;
    max-width: 100%;
  }

  .poi-ashigara-forest-camp,
  .poi-hakone-pass {
    justify-self: stretch;
    margin: 0;
  }

  .map-surface > .route-line,
  .route-backdrop {
    position: static;
    width: 100%;
    margin: 0.75rem 0;
    transform: none;
  }

  .generated-expedition-path,
  .choices-list {
    grid-template-columns: 1fr;
  }
}
