:root {
  --bg-dark: #0b1120;
  --bg-horizon: #1e293b;

  --bg-panel: rgba(15, 23, 42, 0.8);
  --bg-panel-soft: rgba(15, 23, 42, 0.72);

  --accent: #4f8df5;
  --accent-soft: #7ac9ff;
  --us-color: #f5c04f;
  --other-color: #4f8df5;

  --text-main: #f9fafb;
  --text-muted: #9aa4c6;

  --border-subtle: rgba(148, 163, 255, 0.36);
  --radius-lg: 26px;
  --shadow-soft: 0 32px 80px rgba(15, 23, 42, 0.75);

  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Roboto", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background:
    radial-gradient(circle at 0% -10%, #1f2937 0, transparent 45%),
    radial-gradient(circle at 100% -5%, #111827 0, transparent 45%),
    linear-gradient(to bottom, var(--bg-dark), var(--bg-horizon) 65%);
  color: var(--text-main);
}

/* Layout */

body {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  grid-template-rows: 100%;
  gap: 1.75rem;
  padding: 1.9rem 2.4rem;
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(320px, 1fr);
    padding: 1.1rem;
  }
}

/* Shared “glass” shell for all major cards */

.ui-panel,
#scene-container,
#sector-panel {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  background:
    radial-gradient(circle at 0 0, rgba(148, 163, 255, 0.26), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(56, 189, 248, 0.16), transparent 60%),
    linear-gradient(to bottom right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.86));
  backdrop-filter: blur(22px);
}

/* Subtle inner highlight line */

.ui-panel::before,
#scene-container::before,
#sector-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

/* Left panel */

.ui-panel {
  padding: 1.6rem 1.9rem;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.ui-header h1 {
  font-size: 1.75rem;
  margin: 0 0 0.8rem 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ui-header p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);;
}

.controls {
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 255, 0.24);
}

.controls label {
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);;
  margin-bottom: 0.4rem;
}

/* Play + year */

.play-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.8rem;
}

.play-button {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: radial-gradient(circle at 20% 0%, #f9fafb, #d1d5db);
  color: #111827;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.play-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.7);
}

.play-button.playing {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #f9fafb;
}

.play-year {
  font-size: 0.95rem;
  color: var(--text-main);
}

.play-year-number {
  font-variant-numeric: tabular-nums;
}

#year-value {
  font-weight: 600;
  color: var(--accent-soft);
}

/* Slider */

#year-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 255, 0.25);
  outline: none;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 25% 0%, #ffffff, #93c5fd);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.26);
}

#year-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 25% 0%, #ffffff, #93c5fd);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.26);
}

/* Legend + totals */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-main);;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.7);
}

.legend-swatch--us {
  /* use the same color as the 3D bar */
  background: linear-gradient(135deg, var(--us-color), #f3b23a);
}

.legend-swatch--other {
  background: linear-gradient(135deg, #5a8df7, #67e3ff);
}

.global-total-row {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  background:
    radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.16), transparent 60%),
    rgba(15, 23, 42, 0.85);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.global-total-label {
  font-size: 0.8rem;
  color: var(--text-main);;
}

.global-total-value {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
}

.caption {
  margin-top: 1.1rem;
  font-size: 0.78rem;
  color: var(--text-main);;
  line-height: 1.6;
}

/* Right column: 3D + detail panel */

.viz-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

/* 3D container */

#scene-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 2 1 60%;
  overflow: hidden;
  background: radial-gradient(circle at top, #111827 0, #020617 65%);
}

/* Tooltip */

.tooltip {
  position: fixed;
  pointer-events: none;
  min-width: 190px;
  max-width: 260px;
  background: rgba(8, 12, 26, 0.97);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 255, 0.4);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  padding: 0.65rem 0.8rem;
  font-size: 0.78rem;
  z-index: 50;
}

.tooltip-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tooltip-body {
  color: var(--text-main);;
  line-height: 1.4;
}

/* Sector detail panel */

#sector-panel {
  background:
    radial-gradient(circle at 0 0, rgba(148, 163, 255, 0.2), transparent 55%),
    linear-gradient(to bottom right, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.88));
  padding: 1rem 1.35rem 1.3rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.sector-header h2 {
  font-size: 1rem;
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sector-subtitle {
  font-size: 0.78rem;
  color: var(--text-main);;
  margin-top: 0.2rem;
}

.sector-pill {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 255, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: var(--accent-soft);
}

/* Radar chart container */

#sector-viz-container {
  width: 100%;
  height: 260px;
}

#sector-viz-container svg {
  width: 100%;
  height: 100%;
}

/* Radar chart styles */

.radar-grid-circle {
  fill: none;
  stroke: rgba(148, 163, 255, 0.25);
  stroke-dasharray: 3 4;
}

