:root {
    --primary-pink: #FFFFFF;
    --white: #FFFFFF;
    --line-color: #000000;
    --shadow-color: #E0D0D0;
    --text-main: #333333;
    --text-sub: #777777;
    --app-radius: 18px;
    --ios-blue: #333333;
    --sketch-border: 2px solid var(--line-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh; /* 动态视口高度，解决移动端地址栏问题 */
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* 手机外壳容器 */
#phone-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    background: var(--primary-pink);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    /* iOS安全区域适配 */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* 方格纸纹理 */
#phone-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(#f0f0f0 1px, transparent 1px),
        linear-gradient(90deg, #f0f0f0 1px, transparent 1px);
    background-size: 25px 25px;
    z-index: 0;
}

/* 顶部装饰花边 - 简化为手绘线条 */
#phone-container::after {
    display: none;
}

#phone-container.status-bar-hidden::after {
    transform: translateY(-100%);
}

@media (min-width: 768px) {
    #phone-container {
        border: 12px solid #333;
        border-radius: 50px;
        height: 85vh;
    }
}

/* 状态栏 - 确保不被遮挡 */
#status-bar {
    height: 24px;
    min-height: 24px;
    padding: 0 20px;
    padding-top: env(safe-area-inset-top, 0px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 3000;
    color: var(--text-main);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

/* 视图管理 */
#view-manager {
    flex: 1;
    position: relative;
    z-index: 1;
}

.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    padding: 0 15px;
}

.view.active {
    display: flex;
}

/* 锁屏页 */
#lock-screen {
    justify-content: flex-start;
    align-items: center;
    background: #ffffff;
    padding-top: 100px;
    padding-top: calc(100px + env(safe-area-inset-top, 0px));
}

.lock-content {
    text-align: center;
}

#lock-time { font-size: 80px; font-weight: 200; color: var(--text-main); }
#lock-date { font-size: 18px; color: var(--text-sub); }

/* 密码界面 */
#passcode-screen {
    justify-content: center;
    align-items: center;
    background: #fff;
}

.passcode-header {
    text-align: center;
    margin-bottom: 40px;
}

.passcode-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid var(--line-color);
    margin: 0 auto 15px;
    overflow: hidden;
    background: #f0f0f0;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--line-color);
}

.passcode-avatar.hidden {
    visibility: hidden;
}

#passcode-avatar-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.passcode-msg {
    font-size: 18px;
    color: var(--text-main);
    margin-bottom: 20px;
}

.passcode-dots {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--line-color);
    transition: background-color 0.2s;
}

.dot.active {
    background-color: var(--line-color);
}

.passcode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    justify-items: center;
}

.num-btn {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: 2px solid var(--line-color);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 32px;
    font-weight: bold;
    color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--line-color);
    transition: all 0.1s;
}

.num-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--line-color);
}

.text-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-main);
    cursor: pointer;
    font-weight: bold;
}

.unlock-area {
    position: absolute;
    bottom: 120px;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 60px);
}

#slider-track {
    height: 50px; 
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px; display: flex; align-items: center;
    padding: 0 5px; border: 2px solid rgba(0, 0, 0, 0.15);
}

#slider-handle {
    width: 40px; height: 40px; 
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 8px; display: flex; justify-content: center;
    align-items: center; border: 2px solid var(--line-color);
}

/* 主屏幕新排版 */
#home-screen {
    padding: 0;
    overflow: hidden;
}

/* 分页容器 */
#home-pager {
    display: flex;
    width: 300%; /* 三页：负一屏、主屏、助手屏 */
    height: 100%; /* 占满高度，确保全屏滑动检测有效 */
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateX(-33.333%); /* 默认显示中间的主屏 */
}

