/* GoGG 6-Axis Robot Arm Studio Stylesheet (Multi-Vendor OLP & 6-DOF IK Edition) */
:root {
  --bg-primary: #090d16;
  --bg-panel: rgba(15, 22, 36, 0.92);
  --bg-card: rgba(20, 29, 48, 0.72);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #38bdf8;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --accent-cyan: #38bdf8;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
}

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

/* Main Page Container (Aligned 1:1 with Global Hamburger Menu Header 1260px) */
.robot-page-container {
  max-width: 1260px;
  width: min(100% - 32px, 1260px);
  margin: 0 auto;
  padding: 0 0 30px;
  box-sizing: border-box;
}

/* Unified Outer Studio Panel (Matches Trajectory & Melsec Monitor) */
.robot-studio-outer-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(13, 20, 34, 0.96) 0%, rgba(9, 14, 24, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 16px;
  padding: 14px 14px 20px;
  margin-bottom: 24px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
  height: 780px;
  min-height: 620px;
  max-height: 1280px;
  display: flex;
  flex-direction: column;
}

/* Bottom Drag Resizer Handle */
.robot-studio-resizer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  user-select: none;
}

.robot-studio-resizer-grip {
  width: 54px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  transition: background 0.2s, width 0.2s;
}

.robot-studio-resizer:hover .robot-studio-resizer-grip,
.robot-studio-resizer.dragging .robot-studio-resizer-grip {
  width: 84px;
  background: #38bdf8;
}

/* Main Studio 2-Column Layout */
.robot-studio-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 14px;
  width: 100%;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}

/* LEFT COLUMN: 3D Workcell Viewport + Scrubber + Telemetry */
.viewport-wrapper {
  position: relative;
  background: radial-gradient(circle at 50% 35%, #151d30 0%, #080c14 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.robot-studio-outer-panel button,
.robot-studio-outer-panel select,
.robot-studio-outer-panel input {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Top Viewport Toolbar */
.viewport-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(10, 15, 26, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 10;
}

.hud-badge-group {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #cbd5e1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

#hud-status-pill {
  min-width: 152px;
}

.hud-pill.status-ok {
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}
.hud-pill.status-warn {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fbbf24;
}
.hud-pill.status-error {
  border-color: rgba(239, 68, 68, 0.55);
  color: #f87171;
}

.viewport-tools-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-icon-hud {
  background: rgba(18, 27, 45, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.16s;
  white-space: nowrap;
}

.btn-icon-hud:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.btn-icon-hud.active {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.22);
}

/* 3D Canvas Container */
#canvas-container {
  width: 100%;
  flex: 1;
  min-height: 260px;
  position: relative;
  cursor: grab;
  overflow: hidden;
}

#canvas-container:active {
  cursor: grabbing;
}

#canvas-container.gizmo-hover {
  cursor: move !important;
}

.viewport-gizmo-hint {
  position: absolute;
  bottom: 10px;
  left: 12px;
  background: rgba(10, 15, 26, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.73rem;
  color: #cbd5e1;
  pointer-events: none;
  z-index: 6;
}

/* Playback & Timeline Scrubber Bar */
.robot-playback-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  height: 40px;
  flex-shrink: 0;
  box-sizing: border-box;
  background: rgba(11, 17, 29, 0.95);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: nowrap;
}

.robot-playback-btns {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.r-play-btn,
.r-ctrl-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  padding: 4px 10px;
  height: 26px;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}

.r-play-btn:hover,
.r-ctrl-btn:hover {
  background: #334155;
  border-color: #38bdf8;
  color: #ffffff;
}

.r-play-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.r-ctrl-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.robot-scrubber-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.robot-scrubber {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #1e293b;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.robot-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
  cursor: pointer;
}

.robot-step-counter,
.robot-time-label {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  min-width: 96px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.robot-speed-wrap,
.robot-speed-group {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
}

.r-speed-lbl {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 800;
  color: #64748b;
}

.robot-speed-select,
.r-speed-select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #38bdf8;
  border-radius: 5px;
  padding: 2px 6px;
  height: 25px;
  font-size: 0.73rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

/* Bottom Engineering Telemetry Strip (5 Fixed-Height Cards — Zero Layout Shift!) */
.viewport-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 10px;
  height: 68px;
  flex-shrink: 0;
  box-sizing: border-box;
  background: rgba(9, 14, 24, 0.96);
}

