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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}



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

/* Desktop Layout */
@media (min-width: 1024px) {
    #app {
        flex-direction: row;
    }

    .control-panel {
        width: 320px;
        height: 100vh;
        position: static !important;
        transform: none !important;
        border-right: 1px solid #3a3a3a;
        padding-top: max(25px, env(safe-area-inset-top));
    }

    .viewport-container {
        flex: 1;
    }

    .mobile-toggle {
        display: none !important;
    }
}

/* Mobile/Tablet Layout */
@media (max-width: 1023px) {
    .control-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        background: #2a2a2a;
        border-top: 2px solid #4a4a4a;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }

    .control-panel.expanded {
        transform: translateY(0);
    }

    .viewport-container {
        flex: 1;
        height: 100vh;
        padding-bottom: 60px;
        /* Add padding for the button */
        box-sizing: border-box;
    }
}

/* Control Panel Styles */
.control-panel {
    background: #2a2a2a;
    display: flex;
    flex-direction: column;
}

.mobile-toggle {
    padding: 15px;
    background: #333;
    text-align: center;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #3a3a3a;
    font-weight: 600;
}

.mobile-toggle:active {
    background: #3a3a3a;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* DRO Display */
.dro-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #e0e0e0;
    /* Brighter for readability */
    margin-bottom: 10px;
    letter-spacing: 1px;
    font-weight: 700;
    /* Bold specifically */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* Shadow for contrast on transparent bg */
}

.coordinates-grid {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.coord-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.coord-label {
    font-size: 12px;
    color: #888;
    font-weight: 700;
    text-transform: uppercase;
}

.coord-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.coord-value.machine {
    color: #FF9800;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

/* Simulation Controls */
.sim-controls {
    margin-bottom: 25px;
}

.button-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #e68900;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #da190b;
}

/* Progress Bar */
.progress-container {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    user-select: none;
    background: transparent;
}

.status-ready {
    color: #4CAF50;
}

.status-running {
    color: #2196F3;
    animation: pulse 2s infinite;
}

.status-paused {
    color: #FF9800;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Viewport */
.viewport-container {
    position: relative;
    background: #1a1a1a;
}

#viewport {
    width: 100%;
    height: 100%;
}

/* DRO Overlay */
.dro-overlay {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top));
    left: 20px;
    z-index: 100;
    pointer-events: none;
}

/* Floating Controls Container */
.floating-controls {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top));
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 100;
    transition: all 0.3s ease;
}

/* Standardized Floating Button */
/* Standardized Floating Button */
.floating-btn {
    width: 44px;
    height: 44px;
    background: rgba(26, 26, 26, 0.4);
    /* Match DRO */
    backdrop-filter: blur(10px);
    /* Match DRO */
    border: 1px solid transparent;
    /* Placeholder for hover */
    border-radius: 6px;
    /* Match DRO */
    color: #e0e0e0;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: none;
    /* Match DRO */
    padding: 0;
    line-height: 1;
}

