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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 375px; /* 模拟iPhone屏幕宽度 */
    padding: 20px;
    margin: 0 auto;
}

/* 响应式布局基础 */
.room-container, .login-form {
    width: 100%;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container,
    .room-container,
    .login-form {
        max-width: 100%;
        padding: 0;
        border-radius: 0;
    }
}

/* 大屏幕显示 */
@media (min-width: 769px) {
    .container,
    .login-form {
        max-width: 400px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
    
    .room-container {
        max-width: 800px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

.login-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.login-form h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #764ba2;
}

.register-link {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

.register-link a {
    color: #667eea;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

#message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

#message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 房间页面样式 */
.room-container {
    height: 100vh;
    width: 100%;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    max-width: 375px;
    margin: 0 auto;
}

.room-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.room-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.room-header .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s;
}

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

.tab-buttons {
    display: flex;
    background: #333;
    color: white;
}

.tab-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: #333;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #667eea;
    font-weight: 600;
}

.tab-btn:hover {
    background: #444;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
}

.tab-content-inner {
    padding: 15px;
}

.tab-content-inner h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.user-role {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.user-role.owner {
    background: #ffd700;
    color: #333;
}

.user-role.admin {
    background: #17a2b8;
    color: white;
}

.empty-queue {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

/* 大屏幕布局优化 */
@media (min-width: 769px) {
    .room-header {
        padding: 20px;
    }
    
    .room-header h2 {
        font-size: 20px;
    }
    
    .tab-btn {
        padding: 16px;
        font-size: 15px;
    }
    
    .tab-content-inner {
        padding: 20px;
    }
    
    .tab-content-inner h3 {
        font-size: 18px;
    }
    
    .message {
        font-size: 15px;
        max-width: 70%;
    }
    
    .chat-input input {
        font-size: 15px;
    }
    
    .chat-input button {
        font-size: 15px;
    }
    
    .room-list li,
    .queue-list li {
        font-size: 15px;
        padding: 14px;
    }
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message.own {
    background: #e3f2fd;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.other {
    background: white;
    border-bottom-left-radius: 4px;
}

.message.system {
    background: #fff3cd;
    color: #856404;
    max-width: 90%;
    text-align: center;
    font-size: 12px;
    margin: 0 auto 14px;
    border-radius: 12px;
}

.message strong {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.chat-input {
    padding: 12px;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    background: white;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ced4da;
    border-radius: 24px;
    font-size: 14px;
    margin-right: 10px;
    transition: all 0.3s;
}

.chat-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.chat-input button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.chat-input button:hover {
    background: #764ba2;
    transform: translateY(-1px);
}

.room-list {
    list-style: none;
    padding: 15px;
}

.room-list li {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.queue-list {
    list-style: none;
    padding: 15px;
}

.queue-list li {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.queue-list li:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.queue-list li.singing {
    background: #e3f2fd;
    border-left: 4px solid #667eea;
}

.mic-controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.85);
    padding: 16px 24px;
    border-radius: 50px;
    color: white;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    box-sizing: border-box;
}

/* 响应式麦克风控制位置 */
@media (max-width: 768px) {
    .mic-controls {
        bottom: 16px;
        padding: 14px 20px;
        gap: 14px;
    }
    
    .chat-input {
        padding: 10px 10px 70px;
    }
}

@media (min-width: 769px) {
    .mic-controls {
        bottom: 32px;
        padding: 18px 28px;
        gap: 20px;
    }
    
    .chat-input {
        padding: 12px 16px 80px;
    }
}

.mic-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mic-btn.active {
    background: #ff5252;
    color: white;
    transform: scale(1.05);
}

.mic-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

/* 音量滑块样式 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 响应式调整 */
@media (max-width: 375px) {
    .room-container {
        max-width: 100%;
        height: 100vh;
    }
    
    .room-header {
        padding: 14px;
    }
    
    .room-header h2 {
        font-size: 16px;
    }
    
    .room-header .btn {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .tab-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message {
        font-size: 13px;
        padding: 8px 12px;
        margin-bottom: 12px;
    }
    
    .chat-input {
        padding: 10px;
    }
    
    .chat-input input {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .chat-input button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .mic-controls {
        padding: 14px 20px;
        gap: 14px;
        bottom: 20px;
    }
    
    .mic-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .room-list,
    .queue-list {
        padding: 12px;
    }
    
    .room-list li,
    .queue-list li {
        padding: 10px;
        margin-bottom: 8px;
    }
}
