:root {
  --bg: #f6f2ea;
  --card: rgba(255, 255, 255, 0.9);
  --ink: #2f2a24;
  --muted: #70695f;
  --line: #ddd3c5;
  --line-strong: #cdbfa9;
  --accent: #8a4e1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #faf6ee, var(--bg) 50%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  width: min(1160px, calc(100vw - 28px));
  margin: 14px auto 40px;
  display: grid;
  gap: 14px;
}

.topbar,
.map-card,
.detail-card,
.embed-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 22px; }

.subhead {
  margin: 8px 0 0;
  color: #403a32;
  font-size: 15px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.micro {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.map {
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(var(--line), var(--line)) center/1px 100% no-repeat,
    linear-gradient(90deg, var(--line), var(--line)) center/100% 1px no-repeat,
    rgba(255,255,255,0.96);
  position: relative;
  overflow: hidden;
}

.axis {
  position: absolute;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.axis.top { top: 14px; left: 50%; transform: translateX(-50%); }
.axis.bottom { bottom: 14px; left: 50%; transform: translateX(-50%); }
.axis.left { left: 14px; top: 50%; transform: translateY(-50%); }
.axis.right { right: 14px; top: 50%; transform: translateY(-50%); }

#trend-points {
  position: absolute;
  inset: 0;
}

.point {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 170px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(35, 31, 24, 0.09);
  text-align: left;
  cursor: pointer;
}

.point.is-active {
  border-color: rgba(86, 58, 31, 0.65);
  box-shadow: 0 13px 28px rgba(35, 31, 24, 0.15);
}

.point strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.point .meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.point .evidence {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 7px;
  display: inline-flex;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.detail-description {
  margin: 8px 0 12px;
  font-size: 15px;
  line-height: 1.6;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(252,248,240,0.92);
  padding: 12px;
}

.detail-box > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.embed-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

pre {
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: #3b342d;
}

.error {
  margin: 0;
  color: #8a1f1f;
  font-size: 13px;
}

.wrap[data-embed="true"] {
  width: 100%;
  margin: 0;
  padding: 0;
}

.wrap[data-embed="true"] #public-map-header,
.wrap[data-embed="true"] #embed-card {
  display: none;
}

.wrap[data-embed="true"] .map-card,
.wrap[data-embed="true"] .detail-card {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; }
  .detail-grid,
  .embed-grid { grid-template-columns: 1fr; }
  .map { min-height: 520px; }
}
