* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Mode Colors */
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-tertiary: #252b45;
    --bg-card: #1e2338;
    --text-primary: #e8eaf6;
    --text-secondary: #b0b8d0;
    --text-muted: #7a82a0;
    --accent-primary: #7c3aed;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-color: #2d3447;
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-lg: rgba(0, 0, 0, 0.7);
}

body.light-mode {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf1;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success: #48bb78;
    --warning: #ed8936;
    --error: #f56565;
    --border-color: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.2);
}

/* Professional Loading State */
body.app-loading {
    overflow: hidden;
}

body.app-loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

body.app-loaded::before {
    opacity: 0;
    pointer-events: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 80px 20px 200px;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    position: relative;
    font-feature-settings: 'kern' 1, 'liga' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-logo {
    font-size: 1.5em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo .fas {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
}

.user-greeting {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.user-greeting strong {
    color: var(--accent-primary);
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.theme-toggle:hover {
    background: var(--accent-primary);
    transform: rotate(20deg) scale(1.1);
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

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

.container {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-lg);
    padding: 40px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.instrument-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.instrument-btn {
    padding: 12px 30px;
    border: 2px solid var(--accent-primary);
    background: var(--bg-card);
    color: var(--accent-primary);
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.instrument-btn:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.instrument-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.tuner-display {
    text-align: center;
    margin-bottom: 30px;
}

.frequency-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.frequency-value {
    font-size: 3em;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.frequency-unit {
    font-size: 1.5em;
    color: var(--text-secondary);
}

.note-display {
    margin-bottom: 30px;
}

.current-note {
    font-size: 5em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 5px;
    font-variant-numeric: tabular-nums;
}

.note-octave {
    font-size: 1.2em;
    color: var(--text-muted);
}

.tuning-indicator {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.needle-container {
    position: relative;
    height: 100px;
    margin: 20px 0;
    background: linear-gradient(to right, 
        var(--error) 0%, 
        var(--warning) 25%, 
        var(--success) 50%, 
        var(--warning) 75%, 
        var(--error) 100%);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px var(--shadow);
}

.needle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--text-primary);
    transform-origin: center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 0.1s ease-out;
    z-index: 10;
    box-shadow: 0 0 10px var(--shadow-lg);
}

.needle::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid var(--text-primary);
}

.tuning-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.target-note {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.target-note span:last-child {
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.listening .status-dot {
    background: var(--success);
}

.status-indicator.tuned .status-dot {
    background: var(--success);
    animation: none;
    box-shadow: 0 0 10px var(--success);
}

.status-indicator.sharp .status-dot,
.status-indicator.flat .status-dot {
    background: var(--error);
}

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

.mic-permission-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.5;
}

.mic-hint-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.mic-permission-hint strong {
    color: var(--accent-primary);
}

.mic-denied-message {
    padding: 16px;
    margin-top: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.mic-denied-message .mic-denied-icon {
    display: block;
    font-size: 1.5em;
    margin-bottom: 8px;
}

.mic-denied-message p {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.mic-denied-message p:last-of-type {
    margin-bottom: 4px;
}

.mic-denied-message ul {
    margin: 0;
    padding-left: 20px;
}

.mic-denied-message li {
    margin-bottom: 4px;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.control-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 30px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.control-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.control-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.control-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--shadow);
}

.strings-display {
    display: grid;
    gap: 10px;
    margin-bottom: 30px;
}

.string-item {
    padding: 15px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.string-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(5px);
    border-color: var(--accent-primary);
}

.string-item.active {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.string-name {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-primary);
}

.string-frequency {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.info-panel {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.info-panel h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.reference-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.reference-item {
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
}

.reference-note {
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.1em;
}

.reference-freq {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 5px;
}

/* Gallery Styles */
.gallery-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    min-height: 200px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.gallery-empty h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.gallery-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
    border-color: var(--accent-primary);
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item-icon {
    font-size: 3em;
    text-align: center;
    margin-bottom: 15px;
}

.gallery-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 1.1em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-item-info {
    color: var(--text-secondary);
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Player Modal */
.player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.player-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.player-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-lg);
    position: relative;
}

.player-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.player-close:hover {
    background: var(--error);
    color: white;
    transform: rotate(90deg);
}

.player-info {
    text-align: center;
    margin-bottom: 20px;
}

.player-info h3 {
    font-size: 1.5em;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.player-info p {
    color: var(--text-secondary);
}

#audioPlayer {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 10px;
}

.player-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.player-btn {
    padding: 10px 20px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.player-btn:hover {
    background: var(--error);
    color: white;
    transform: translateY(-2px);
}

/* Auth Modal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.auth-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.auth-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 0;
    max-width: 450px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.auth-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.auth-close:hover {
    background: var(--error);
    color: white;
    transform: rotate(90deg);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.auth-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.auth-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: var(--bg-card);
}

.auth-form {
    display: none;
    padding: 30px;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.auth-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9em;
    min-height: 20px;
}

.auth-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Rooms Styles */
.rooms-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    min-height: 200px;
}

.rooms-loading,
.rooms-error,
.rooms-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.room-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
    border-color: var(--accent-primary);
}

.room-card.joined {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.room-card-header h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin: 0;
    flex: 1;
}

.room-badge {
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.room-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 15px;
    line-height: 1.5;
}

.room-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-members-count {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.room-action-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-action-btn.join {
    background: var(--accent-gradient);
    color: white;
}

.room-action-btn.enter {
    background: var(--success);
    color: white;
}

.room-action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Active Room Styles */
.room-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.room-header h2 {
    font-size: 2em;
    margin: 10px 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.room-header .control-btn {
    position: absolute;
    left: 0;
    top: 0;
}

.room-info {
    color: var(--text-secondary);
    margin-top: 10px;
}

.room-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.room-left h3,
.room-right h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.room-playlist {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.empty-playlist {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.playlist-item:hover {
    background: var(--bg-card);
    transform: translateX(5px);
}

.playlist-item-info {
    flex: 1;
}

.playlist-item-name {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.playlist-item-owner {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.playlist-play-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.playlist-play-btn:hover {
    background: var(--accent-secondary);
    transform: scale(1.1);
}

.room-chat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.chat-message.own {
    background: rgba(124, 58, 237, 0.2);
    margin-left: 20px;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-message-header strong {
    color: var(--accent-primary);
    font-size: 0.9em;
}

.chat-time {
    color: var(--text-muted);
    font-size: 0.8em;
}

.chat-message-text {
    color: var(--text-primary);
    word-wrap: break-word;
}

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

.chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9em;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.chat-input-container .control-btn {
    padding: 10px 20px;
    font-size: 0.9em;
}

.room-members {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.room-member {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.member-name {
    color: var(--text-primary);
    font-weight: 500;
}

.room-player {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.room-player-info {
    text-align: center;
    margin-bottom: 15px;
}

.room-player-info #roomTrackName {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.room-player-info #roomTrackOwner {
    color: var(--text-secondary);
    font-size: 0.9em;
}

#roomAudioPlayer {
    width: 100%;
    border-radius: 10px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--error);
    color: white;
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-content textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
}

.modal-content textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.modal-content label input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

/* Piano Styles */
.piano-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.piano-info {
    flex: 1;
    text-align: center;
}

.current-note-display {
    font-size: 3em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-hint {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.piano-settings {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.piano-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.piano-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.piano-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.piano-keyboard {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    min-height: 300px;
    padding: 20px 0;
}

.piano-key {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
}

.piano-key.white {
    width: 60px;
    height: 250px;
    background: linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%);
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin: 0 2px;
    z-index: 1;
}

.piano-key.white:hover {
    background: linear-gradient(to bottom, #f0f0f0 0%, #e5e5e5 100%);
}

.piano-key.white.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
    transform: translateY(2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.piano-key.black {
    width: 40px;
    height: 160px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border-radius: 0 0 5px 5px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    position: absolute;
    z-index: 2;
    margin-left: -20px;
}

.piano-key.black:hover {
    background: linear-gradient(to bottom, #444 0%, #111 100%);
}

.piano-key.black.active {
    background: linear-gradient(to bottom, #222 0%, #000 100%);
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

.piano-key-label {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.piano-key.white .piano-key-label {
    color: #666;
}

.piano-key.black .piano-key-label {
    color: #fff;
}

.piano-key-note {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7em;
    font-weight: 600;
    pointer-events: none;
}

.piano-key.white .piano-key-note {
    color: #999;
}

.piano-key.black .piano-key-note {
    color: #ccc;
}

.piano-help {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.piano-help h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    text-align: center;
}

.key-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.key-map-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.key-label {
    background: var(--accent-gradient);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    min-width: 35px;
    text-align: center;
}

.key-note {
    color: var(--text-primary);
    font-weight: 500;
}

body.light-mode .piano-key.white {
    background: linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%);
    border-color: #ddd;
}

body.light-mode .piano-key.white:hover {
    background: linear-gradient(to bottom, #f0f0f0 0%, #e5e5e5 100%);
}

body.light-mode .piano-key.white.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
}

@media (max-width: 900px) {
    .room-content {
        grid-template-columns: 1fr;
    }

    .piano-key.white {
        width: 45px;
        height: 200px;
    }

    .piano-key.black {
        width: 30px;
        height: 130px;
        margin-left: -15px;
    }

    .piano-container {
        padding: 15px;
    }
}

/* Footer Styles */
.main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 20px 20px;
    z-index: 100;
    box-shadow: 0 -2px 10px var(--shadow);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 20px;
}

.footer-section h3 {
    color: var(--accent-primary);
    font-size: 1.3em;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-section h4 {
    color: var(--text-primary);
    font-size: 1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 8px;
    padding-left: 0;
}

.footer-section ul li::before {
    content: "🎵 ";
    margin-right: 5px;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85em;
    margin: 0;
}

/* Professional Notifications */
.app-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px var(--shadow-lg);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
}

.app-notification-success {
    border-left: 4px solid var(--success);
}

.app-notification-error {
    border-left: 4px solid var(--error);
}

.app-notification-info {
    border-left: 4px solid var(--accent-primary);
}

.notification-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9em;
}

.notification-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========== SUPER RESPONSIVE: Compact header & footer on small screens ========== */

/* Tablet: slightly compact */
@media (max-width: 900px) {
    body {
        padding-top: 65px;
        padding-bottom: 180px;
    }

    .nav-content {
        padding: 10px 15px;
    }

    .nav-logo {
        font-size: 1.25em;
    }

    .nav-btn {
        padding: 8px 14px;
        font-size: 0.88em;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1em;
    }

    .main-footer {
        padding: 20px 15px 15px;
    }

    .footer-content {
        gap: 20px;
        margin-bottom: 15px;
    }

    .footer-section h3 {
        font-size: 1.15em;
        margin-bottom: 8px;
    }

    .footer-section h4 {
        margin-bottom: 10px;
    }

    .footer-bottom {
        padding-top: 15px;
    }
}

/* Mobile: minimal header & footer to maximize content space */
@media (max-width: 600px) {
    body {
        padding-top: 48px;
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 52px;
    }

    /* Compact header - single row, minimal height */
    .main-nav {
        min-height: auto;
    }

    .nav-content {
        padding: 6px 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 4px;
    }

    .nav-logo {
        font-size: 1em;
        white-space: nowrap;
    }

    .nav-buttons {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 4px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 0.72em;
        border-radius: 14px;
    }

    .nav-btn[data-section="tuner"] { padding: 6px 8px; }
    .nav-btn[data-section="gallery"] { padding: 6px 8px; }
    .nav-btn[data-section="rooms"] { padding: 6px 6px; }
    .nav-btn[data-section="piano"] { padding: 6px 8px; }

    .user-menu {
        margin-right: 0;
        flex-direction: row;
        gap: 4px;
    }

    .user-greeting {
        display: none !important; /* hide "Hello, user" on mobile to save space */
    }

    .user-greeting + .nav-btn,
    .user-menu .nav-btn {
        padding: 6px 10px;
        font-size: 0.72em;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.9em;
        margin-left: 2px;
    }

    /* Compact footer - single line / minimal block */
    .main-footer {
        padding: 10px 12px 10px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 8px;
    }

    .footer-section {
        display: none;
    }

    .footer-section:first-child {
        display: block;
        text-align: center;
    }

    .footer-section:first-child h3 {
        font-size: 1em;
        margin-bottom: 2px;
    }

    .footer-section:first-child p {
        font-size: 0.75em;
        margin-bottom: 0;
    }

    .footer-bottom {
        padding-top: 8px;
        border-top-width: 1px;
    }

    .footer-bottom p {
        font-size: 0.7em;
    }
}

/* Extra small phones: even tighter */
@media (max-width: 380px) {
    body {
        padding-top: 44px;
        padding-bottom: 48px;
    }

    .nav-content {
        padding: 5px 8px;
    }

    .nav-logo {
        font-size: 0.9em;
    }

    .nav-btn {
        padding: 5px 8px;
        font-size: 0.68em;
    }

    .main-footer {
        padding: 8px 10px;
    }

    .footer-section:first-child h3 {
        font-size: 0.9em;
    }

    .footer-bottom p {
        font-size: 0.65em;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    header h1 {
        font-size: 2em;
    }

    .current-note {
        font-size: 4em;
    }

    .frequency-value {
        font-size: 2.5em;
    }

    .piano-key.white {
        width: 35px;
        height: 180px;
    }

    .piano-key.black {
        width: 25px;
        height: 110px;
        margin-left: -12.5px;
    }

    .current-note-display {
        font-size: 2em;
    }

    .key-mapping {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .gallery-grid,
    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .auth-content,
    .modal-content {
        max-width: 95%;
    }

    .room-header .control-btn {
        position: static;
        margin-bottom: 15px;
    }
}
