body { 
    font-family: Arial, sans-serif; 
    padding: 20px; 
    max-width: 800px; 
    margin: 0 auto;
    background: #ffffff;
    color: #000000;
}
.realtime-visualizer {
    margin-bottom: 15px;
    padding: 12px;
    background: #0b0b0f;
    border-radius: 8px;
    border: 2px solid #4a90e2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.visualizer-row {
    display: flex;
    gap: 12px;
}
.visualizer-panel {
    flex: 1;
    min-width: 0;
}
.visualizer-label {
    font-size: 12px;
    font-weight: bold;
    color: #cde2ff;
    margin-bottom: 4px;
}
.visualizer-config {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: #cde2ff;
}
.visualizer-config label {
    font-size: 13px;
}
.realtime-visualizer canvas {
    width: 100%;
    display: block;
    border: 1px solid #2a3a5a;
    border-radius: 4px;
    background: #000;
    box-sizing: border-box;
}
@media (max-width: 720px) {
    .visualizer-row {
        flex-direction: column;
    }
}
.controls { margin: 20px 0; padding: 15px; background: #eef; border-radius: 5px; }
.storage-controls { 
    margin: 20px 0; 
    padding: 15px; 
    background: #f0f8ff; 
    border-radius: 5px; 
    border: 2px solid #4a90e2;
}
.storage-toggle-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    border: none;
    background: #4a90e2;
    color: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}
.storage-toggle-btn:hover {
    background: #357abd;
}
.storage-toggle-btn:focus {
    outline: 2px solid #1e5a9e;
    outline-offset: 2px;
}
.toggle-icon::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.2s;
}
.storage-toggle-btn[aria-expanded="true"] .toggle-icon::before {
    transform: rotate(90deg);
}
.storage-content {
    margin-top: 15px;
}
.storage-section { 
    margin: 10px 0; 
    padding: 8px 0;
}
.storage-section:not(:last-child) {
    border-bottom: 1px solid #ddd;
}
.slot-info {
    margin-top: 15px;
    padding-top: 10px;
}
.slot-info-header {
    margin-top: 10px;
}
.slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}
.slot-item {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-size: 12px;
}
.slot-empty {
    background: #f5f5f5;
    color: #999;
    border: 1px dashed #ccc;
}
.slot-filled {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
    transition: transform 0.1s, box-shadow 0.1s;
}
.slot-filled:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.slot-corrupt {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}
.slot-item small {
    color: #666;
    font-size: 10px;
}
select { padding: 10px; font-size: 16px; margin-right: 10px; min-width: 200px; }
button { padding: 10px 30px; font-size: 16px; margin: 5px; cursor: pointer; font-weight: bold;}
.duration-display { margin-left: 10px; font-size: 14px; color: #555; }
.waveform-preview {
    display: inline-block;
    vertical-align: middle;
    margin: 0 10px;
    max-width: 100%;
}
.waveform-preview canvas {
    display: block;
    border: 2px solid #333;
    border-radius: 4px;
    background: #000;
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}
textarea { 
    width: 100%; 
    height: 300px; 
    font-family: 'Consolas', 'Monaco', monospace; 
    font-size: 14px; 
    padding: 10px;
    box-sizing: border-box;
    margin-top: 10px;
    border: 1px solid #ccc;
}
#toneEditor {
    height: 150px;
    background: #f8fff8;
}
#mmlInput {
    height: 100px;
    background: #fffef8;
    border: 2px solid #f0ad4e;
}
.info { margin-top: 20px; padding: 10px; background: #f0f0f0; border-radius: 5px; }
h1 { margin-bottom: 5px; }
.editor-label { margin-top: 20px; font-weight: bold; display: block; }

/* Random Tone Controls */
.random-controls { 
    margin: 20px 0; 
    padding: 15px; 
    background: #f0fff8; 
    border-radius: 5px; 
    border: 2px solid #4a9070;
}
.random-toggle-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    border: none;
    background: #4a9070;
    color: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}
