/* ===== 全局 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* ===== 手机外壳 ===== */
.phone {
    width: 390px;
    height: 780px;
    background: #000;
    border-radius: 40px;
    padding: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
}

/* ===== 屏幕 ===== */
.screen {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== 状态栏 ===== */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px 6px 20px;
    font-size: 13px;
    font-weight: bold;
    background: #f2f2f2;
    flex-shrink: 0;
    z-index: 10;
}

/* ===== 桌面 ===== */
.desktop {
    flex: 1;
    background: #f2f2f2;
    padding: 20px 16px 0 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 8px;
    align-content: start;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 4px;
}

.icon-box {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    pointer-events: none;
}

.app-icon span {
    font-size: 11px;
    color: #333;
    text-align: center;
    line-height: 1.2;
    max-width: 64px;
}

/* ===== 底部导航 ===== */
.dock {
    height: 50px;
    background: #f2f2f2;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.dock span {
    font-size: 8px;
    color: #999;
}

/* ===== App 全屏页面 ===== */
.app-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 30px;
    display: none;
    flex-direction: column;
    z-index: 20;
    overflow: hidden;
}

.app-screen.show {
    display: flex;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    min-height: 50px;
    padding-top: 16px;
}
.app-header .back-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}
.app-header span {
    font-size: 17px;
    font-weight: bold;
}

.app-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== 微信：好友列表 ===== */
.friend-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    background: #fff;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.friend-item .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.friend-item .info {
    flex: 1;
}
.friend-item .name {
    font-weight: bold;
    font-size: 15px;
}
.friend-item .last-msg {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.friend-item .badge {
    background: #ff3b30;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
}

/* ===== 聊天窗口 ===== */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}
.chat-header button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}
.chat-header span {
    font-size: 17px;
    font-weight: bold;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ededed;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}
.message.mine {
    align-self: flex-end;
    background: #07c160;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.message.theirs {
    align-self: flex-start;
    background: #fff;
    color: #000;
    border-bottom-left-radius: 4px;
}
.message .sender {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
}
.message.mine .sender {
    color: #aaffaa;
}

.input-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}
.input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 15px;
    outline: none;
}
.input-bar input:focus {
    border-color: #07c160;
}
.input-bar button {
    padding: 10px 18px;
    background: #07c160;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    cursor: pointer;
}

/* ===== 设置页面 ===== */
#roleList .role-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 6px;
}
#roleList .role-item button {
    background: #ff3b30;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
}

input[type="text"], input[type="password"], input[type="number"] {
    box-sizing: border-box;
}

/* ===== 弹窗动画 ===== */
@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}