.home-page {
    width: 33.333%;
    height: 100%;
    padding: 30px 15px 130px; /* 顶部增加到 30px 以避开状态栏 */
    padding-top: calc(30px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.home-page::-webkit-scrollbar { display: none; }

/* 分页点 */
.home-pagination {
    position: absolute;
    bottom: 120px;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.page-dot {
    width: 6px; height: 6px;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    transition: all 0.3s;
}

.page-dot.active {
    background: rgba(0,0,0,0.8);
    transform: scale(1.2);
}

/* 第四界面：四象限新布局 */
.assistant-new-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px;
}

.quadrant-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    height: 50%; /* 占据屏幕一半 */
    min-height: 280px;
    position: relative; /* 使内部绝对定位元素相对于此容器 */
}

.quadrant-item {
    background: #fff;
    border: 2px solid var(--line-color);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 4px 4px 0 var(--line-color);
    display: flex;
    flex-direction: column;
    position: relative;
}

.q-title {
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 6px;
    width: fit-content;
    margin-bottom: 8px;
    border: 1.5px solid var(--line-color);
}

.q-content {
    flex: 1;
    font-size: 13px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.q-todo {
    position: relative;
    padding: 2px 30px 2px 22px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    min-height: 20px;
}
.q-todo::before {
    content: '';
    position: absolute;
    left: 0; top: 4px;
    width: 14px; height: 14px;
    border: 1.5px solid var(--line-color);
    border-radius: 3px;
    background: #fff;
}
.q-todo.completed {
    opacity: 0.6;
}
.q-todo.completed .q-todo-text {
    text-decoration: line-through;
}
.q-todo.completed::before {
    background-color: var(--line-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center;
}
.q-todo-text {
    display: block;
    word-break: break-all;
}
.q-todo-edit, .q-todo-del {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-sub);
    opacity: 0.4;
    transition: opacity 0.2s;
}
.q-todo-edit {
    right: 18px;
}
.q-todo:hover .q-todo-edit, .q-todo:hover .q-todo-del {
    opacity: 1;
}
.q-add {
    margin-left: 5px;
    cursor: pointer;
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    border: 1px solid var(--line-color);
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

/* 象限配色 - 手绘感色彩 */
.q-urgent-important { background-color: #fff0f0; }
.q-urgent-important .q-title { background: #ffcfcf; }

.q-important { background-color: #fff9e6; }
.q-important .q-title { background: #ffecb3; }

.q-urgent { background-color: #e3f2fd; }
.q-urgent .q-title { background: #bbdefb; }

.q-none { background-color: #f5f5f5; }
.q-none .q-title { background: #e0e0e0; }

/* 四象限中间的圆形绑定按钮 */
.quadrant-center-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--line-color);
    box-shadow: 3px 3px 0 var(--line-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.1s;
    color: var(--line-color);
}

.quadrant-center-btn:active {
    transform: translate(calc(-50% + 2px), calc(-50% + 2px));
    box-shadow: 0px 0px 0 var(--line-color);
}

.quadrant-center-btn.has-binding {
    background: var(--line-color);
    color: #fff;
}

.quadrant-center-btn svg {
    width: 28px;
    height: 28px;
}

/* 支持自定义图标 */
.quadrant-center-btn.custom-icon {
    background-size: cover;
    background-position: center;
}

.quadrant-center-btn.custom-icon svg {
    display: none;
}

.assistant-apps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 10px;
    padding: 10px 0;
}

/* 四象限绑定卡片 */
.quadrant-binding-card {
    background: #fff;
    border: 2px solid var(--line-color);
    border-radius: 18px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 4px 4px 0 var(--line-color);
    cursor: pointer;
    transition: transform 0.1s;
}

.quadrant-binding-card:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--line-color);
}

.q-binding-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    background: #f0f0f0;
    border: 2px solid var(--line-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.q-binding-info {
    flex: 1;
}

.q-binding-label {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: bold;
}

.q-binding-value {
    font-size: 15px;
    color: var(--text-main);
    font-weight: bold;
}

.q-binding-arrow {
    color: #ccc;
    font-weight: bold;
}

.cloud-clock-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.cloud-clock {
    width: 280px;
    height: 110px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--app-radius);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--line-color);
    box-shadow: 5px 5px 0 var(--line-color);
    backdrop-filter: blur(5px);
}

.cloud-clock::before {
    display: none;
}

.cloud-time { font-size: 40px; font-weight: bold; color: var(--text-main); letter-spacing: 2px; }
.cloud-date { font-size: 14px; color: var(--text-sub); }

/* 网格布局 */
.home-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 应用图标样式 */
.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.app-icon.cat-style {
    width: 55px;
    height: 55px;
    background: #fff;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    border: 2px solid var(--line-color);
    position: relative;
    box-shadow: 4px 4px 0 var(--line-color);
    transition: transform 0.1s;
}

.app-icon.cat-style:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--line-color);
}

/* 移除猫耳朵，保持简约 */
.app-icon.cat-style::before, .app-icon.cat-style::after {
    display: none;
}

.app-name {
    font-size: 11px;
    color: var(--text-main);
    margin-top: 8px;
    font-weight: bold;
}

/* 组件 */
.square-widget {
    grid-column: span 2;
    background-color: #fff;
    border-radius: var(--app-radius);
    padding: 15px;
    border: 2px solid var(--line-color);
    box-shadow: 5px 5px 0 var(--line-color);
    height: 140px;
    display: flex;
    flex-direction: column;
    background-size: cover; /* 改为 cover 以确保填满且比例正确 */
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    overflow: hidden;
}

.search-widget {
    background-color: rgba(255, 255, 255, 0.6);
    padding: 0; /* 移除内边距，使背景图能完整覆盖整个区域 */
}

.search-bar {
    display: flex;
    justify-content: space-between;
    background: #fff;
    padding: 5px 15px;
    border-radius: 10px;
    border: 2px solid var(--line-color);
}

.widget-cat-img {
    flex: 1;
    background: url('https://api.dicebear.com/7.x/adventurer/svg?seed=Lucky') no-repeat center;
    background-size: contain;
}

.music-widget {
    grid-column: span 2;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: var(--app-radius);
    padding: 15px;
    border: 2px solid var(--line-color);
    box-shadow: 5px 5px 0 var(--line-color);
    height: 140px;
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.music-cat-img {
    width: 60px; height: 60px;
    background: #fff;
    border-radius: 10px;
    border: 2px solid var(--line-color);
    display: flex;
    justify-content: center;
    align-items: center;
}
.music-cat-img::after {
    content: '♪';
    font-size: 30px;
    color: var(--line-color);
}

.music-info { margin-top: 10px; }
.music-title { font-size: 14px; font-weight: bold; color: var(--text-main); }
.music-artist { font-size: 12px; color: var(--text-sub); }
.spotify-icon { position: absolute; top: 15px; right: 20px; font-size: 24px; color: #1DB954; }

/* Dock */
#dock {
    position: absolute;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 15px;
    right: 15px;
    height: 90px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 5px 5px 0 var(--line-color);
}

/* App Overlays */
#app-overlay { background: #fff; padding: 0; z-index: 2000; }
.app-header {
    height: 74px; display: flex; align-items: center; justify-content: space-between;
    padding: 24px 20px 0; background: #fff; border-bottom: 2px solid #000;
    border-top: none;
    position: relative;
    flex-shrink: 0;
}
.status-placeholder {
    width: 100%;
    height: 24px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #000;
}
.header-main {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 15px;
}
.back-btn { 
    font-size: 18px; cursor: pointer; margin-right: 15px; color: #000; 
    position: relative; z-index: 10;
}
.app-title { 
    font-size: 18px; font-weight: bold; flex: 1; text-align: center; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    position: absolute; left: 50%; transform: translateX(-50%); width: 60%; 
    z-index: 1; pointer-events: none; /* 防止标题容器遮挡两侧按钮点击 */
}
.header-right-btn { 
    font-size: 24px; cursor: pointer; color: #000; min-width: 40px; text-align: center; 
    position: relative; z-index: 10;
}
.header-right-btns { 
    display: flex; gap: 15px; 
    position: relative; z-index: 10;
}

.primary-btn {
    width: 90%; margin: 20px 5%; padding: 12px;
    background: #fff; color: var(--line-color);
    border: 2px solid var(--line-color); border-radius: 12px; font-size: 16px; font-weight: bold;
    box-shadow: 3px 3px 0 var(--line-color);
}

/* 设置 app 专项手绘风格 */
.settings-icon {
    color: #000 !important;
    filter: drop-shadow(1px 1px 0px #fff);
}

.settings-small-btn {
    padding: 0 10px;
    border: 2px solid #000;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
    transition: all 0.1s;
}

.settings-small-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0 #000;
}

.settings-main-btn {
    border: 2px solid #000 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: 4px 4px 0 #000 !important;
    transition: all 0.1s;
}

.settings-main-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0 #000 !important;
}

.settings-main-btn.secondary {
    background: #fff !important;
    margin-top: 10px;
}

.save-btn, .send-btn {
    background: #fff !important;
    color: var(--line-color) !important;
    border: 2px solid var(--line-color) !important;
    border-radius: 10px !important;
    box-shadow: 3px 3px 0 var(--line-color) !important;
}

/* 列表样式 */
.list-container { flex: 1; overflow-y: auto; background: #fff; }

/* 世界书内容区域 */
.world-content { flex: 1; overflow-y: auto; background: #f3f3f3; }
.item-icon { font-size: 20px; width: 30px; }
.list-item-arrow { color: #ccc; font-family: "宋体"; font-weight: bold; }
.icon-btn { cursor: pointer; font-size: 20px; position: relative; }
.icon-btn sup { font-size: 12px; font-weight: bold; position: absolute; top: -5px; right: -8px; }

/* 资料/设置页 */
.settings-page { flex: 1; overflow-y: auto; background: #ededed; }

.list-group {
    background: #fff;
    margin: 10px 15px;
    border: 2px solid #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.1);
}
.list-item {
    display: flex; align-items: center; padding: 0 15px; height: 54px;
    border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #f2f2f2; }
.list-item-icon {
    width: 24px; height: 24px; margin-right: 15px; font-size: 18px;
    display: flex; justify-content: center; align-items: center;
}
.list-item-title { flex: 1; font-size: 16px; color: #000; }
.list-item-arrow { color: #ccc; font-size: 16px; }

.icon-green { color: #07c160; }
.icon-yellow { color: #fa9d3b; }
.icon-blue { color: #2782D7; }
.icon-gold { color: #ffbe00; }

/* 表单 */
.form-group { padding: 15px 20px; background: #fff; border-bottom: 1px solid #f0f0f0; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; color: #666; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px; border: 2px solid #000; border-radius: 12px; font-size: 16px;
}

/* 自定义提示框 */
#custom-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid #000;
    border-radius: 16px;
    padding: 20px;
    width: 80%;
    max-width: 320px;
    box-shadow: 6px 6px 0 #000;
    z-index: 9999;
    display: none;
    animation: noticePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

#notice-text {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    margin-bottom: 20px;
    line-height: 1.5;
    word-break: break-all;
}

#notice-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #000;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    background: #f9f9f9;
    font-family: inherit;
    display: block;
}

#notice-input:focus {
    background: #fff;
    border-color: #007aff;
}

.notice-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.notice-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    transition: all 0.1s;
}

.notice-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0 #000;
}

#notice-cancel {
    background: #f5f5f5;
}

@keyframes noticePop {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#notice-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

/* 手绘风格滑动开关 */
.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #fff;
    border: 2px solid #000;
    transition: .3s;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #000;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .switch-slider {
    background-color: #000;
}

input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* 自定义弹窗 (Modal) 样式 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid #000;
    border-radius: 16px;
    padding: 20px;
    width: 80%;
    max-width: 320px;
    box-shadow: 6px 6px 0 #000;
    z-index: 9999;
    display: none;
    animation: noticePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal.active {
    display: block;
}

.modal-overlay.active {
    display: block;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    margin-bottom: 15px;
    line-height: 1.5;
}

.modal-body p {
    font-size: 14px;
    color: #333;
    margin-bottom: 20px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #000;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #f9f9f9;
    font-family: inherit;
}

.modal-input:focus {
    background: #fff;
    border-color: #000;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    transition: all 0.1s;
}

.modal-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0 #000;
}

.modal-btn-cancel {
    background: #fff;
}

.modal-btn-confirm {
    background: #fff;
    color: #000;
    border-color: #000;
}

/* ============================================ */
/* 移动端适配优化 */
/* ============================================ */

/* 移动端全屏模式 - 手机浏览器 */
@media screen and (max-width: 767px) {
    body {
        background-color: #fff;
    }
    
    #phone-container {
        border: none;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
        box-shadow: none;
    }
}

/* 平板和桌面端 - 保持手机模拟框 */
@media screen and (min-width: 768px) {
    body {
        background-color: #f0f0f0;
    }
    
    #phone-container {
        max-width: 414px;
        max-height: 896px;
        border: 12px solid #333;
        border-radius: 50px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.2);
        /* 桌面端不需要安全区域 */
        padding: 0;
    }
    
    /* 桌面端状态栏不需要额外padding */
    #status-bar {
        padding-top: 0;
    }
    
    /* 桌面端页面不需要安全区域padding */
    .home-page {
        padding-top: 30px;
        padding-bottom: 130px;
    }
    
    /* 桌面端Dock和分页指示器 */
    #dock {
        bottom: 20px;
    }
    
    .home-pagination {
        bottom: 120px;
    }
    
    .unlock-area {
        bottom: 120px;
    }
    
    #lock-screen {
        padding-top: 100px;
    }
}

/* 短屏手机适配 (如 iPhone SE, 较老的安卓手机) */
@media screen and (max-height: 700px) and (max-width: 767px) {
    #lock-time {
        font-size: 60px;
    }
    
    #lock-screen {
        padding-top: 60px;
        padding-top: calc(60px + env(safe-area-inset-top, 0px));
    }
    
    .passcode-header {
        margin-bottom: 20px;
    }
    
    .passcode-avatar {
        width: 70px;
        height: 70px;
    }
    
    .num-btn {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    .passcode-grid {
        gap: 12px;
    }
    
    .cloud-clock {
        height: 90px;
    }
    
    .cloud-time {
        font-size: 32px;
    }
    
    .quadrant-container {
        min-height: 220px;
    }
    
    .square-widget,
    .music-widget {
        height: 110px;
    }
    
    #dock {
        height: 75px;
    }
    
    .app-icon.cat-style {
        width: 48px;
        height: 48px;
    }
    
    .app-icon.cat-style svg {
        width: 26px;
        height: 26px;
    }
}