.radar-axis-line {
  stroke: rgba(148, 163, 255, 0.25);
  stroke-width: 0.7;
}

.radar-axis-label {
  fill: var(--text-muted);
  font-size: 0.68rem;
  text-anchor: middle;
}

.radar-polygon {
  fill: rgba(96, 165, 250, 0.32);
  stroke: #60a5fa;
  stroke-width: 1.6;
}

.radar-point {
  stroke: #020617;
  stroke-width: 1;
}

/* Legend under radar chart */

#sector-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin-top: 0.25rem;
}

.sector-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-main);;
}

.sector-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

/* Labels above bars */

.bar-label {
  position: absolute;
  pointer-events: none;
  font-size: 0.65rem;
  color: rgba(241, 245, 249, 0.96);
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.9);
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

/* Mouse hints */

.hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hint-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  background: radial-gradient(circle at 25% 15%, #ffffff33, #020617f0);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow:
    0 6px 12px rgba(15, 23, 42, 0.6),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

/* Mouse body + wheel (shared) */
.hint-icon::before,
.hint-icon::after {
  content: "";
  position: absolute;
}

.hint-icon::before {
  width: 14px;
  height: 20px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent 30%,
      #e5e7eb 30%,
      #e5e7eb 38%,
      transparent 38%,
      transparent 100%
    );
}

/* ROTATE */

.hint-icon--rotate::after {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(129, 140, 248, 0.95);
  border-bottom-color: transparent;
  border-left-color: transparent;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  animation: mouse-rotate 1.9s linear infinite;
}

@keyframes mouse-rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* PAN */

.hint-icon--pan::after {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.95);
  top: 50%;
  left: 50%;
  box-shadow:
    -8px 0 0 rgba(96, 165, 250, 0.35),
    8px 0 0 rgba(96, 165, 250, 0.35);
  transform-origin: center center;
  animation: mouse-pan 1.6s ease-in-out infinite;
}

@keyframes mouse-pan {
  0% {
    transform: translate(-60%, -50%);
  }
  50% {
    transform: translate(-40%, -50%);
  }
  100% {
    transform: translate(-60%, -50%);
  }
}

/* ZOOM */

.hint-icon--zoom::after {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(45, 212, 191, 0.95);
  top: 50%;
  left: 50%;
  transform-origin: center center;
  animation: mouse-zoom 1.8s ease-in-out infinite;
}

@keyframes mouse-zoom {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.6;
  }
}

/* Small screens tweak */

@media (max-width: 600px) {
  .ui-panel {
    padding: 1.3rem 1.4rem;
  }
  .ui-header h1 {
    font-size: 1.45rem;
  }
}

/* --- Techy container motion --- */

.ui-panel,
#scene-container,
#sector-panel {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  animation: shell-in 0.7s cubic-bezier(0.18, 0.95, 0.35, 1.02) forwards;
}

#scene-container {
  animation-delay: 0.08s;
}

#sector-panel {
  animation-delay: 0.16s;
}

@keyframes shell-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* micro-hover lift / glow */

.ui-panel:hover,
#scene-container:hover,
#sector-panel:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.75);
  border-color: rgba(148, 163, 255, 0.6);
}

/* Layout: radar + metrics side by side */

.sector-main {
  display: flex;
  gap: 1.8rem;
  align-items: flex-start;
  margin-top: 0.5rem;
}

#sector-viz-container {
  flex: 0 0 55%; /* radar takes ~half, tweak as you like */
  height: 280px;
}

.sector-metrics {
  flex: 1;
  padding: 0.75rem 0.4rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Title */

.sector-metrics-title {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-main);;
  margin-bottom: 0.2rem;
}

/* Rows */

#sector-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sector-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  padding: 0.18rem 0.2rem;
  border-radius: 999px;
  background: radial-gradient(
      circle at 0 50%,
      rgba(148, 163, 255, 0.18),
      transparent 65%
    );
}

.sector-metric-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-main);;
}

.sector-metric-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.8);
}

.sector-metric-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-main);
}

/* Small screens: stack radar above metrics */

@media (max-width: 900px) {
  .sector-main {
    flex-direction: column;
  }

  #sector-viz-container {
    width: 100%;
    height: 260px;
  }
}

.caption {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-main);;
  line-height: 1.6;
}

.caption p {
  margin: 0 0 0.85rem; /* space between text and "How to use..." */
}

.caption-howto {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem; /* space between heading and first hint */
  color: var(--text-main);;
}

.interaction-hints {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hint-text {
  font-size: 0.78rem;
  line-height: 1.5;
}

.hint-label {
  font-weight: 600;
  margin-right: 0.3rem;
}
