* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: #f5f7fa;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 500px;
    height: 90vh;
    background: white;
    border-radius: 28px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.view {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: white;
}

.view.active {
    display: flex;
}

/* 头部 */
header {
    padding: 20px 20px 10px;
    background: white;
    border-bottom: 1px solid #eee;
}

h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 16px;
    background: #f9f9f9;
}

/* 状态列表 */
main {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
    -webkit-overflow-scrolling: touch;
}

.state-list {
    list-style: none;
}

.state-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.state-item:active {
    background: #f0f2f5;
}

.state-name {
    font-size: 18px;
    font-weight: 500;
    color: #2c3e50;
}

.state-count {
    background: #e6f7ff;
    color: #1890ff;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
}

/* 底部新建 */
footer {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #eee;
}

.new-state {
    display: flex;
    gap: 10px;
}

.new-state input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 16px;
}

.new-state button {
    padding: 12px 20px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

/* 等待视图 */
.wait-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.wait-container p {
    font-size: 18px;
    color: #666;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#cancelWaitBtn {
    padding: 10px 30px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
}

/* 聊天视图 */
#chatView header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chatView header h2 {
    font-size: 18px;
    color: #333;
}

#leaveChatBtn {
    padding: 6px 16px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.self {
    align-self: flex-end;
    background: #1890ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.other {
    align-self: flex-start;
    background: #e9e9eb;
    color: #333;
    border-bottom-left-radius: 4px;
}

#chatView footer {
    display: flex;
    gap: 10px;
    background: white;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 30px;
}

#sendChatBtn {
    padding: 12px 20px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

/* 在线人数标签 */
.online-count {
    background: #52c41a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}