:root {
  --bg-primary: #18191c;
  --panel-bg: rgba(24, 25, 28, 0.85);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-family);
  color: var(--text-main);
}

#three-canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}

/* Header toolbar */
.header-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 20;
}

.brand-badge {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.brand-badge h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  pointer-events: auto;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn-group {
  display: flex;
  align-items: center;
  padding: 6px;
  gap: 6px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 6px;
}

.sun-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  flex-shrink: 0;
}

#solar-stats-pill {
  width: 225px;
  min-width: 225px;
  max-width: 225px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  box-sizing: border-box;
}

#sun-elevation-badge {
  display: inline-block;
  width: 95px;
  min-width: 95px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

#sun-azimuth-badge {
  display: inline-block;
  width: 110px;
  min-width: 110px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

#sun-time-val {
  display: inline-block;
  width: 44px;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #fbbf24;
}

/* 2D Compass HUD Badge */
#compass-badge {
  position: absolute;
  top: 86px;
  right: 16px;
  width: 58px;
  height: 58px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

#compass-badge:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.compass-dial {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 16px solid #ef4444; /* North red */
  top: 2px;
}

.compass-arrow-south {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 16px solid #94a3b8; /* South grey */
  bottom: 2px;
}

.compass-letter-n {
  position: absolute;
  top: -3px;
  font-size: 10px;
  font-weight: 800;
  color: #ef4444;
}

.btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease-in-out;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.select-custom {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.select-custom option {
  background: #222;
  color: #fff;
}

/* Sidebar / Info panels */
.left-sidebar {
  position: absolute;
  top: 90px;
  left: 16px;
  width: 290px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.card {
  pointer-events: auto;
  padding: 14px 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-list {
  list-style: none;
  font-size: 12.5px;
  line-height: 1.6;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 3px 0;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-muted);
}

.info-val {
  font-weight: 500;
  color: #fff;
}

/* Element Inspector Panel */
#inspector-panel {
  display: none;
  max-height: 380px;
  overflow-y: auto;
}

#inspector-panel.visible {
  display: block;
}

.props-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}

.props-table td {
  padding: 4px 2px;
  vertical-align: top;
}

.props-table .prop-name {
  color: var(--text-muted);
  width: 40%;
}

.props-table .prop-val {
  color: #fff;
  word-break: break-all;
}

/* Bottom status bar */
.status-bar {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  font-size: 12px;
  color: var(--text-muted);
}

.hint-badge {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: 8px;
  pointer-events: auto;
}

/* Drag & Drop Overlay */
#drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  color: white;
  pointer-events: none;
}

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

.drop-box {
  border: 2px dashed #3b82f6;
  border-radius: 16px;
  padding: 40px 60px;
  text-align: center;
  background: rgba(59, 130, 246, 0.08);
}

.drop-box h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

/* Loading spinner overlay */
#loading-overlay {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: 10px 24px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

#loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