/* Specific icon adjustments for visual alignment */
.floating-btn .icon-adjust {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.floating-btn:hover {
    background: rgba(76, 175, 80, 0.9);
    border-color: #4CAF50;
    color: white;
    transform: scale(1.05);
}

.floating-btn:active {
    transform: scale(0.95);
}

/* Mobile positioning */
@media (max-width: 1023px) {
    .floating-controls {
        top: auto;
        bottom: 80px;
        right: 10px;
        /* Moves to bottom right or left? Previous was left. Let's keep right for easier reach? Or left to avoid view cube? */
        /* Previous code had left: 10px. Let's stick to right for consistency with desktop, or check interaction. */
        left: 10px;
        right: auto;
        flex-direction: row;
        /* Horizontal row */
    }

    .floating-controls.panel-expanded {
        bottom: calc(70vh + 20px);
    }

    .floating-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
}

.dro-overlay .coordinates-grid {
    pointer-events: auto;
}

.dro-overlay .dro-section {
    background: rgba(26, 26, 26, 0.4);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.dro-overlay .section-title {
    font-size: 10px;
    margin-bottom: 6px;
    opacity: 1;
    /* Remove opacity reduction */
}

/* Mobile DRO adjustments */
@media (max-width: 768px) {
    .dro-overlay {
        top: 10px;
        left: 10px;
    }

    .dro-overlay .coord-value {
        font-size: 16px;
    }

    .dro-overlay .dro-section {
        padding: 6px 10px;
    }

    .coordinates-grid {
        gap: 12px;
    }
}

/* Touch-friendly on mobile */
@media (max-width: 1023px) {
    .btn {
        padding: 16px;
        font-size: 16px;
    }

    .coord-value {
        font-size: 24px;
    }
}

/* Info Panel */
.info-panel {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #2a2a2a;
}

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

.info-label {
    color: #888;
    font-size: 13px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Tool Load Panel Overlay */
.tool-load-overlay {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 20px;
    z-index: 100;
    pointer-events: none;
}

.tool-load-panel {
    background: rgba(26, 26, 26, 0.4);
    /* Match DRO */
    backdrop-filter: blur(10px);
    /* Match DRO */
    border: 1px solid transparent;
    /* Match DRO (effectively) */
    border-radius: 6px;
    /* Match DRO */
    padding: 12px 14px;
    min-width: 180px;
    pointer-events: auto;
}



/* Load Bar */
.load-bar-container {
    margin-bottom: 10px;
}

.load-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 4px;
}

.load-bar-value {
    font-weight: 600;
    color: #fff;
}

.load-bar-track {
    height: 8px;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.load-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.15s ease, background-color 0.3s;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.load-bar-fill.warning {
    background: linear-gradient(90deg, #FF9800, #FFC107);
}

.load-bar-fill.critical {
    background: linear-gradient(90deg, #f44336, #FF5722);
    animation: pulse-critical 0.5s infinite alternate;
}

@keyframes pulse-critical {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.7;
    }
}

/* Metrics Grid */
.load-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.load-metric {
    background: rgba(40, 40, 40, 0.6);
    border-radius: 4px;
    padding: 6px 8px;
}

.load-metric-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.load-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.load-metric-unit {
    font-size: 10px;
    color: #666;
    font-weight: normal;
    margin-left: 2px;
}

/* Wear Bar */
.wear-section {
    border-top: 1px solid rgba(60, 60, 60, 0.5);
    padding-top: 8px;
    margin-top: 4px;
}

.wear-bar-track {
    height: 4px;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.wear-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.wear-bar-fill.high {
    background: linear-gradient(90deg, #FF9800, #FFC107);
}

.wear-bar-fill.critical {
    background: linear-gradient(90deg, #f44336, #FF5722);
}

/* Warning Indicators */
.load-warnings {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.load-warning-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    animation: blink-warning 0.8s infinite alternate;
}

.load-warning-badge.overload {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.load-warning-badge.chatter {
    background: rgba(255, 152, 0, 0.3);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.5);
}

@keyframes blink-warning {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.6;
    }
}

/* Mobile responsive */
@media (max-width: 1023px) {
    .tool-load-overlay {
        /* Move up to clear the floating buttons (at bottom: 80px, height ~50px) */
        bottom: calc(140px + env(safe-area-inset-bottom));
        left: 10px;
        transition: bottom 0.3s ease;
    }

    .tool-load-overlay.panel-expanded {
        /* Move up when panel expands (70vh + spacing above buttons) */
        bottom: calc(70vh + 80px);
    }

    .tool-load-panel {
        min-width: 150px;
        padding: 10px 12px;
    }

    .load-metric-value {
        font-size: 12px;
    }
}


/* Tabs */
.tabs {
    display: flex;
    background: #222;
    border-bottom: 1px solid #3a3a3a;
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #888;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tab:hover {
    background: #2a2a2a;
    color: #e0e0e0;
}

.tab.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
    background: #2a2a2a;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Hide number input spinners */
/* Chrome, Safari, Edge, Opera */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Jog Controls */
.jog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.jog-btn {
    padding: 20px;
    background: #333;
    border: 1px solid #4a4a4a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.jog-btn:active:not(:disabled) {
    background: #4CAF50;
    transform: scale(0.95);
}

.jog-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.jog-btn.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.step-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.step-btn {
    flex: 1;
    padding: 10px;
    background: #333;
    border: 1px solid #4a4a4a;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.step-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    /* ... existing tool grid styles ... */
}

/* Terminal Console Styles */
.terminal-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #121212;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    font-family: 'Consolas', 'Monaco', monospace;
    overflow: hidden;
}

.terminal-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #a0a0a0;
    scroll-behavior: smooth;
}

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
}

.terminal-line.tx {
    color: #4CAF50;
    /* Transmit = Green */
}

.terminal-line.rx {
    color: #e0e0e0;
    /* Receive = White/Gray */
}

.terminal-line.rx.error {
    color: #f44336;
    /* Error = Red */
}

.terminal-line.rx.info {
    color: #2196F3;
    /* Info = Blue */
}

.terminal-input-area {
    display: flex;
    border-top: 1px solid #3a3a3a;
    background: #1e1e1e;
    padding: 4px;
}

.terminal-prompt {
    color: #4CAF50;
    padding: 8px 4px 8px 8px;
    font-weight: bold;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    padding: 8px;
    outline: none;
}

.terminal-send-btn {
    background: #333;
    color: #fff;
    border: none;
    padding: 0 12px;
    cursor: pointer;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    transition: background 0.2s;
}

.terminal-send-btn:hover {
    background: #4CAF50;
}
}

.tool-card {
    background: #2a2a2a;
    /* Consistent with other panels */
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-card:hover {
    border-color: #4CAF50;
    background: #333;
}

.tool-card.active {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4CAF50;
}

.tool-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #e0e0e0;
}

.tool-specs {
    font-size: 11px;
    color: #888;
}

/* G-code Editor */
.gcode-editor {
    margin-bottom: 15px;
}

.gcode-textarea {
    width: 100%;
    height: 200px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 12px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
}

.gcode-textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Unified Input Styles */
.select-input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 10px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    cursor: pointer;
}

/* Apply arrow and specific padding ONLY to select elements */
select.select-input {
    padding-right: 30px;
    /* Space for arrow */
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234CAF50%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

/* Firefox fix for dropdown shimmer */
.select-input option {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.select-input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Fix for IE10+ */
.select-input::-ms-expand {
    display: none;
}

.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-secondary {
    background: #4a4a4a;
    /* Darker grey */
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a5a5a;
}

/* Home Button */
.home-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.home-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.home-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggle Switch Styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    border: 1px solid #4a4a4a;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #888;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
}

input:checked+.toggle-slider:before {
    background-color: #4CAF50;
    transform: translateX(26px);
}

input:disabled+.toggle-slider {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Zero Buttons */
.zero-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.zero-btn {
    padding: 10px;
    background: #333;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    /* Consistent outline style */
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.zero-btn:hover:not(:disabled) {
    border-color: #FF9800;
    color: #FF9800;
    background: rgba(255, 152, 0, 0.1);
}

.zero-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Advanced Section - Native Details/Summary Disclosure */
.advanced-section {
    margin-top: 30px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.advanced-section summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    margin-bottom: 10px;
    list-style: none;
    user-select: none;
}

.advanced-section summary::-webkit-details-marker {
    display: none;
}

.advanced-section summary::before {
    content: '▶';
    color: #888;
    font-size: 10px;
    margin-right: 10px;
    transition: transform 0.2s ease;
}

.advanced-section[open] summary::before {
    transform: rotate(90deg);
}

.advanced-section summary:hover {
    background: #333;
    border-color: #4CAF50;
}

.advanced-title {
    color: #e0e0e0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.advanced-content {
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subsection-title {
    margin-bottom: 15px;
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.nav-buttons .btn {
    padding: 8px 0;
    font-size: 11px;
    background: #333;
    border: 1px solid #4a4a4a;
    color: #888;
}

.nav-buttons .btn:hover {
    border-color: #4CAF50;
    color: #e0e0e0;
}

.jump-input-row {
    display: flex;
    gap: 5px;
}

.jump-input {
    flex: 1;
    padding: 8px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.jump-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.no-gcode-message {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    padding: 30px;
}

.loading-text {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.progress-bar-container {
    width: 250px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784, #4CAF50);
    background-size: 200% 100%;
    animation: progressPulse 1.5s ease-in-out infinite;
    width: 100%;
    transition: width 0.1s ease-out;
}

.loading-percent {
    color: #4CAF50;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
}

.loading-detail {
    color: #888;
    font-size: 12px;
    margin-top: 10px;
}

@keyframes progressPulse {
    0% {
        background-position: 100% 0;
    }

    50% {
        background-position: 0% 0;
    }

    100% {
        background-position: 100% 0;
    }
}

/* Notification Toast Overlay */
.notification-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification-toast {
    background: rgba(26, 26, 26, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-weight: 600;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
    pointer-events: auto;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-toast.warning {
    border-left-color: #FF9800;
    color: #ffe0b2;
}

.notification-toast.error {
    border-left-color: #f44336;
    color: #ffcdd2;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slider */
.slider-container {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: 2px solid #2a2a2a;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: 2px solid #2a2a2a;
}

.slider-label {
    font-size: 12px;
    color: #888;
    min-width: 45px;
    font-family: monospace;
}

.reset-btn {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #888;
    font-family: monospace;
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 60px;
    justify-content: center;
    transition: all 0.2s;
}

.reset-btn:hover {
    color: #4CAF50;
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

/* Warning Panel */
.warning-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 300px;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid #FF9800;
    border-radius: 8px;
    z-index: 1500;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.warning-panel.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

.warning-header {
    padding: 10px 15px;
    background: rgba(255, 152, 0, 0.1);
    border-bottom: 1px solid #FF9800;
    color: #FF9800;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#warningList {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.warning-item {
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(255, 152, 0, 0.05);
    border-left: 3px solid #FF9800;
    font-size: 12px;
    color: #e0e0e0;
    line-height: 1.4;
}

.warning-item:last-child {
    margin-bottom: 0;
}

@keyframes slideIn {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Sponsor Banner */
.sponsor-banner {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 90;
    padding: 10px 20px;
    background: rgba(42, 42, 42, 0.85);
    border: 1px solid #FF4081;
    border-radius: 25px;
    color: #FF4081;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    backdrop-filter: blur(5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.sponsor-banner:hover {
    background: #FF4081;
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 64, 129, 0.4);
}

.sponsor-banner:active {
    transform: translateY(-1px) scale(0.98);
}

/* Mobile adjustments for Sponsor Banner */
@media (max-width: 1023px) {
    .sponsor-banner {
        bottom: 80px;
        right: 20px;
        font-size: 13px;
        padding: 8px 16px;
    }

    .sponsor-banner.panel-expanded {
        bottom: calc(70vh + 20px);
        transition: bottom 0.3s ease;
    }
}

/* Analysis Modal */
.analysis-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.analysis-modal {
    background: #2a2a2a;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 8px;
    border: 1px solid #4CAF50;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.analysis-header {
    padding: 15px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analysis-title {
    color: #4CAF50;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
}

.analysis-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
}

.analysis-body {
    padding: 20px;
    overflow-y: auto;
}

.analysis-stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
    font-size: 13px;
}

.analysis-value {
    font-family: monospace;
    color: #fff;
}

.analysis-warning-item {
    padding: 10px;
    margin-bottom: 10px;
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #FF9800;
    color: #ccc;
    font-size: 13px;
}

.analysis-warning-item.danger {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: #f44336;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-logo {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
    position: relative;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #667eea;
    border-right-color: #764ba2;
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: #f093fb;
    border-right-color: #667eea;
    animation-duration: 2s;
    animation-direction: reverse;
}

.loading-text {
    color: #a0a0a0;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fadeInOut 2s ease-in-out infinite;
}

.loading-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% 100%;
    animation: progressFlow 2s linear infinite;
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

@keyframes progressFlow {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 200% 0%;
    }
}

.loading-dots {
    display: inline-block;
    margin-left: 5px;
}

.loading-dots span {
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        opacity: 0.3;
    }

    40% {
        opacity: 1;
    }
}

/* Welcome Screen & Walkthrough */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.welcome-modal {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #4CAF50;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(76, 175, 80, 0.1);
    color: #e0e0e0;
    text-align: center;
    transform: translateY(20px);
    animation: slideUp 0.5s 0.2s forwards;
    opacity: 0;
}

.welcome-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.welcome-header p {
    font-size: 15px;
    color: #888;
    margin-bottom: 30px;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.feature-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.feature-title {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
    display: block;
}

.feature-desc {
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
}

.welcome-actions {
    margin-top: 10px;
}

.start-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.start-btn:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .welcome-modal {
        padding: 20px;
    }


}

/* Pulse Animation for Tutorial */
@keyframes driverPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.driver-active-element {
    animation: driverPulse 2s infinite;
    outline: 2px solid #4CAF50 !important;
    outline-offset: 4px;
    position: relative;
    z-index: 10002 !important;
    /* Ensure it stays above the overlay */
}

/* Driver.js Theme Overrides */
.driver-popover {
    background: rgba(30, 30, 30, 0.95) !important;
    backdrop-filter: blur(12px);
    border: 1px solid #4CAF50 !important;
    border-radius: 12px !important;
    color: #fff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
    padding: 20px !important;
}

.driver-popover-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    color: #4CAF50 !important;
}

.driver-popover-description {
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: #ccc !important;
    margin-bottom: 20px !important;
}

.driver-popover-footer {
    margin-top: 10px !important;
}

.driver-popover-btn {
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    text-shadow: none !important;
    transition: all 0.2s;
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #eee !important;
}

.driver-popover-btn:hover {
    background: #444 !important;
    color: #fff !important;
}

.driver-popover-next-btn {
    background: #4CAF50 !important;
    border-color: #45a049 !important;
    color: #fff !important;
}

.driver-popover-next-btn:hover {
    background: #45a049 !important;
}

.driver-popover-close-btn {
    color: #888 !important;
}

.driver-popover-close-btn:hover {
    color: #fff !important;
}

.driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: #4CAF50 !important;
}

.driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: #4CAF50 !important;
}

.driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: #4CAF50 !important;
}

.driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: #4CAF50 !important;
}

/* Update Welcome Actions */
.welcome-actions {
    display: flex;
    gap: 15px;
}

.tour-btn {
    flex: 1;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tour-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* VR Overlay State */
body.vr-overlay-active .control-panel {
    display: flex !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 80vw !important;
    height: 80vh !important;
    z-index: 10000 !important;
    border: 2px solid #4CAF50;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    border-radius: 12px;
}

body.vr-overlay-active .mobile-toggle {
    display: none !important;
}

body.vr-overlay-active #viewport {
    filter: blur(5px);
    /* Optional: Blur background if visible */
}

/* Close button for VR Overlay */
.vr-overlay-close {
    display: none;
}

body.vr-overlay-active .vr-overlay-close {
    display: block;
    position: absolute;
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    background: #f44336;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    border: 2px solid white;
    cursor: pointer;
    z-index: 10001;
    text-align: center;
    line-height: 36px;
    font-size: 20px;
}