:root {
    --bg-dark: #0A0D14;
    --panel-bg: rgba(14, 20, 32, 0.85);
    --panel-border: rgba(45, 75, 120, 0.4);
    --primary: #00E5FF;
    --primary-glow: rgba(0, 229, 255, 0.3);
    --accent: #00FF88;
    --danger: #FF3366;
    --warning: #FFB300;
    --text: #E0E6ED;
    --text-muted: #8A99AD;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text);
}

#viewport-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* TOP BAR */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(180deg, rgba(10, 13, 20, 0.95) 0%, rgba(10, 13, 20, 0.75) 100%);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

.brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #FFFFFF;
}

.highlight {
    color: var(--primary);
}

.subtitle {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-left: 8px;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 20px;
}

.timer-card, .status-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-label, .status-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.timer-time {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 12px var(--primary-glow);
    letter-spacing: 2px;
}

.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.badge-idle {
    background: rgba(255, 179, 0, 0.2);
    color: var(--warning);
    border: 1px solid rgba(255, 179, 0, 0.4);
}

.badge-active {
    background: rgba(0, 229, 255, 0.2);
    color: var(--primary);
    border: 1px solid rgba(0, 229, 255, 0.4);
}

.badge-success {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.badge-disconnected {
    background: rgba(255, 51, 102, 0.2);
    color: var(--danger);
    border: 1px solid rgba(255, 51, 102, 0.4);
}

.badge-network-info {
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: #00e5ff;
    cursor: pointer;
    user-select: all;
    font-family: monospace;
    font-size: 0.72rem;
    transition: all 0.2s;
}

.badge-network-info:hover {
    background: rgba(0, 229, 255, 0.25);
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.badge-connected {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* BUTTONS */
.btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #00B4D8 0%, #0077B6 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #00D2FF 0%, #0096C7 100%);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(45, 75, 120, 0.4);
    color: var(--text);
    border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
    background: rgba(45, 75, 120, 0.7);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text);
}

.btn-outline.active {
    border-color: var(--primary);
    background: rgba(0, 229, 255, 0.15);
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.7rem;
    cursor: pointer;
}

.btn-text:hover {
    text-decoration: underline;
}

/* LEFT SIDEBAR */
.left-sidebar {
    position: absolute;
    top: 76px;
    left: 16px;
    width: 320px;
    max-height: calc(100% - 130px);
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.sidebar-header h3 {
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--primary);
    font-weight: 700;
}

.sidebar-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.obstacle-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.obs-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    color: var(--text);
}

.obs-card:hover {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.3);
}

.obs-card.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.obs-icon {
    font-size: 1.4rem;
}

.obs-info {
    display: flex;
    flex-direction: column;
}

.obs-name {
    font-size: 0.82rem;
    font-weight: 700;
}

.obs-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.placement-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.placement-angle-box {
    background: rgba(0, 229, 255, 0.06);
    border: 1px dashed rgba(0, 229, 255, 0.35);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: pulseBorder 2s infinite ease-in-out;
}

@keyframes pulseBorder {
    0%, 100% { border-color: rgba(0, 229, 255, 0.3); }
    50% { border-color: rgba(0, 229, 255, 0.75); }
}

.placement-angle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
}

.placement-angle-hint {
    font-size: 0.64rem;
    color: var(--primary);
    font-style: italic;
}

.btn-pre-rot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn-pre-rot:hover {
    background: rgba(0, 229, 255, 0.25);
    border-color: var(--primary);
    color: #ffffff;
}

.obstacle-list-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.obs-list-container {
    max-height: 140px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.empty-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 8px 0;
}

.obs-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.72rem;
}

.obs-item-del {
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
}

/* MINIMAP */
.minimap-container {
    position: absolute;
    top: 76px;
    right: 16px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.minimap-header {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary);
}

#minimap-canvas {
    background: #06090F;
    border-radius: 6px;
    border: 1px solid rgba(45, 75, 120, 0.3);
}

.minimap-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 2px;
}

.dot-blue { background: #00B4D8; }
.dot-green { background: #00FF88; }
.dot-gold { background: #FFD700; }
.dot-red { background: #FF3366; }

/* BOTTOM BAR */
.bottom-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 44px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 10;
}

.cam-modes {
    display: flex;
    gap: 8px;
}

.btn-cam {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cam.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.cam-hints {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
}

/* SELECTED OBSTACLE INSPECTOR & ROTATION CONTROLS */
.selected-obs-panel {
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 8px;
    padding: 12px;
    margin-top: 6px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.inspector-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
}

.inspector-title-box {
    display: flex;
    flex-direction: column;
}

.inspector-tag {
    font-size: 0.6rem;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.inspector-header h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 2px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.inspector-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inspector-prop-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
}

.prop-label {
    color: var(--text-muted);
}

.prop-val {
    color: var(--text);
    font-weight: 600;
    font-family: monospace;
}

.prop-val.highlight {
    color: var(--primary);
    font-size: 0.85rem;
    text-shadow: 0 0 8px var(--primary-glow);
}

.rotation-control-group {
    background: rgba(10, 15, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rotation-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
}

.yaw-slider {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.rotation-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.btn-rot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn-rot:hover {
    background: rgba(0, 229, 255, 0.2);
    border-color: var(--primary);
    color: #ffffff;
}

.rotation-fine-tune {
    display: flex;
    gap: 4px;
}

.btn-fine {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-fine:hover {
    color: var(--primary);
    border-color: rgba(0, 229, 255, 0.3);
}

.obs-item {
    cursor: pointer;
    transition: all 0.2s;
}

.obs-item:hover {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.3);
}

.obs-item.selected {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

/* MISSION SELECTOR */
.mission-select-card {
    display: flex;
    flex-direction: column;
    background: rgba(14, 24, 42, 0.9);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 6px;
    padding: 6px 12px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

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

.mission-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-transform: uppercase;
}

.btn-info-badge {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-info-badge:hover {
    background: rgba(0, 229, 255, 0.3);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.map-dropdown {
    background: #0d1522;
    color: #e2e8f0;
    border: 1px solid rgba(45, 75, 120, 0.6);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 250px;
}

.map-dropdown:focus, .map-dropdown:hover {
    border-color: var(--primary);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.map-dropdown option {
    background: #0a101d;
    color: #ffffff;
    padding: 8px;
}

/* BRIEFING MODAL */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 8, 14, 0.82);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1.0); }
}

.modal-card {
    background: linear-gradient(180deg, #101929 0%, #0c1320 100%);
    border: 1px solid rgba(0, 229, 255, 0.5);
    border-radius: 10px;
    width: 600px;
    max-width: 90vw;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.25);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    background: rgba(14, 24, 42, 0.8);
    border-bottom: 1px solid rgba(45, 75, 120, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title-group h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.briefing-section {
    background: rgba(0, 229, 255, 0.04);
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
}

.briefing-subtitle {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 4px;
}

.briefing-section p {
    font-size: 0.85rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.briefing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.briefing-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.briefing-box-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.briefing-box-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: #f1f5f9;
}

.modal-footer {
    padding: 14px 20px;
    background: rgba(14, 24, 42, 0.8);
    border-top: 1px solid rgba(45, 75, 120, 0.4);
    display: flex;
    justify-content: flex-end;
}
