body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #111;
    color: #eee;
    /* Fill the viewport without allowing the page to scroll */
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#controls {
    display: flex;
    flex-direction: column;
    padding: 10px;
    padding-left: 70px;
    background: rgba(45, 1, 59, 0.9); /* darker purple with slight transparency */
    position: sticky;
    top: 0;
    z-index: 2;
}
#controls .row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
#controls .row:last-child {
    margin-bottom: 0;
}
#controls .row > * {
    margin-right: 10px;
}

/* Apply purple theme to controls */
#controls button,
#controls select,
#controls input[type="number"],
#controls input[type="file"] {
    background: rgba(75, 21, 112, 0.85); /* darker purple */
    color: #eee;
    border: 1px solid #663388;
    border-radius: 4px;
    padding: 4px 6px;
}
#avgKeyTime {
    width: 4ch; /* compact width for time input */
}
#labelFontSize {
    width: 5ch; /* narrower width for font size input */
}

#controls button:hover,
#fullscreenToggle:hover {
    background: rgba(92, 34, 144, 0.95); /* slightly lighter purple */
}

#analyzers {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.channel {
    flex: 0 0 50%;
    width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.channel canvas {
    width: 100%;
    height: 50%;
    background: #000;
}

/* Layout and flipping styles */
body.layout-mono #right-channel,
body.layout-flip-mono #right-channel {
    display: none;
}

body.layout-flip-mono #left-channel canvas,
body.layout-flip-left #left-channel canvas,
body.layout-flip-right #right-channel canvas,
body.layout-flip-both #left-channel canvas,
body.layout-flip-both #right-channel canvas {
    transform: scaleX(-1);
    transform-origin: center;
}

#keyInfo {
    position: sticky;
    top: 50px;
    background: rgba(45, 1, 59, 0.9); /* darker purple with slight transparency */
    padding: 4px 10px;
    z-index: 1;
    font-family: monospace;
}

/* No empty readout strip between the header and the visualizer. */
#keyInfo:empty { display: none; }

.warning {
    color: #ff8080;
    font-family: monospace;
    padding: 4px 10px;
    position: relative;
}

.warning .close-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

#keyInfo .stat-value {
    display: inline-block;
    min-width: 4ch;
    text-align: left;
    font-family: monospace;
}

/* Hamburger menu toggle */
/* Fullscreen toggle button */
#fullscreenToggle {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 24px;
    background: rgba(75, 21, 112, 0.85); /* darker purple */
    color: #eee;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 3;
}

