html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d1117;
    color: #c9d1d9;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    /* Remove padding to let banner fill width */
    box-sizing: border-box;
}

/* Header & Banner */
#header {
    width: 100%;
    background: #000;
    border-bottom: 2px solid #30363d;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
    flex-shrink: 0;
}

#banner {
    width: 100%;
    max-width: 100%;
    /* Allow full width */
    height: auto;
    /* Scale proportionally */
    max-height: 50px;
    /* Cap height to prevent layout shift */
    object-fit: contain;
    display: block;
    /* Remove inline gap */
}

#main-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#right-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

#content-row {
    display: flex;
    flex-direction: row;
    flex: 1;
    height: calc(100% - 50px);
    /* Subtract banner height approximately */
    overflow: hidden;
}

#right-panel {
    width: 500px;
    height: 100%;
    background: #0d1117;
    border-left: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    flex-shrink: 0;
}

#stealth-graph-container {
    flex-shrink: 0;
    min-height: 250px;
}

.sjr-subgraph h3 {
    margin: 10px;
    color: #58a6ff;
    text-align: center;
    font-size: 1.1em;
    border-bottom: 1px solid #30363d;
    padding-bottom: 5px;
}

.sjr-subgraph .legend {
    padding: 0 10px 10px 10px;
    font-size: 0.85em;
    font-weight: bold;
    border-bottom: 1px solid #30363d;
}

.sjr-subgraph {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    position: relative;
    border-bottom: 1px solid #30363d;
}

.sjr-subgraph:last-child {
    border-bottom: none;
}

#sjrDigitalCanvas,
#sjrAnalogCanvas,
#stealthCanvas {
    flex: 1;
    width: 100%;
    position: relative;
    min-height: 0;
}

/* Left Sidebar Controls */
#controls-panel {
    width: 280px;
    /* Fixed Width Sidebar */
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    padding: 10px;
    /* Reduced padding from 15px */
    box-sizing: border-box;
    overflow-y: auto;
    /* Scrollable */
    flex-shrink: 0;
}

#controls-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    /* Explicit bottom margin */
    border-bottom: 1px solid #30363d;
    padding-bottom: 5px;
    /* Reduced from 10px */
    color: #58a6ff;
    text-align: center;
    font-size: 1.1em;
    /* Slightly smaller */
}

.control-section {
    margin-bottom: 10px;
    /* Reduced from 20px */
    border-bottom: 1px solid #21262d;
    padding-bottom: 8px;
    /* Reduced from 15px */
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h4 {
    margin: 0 0 5px 0;
    /* Reduced bottom margin from 10px */
    color: #8b949e;
    font-size: 0.8rem;
    /* Slightly smaller */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-section label {
    display: block;
    margin-bottom: 4px;
    /* Reduced from 8px */
    font-size: 0.85rem;
    /* Slightly smaller */
    cursor: pointer;
}

.control-section select,
.control-section input[type="text"],
.control-section input[type="number"] {
    width: 100%;
    margin-bottom: 5px;
    /* Reduced from 10px */
    padding: 4px;
    /* Reduced from 5px */
    background: #0d1117;
    border: 1px solid #30363d;
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9rem;
}

.control-section button {
    width: 100%;
    margin-bottom: 5px;
    /* Reduced from 8px */
    padding: 6px;
    /* Reduced from 8px */
    background: #238636;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.control-section button:hover {
    background: #2ea043;
}

#clearBtn {
    background: #da3633;
}

#clearBtn:hover {
    background: #f85149;
}

#pauseBtn {
    background: #1f6feb;
}

#pauseBtn:hover {
    background: #388bfd;
}


/* Wrapper & Canvas */
#canvas-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    background: #000;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

#canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#mapBg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.6;
}

#droneCanvas {
    z-index: 3;
    pointer-events: none;
}

#glCanvas {
    z-index: 1;
    background-color: transparent;
    mix-blend-mode: screen;
    opacity: 1.0;
}

#overlayCanvas {
    z-index: 2;
    pointer-events: auto;
    cursor: crosshair;
}

/* Fullscreen Aspect Ratio Fix (Fill Screen) */
#canvas-wrapper:fullscreen,
#canvas-wrapper:-webkit-full-screen {
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw !important;
    height: 100vh !important;
}

#canvas-wrapper:fullscreen canvas,
#canvas-wrapper:fullscreen #mapBg,
#canvas-wrapper:-webkit-full-screen canvas,
#canvas-wrapper:-webkit-full-screen #mapBg {
    width: 100vw !important;
    height: 100vh !important;
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    box-shadow: none;
    object-fit: cover;
}

/* Help Overlay */
#help-overlay,
#keyboard-help-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

#help-overlay.hidden,
#keyboard-help-overlay.hidden {
    display: none;
}

.help-content-wide {
    position: relative;
    width: 1000px;
    max-width: 95%;
    background: #0d1117;
    border: 2px solid #00ffff;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: white;
}

.controller-layout {
    position: relative;
    width: 1000px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ctrl-img {
    width: 450px;
    height: auto;
    z-index: 1;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.ctrl-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.ctrl-lines line {
    stroke: #00ffff;
    stroke-width: 2;
    opacity: 0.5;
}

.label {
    position: absolute;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    font-size: 0.95em;
    color: #e6edf3;
    text-shadow: 1px 1px 2px #000;
    z-index: 3;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
}

.left-label {
    left: 20px;
    text-align: right;
    width: 200px;
}

.right-label {
    right: 20px;
    text-align: left;
    width: 200px;
}

/* Keyboard Help */
.key-help-content {
    min-height: 400px;
    padding: 40px;
}

.keyboard-layout {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 20px;
}

.key-column {
    display: flex;
    flex-direction: column;
    width: 45%;
    text-align: left;
}

.key-column h3 {
    color: #00ffff;
    border-bottom: 1px solid #00ffff;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.key-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.key-label {
    color: #ccc;
}

.key-val {
    color: #fff;
    font-weight: bold;
    background: #333;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #555;
}

.key-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #888;
}

.scenario-help {
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px solid #444;
    text-align: left;
}

.scenario-help h3 {
    color: #4CAF50;
    margin-bottom: 5px;
}

.scenario-item {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.3;
    color: #ddd;
}

.scenario-item strong {
    color: #fff;
    display: block;
    margin-bottom: 5px;
}
/* Audio Player Styling */
.audio-controls {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #30363d;
}

.audio-marquee {
    font-size: 0.8em;
    color: #8b949e;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: #0d1117;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #30363d;
    height: 15px;
    line-height: 15px;
}
