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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #333;
}

.header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: #1a1a2e;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
    align-items: center;
}

.controls label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.controls select {
    padding: 6px 8px;
    min-width: 200px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}

.controls select:disabled {
    background: #eee;
    color: #999;
}

.refresh-btn {
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
}

.refresh-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.map-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.map-stage {
    flex: 1;
    position: relative;
    min-width: 0;
    min-height: 0;
}

#map {
    position: absolute;
    inset: 0;
    background: #000;
    overflow: hidden;
}

#map canvas {
    display: block;
}

.status-bar {
    padding: 4px 16px;
    font-size: 12px;
    color: #666;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.status-bar.error {
    color: #c0392b;
    background: #fdecea;
}

/* ?ui=off — globe-only mode: no header, controls or status bar */
html.bare .header,
html.bare .controls,
html.bare .status-bar {
    display: none;
}

.path-legend {
    display: flex;
    gap: 10px;
    margin-left: auto;
    font-size: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.path-legend .swatch {
    display: inline-block;
    width: 20px;
    height: 3px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 3px;
}

.path-toggle {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.5;
}

.path-toggle.active {
    opacity: 1;
    border-color: #666;
    background: #f0f0f0;
}

.path-detail {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 1000;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #bbb;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    min-width: 480px;
    max-width: 720px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.path-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a2e;
    color: #fff;
    font-weight: 600;
}

.path-detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-detail-title .swatch {
    display: inline-block;
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.path-detail-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.path-detail-close:hover {
    opacity: 0.7;
}

.path-detail-sub {
    padding: 6px 12px;
    background: #f0f2f7;
    color: #555;
    border-bottom: 1px solid #ddd;
    font-variant-numeric: tabular-nums;
}

.path-detail-body {
    overflow-y: auto;
    max-height: 300px;
}

.path-detail-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.path-detail-table th,
.path-detail-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.path-detail-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

.path-detail-table tbody tr:hover {
    background: #f9f9f9;
}

.path-detail-table td.metric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
