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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --text: #eee;
    --text-muted: #888;
    --green: #2ecc71;
    --yellow: #f39c12;
    --red: #e74c3c;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    height: 100vh;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ---- Auth screen ---- */
#auth-screen {
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 28px;
    color: var(--accent);
}

#auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent);
    color: var(--text);
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#auth-form input {
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#auth-form input:focus {
    border-color: var(--accent);
}

#auth-form input::placeholder {
    color: var(--text-muted);
}

#auth-btn {
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#auth-btn:hover {
    background: var(--accent-hover);
}

#auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error {
    margin-top: 12px;
    padding: 10px;
    background: rgba(231, 76, 60, 0.2);
    border-radius: 8px;
    color: var(--red);
    font-size: 14px;
    text-align: center;
}

/* ---- Room screen ---- */
#room-screen {
    flex-direction: column;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }

.btn-icon {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--red);
    border-color: var(--red);
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ---- Participants grid ---- */
#participants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.participant.speaking {
    border-color: var(--green);
    box-shadow: 0 0 16px rgba(46, 204, 113, 0.2);
}

.participant.muted {
    opacity: 0.6;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
}

.participant-name {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    word-break: break-word;
}

.participant-status {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Footer controls ---- */
footer {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.device-selectors {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 500px;
}

.device-selectors label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.device-selectors select {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.controls {
    display: flex;
    gap: 12px;
}

.btn-control {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control.active {
    background: var(--bg-card);
    color: var(--green);
}

.btn-control.muted {
    background: var(--red);
    color: white;
}

.banner {
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(243, 156, 18, 0.2);
    color: var(--yellow);
    font-size: 13px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.stats-bar {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    text-align: center;
    min-height: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-card { padding: 24px; margin: 16px; }
    header { padding: 12px 16px; }
    main { padding: 16px; }
    #participants { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
}
