:root {
  --bg-color: #0b0f17;
  --panel-bg: rgba(22, 27, 34, 0.95);
  --panel-border: rgba(255, 255, 255, 0.12);
  --primary-color: #38bdf8;
  --e-color: #f43f5e;
  --b-color: #a855f7;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#top-viewport {
  position: relative;
  flex: 1;
  min-height: 50vh;
  width: 100%;
  background: #000;
}

#canvas-container {
  width: 100%;
  height: 100%;
}

#ui-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 280px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--primary-color);
}

.control-group {
  margin-bottom: 8px;
}

.timeline-group {
  border-top: 1px dashed var(--panel-border);
  padding-top: 8px;
  margin-top: 10px;
}

label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 3px;
}

.val-badge {
  font-family: monospace;
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #374151;
  outline: none;
}

input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
}

.btn-group {
  display: flex;
  gap: 6px;
  margin: 10px 0;
}

.btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-color);
  color: #0284c7;
}

.btn-primary:hover {
  background: #7dd3fc;
}

.btn-secondary {
  background: #374151;
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #4b5563;
}

.status-box {
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  font-size: 11px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  color: var(--text-muted);
}

.status-val {
  color: #e5e7eb;
  font-family: monospace;
}

.guide {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.3;
  border-top: 1px solid var(--panel-border);
  padding-top: 6px;
}

#axis-gizmo {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 70px;
  height: 70px;
  pointer-events: none;
  z-index: 10;
}

/* 오른쪽 상단 대형 3D 벡터 인디케이터 박스 */
#vector-indicator-box {
  position: absolute;
  top: 90px;
  right: 16px;
  width: 180px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.indicator-title {
  font-size: 11px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 6px;
  text-align: center;
}

#vector-indicator-canvas {
  width: 160px;
  height: 140px;
}

.indicator-legend {
  display: flex;
  gap: 8px;
  font-size: 10px;
  margin-top: 4px;
}

/* 하단 대시보드 */
#bottom-dashboard {
  background: #0f172a;
  border-top: 1px solid var(--panel-border);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 42vh;
  overflow-y: auto;
}

.info-row {
  display: flex;
  gap: 12px;
}

.field-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  flex: 1;
}

.field-card h3 {
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 600;
}

.e-field h3 { color: var(--e-color); }
.b-field h3 { color: var(--b-color); }
.s-field h3 { color: #facc15; }

.field-val {
  font-family: monospace;
  font-size: 11px;
  color: #e5e7eb;
  margin-bottom: 2px;
}

.field-mag {
  font-family: monospace;
  font-size: 11px;
  font-weight: bold;
  color: var(--primary-color);
}

.graph-row {
  display: flex;
  gap: 12px;
}

.graph-card {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.label-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-ex { background: rgba(244, 63, 94, 0.2); color: #f43f5e; }
.badge-ey { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-ez { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }

.graph-val {
  font-family: monospace;
  font-size: 11px;
  color: #e5e7eb;
}

.graph-card canvas {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  width: 100%;
  height: 90px;
  display: block;
}