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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateZ(0);
    will-change: transform;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

h1 {
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.room-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 1.1em;
}

#room-name {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#peer-count {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.audio-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.gate-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    max-width: 400px;
}

.gate-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.gate-content p {
    margin-bottom: 30px;
    opacity: 0.9;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bpm-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.status {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.recording-controls {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

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

.btn-transport {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
}

.btn-small {
    padding: 8px 16px;
    font-size: 1.2em;
}

.btn-record {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
}

.btn-record.recording {
    background: rgba(255, 59, 48, 0.5);
    animation: pulse 2s infinite;
}

.btn-download {
    background: rgba(52, 199, 89, 0.2);
    border-color: rgba(52, 199, 89, 0.5);
    text-decoration: none;
    display: inline-block;
}

.btn-voice {
    background: rgba(50, 215, 75, 0.2);
    border-color: rgba(50, 215, 75, 0.5);
}

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

.tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.tile {
    padding: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    min-height: 115px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.tile.active {
    background: rgba(50, 215, 75, 0.3);
    border-color: rgba(50, 215, 75, 0.5);
    box-shadow: 0 0 30px rgba(50, 215, 75, 0.3);
}

.tile-icon {
    font-size: 2.2em;
    margin-bottom: 6px;
}

.tile-label {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 6px;
}

.tile-status {
    font-size: 0.9em;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.voice-chat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.voice-chat h3 {
    margin-bottom: 15px;
    font-size: 1.4em;
}

.voice-status {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
}

.peer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.peer-item {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.9em;
}

.no-peers {
    opacity: 0.6;
    font-style: italic;
}

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

footer p {
    margin: 5px 0;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
    }

    .transport-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .tiles-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .tile {
        padding: 12px;
        min-height: 90px;
    }

    .tile-icon {
        font-size: 1.8em;
    }

    .tile-label {
        font-size: 0.85em;
    }

    .tile-status {
        font-size: 0.7em;
    }
}