:root {
  --ink: #25211e;
  --muted: #6d655f;
  --paper: #f7f2e9;
  --card: #fffdf8;
  --line: #d9d0c4;
  --accent: #9e3f31;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: radial-gradient(circle at 16% 5%, rgb(190 121 83 / 13%), transparent 28rem), var(--paper);
}

button { font: inherit; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 64px;
}

.intro { max-width: 780px; margin-bottom: 32px; }
.eyebrow, .dialog-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}

.intro-copy { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.visual-card {
  overflow: hidden;
  border: 1px solid rgb(74 54 39 / 12%);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 20px 55px rgb(54 39 27 / 10%);
}

.visual-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding: 24px 28px 0; }
.visual-heading h2 { margin-bottom: 4px; font-family: Georgia, "Times New Roman", serif; font-size: 1.45rem; font-weight: 500; }
.status-text { margin-bottom: 0; color: var(--muted); font-size: .92rem; }
.reset-button { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: transparent; cursor: pointer; }
.reset-button:hover { background: #f3ede4; }
.visualization { position: relative; width: 100%; aspect-ratio: 1.32; min-height: 590px; }
.constellation { display: block; width: 100%; height: 100%; overflow: visible; }

.relationship {
  fill: none;
  stroke: var(--threat-color);
  stroke-linecap: round;
  stroke-width: 1.8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease, stroke-width 320ms ease;
}
.relationship.is-active { stroke-width: 2.5; opacity: .68; }
.threat-node, .treasure-node { cursor: pointer; outline: none; }
.threat-node .threat-halo, .threat-node .threat-core, .treasure-node .treasure-halo, .treasure-node .treasure-core {
  transition: opacity 250ms ease, transform 250ms ease, fill 250ms ease, stroke 250ms ease;
}
.threat-node .threat-halo { fill: var(--threat-color); opacity: .1; transform-box: fill-box; transform-origin: center; }
.threat-node .threat-core { fill: var(--card); stroke: var(--threat-color); stroke-width: 2; }
.threat-node text { fill: var(--ink); font-size: 11px; font-weight: 750; pointer-events: none; text-anchor: middle; }
.threat-node:hover .threat-halo, .threat-node:focus-visible .threat-halo, .threat-node.is-active .threat-halo { opacity: .22; transform: scale(1.08); }
.threat-node:focus-visible .threat-core { stroke-width: 4; }
.threat-node.is-active .threat-core { fill: var(--threat-color); }
.threat-node.is-active text { fill: white; }
.threat-node.is-muted { opacity: .2; }
.treasure-node { transition: opacity 250ms ease; }
.treasure-halo { fill: var(--card); stroke: transparent; stroke-width: 3; }
.treasure-core { fill: #8d8177; stroke: var(--card); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.treasure-node:hover .treasure-core, .treasure-node:focus-visible .treasure-core { transform: scale(1.4); }
.treasure-node:focus-visible .treasure-halo { stroke: var(--ink); }
.treasure-node.is-related .treasure-core { fill: var(--threat-color); }
.treasure-node.is-related .treasure-halo { stroke: var(--threat-color); }
.treasure-node.is-muted { opacity: .13; }
.treasure-label {opacity: 0; fill: var(--ink); font-size: 12px; font-weight: 650; pointer-events: none; transition: opacity 250ms ease; }
.treasure-node.is-related .treasure-label { fill: var(--ink); font-size: 12px; font-weight: 650; pointer-events: none; transition: opacity 250ms ease; opacity: 1;}
.treasure-node:hover .treasure-label { fill: var(--ink); font-size: 12px; font-weight: 650; pointer-events: none; transition: opacity 250ms ease; opacity: 1;}
.treasure-node.is-muted .treasure-label { opacity: 0; }
.error-message { margin: 24px 28px 32px; padding: 16px; border-radius: 12px; color: #792c21; background: #f8e4df; }

.treasure-dialog { width: min(680px, calc(100% - 32px)); padding: 36px; border: 0; border-radius: 20px; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px rgb(30 20 12 / 30%); }
.treasure-dialog::backdrop { background: rgb(37 33 30 / 52%); backdrop-filter: blur(3px); }
.dialog-media { display: grid; width: calc(100% + 72px); aspect-ratio: 16 / 9; margin: -36px -36px 28px; overflow: hidden; place-items: center; color: var(--muted); background: #eee7dc; }
.dialog-media > * { grid-area: 1 / 1; }
.dialog-media img { width: 100%; height: 100%; object-fit: cover; }
.dialog-image-status { font-size: .9rem; }
.treasure-dialog h2 { padding-right: 32px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 500; line-height: 1.05; }
#dialog-description { color: var(--muted); line-height: 1.65; }
.dialog-map-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 11px 16px; border-radius: 999px; color: white; background: #4C8A98; font-size: .92rem; font-weight: 750; text-decoration: none; }
.dialog-map-link:hover { background: #4d9dad; }
.dialog-map-link:focus-visible { outline: 3px solid rgb(76 138 152 / 70%); outline-offset: 3px; }
.dialog-close { position: absolute; z-index: 1; top: 14px; right: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--ink); background: rgb(255 253 248 / 88%); box-shadow: 0 2px 12px rgb(30 20 12 / 16%); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 32px; }
  .visual-heading { padding: 20px 18px 0; }
  .visualization { aspect-ratio: .82; min-height: 700px; }
  .treasure-label { display: none; }
  .threat-node text { font-size: 11px; }
  .treasure-dialog { padding: 30px 24px; }
  .dialog-media { width: calc(100% + 48px); margin: -30px -24px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
