* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background-color: #0b1120; color: #f1f5f9; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
header { background: #0f172a; border-bottom: 1px solid #1e293b; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 10; flex-shrink: 0; }
.title-group h1 { font-size: 15px; font-weight: 700; color: #38bdf8; display: flex; align-items: center; gap: 8px; }
.badge { font-size: 11px; background: #0284c7; color: white; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.badge-lod { font-size: 11px; background: #10b981; color: white; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.badge-engine { font-size: 11px; background: #6366f1; color: white; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.title-group p { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.metrics { display: flex; gap: 10px; }
.metric-card { background: #1e293b; border: 1px solid #334155; padding: 4px 8px; border-radius: 6px; text-align: right; }
.metric-val { font-size: 12px; font-weight: 700; color: #10b981; }
.metric-lbl { font-size: 9px; color: #64748b; text-transform: uppercase; }

.main-container { flex: 1; display: flex; flex-direction: row; position: relative; overflow: hidden; width: 100%; height: calc(100vh - 60px); }
#webgl-container { flex: 1; min-width: 0; height: 100%; position: relative; cursor: grab; }
#webgl-container:active { cursor: grabbing; }

/* Control Sidebar */
.sidebar { width: 390px; min-width: 390px; flex-shrink: 0; background: #0f172a; border-left: 1px solid #1e293b; display: flex; flex-direction: column; z-index: 10; overflow-y: auto; height: 100%; }
.panel-section { padding: 12px 14px; border-bottom: 1px solid #1e293b; }
.panel-title { font-size: 11px; font-weight: 700; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

.preset-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 6px; }
.btn-preset { background: #1e293b; border: 1px solid #334155; color: #cbd5e1; padding: 6px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.15s; }
.btn-preset:hover, .btn-preset.active { background: #0284c7; color: white; border-color: #38bdf8; }

.layer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11.5px; color: #cbd5e1; cursor: pointer; user-select: none; }
.layer-item input[type="checkbox"] { accent-color: #38bdf8; width: 14px; height: 14px; cursor: pointer; }
.layer-color { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* Property Inspector */
.prop-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 12px; }
.prop-header { font-size: 13px; font-weight: 700; color: #38bdf8; margin-bottom: 8px; border-bottom: 1px solid #334155; padding-bottom: 6px; }
.prop-row { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 0; border-bottom: 1px solid rgba(51, 65, 85, 0.5); }
.prop-lbl { color: #94a3b8; }
.prop-val { font-weight: 600; color: #e2e8f0; text-align: right; }
.highlight-val { color: #38bdf8; font-weight: 700; }
.cost-val { color: #10b981; font-weight: 700; }

/* Controls Overlay */
.controls-overlay { position: absolute; top: 76px; left: 16px; background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(8px); border: 1px solid #334155; border-radius: 8px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; z-index: 6; flex-wrap: wrap; }
.btn { background: #1e293b; border: 1px solid #475569; color: #f1f5f9; padding: 5px 10px; border-radius: 5px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 4px; }
.btn:hover { background: #334155; border-color: #38bdf8; color: #38bdf8; }
.btn-active { background: #0284c7 !important; color: white !important; border-color: #38bdf8 !important; }
.btn-primary { background: #0284c7; border-color: #38bdf8; color: #ffffff; }
.btn-primary:hover { background: #0369a1; border-color: #7dd3fc; color: #ffffff; }
.btn-export-video { white-space: nowrap; font-weight: 700; }
.btn-export-video.recording { background: #dc2626 !important; border-color: #ef4444 !important; color: #ffffff !important; animation: pulse-rec 1.2s infinite; cursor: not-allowed; }
@keyframes pulse-rec { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.slider-group { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #94a3b8; }
.slider-group input { accent-color: #38bdf8; cursor: pointer; width: 80px; }

/* Instructions Overlay */
.hint-overlay { position: absolute; top: 16px; left: 16px; background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(6px); border: 1px solid #334155; border-radius: 6px; padding: 8px 12px; font-size: 11px; color: #cbd5e1; max-width: 680px; z-index: 5; line-height: 1.4; }
.hint-highlight { color: #f59e0b; font-weight: 700; }

/* Compass Rose / North Indicator */
.compass { position: absolute; top: 16px; right: 410px; width: 56px; height: 56px; background: rgba(15, 23, 42, 0.90); border: 2px solid #38bdf8; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 5; font-size: 11px; font-weight: bold; color: #ef4444; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.compass .arrow { font-size: 16px; line-height: 1; margin-bottom: 2px; }
.compass .lbl { font-size: 8.5px; color: #f8fafc; font-weight: 700; letter-spacing: 1px; }

/* Floating Station Badges (HTML Overlay) */
.station-marker { position: absolute; transform: translate(-50%, -100%); pointer-events: none; background: rgba(15, 23, 42, 0.92); border: 1px solid #38bdf8; border-radius: 4px; padding: 2px 6px; font-size: 10px; font-weight: 600; color: #f8fafc; white-space: nowrap; z-index: 4; box-shadow: 0 2px 6px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 4px; }
.station-marker::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border-width: 4px; border-style: solid; border-color: #38bdf8 transparent transparent transparent; }
.station-dot { width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.joint-badge { border-color: #ec4899; color: #f472b6; }
.joint-badge::after { border-color: #ec4899 transparent transparent transparent; }

/* 4D BIM Player Dock (Floating Dark Slate Dock) */
.player-4d-dock {
  position: absolute;
  left: 16px;
  right: calc(390px + 16px); /* STRICT ZERO OCCLUSION */
  bottom: 205px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9;
  transition: bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
.player-4d-dock.dock-collapsed {
  bottom: 42px;
}
.player-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.player-phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  font-size: 11px;
}
.btn-play-4d {
  background: #0284c7;
  color: white;
  font-weight: 700;
  min-width: 85px;
  justify-content: center;
}
.btn-play-4d:hover {
  background: #0369a1;
  color: white;
}
.timeline-slider-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.timeline-slider {
  flex: 1;
  accent-color: #38bdf8;
  cursor: pointer;
  height: 6px;
}
.current-day-val {
  font-family: "JetBrains Mono", monospace, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  color: #38bdf8;
  font-size: 12px;
  white-space: nowrap;
  min-width: 130px;
}
.phase-badge {
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10.5px;
  white-space: nowrap;
}
.btn-speed {
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
}
.btn-speed:hover, .btn-speed.active {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
}
.phase-jump-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.btn-phase {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-phase:hover {
  background: #334155;
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Interactive Site Diary Bottom Dock (Collapsible Dark Slate) */
.site-diary-dock {
  position: absolute;
  left: 0;
  right: 390px; /* STRICT ZERO OCCLUSION WITH 390px SIDEBAR */
  bottom: 0;
  height: 195px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #1e293b;
  border-right: 1px solid #1e293b;
  z-index: 8;
  display: flex;
  flex-direction: column;
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}
.site-diary-dock.collapsed {
  height: 32px;
}
.dock-header {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  cursor: pointer;
  user-select: none;
}
.dock-title {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dock-sync-badge {
  font-size: 9.5px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
}
.btn-dock-toggle {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-dock-toggle:hover {
  background: #334155;
  color: #f8fafc;
  border-color: #38bdf8;
}
.dock-body {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1.1fr 1.1fr 1.3fr;
  gap: 10px;
  padding: 8px 12px;
  overflow-y: auto;
  font-size: 11px;
}
.dock-panel {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.dock-panel-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  padding-bottom: 3px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dock-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
}
.dock-lbl {
  color: #64748b;
  font-size: 10px;
  flex-shrink: 0;
}
.dock-val {
  font-weight: 600;
  color: #e2e8f0;
  text-align: right;
}
.dock-val-mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
}
.dock-progress-wrap {
  width: 100%;
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 1px;
  margin-bottom: 2px;
}
.dock-progress-bar {
  height: 100%;
  background: #38bdf8;
  border-radius: 2px;
  transition: width 0.15s ease;
}
.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #f87171;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}