/* 超大屏手机适配 (如 iPhone Pro Max系列) */
@media screen and (min-height: 850px) and (max-width: 767px) {
    .home-page {
        padding-top: calc(40px + env(safe-area-inset-top, 0px));
    }
    
    .cloud-clock {
        height: 120px;
        margin-bottom: 30px;
    }
    
    .cloud-time {
        font-size: 44px;
    }
    
    .quadrant-container {
        min-height: 320px;
    }
}

/* 横屏模式基础支持 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #lock-screen {
        padding-top: 30px;
        padding-top: calc(30px + env(safe-area-inset-top, 0px));
        flex-direction: row;
        justify-content: space-around;
    }
    
    .lock-content {
        margin-right: 40px;
    }
    
    #lock-time {
        font-size: 50px;
    }
    
    .unlock-area {
        position: relative;
        bottom: auto;
        width: 200px;
        align-self: center;
    }
    
    .passcode-grid {
        gap: 10px;
    }
    
    .num-btn {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
    
    .passcode-header {
        margin-bottom: 15px;
    }
    
    .passcode-avatar {
        width: 60px;
        height: 60px;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移动设备触摸优化 */
    .app-item,
    .list-item,
    .num-btn,
    .notice-btn,
    .modal-btn,
    .dock-item {
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }
    
    /* 增大可点击区域 */
    .back-btn,
    .header-right-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 禁用长按菜单 */
    img, a, button {
        -webkit-touch-callout: none;
    }
}

/* iOS特定修复 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari 地址栏收缩问题 */
    body {
        min-height: -webkit-fill-available;
    }
    
    #phone-container {
        min-height: -webkit-fill-available;
    }
}

/* Android特定修复 - 底部导航栏 */
@media screen and (max-width: 767px) {
    /* 为Android底部导航栏预留空间 */
    #dock {
        /* 使用max()确保至少有20px底部间距 */
        bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }
}

/* 防止iOS橡皮筋效果导致的布局问题 */
html {
    overflow: hidden;
    height: 100%;
}

body {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
}

/* 输入框聚焦时防止页面缩放 */
input, textarea, select {
    font-size: 16px !important; /* 防止iOS自动缩放 */
}

/* 滚动优化 */
.home-page,
.list-container,
.settings-page,
.world-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