.random-toggle-btn:hover {
    background: #3a7050;
}
.random-toggle-btn:focus {
    outline: 2px solid #2a6040;
    outline-offset: 2px;
}
.random-toggle-btn[aria-expanded="true"] .toggle-icon::before {
    transform: rotate(90deg);
}
.random-content {
    margin-top: 15px;
}
.random-section { 
    margin: 10px 0; 
    padding: 8px 0;
}
.random-section:not(:last-child) {
    border-bottom: 1px solid #ddd;
}
.config-textarea {
    height: 200px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    background: #f8f8f8;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .realtime-visualizer {
        background: #0d111a;
        border-color: #6aa0ff;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    }
    
    .visualizer-label {
        color: #b3c7ff;
    }
    
    .realtime-visualizer canvas {
        border-color: #3a4a6a;
    }
    
    .controls {
        background: #2a2a3a;
        color: #e0e0e0;
    }
    
    .storage-controls {
        background: #1e2a3a;
        border-color: #3a6ea5;
        color: #e0e0e0;
    }
    
    .storage-toggle-btn {
        background: #3a6ea5;
        color: #e0e0e0;
    }
    
    .storage-toggle-btn:hover {
        background: #2a5a85;
    }
    
    .storage-toggle-btn:focus {
        outline-color: #4a90e2;
    }
    
    .storage-section:not(:last-child) {
        border-bottom-color: #444;
    }
    
    .slot-empty {
        background: #2a2a2a;
        color: #888;
        border-color: #444;
    }
    
    .slot-filled {
        background: #1e3a1e;
        color: #7bc67b;
        border-color: #4a7c4a;
    }
    
    .slot-filled:hover {
        box-shadow: 0 4px 8px rgba(255,255,255,0.1);
    }
    
    .slot-corrupt {
        background: #3a1e1e;
        color: #ff6b6b;
        border-color: #7a3a3a;
    }
    
    .slot-item small {
        color: #aaa;
    }
    
    .duration-display {
        color: #aaa;
    }

    .waveform-preview canvas {
        border-color: #555;
    }
    
    select {
        background: #2a2a2a;
        color: #e0e0e0;
        border: 1px solid #444;
    }
    
    button {
        background: #3a3a4a;
        color: #e0e0e0;
        border: 1px solid #555;
    }
    
    button:hover {
        background: #4a4a5a;
    }
    
    textarea {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    #mmlInput {
        background: #1f1f1f;
        color: #f2f2f2;
        border-color: #d48b2c;
    }
    
    #toneEditor {
        background: #1e2a1e;
        color: #e0e0e0;
    }
    
    .info {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .random-controls {
        background: #1e3a2a;
        border-color: #4a9070;
        color: #e0e0e0;
    }
    
    .random-toggle-btn {
        background: #4a9070;
        color: #e0e0e0;
    }
    
    .random-toggle-btn:hover {
        background: #3a7050;
    }
    
    .random-toggle-btn:focus {
        outline-color: #5aa080;
    }
    
    .random-section:not(:last-child) {
        border-bottom-color: #444;
    }
    
    .config-textarea {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
}

/* Oscilloscope Controls */
.oscilloscope-container { 
    margin: 20px 0; 
    padding: 15px; 
    background: #f0f0ff; 
    border-radius: 5px; 
    border: 2px solid #5a6ea5;
}
.oscilloscope-toggle-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    border: none;
    background: #5a6ea5;
    color: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}
.oscilloscope-toggle-btn:hover {
    background: #4a5a85;
}
.oscilloscope-toggle-btn:focus {
    outline: 2px solid #3a4a75;
    outline-offset: 2px;
}
.oscilloscope-toggle-btn[aria-expanded="true"] .toggle-icon::before {
    transform: rotate(90deg);
}
.oscilloscope-content {
    margin-top: 15px;
}
#oscilloscope {
    width: 100%;
    max-width: 800px;
    border: 2px solid #333;
    border-radius: 5px;
    background: #000;
    display: block;
}

/* Dark Mode Oscilloscope Styles */
@media (prefers-color-scheme: dark) {
    .oscilloscope-container {
        background: #1e2a3a;
        border-color: #5a6ea5;
        color: #e0e0e0;
    }
    
    .oscilloscope-toggle-btn {
        background: #5a6ea5;
        color: #e0e0e0;
    }
    
    .oscilloscope-toggle-btn:hover {
        background: #4a5a85;
    }
    
    .oscilloscope-toggle-btn:focus {
        outline-color: #6a90e2;
    }
    
    #oscilloscope {
        border-color: #555;
        background: #1a1a1a;
    }
}

/* Repository Links - Multiple links in bottom-left area */
.repo-links {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    z-index: 1000;
    display: flex;
    gap: 15px;
}

.repo-links a {
    color: #666;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.repo-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.render-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(2px);
    overscroll-behavior: none;
}

.render-overlay.is-active {
    display: flex;
}

.render-overlay__content {
    background: #ffffff;
    color: #000000;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    min-width: 240px;
    justify-content: center;
}

.render-overlay__spinner {
    width: 28px;
    height: 28px;
    border: 4px solid #4a90e2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: render-spin 1s linear infinite;
}

@keyframes render-spin {
    to {
        transform: rotate(360deg);
    }
}

body.rendering {
    touch-action: none;
    overflow: hidden;
}

body.rendering select:disabled {
    opacity: 0.7;
}

/* Legacy single repo-link support (for backwards compatibility) */
.repo-link {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.2s;
    z-index: 1000;
}

.repo-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Dark Mode Repository Links */
@media (prefers-color-scheme: dark) {
    .repo-links a {
        color: #aaa;
    }
    .repo-link {
        color: #aaa;
    }

    .render-overlay__content {
        background: #1e1e2a;
        color: #e0e0e0;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }
    .render-overlay__spinner {
        border-color: #a0c4ff;
        border-top-color: transparent;
    }
}
