/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-text {
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

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

.header-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    font-size: 0.9em;
}

.header-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.language-selector label {
    font-weight: 500;
}

.language-selector select,
.setting-group select {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    color: #333;
    width: 100%;
    max-width: 200px;
}

.language-selector select:focus,
.setting-group select:focus {
    outline: 2px solid #667eea;
    border-color: #667eea;
}

/* Main Content */
main {
    padding: 30px;
}

section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

/* Room Input */
.room-input-group {
    margin-bottom: 15px;
}

.room-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #667eea;
}

.room-input-group input[type="text"] {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    margin-bottom: 5px;
}

.room-input-group input[type="text"]:focus {
    outline: none;
    border-color: #764ba2;
}

.room-input-group .description {
    font-size: 0.85em;
    color: #666;
    margin: 0;
}

/* Room Info */
.room-info {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
}

.room-info #roomName {
    font-weight: bold;
    color: #764ba2;
}
.room-info {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
}

.room-info #roomName {
    font-weight: bold;
    color: #764ba2;
}

.status-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
    background: #6c757d; /* Default gray: disconnected state */
    transition: background-color 0.3s ease;
}

.status-indicator.connecting {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-indicator.connected {
    background: #28a745;
}

.status-indicator.error {
    background: #dc3545;
}

.status-indicator.warning {
    background: #fd7e14;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.room-info #connectionStatus {
    font-weight: bold;
}

/* Share URL Section */
.share-url-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f8ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.share-url-section p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #667eea;
}

.share-url-input {
    width: 100%;
    padding: 10px;
    font-size: 0.95em;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    margin-bottom: 10px;
    font-family: monospace;
}

.share-url-input:focus {
    outline: none;
    border-color: #764ba2;
}

/* Settings */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: flex;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
    font-size: 1.1em;
}

.setting-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.description {
    margin-top: 5px;
    margin-left: 30px;
    color: #666;
    font-size: 0.9em;
}

/* MIDI Devices */
.device-group {
    margin-bottom: 15px;
}

.device-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.device-group select {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
}

.device-group select:focus {
    outline: none;
    border-color: #667eea;
}

.synth-reverb-group[hidden] {
    display: none;
}

.synth-reverb-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.synth-reverb-row input[type="range"] {
    width: 100%;
    flex: 1;
    accent-color: #667eea;
}

.synth-reverb-value {
    min-width: 3.5rem;
    text-align: right;
    font-weight: 600;
    color: #667eea;
    font-variant-numeric: tabular-nums;
}

/* Monitor toggle */
.monitor-toggle-group {
    display: flex;
    align-items: center;
}

.monitor-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.monitor-toggle-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #667eea;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    margin: 5px;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

/* Advanced section */
.advanced {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.advanced summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
}

.advanced summary::-webkit-details-marker {
    display: none;
}

.advanced summary::before,
.chat-section summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.85em;
    transition: transform 0.2s;
    color: #667eea;
    flex-shrink: 0;
}

.advanced[open] summary::before,
.chat-section[open] summary::before {
    transform: rotate(90deg);
}

.advanced h2 {
    color: #667eea;
    margin: 10px 0;
    display: inline;
}

.advanced h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.advanced h3:first-child {
    margin-top: 0;
}

.advanced .advanced-content {
    padding-top: 15px;
}

.advanced .description {
    color: #666;
    font-size: 0.9em;
    margin-top: 10px;
}

.advanced label {
    display: block;
    margin: 10px 0;
    color: #333;
}

/* Messages section (now inside Advanced) */
#messageLog {
    background: white;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #ddd;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.message {
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 0.95em;
}

.message.info {
    background: #d1ecf1;
    border-left: 3px solid #0c5460;
    color: #0c5460;
}

.message.success {
    background: #d4edda;
    border-left: 3px solid #155724;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    border-left: 3px solid #721c24;
    color: #721c24;
}

.message.warning {
    background: #fff3cd;
    border-left: 3px solid #856404;
    color: #856404;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    border-top: 1px solid #ddd;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* MIDI Activity Display */
#midiActivity:not(.sr-only) {
    position: static;
    width: auto;
    height: auto;
    padding: 12px 16px;
    margin: 20px 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: 600;
    color: #2e7d32;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 15px;
    }

    section {
        padding: 15px;
    }
}

/* Help Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.help-step {
    margin-bottom: 25px;
}

.help-step h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.help-step p {
    color: #555;
    line-height: 1.6;
}

.help-tip {
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

.help-tip strong {
    color: #667eea;
    display: block;
    margin-bottom: 8px;
}

.help-tip p {
    margin: 0;
    color: #555;
}

.modal-footer {
    padding: 15px 30px;
    border-top: 1px solid #eee;
    text-align: right;
}

.modal-footer .btn {
    min-width: 100px;
}

@media (max-width: 600px) {
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px 20px;
    }
}

/* Help Page */
.help-page main {
    padding: 30px;
}

