@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Rajdhani:wght@600;700&display=swap');

:root {
  --bg: #0b141a;
  --panel: rgba(20, 32, 44, 0.92);
  --panel-strong: rgba(18, 38, 50, 0.94);
  --glow: #66c0f4;
  --text: #d9e6f2;
  --muted: #8aa2b5;
  --accent: #17a2f3;
  --border: rgba(102, 192, 244, 0.25);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, rgba(102,192,244,0.08), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(84,110,167,0.15), transparent 30%),
    linear-gradient(160deg, #0b141a 0%, #0f1a24 45%, #0b141a 100%);
}

#controls {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.35) inset;
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
  max-width: min(94vw, 960px);
  overflow: visible;
}

#controls input, #controls button {
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}

#controls input {
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(11, 20, 26, 0.8);
  color: var(--text);
  min-width: 170px;
  outline: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35) inset;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, 86vw);
  max-height: min(44vh, 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: 0 14px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.35) inset;
  backdrop-filter: blur(10px);
}

.search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.search-nav {
  display: inline-flex;
  gap: 6px;
}

#controls .search-nav button {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(18, 28, 40, 0.9);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 11px;
}

#controls .search-nav button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

#search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 2px;
  max-height: 120px;
}

#controls .search-result {
  border: 1px solid rgba(102, 192, 244, 0.18);
  background: rgba(11, 20, 26, 0.75);
  border-radius: 10px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

#controls .search-result:hover,
#controls .search-result:focus-visible {
  border-color: rgba(102, 192, 244, 0.5);
  outline: none;
}

#controls .search-result.active {
  border-color: rgba(231, 76, 60, 0.7);
  box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.35) inset;
}

.search-result-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.search-more {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-right: 4px;
}

#controls input::placeholder {
  color: var(--muted);
}

#controls input:focus {
  border-color: var(--glow);
  box-shadow: 0 0 0 1px rgba(102,192,244,0.3), 0 10px 30px rgba(0,0,0,0.35) inset;
}

#controls button {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(32,55,78,0.95), rgba(21,35,52,0.95));
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

#controls button:hover, #controls button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(102,192,244,0.6);
  box-shadow: 0 8px 18px rgba(0,0,0,0.45), 0 0 0 1px rgba(102,192,244,0.35) inset;
  outline: none;
}

#controls button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35) inset;
}

#about-btn {
  width: 38px;
  padding: 9px 0;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #233345, #1b2838);
  border-color: rgba(102, 192, 244, 0.6);
  color: #dfe9f3;
}

#about-btn:hover,
#about-btn:focus-visible {
  border-color: rgba(102, 192, 244, 0.9);
}

#plot {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, rgba(11,20,26,0.8), rgba(12,24,33,0.9));
  touch-action: none;
}

#selection-banner {
  position: fixed;
  bottom: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.3) inset;
  backdrop-filter: blur(10px);
}

#selection-banner .selection-left {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

#selection-banner .selection-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 400pt;
  flex: 1;
}

#selection-banner strong {
  font-size: 15px;
  font-family: 'Rajdhani', 'Space Grotesk', sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#selection-detail {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

#selection-detail .detail-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: #e5eef7;
  border-radius: 10px;
  padding: 3px 7px;
  font-size: 11px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.3) inset;
}

#selection-detail .detail-pill strong {
  font-weight: 700;
  color: #9dd5ff;
  letter-spacing: 0.01em;
  font-size: 11px;
}

#selection-tags {
  margin-top: 2px;
}

#selection-tags .tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 6px;
}

#selection-tags .tag-label {
  font-weight: 600;
  color: #c7d5e0;
  letter-spacing: 0.01em;
  margin-right: 2px;
}

#selection-tags .tag-list {
  display: contents;
}

#selection-tags .tag-pill {
  background: linear-gradient(180deg, #1b2838 0%, #0f1a26 100%);
  border: 1px solid rgba(102, 192, 244, 0.35);
  color: #c7d5e0;
  border-radius: 14px;
  padding: 3px 9px;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  white-space: nowrap;
}

