/* ============================================================
   📱 我的小手机 - 干净版
   ============================================================ */

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #e1e1e1;
    font-family: system-ui, -apple-system, sans-serif;
}

/* ---------- 手机容器 ---------- */
#app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #e1e1e1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ---------- 状态栏 ---------- */
#statusBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    flex-shrink: 0;
    z-index: 10;
    font-size: 14px;
    font-weight: 600;
    color: rgba(0,0,0,0.8);
    min-height: 32px;
}

/* ---------- 主屏幕 ---------- */
#homeScreen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 16px 8px 16px;
    position: relative;
    overflow: hidden;
}

/* 壁纸 */
.wallpaper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(220,220,220,0.5) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(210,210,210,0.6) 0%, transparent 50%),
        linear-gradient(180deg, #e1e1e1 0%, #d8d8d8 40%, #cecece 65%, #d8d8d8 100%);
    z-index: 0;
    pointer-events: none;
}

.wallpaper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 55% 15%, rgba(255,255,255,0.1) 0%, transparent 45%);
}

/* ---------- 图标网格 ---------- */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 12px;
    padding: 16px 4px;
    z-index: 1;
    margin-top: auto;
    margin-bottom: 12px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}

.app-icon:active {
    transform: scale(0.88);
}

.icon-box {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(120, 120, 128, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 0.5px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.3);
}

.icon-box i {
    font-size: 34px;
    color: #3a3a3c;
    opacity: 0.85;
}

.app-icon span {
    font-size: 12px;
    color: rgba(0,0,0,0.7);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255,255,255,0.3);
}

/* ---------- Dock ---------- */
.dock {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    margin: 0 8px 6px 8px;
    padding: 10px 16px;
    background: rgba(200,200,200,0.4);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 8px 40px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.4);
    z-index: 1;
}

.dock-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    user-select: none;
    flex: 1;
    max-width: 70px;
    transition: transform 0.15s ease;
}

.dock-icon:active {
    transform: scale(0.88);
}

.dock-icon .icon-box {
    width: 62px;
    height: 62px;
    border-radius: 16px;
}

.dock-icon .icon-box i {
    font-size: 28px;
}

.dock-icon span {
    font-size: 11px;
    color: rgba(0,0,0,0.6);
    font-weight: 500;
}

/* ---------- Home Indicator ---------- */
.home-indicator {
    width: 130px;
    height: 5px;
    background: rgba(0,0,0,0.12);
    border-radius: 3px;
    margin: 2px auto 0 auto;
    flex-shrink: 0;
    z-index: 1;
}

/* ---------- App 窗口 ---------- */
.app-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f2f2f7;
    border-radius: 30px;
    display: none;
    flex-direction: column;
    z-index: 20;
    overflow: hidden;
}

.app-screen.active {
    display: flex;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: 16px;
    background: rgba(242,242,247,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    min-height: 50px;
}

.app-header button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #007aff;
    padding: 0 8px;
}

.app-header span {
    font-size: 17px;
    font-weight: 600;
    color: #000;
}

.app-header span:last-child {
    width: 40px;
}

.app-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
}

/* ---------- 好友列表 ---------- */
#friendList {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    margin: 0 -16px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
}

.friend-item .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(145deg, #8e8e93, #6e6e73);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.friend-item .info {
    flex: 1;
    min-width: 0;
}

.friend-item .name {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
}

.friend-item .last-msg {
    font-size: 13px;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-item .badge {
    background: #ff3b30;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* ---------- 聊天 ---------- */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    background: #f2f2f7;
}

.chat-header button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #007aff;
}

#messageList {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ededed;
    margin: 0 -16px;
    padding: 12px 16px;
}

.message {
    max-width: 78%;
    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;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message .sender {
    font-size: 12px;
    font-weight: 600;
    color: #8e8e93;
    margin-bottom: 2px;
}

.message.mine .sender {
    color: rgba(255,255,255,0.7);
}

.input-bar {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    background: #f2f2f7;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 20px;
    font-size: 15px;
    outline: none;
    background: rgba(255,255,255,0.9);
}

.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;
    font-weight: 500;
}

/* ---------- 设置页面 ---------- */
.setting-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.setting-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.setting-section label {
    font-size: 13px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.setting-section input[type="text"],
.setting-section input[type="password"],
.setting-section input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.setting-section .btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.setting-section .btn-primary {
    background: #007aff;
    color: #fff;
}

.setting-section .btn-success {
    background: #07c160;
    color: #fff;
}

.setting-section .btn-warning {
    background: #ff9500;
    color: #fff;
}

.setting-section .btn-danger {
    background: #ff3b30;
    color: #fff;
}

/* ---------- 开关 ---------- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e5e5ea;
    transition: .3s;
    border-radius: 28px;
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.switch input:checked + .slider {
    background: #07c160;
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(20px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 14px;
    z-index: 99999;
    font-size: 14px;
    max-width: 85%;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.06);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 380px) {
    .icon-box {
        width: 64px;
        height: 64px;
    }
    .icon-box i {
        font-size: 28px;
    }
    .dock-icon .icon-box {
        width: 54px;
        height: 54px;
    }
    .dock-icon .icon-box i {
        font-size: 24px;
    }
    .icon-grid {
        gap: 14px 8px;
    }
    .app-icon span {
        font-size: 10px;
    }
    .dock-icon span {
        font-size: 10px;
    }
}

@media (max-width: 430px) {
    .app-screen {
        border-radius: 0;
    }
}