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

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

.main-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Side-by-side viewer row */
.viewer-row {
    display: flex;
    gap: 8px;
}

.viewer-row > .viewer-section {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .viewer-row {
        flex-direction: column;
    }
}

/* Viewer sections */
.viewer-section {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #0f3460;
    font-size: 0.85rem;
    font-weight: 600;
}

.toolbar {
    display: flex;
    gap: 4px;
}

.toolbar .btn {
    font-size: 0.75rem;
    padding: 2px 8px;
}

.viewer-container {
    position: relative;
    width: 100%;
    height: 50vh;
    background: #0a0a1a;
}

.viewer-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.cross-section-height {
    height: 60vh;
}

.placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #555;
    font-size: 0.9rem;
}

/* File info bar */
.file-info-bar {
    background: #0f3460;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #aaa;
}

/* Corridor controls */
.corridor-controls {
    padding: 4px 12px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.corridor-controls .form-range {
    max-width: 200px;
}

/* Color legend */
.color-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 8px;
    font-size: 0.75rem;
}

.legend-bar {
    flex: 1;
    max-width: 200px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000);
}

.legend-label {
    color: #999;
    min-width: 40px;
}

/* Results panel */
.results-section {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    overflow: hidden;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1px;
    background: #0f3460;
    padding: 1px;
}

.result-item {
    background: #16213e;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
}

.result-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e0e0e0;
    font-variant-numeric: tabular-nums;
}

.result-coords {
    font-size: 0.85rem;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Convert modal */
.convert-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 900;
}

.convert-modal-content {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
}

/* Marker tooltip */
.marker-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 500;
    white-space: nowrap;
}

/* Selection mode cursor */
.selecting-crest #top-down-container canvas,
.selecting-toe #top-down-container canvas {
    cursor: crosshair;
}

/* Active button states */
.btn-select-active {
    box-shadow: 0 0 0 2px #fff;
}