.platform-pill .platform-icons {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.platform-pill img {
  width: 16px;
  height: 16px;
  filter: brightness(1.1) drop-shadow(0 0 4px rgba(102,192,244,0.25));
}

#selection-tags .tag-pill:focus-visible {
  outline: 1px solid #66c0f4;
  outline-offset: 2px;
}

#selection-tags .tag-empty {
  color: var(--muted);
}

#selection-platforms {
  display: none;
}

.banner-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 4px 0;
  flex: 1;
  justify-content: flex-start;
  min-width: 0;
}

.banner-strip img {
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
  background: #0a0f16;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.banner-strip img:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(0,0,0,0.55), 0 0 0 1px rgba(102,192,244,0.35) inset;
}

#image-popover {
  position: fixed;
  z-index: 30;
  border: 1px solid var(--border);
  background: rgba(9, 15, 22, 0.94);
  box-shadow: 0 14px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(102,192,244,0.35) inset;
  padding: 6px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

#image-popover.visible {
  opacity: 1;
  transform: translateY(0);
}

#image-popover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

@media (max-width: 640px) {
  #selection-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  #selection-banner .selection-left {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
  .banner-strip {
    max-width: 100%;
    width: 100%;
    justify-content: flex-start;
  }
  #open-link-btn {
    width: 100%;
    text-align: center;
  }
}

#open-link-btn {
  background: linear-gradient(180deg, #233345, #1b2838);
  color: #dfe9f3;
  border: 1px solid rgba(102, 192, 244, 0.6);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.3) inset;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease, border-color 120ms ease;
  cursor: pointer;
  text-transform: uppercase;
  font-family: 'Rajdhani', 'Space Grotesk', sans-serif;
}

#open-link-btn:hover:not([disabled]),
#open-link-btn:focus-visible:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(102,192,244,0.5) inset;
  border-color: rgba(102, 192, 244, 0.9);
  outline: none;
}

#open-link-btn:active:not([disabled]) {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35), 0 0 0 1px rgba(102,192,244,0.4) inset;
}

#open-link-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.selection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #c7d5e0;
}

.selection-meta:empty {
  display: none;
}

.selection-meta span {
  white-space: nowrap;
}

#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

#about-overlay.active {
  display: flex;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 18, 0.72);
  backdrop-filter: blur(6px);
}

.about-card {
  position: relative;
  max-width: min(860px, 100%);
  width: 100%;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.3) inset;
  color: var(--text);
  font-size: 14px;
  max-height: min(90vh, 980px);
  overflow-y: auto;
}

.about-card h2 {
  margin: 0 0 8px;
  font-family: 'Rajdhani', 'Space Grotesk', sans-serif;
  letter-spacing: 0.03em;
}

.about-card h3 {
  margin: 16px 0 6px;
  font-size: 15px;
  color: #a5bed1;
}

.about-card p {
  margin: 6px 0;
  line-height: 1.5;
  color: #cdd9e4;
}

.about-links {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dataset-section {
  margin-top: 18px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(12, 21, 30, 0.9);
  box-shadow: 0 10px 24px rgba(0,0,0,0.4) inset;
}

.dataset-section h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.dataset-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.dataset-field label {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}

#dataset-select {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(11, 20, 26, 0.8);
  color: var(--text);
  outline: none;
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}

#dataset-notes {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  min-height: 1.4em;
  margin-bottom: 8px;
}

.dataset-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#dataset-load-btn {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(32,55,78,0.95), rgba(21,35,52,0.95));
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

#dataset-load-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

#dataset-error {
  color: #e74c3c;
  font-size: 13px;
  min-height: 1.2em;
}

.about-links a {
  color: var(--glow);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(17, 27, 38, 0.85);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transition: border-color 120ms ease, color 120ms ease, transform 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.about-links a:hover,
.about-links a:focus-visible {
  color: #fff;
  border-color: rgba(102, 192, 244, 0.8);
  transform: translateY(-1px);
  outline: none;
}

.about-links a img {
  height: 18px;
  width: 18px;
  object-fit: contain;
  display: block;
}

#close-about-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(11, 20, 26, 0.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

#close-about-btn:hover,
#close-about-btn:focus-visible {
  border-color: rgba(102, 192, 244, 0.9);
  outline: none;
}