.help-navigation {
    margin-bottom: 30px;
}

.help-navigation button {
    min-width: 150px;
}

.help-content {
    max-width: 800px;
    margin: 0 auto;
}

.help-content h2 {
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.help-content h3 {
    color: #764ba2;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.help-content ul {
    margin: 15px 0;
    padding-left: 30px;
}

.help-content li {
    margin: 10px 0;
    line-height: 1.6;
}

.help-content p {
    line-height: 1.8;
    margin: 15px 0;
}

.help-content strong {
    color: #667eea;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f5f5f5;
    margin-top: 30px;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Chat Section */
.chat-section {
    margin: 20px 0;
}

.chat-section summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 5px;
    transition: background 0.3s;
}

.chat-section summary::-webkit-details-marker {
    display: none;
}

.chat-section summary:hover {
    background: #e9ecef;
}

.chat-section summary h2 {
    margin: 0;
    font-size: 1.3em;
    color: #667eea;
}

.chat-content {
    padding: 20px;
}

.chat-log {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.sent {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.chat-message.received {
    background: #e9ecef;
    color: #333;
    margin-right: auto;
    text-align: left;
}

.chat-message-sender {
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 4px;
    opacity: 0.8;
}

.chat-message-text {
    font-size: 0.95em;
}

.chat-message-time {
    font-size: 0.75em;
    margin-top: 4px;
    opacity: 0.7;
}

.chat-input-group {
    display: flex;
    gap: 10px;
}

.chat-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.chat-input-group input:focus {
    outline: 2px solid #667eea;
    border-color: #667eea;
}

.chat-input-group input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.chat-input-group button {
    padding: 10px 20px;
    white-space: nowrap;
}

/* Available Rooms Section */
.available-rooms {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rooms-controls {
    margin-bottom: 15px;
}

.rooms-controls button {
    padding: 10px 20px;
}

.rooms-status {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.rooms-status.empty {
    color: #999;
}

.rooms-list {
    margin-top: 15px;
}

.rooms-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.room-item:hover {
    background: #f5f5f5;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.room-name {
    flex: 1;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.room-peer-count {
    font-size: 0.85em;
    color: #666;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .room-item {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .room-peer-count {
        order: 3;
        flex-basis: 100%;
        margin-top: 8px;
    }
    
    .btn-small {
        margin-left: auto;
    }
}

/* ── Peer count badge ───────────────────────────────────────────────────────── */
.peer-count-badge {
    display: inline-block;
    background: #28a745;
    color: #fff;
    font-size: 0.8em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 8px;
    transition: opacity 0.3s;
}
.peer-count-badge:empty { display: none; }

/* ── IP Version Badge ────────────────────────────────────────────────────────── */
.ip-version-badge {
    display: inline-block;
    font-size: 0.78em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 8px;
    transition: background 0.3s, color 0.3s;
    letter-spacing: 0.02em;
}
.ip-version-badge[hidden] { display: none; }
.ip-version-v6 { background: #0d6efd; color: #fff; }
.ip-version-v4 { background: #6c757d; color: #fff; }

/* ── Experimental Mode section ───────────────────────────────────────────────── */
.experimental-mode {
    border: 1.5px solid #fd7e14;
    border-radius: 8px;
    padding: 10px 14px;
    background: rgba(253, 126, 20, 0.07);
}
.experimental-mode label span { color: #fd7e14; font-weight: 600; }

/* ── MIDI Recorder ──────────────────────────────────────────────────────────── */
.recorder-section {
    background: var(--section-bg, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.recorder-section h2 {
    margin: 0 0 12px;
    font-size: 1.1em;
}
.recorder-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rec-status {
    margin-top: 10px;
    font-size: 0.9em;
    font-weight: 600;
    min-height: 1.4em;
    color: #c0392b;
}

/* ── Piano Keyboard ──────────────────────────────────────────────────────────── */
.piano-section {
    background: var(--section-bg, #1e1e2e);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    overflow: hidden;
}
.piano-section h2 {
    margin: 0 0 12px;
    font-size: 1.1em;
    color: #f0f0f0;
}

.piano-keyboard {
    position: relative;
    display: flex;
    align-items: flex-start;
    height: 90px;
    user-select: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px; /* room for scrollbar */
}

/* White keys */
.piano-key--white {
    position: relative;
    flex: 0 0 22px;
    height: 86px;
    background: #f5f5f5;
    border: 1px solid #888;
    border-top: none;
    border-radius: 0 0 4px 4px;
    margin-right: 1px;
    z-index: 1;
    transition: background 80ms;
    box-sizing: border-box;
}

/* Black keys — absolutely positioned above white keys via negative margin trick */
.piano-key--black {
    position: relative;
    flex: 0 0 14px;
    height: 54px;
    background: #222;
    border-radius: 0 0 3px 3px;
    margin-left: -8px;
    margin-right: -7px;
    z-index: 2;
    transition: background 80ms;
    box-sizing: border-box;
}

/* Local (blue) */
.piano-key--white.piano-key--local  { background: #4a9eff; border-color: #2277cc; }
.piano-key--black.piano-key--local  { background: #1a6fd4; }

/* Remote teacher (amber) */
.piano-key--white.piano-key--remote { background: #ffb830; border-color: #cc8800; }
.piano-key--black.piano-key--remote { background: #cc8800; }

/* Both simultaneously (purple blend) */
.piano-key--white.piano-key--both   { background: #b060f0; border-color: #7a30c0; }
.piano-key--black.piano-key--both   { background: #7a30c0; }

/* Legend */
.piano-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.8em;
    color: #d0d0d0;
}
.piano-legend-item { display: flex; align-items: center; gap: 5px; }
.piano-legend-swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
}
.swatch-local  { background: #4a9eff; }
.swatch-remote { background: #ffb830; }
.swatch-both   { background: #b060f0; }

/* ── Stability Test ──────────────────────────────────────────────────────────── */

.stability-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.stability-controls label { font-size: 0.9em; }
.stability-controls input[type=number] {
    width: 70px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #555;
    background: #2a2a3e;
    color: inherit;
    font-size: 0.9em;
}

#stabilityStatus {
    font-size: 0.85em;
    font-weight: 600;
    min-height: 1.2em;
    margin-bottom: 8px;
}
#stabilityStatus.stable   { color: #2ecc71; }
#stabilityStatus.unstable { color: #e74c3c; }
#stabilityStatus.running  { color: #f39c12; }

/* Mini jitter chart — a row of coloured bars */
#jitterChart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 50px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(0,0,0,0.2);
    padding: 4px;
}
.jitter-bar {
    flex: 0 0 6px;
    border-radius: 2px 2px 0 0;
    transition: height 150ms, background 150ms;
    min-height: 2px;
}
.jitter-bar.ok      { background: #2ecc71; }
.jitter-bar.warning { background: #f39c12; }
.jitter-bar.bad     { background: #e74c3c; }

.stability-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8em;
    margin-top: 6px;
    opacity: 0.8;
    flex-wrap: wrap;
}

/* ── Participants Panel ─────────────────────────────────────────────────────── */

.participants-section {
    background: var(--section-bg, #fff);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.participants-section h2 {
    margin: 0 0 12px;
    font-size: 1.1em;
    color: #333;
}

.participants-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.04);
    font-size: 0.9em;
}

.participant-row--me {
    background: rgba(74, 158, 255, 0.1);
}

.participant-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #aaa;
}

.participant-name {
    flex: 1;
    font-weight: 500;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participant-role {
    font-size: 1.1em;
    flex-shrink: 0;
}

.participant-latency {
    font-size: 0.78em;
    color: #666;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.participant-stale {
    font-size: 0.75em;
    background: #fffbe6;
    color: #7a5c00;
    border: 1px solid #f0c040;
    border-radius: 4px;
    padding: 0 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Nickname input in connection section */
#nicknameInput {
    width: 100%;
    max-width: 260px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95em;
    margin-top: 4px;
}

/* ── Participant playing indicator ─────────────────────────────────────────── */
.participant-playing {
    font-size: 0.9em;
    animation: participant-pulse 0.6s ease-in-out infinite alternate;
    margin-left: 0.25rem;
}

@keyframes participant-pulse {
    from { opacity: 0.5; transform: scale(0.9); }
    to   { opacity: 1;   transform: scale(1.1); }
}

.participant-row--playing .participant-name {
    font-weight: 600;
}

/* ── Connection form visibility ────────────────────────────────────────────── */
.controls h2[hidden],
.room-input-group[hidden] {
    display: none;
}

/* ── App version badge ─────────────────────────────────────────────────────── */
.app-version {
    font-size: 0.45em;
    font-weight: 400;
    letter-spacing: 0.04em;
    opacity: 0.55;
    vertical-align: middle;
    margin-left: 0.4em;
    font-family: monospace;
}

/* ── Hero tagline ───────────────────────────────────────────────────────────── */
.hero-tagline {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.08) 100%);
    border-left: 3px solid var(--color-primary, #6366f1);
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--color-text, inherit);
    margin: 0 0 1.25rem 0;
}

.hero-tagline strong {
    color: var(--color-primary, #6366f1);
    font-weight: 700;
}

/* ── Browser Synth status ───────────────────────────────────────────────────── */
.synth-status {
    display: block;
    font-size: 0.82rem;
    color: var(--color-muted, #94a3b8);
    font-style: italic;
    margin-top: 0.25rem;
    min-height: 1.2em;
}

.no-midi-notice {
    font-size: 0.9rem;
    color: var(--color-muted, #94a3b8);
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-left: 3px solid var(--color-primary, #6366f1);
    border-radius: 0 0.25rem 0.25rem 0;
}