.r-telem-card {
  background: rgba(18, 26, 44, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  padding: 5px 8px;
  height: 54px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
}

.r-telem-title {
  font-size: 0.62rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-telem-vals,
.r-telem-val {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.71rem;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.r-telem-vals strong,
.r-telem-val span {
  color: #38bdf8;
}

.r-telem-sub {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* RIGHT COLUMN: Control Panel & Multi-Vendor OLP Studio */
.control-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

/* Top 4 Studio Main Tabs */
.studio-main-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(8, 12, 20, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.studio-tab-btn {
  padding: 10px 4px;
  text-align: center;
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  transition: all 0.16s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.studio-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.studio-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

/* Scrollable Tab Content */
.panel-scroll-body {
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden !important;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.panel-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll-body::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.studio-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

/* TAB 1: Multi-Vendor OLP Program Editor */
.olp-brand-card {
  background: var(--bg-card);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.olp-brand-header,
.olp-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.olp-label {
  font-size: 0.69rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.olp-dialect-badge,
.olp-detected-badge {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  white-space: nowrap;
}

.olp-select {
  width: 100%;
  height: 32px;
  background: #0b111e;
  border: 1px solid #334155;
  color: #f0f6fc;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.olp-select:focus {
  border-color: #38bdf8;
}

.olp-preset-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

/* Teach Pendant Quick Bar */
.olp-teach-bar {
  background: rgba(16, 24, 40, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.olp-teach-title {
  font-size: 0.68rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

.olp-teach-btns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.btn-teach,
.olp-teach-btn {
  background: #172236;
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #e2e8f0;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s;
}

.olp-teach-btn.primary {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.olp-teach-btn.cyan {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.olp-teach-btn.amber {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.btn-teach:hover,
.olp-teach-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
}

/* Robot Program Source Code Editor */
.olp-editor-wrap {
  background: #070b13;
  border: 1px solid #1e293b;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 175px;
}

.olp-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.71rem;
  font-weight: 700;
  color: #38bdf8;
}

.olp-editor-actions {
  display: flex;
  gap: 5px;
}

.olp-btn-mini,
.olp-mini-btn {
  background: #1e293b;
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #cbd5e1;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 0.69rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.olp-btn-mini:hover,
.olp-mini-btn:hover {
  background: #38bdf8 !important;
  color: #090d16 !important;
  border-color: #38bdf8 !important;
}

.btn-action-primary {
  width: 100%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(56, 189, 248, 0.16));
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #38bdf8;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.79rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s;
  box-sizing: border-box;
}

.btn-action-primary:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
  color: #ffffff;
}

.olp-code-textarea {
  width: 100%;
  flex: 1;
  min-height: 145px;
  background: #070b13;
  color: #e2e8f0;
  border: none;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.73rem;
  line-height: 1.48;
  resize: none;
  outline: none;
  box-sizing: border-box;
  white-space: pre;
  overflow-x: auto;
}

/* Compiled Waypoints Table */
.olp-waypoints-box {
  background: rgba(13, 20, 35, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.olp-waypoints-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: rgba(20, 30, 50, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.68rem;
  font-weight: 800;
  color: #94a3b8;
}

.olp-waypoints-scroll,
.olp-wp-table-scroll {
  max-height: 135px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.olp-wp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.69rem;
}

.olp-wp-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #64748b;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #1e293b;
}

.olp-wp-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  cursor: pointer;
}

.olp-wp-table tr:hover td {
  background: rgba(56, 189, 248, 0.12);
  color: #ffffff;
}

.olp-wp-table tr.active-wp td {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  font-weight: 700;
}

/* Joint Slider Card & Limit Margin Bar */
.joint-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 9px 11px;
  transition: border-color 0.2s;
}

.joint-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

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

.joint-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.joint-deg-display {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  min-width: 68px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.joint-limit-bar {
  width: 100%;
  height: 4px;
  background: #0f172a;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.joint-limit-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  border-radius: 999px;
  transition: width 0.1s, background 0.2s;
}

.joint-limit-fill.limit-warn {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.joint-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.joint-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: #1e293b;
  border-radius: 3px;
  outline: none;
}

.joint-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.joint-jog-group {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.btn-jog {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-jog:hover {
  background: #334155;
  color: #ffffff;
  border-color: #64748b;
}

/* Cartesian Coordinates Grid */
.cartesian-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.cart-input-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  box-sizing: border-box;
}

.cart-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-input {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 5px;
  color: #38bdf8;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 4px 6px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.cart-input:focus {
  border-color: var(--accent-cyan);
}

/* Configuration Selectors */
.config-group {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.config-toggle-btn {
  flex: 1;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.config-toggle-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

/* Preset Buttons Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.btn-preset {
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-preset:hover {
  background: #334155;
  border-color: var(--accent-cyan);
}

.btn-preset.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

/* Color Theme Swatches */
.theme-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 10px;
}

.theme-swatches {
  display: flex;
  gap: 8px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.theme-swatch:hover {
  transform: scale(1.15);
  border-color: #ffffff;
}

.theme-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transform: scale(1.18);
}

/* Floating Hover Tooltip */
.robot-floating-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  max-width: 270px;
  background: rgba(9, 14, 24, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 8px 11px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.robot-floating-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.robot-floating-tooltip .tip-title {
  font-size: 0.76rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 3px;
}

.robot-floating-tooltip .tip-desc {
  font-size: 0.71rem;
  line-height: 1.42;
  color: #cbd5e1;
}

/* Guide Documentation Styles */
.guide-wrapper {
  width: 100%;
  margin: 32px 0;
  padding: 0;
  box-sizing: border-box;
}

.guide-card {
  background: #111726;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 36px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.guide-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.guide-meta {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 24px;
}

.guide-content h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 28px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.guide-content p {
  font-size: 0.96rem;
  line-height: 1.75;
  color: #cbd5e1;
  margin-bottom: 14px;
}

.guide-content ul, .guide-content ol {
  padding-left: 24px;
  margin-bottom: 18px;
  color: #cbd5e1;
  line-height: 1.7;
}

.guide-content li {
  margin-bottom: 6px;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.88rem;
}

.guide-table th {
  background: #1e293b;
  color: #38bdf8;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #334155;
}

.guide-table td {
  padding: 8px 14px;
  border: 1px solid #334155;
  color: #cbd5e1;
}

.guide-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Hero Banner Card (Family Look with Trajectory & UVW Stage) */
.robot-hero-section {
  background: linear-gradient(135deg, rgba(11, 19, 34, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 14px;
  padding: 16px 22px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.robot-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.robot-hero-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.25), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.robot-hero-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.robot-hero-badge-ver {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

.robot-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Language Switcher */
.lang-switcher-wrap {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 0 8px;
  height: 32px;
  gap: 5px;
  transition: border-color 0.2s, background 0.2s;
}

.lang-switcher-wrap:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.lang-switcher-wrap select {
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding-right: 4px;
}

.lang-switcher-wrap select option {
  background: #0f172a;
  color: #f8fafc;
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .robot-studio-outer-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  .robot-studio-resizer {
    display: none !important;
  }
  .robot-studio-container {
    grid-template-columns: 1fr;
  }
  .viewport-wrapper {
    height: auto !important;
    min-height: 0 !important;
  }
  #canvas-container {
    flex: none !important;
    height: 380px !important;
    min-height: 340px !important;
  }
  .viewport-telemetry-grid {
    height: auto !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .control-panel {
    height: auto !important;
    max-height: none !important;
  }
  .panel-scroll-body {
    overflow-y: visible !important;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .robot-page-container {
    width: calc(100% - 16px) !important;
    padding: 8px 0 28px !important;
    overflow-x: hidden;
  }
  .robot-hero-section {
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 10px;
    overflow: hidden;
  }
  .robot-hero-left {
    width: 100%;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
  }
  .robot-hero-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    border-radius: 10px;
  }
  .robot-hero-title {
    flex-direction: column;
    align-items: flex-start;
    font-size: 1.15rem;
    gap: 5px;
    width: 100%;
    min-width: 0;
  }
  .robot-hero-badge-ver {
    border-radius: 6px !important;
    padding: 3px 8px;
    font-size: 0.68rem;
    line-height: 1.35;
    white-space: normal;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
  }
  .robot-hero-actions {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
  .robot-studio-outer-panel {
    padding: 8px !important;
    border-radius: 12px;
  }
  .viewport-toolbar {
    padding: 8px;
    gap: 6px;
  }
  .hud-badge-group {
    flex-wrap: wrap;
    width: 100%;
    gap: 5px;
  }
  #hud-status-pill {
    min-width: 0;
  }
  .hud-pill {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
  .viewport-tools-bar {
    width: 100%;
    gap: 4px;
  }
  .btn-icon-hud {
    padding: 4px 7px;
    font-size: 0.68rem;
    flex: 1 1 auto;
    justify-content: center;
  }
  #canvas-container {
    height: 340px !important;
    min-height: 300px !important;
  }
  .viewport-gizmo-hint {
    left: 8px;
    right: 8px;
    bottom: 8px;
    font-size: 0.66rem;
    padding: 4px 8px;
  }
  .robot-playback-bar {
    height: auto !important;
    flex-wrap: wrap;
    padding: 8px;
    gap: 6px;
  }
  .robot-playback-btns {
    flex-wrap: wrap;
    gap: 4px;
  }
  .robot-speed-group {
    margin-left: auto;
  }
  .robot-scrubber-wrap {
    flex: 1 1 100%;
    min-width: 0;
    order: 10;
    gap: 6px;
  }
  .robot-time-label {
    min-width: auto;
    font-size: 0.68rem;
  }
  .viewport-telemetry-grid {
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }
  .viewport-telemetry-grid .r-telem-card:last-child {
    grid-column: 1 / -1;
  }
  .studio-tab-btn {
    font-size: 0.68rem;
    padding: 9px 2px;
  }
  .olp-row-between {
    flex-wrap: wrap;
  }
  .olp-teach-btns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .olp-waypoints-scroll,
  .olp-wp-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cartesian-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .config-group {
    flex-wrap: wrap;
  }
  .guide-card {
    padding: 18px 14px;
  }
  .guide-table {
    display: block;
    overflow-x: auto;
  }
}
