/* lab1702 design system — terminal phosphor. Tokens copied from the
   lab1702 skill (colors/type/spacing/effects); app is dependency-free CSS. */
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --bg-0: oklch(0.15 0.010 100);
  --bg-1: oklch(0.18 0.012 100);
  --bg-2: oklch(0.22 0.014 100);
  --fg-1: oklch(0.92 0.020 95);
  --fg-2: oklch(0.70 0.020 95);
  --fg-3: oklch(0.52 0.018 95);
  --amber: oklch(0.80 0.16 75);
  --danger: oklch(0.70 0.16 25);
  --border-1: oklch(0.32 0.018 100);
  --border-2: oklch(0.42 0.020 100);

  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-sans: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, sans-serif;
  --tracking-label: 0.08em;

  --radius-1: 2px;
  --radius-2: 4px;
  --shadow-card: 0 1px 0 oklch(0 0 0 / 0.4), 0 4px 16px oklch(0 0 0 / 0.35);
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}

::selection {
  background: oklch(0.80 0.16 75 / 0.25);
}

#title {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: var(--tracking-label);
  color: var(--fg-1);
  z-index: 90;
  pointer-events: none;
  text-shadow: 0 1px 4px oklch(0 0 0 / 0.8);
}

#cy {
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* The layout search lays each continent out many times over to pick the best
   arrangement; hide the canvas while it does, or the graph visibly thrashes. */
#cy canvas {
  transition: opacity var(--dur-fast) var(--ease-out);
}

#cy.settling canvas {
  opacity: 0;
}

#tooltip {
  position: absolute;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-card);
  padding: 8px 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  z-index: 100;
  max-width: 240px;
  font-size: 12.5px;
  color: var(--fg-2);
}

#tooltip strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--fg-1);
}

#tooltip em {
  font-style: normal;
  color: var(--fg-3);
}

#tooltip.visible {
  opacity: 1;
}

#lightbox {
  position: fixed;
  inset: 0;
  background: oklch(0.15 0.010 100 / 0.94);
  display: none;
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

#lightbox.open {
  display: flex;
}

.lightbox-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-1);
}

.lightbox-header h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg-1);
}

.lightbox-header .levels {
  font-family: var(--font-mono);
  color: var(--fg-2);
  font-size: 12.5px;
}

.lightbox-header .close-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--fg-2);
}

.lightbox-header .close-btn {
  background: none;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-1);
  color: var(--fg-2);
  font-size: 20px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.lightbox-header .close-btn:hover {
  color: var(--fg-1);
  border-color: var(--border-2);
}

.lightbox-header .close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--bg-0), 0 0 0 3px var(--amber);
}

.lightbox-body {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: 720px;
  box-sizing: border-box;
  padding: 24px;
}

/* Zone detail sheet */
.zone-facts {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.zone-facts dt {
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-size: 11px;
  align-self: center;
}

.zone-facts dd {
  margin: 0;
  color: var(--fg-1);
}

.zone-note {
  margin: 20px 0 0;
  color: var(--fg-2);
  font-size: 13.5px;
  border-left: 2px solid var(--border-2);
  padding-left: 12px;
}

.zone-note:empty {
  display: none;
}

.zone-links {
  margin-top: 24px;
}

.zone-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.zone-link {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.zone-link:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.zone-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--bg-0), 0 0 0 3px var(--amber);
}

.zone-link .via {
  color: var(--fg-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

/* Loading indicator */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--fg-2);
  z-index: 50;
  pointer-events: none;
}

#loading::after {
  content: "▊";
  color: var(--amber);
  margin-left: 4px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Legend */
#legend {
  position: fixed;
  top: 16px;
  left: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  z-index: 90;
  font-size: 12px;
  line-height: 1.6;
  min-width: 140px;
}

.legend-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  margin-bottom: 6px;
  color: var(--fg-2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
}

.legend-circle {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.legend-shape {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 1.5px solid var(--fg-3);
  box-sizing: border-box;
}

.legend-circle-shape {
  border-radius: 999px;
}

.legend-square-shape {
  border-radius: var(--radius-1);
}

.legend-triangle-shape {
  border: none;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--fg-3);
}

.legend-diamond-shape {
  transform: rotate(45deg) scale(0.8);
}

.legend-region {
  display: inline-block;
  width: 14px;
  height: 10px;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1px dashed var(--fg-3);
  border-radius: var(--radius-1);
  background: oklch(0.92 0.020 95 / 0.04);
}

.legend-line {
  display: inline-block;
  width: 14px;
  height: 0;
  flex-shrink: 0;
  border-top-width: 2px;
}

.legend-line-land {
  border-top: 2px solid #6b6858;
}

.legend-line-boat {
  border-top: 2px dashed #5b8390;
}

.legend-line-portal {
  border-top: 2px dotted #a07fb8;
}

.legend-separator {
  border-top: 1px solid var(--border-1);
  margin: 6px 0;
}

.legend-hint {
  color: var(--fg-3);
  font-size: 11px;
}

/* Continent filters */
#filters {
  position: fixed;
  bottom: 16px;
  left: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  z-index: 90;
  min-width: 140px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  cursor: pointer;
}

.filter-item input {
  accent-color: var(--amber);
  margin: 0;
  cursor: pointer;
}

/* Responsive styles for small screens */
@media (max-width: 767px) {
  .lightbox-header h2 {
    font-size: 16px;
  }

  .lightbox-header {
    padding: 10px 16px;
  }

  .lightbox-body {
    padding: 16px;
  }

  #legend {
    padding: 8px 12px;
    top: 8px;
    left: 8px;
    min-width: 120px;
  }

  #filters {
    padding: 8px 12px;
    bottom: 8px;
    left: 8px;
    min-width: 120px;
  }
}
