/* --- 布局与主屏幕样式 --- */

.phone-screen {
    width: 100%;
    height: 100vh;
    background-color: #ffffff;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    width: 100%;
    flex: 1;
    overflow: hidden;
    height: auto;
    animation: fadeIn 0.5s ease;
    order: 1; /* 确保所有屏幕内容在导航栏之前 */
}

.screen.active {
    display: flex;
}

.content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px; /* 防止被底部导航栏遮挡 */
    position: relative;
}

/* 头部导航栏 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    padding-top: max(10px, env(safe-area-inset-top)); /* 适配灵动岛 */
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

body.has-statusbar .app-header {
    padding-top: calc(35px + env(safe-area-inset-top)) !important; /* 开启状态栏时，让顶部导航栏顺位下移 */
}

.app-header .back-btn,
.app-header .action-btn {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: var(--func-icon-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header .action-btn svg,
.app-header .back-btn svg {
    stroke: var(--func-icon-color);
}

.app-header .action-btn-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.app-header .action-btn-group .action-btn {
    font-size: 28px;
    padding: 0;
    width: 40px;
    height: 40px;
    background-color: transparent;
    color: var(--func-icon-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.app-header .action-btn-group .action-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--func-icon-color);
    stroke-width: 2;
    fill: none;
}

.app-header .action-btn img {
    width: 28px;
    height: 28px;
}

.app-header .title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.app-header .title {
    font-size: calc(18px * var(--app-font-scale));
    font-weight: 600;
    color: var(--global-title-color);
    margin: 0;
}

.app-header .subtitle {
    font-size: calc(12px * var(--app-font-scale));
    color: #888;
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--online-status-color);
    margin-right: 5px;
}

.app-header .placeholder {
    width: 40px;
}

/* 主屏幕 (Home Screen) */
#home-screen {
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
    padding: calc(45px + env(safe-area-inset-top)) 5px 25px;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

body.has-statusbar #home-screen {
    padding-top: calc(75px + env(safe-area-inset-top)) !important; /* 开启状态栏时，让内容下移防止遮挡 */
}

/* 顶栏状态栏 */
.home-top-statusbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color, #333);
    background: transparent;
    pointer-events: none;
    font-family: var(--font-family);
}

.home-top-statusbar .htsb-time {
    font-variant-numeric: tabular-nums;
}

.home-top-statusbar .htsb-battery {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.home-top-statusbar .htsb-battery-level {
    font-variant-numeric: tabular-nums;
}

/* 夜间模式 - 全局纯黑 */
body.night-mode-active {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --white-color: #e0e0e0;
    --primary-color: #1e1e1e;
    --secondary-color: #666;
    --accent-color: #1e1e1e;
    --top-pinned-bg: #1a1a1a;
    --panel-bg: #181818;
    --chat-bottom-bar-bg: #181818;
    --folder-pill-bg: #1e1e1e;
    --folder-pill-text: #bbb;
    --folder-pill-active-bg: #333;
    --folder-pill-active-text: #fff;
    --global-title-color: #e0e0e0;
    --nav-icon-color: #777;
    --nav-active-icon-color: #e0e0e0;
    --kkt-icon-color: #e0e0e0;
    --func-icon-color: #e0e0e0;
}

body.night-mode-active {
    background: #0e0e0e;
}

body.night-mode-active .phone-screen {
    background-color: #121212;
}

body.night-mode-active .screen {
    background-color: #121212;
}

body.night-mode-active .app-header {
    background-color: #181818;
    border-bottom-color: #222;
    color: #e0e0e0;
}

body.night-mode-active .app-header .title,
body.night-mode-active .app-header .back-btn {
    color: #e0e0e0;
}

body.night-mode-active .content {
    background-color: #121212;
}

body.night-mode-active .kkt-group,
body.night-mode-active .kkt-item,
body.night-mode-active .collapsible-header {
    background-color: #181818 !important;
    color: #e0e0e0;
    border-color: #222 !important;
}

body.night-mode-active .kkt-item-label {
    color: #e0e0e0 !important;
}

body.night-mode-active input,
body.night-mode-active textarea,
body.night-mode-active select {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-color: #333;
}

body.night-mode-active .btn {
    border-color: #333;
}

body.night-mode-active .settings-sidebar {
    background-color: #121212;
}

body.night-mode-active .modal-overlay .modal-window {
    background-color: #181818;
    color: #e0e0e0;
}

/* 夜间模式 - 聊天列表 */
body.night-mode-active .chat-item,
body.night-mode-active #chat-list-container .list-item {
    background-color: #121212 !important;
    border-bottom-color: #222 !important;
}

body.night-mode-active .chat-item:active,
body.night-mode-active #chat-list-container .list-item:hover {
    background-color: #1a1a1a !important;
}

body.night-mode-active .chat-item.pinned {
    background-color: #161616 !important;
}

body.night-mode-active .chat-item-blocked {
    background-color: #141414 !important;
}

body.night-mode-active .item-name,
body.night-mode-active #chat-list-container .item-name {
    color: #e0e0e0 !important;
}

body.night-mode-active .item-preview,
body.night-mode-active #chat-list-container .item-preview {
    color: #777 !important;
}

body.night-mode-active .item-time,
body.night-mode-active #chat-list-container .item-time {
    color: #555 !important;
}

body.night-mode-active .chat-list-header {
    background-color: #121212 !important;
    border-bottom-color: #222 !important;
}

body.night-mode-active .chat-list-header .title {
    color: #e0e0e0 !important;
}

/* 夜间模式 - 文件夹标签栏 */
body.night-mode-active .folder-tabs,
body.night-mode-active .tab-bar,
body.night-mode-active .chat-category-tabs {
    background-color: #121212 !important;
    border-bottom-color: #222 !important;
}

body.night-mode-active .tab-item {
    background-color: #1e1e1e !important;
    color: #bbb !important;
    border-color: #333 !important;
}

body.night-mode-active .tab-item.active,
body.night-mode-active .tab-item.active.pill-black {
    background-color: #333 !important;
    color: #fff !important;
    border-color: #333 !important;
}

body.night-mode-active .tab-item.pill-white,
body.night-mode-active .tab-item.tab-manage {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    color: #999 !important;
}

/* 夜间模式 - 聊天详情页 */
body.night-mode-active #chat-room-screen {
    background-color: #0e0e0e !important;
}

body.night-mode-active #chat-room-screen .content {
    background-color: #0e0e0e !important;
}

body.night-mode-active .message-bubble {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.night-mode-active .message-wrapper.sent .message-bubble {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

body.night-mode-active .message-input-area,
body.night-mode-active .bottom-input-area,
body.night-mode-active .chat-input-wrapper {
    background-color: #181818 !important;
    border-top-color: #222 !important;
}

body.night-mode-active .message-input-area textarea,
body.night-mode-active .message-input-area input[type="text"] {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.night-mode-active .message-input-area .icon-btn.circle-bg {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

body.night-mode-active .message-info .sender-name {
    color: #aaa;
}

body.night-mode-active .message-info .message-time {
    color: #666;
}

/* 夜间模式 - 底部导航 */
body.night-mode-active .bottom-nav {
    background-color: #121212 !important;
    border-top-color: #222 !important;
}

/* 夜间模式 - 搜索栏 */
body.night-mode-active .search-bar,
body.night-mode-active .search-input {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

/* 夜间模式 - 表情包面板 */
body.night-mode-active #panel-sticker-area,
body.night-mode-active #panel-sticker-area .header,
body.night-mode-active #sticker-manage-bar {
    background-color: #181818 !important;
}

body.night-mode-active .sticker-category-bar {
    background-color: #181818 !important;
    border-bottom-color: #222 !important;
}

/* 夜间模式 - 设置侧边栏 */
body.night-mode-active .settings-sidebar {
    background-color: #121212 !important;
}

body.night-mode-active .settings-sidebar .header {
    background-color: #181818 !important;
    border-bottom-color: #222 !important;
}

/* 夜间模式 - 通用卡片和面板 */
body.night-mode-active .modal-overlay .modal-window {
    background-color: #181818 !important;
    color: #e0e0e0;
}

body.night-mode-active .collapsible-content {
    background-color: #181818 !important;
}

/* 夜间模式 - 各功能页面 */
body.night-mode-active .wallpaper-preview {
    border-color: #333;
}

body.night-mode-active pre,
body.night-mode-active code {
    background-color: #1a1a1a !important;
    color: #ddd;
}

.home-screen-swiper {
    display: flex;
    width: 200%; /* Two pages */
    flex: 1;
    overflow: hidden;
    transition: transform 0.4s ease-in-out;
}

.home-screen-page {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.page-indicator {
    position: absolute;
    bottom: 160px; /* Adjust based on dock height */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.page-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.25);
    transition: background-color 0.3s;
}

.page-indicator .dot.active {
    background-color: rgba(0, 0, 0, 0.374);
}

/* Home Screen Widgets */
.home-widget-container {
    position: relative;
    width: 230px;
    height: 150px;
    margin: 10px auto 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.central-circle {
    width: 95px;
    height: 95px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
}

.central-circle:hover {
    transform: scale(1.05);
}

.satellite-oval {
    position: absolute;
    width: 120px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0 8px;
    gap: 10px;
    font-size: 11px;
    color: var(--text-color);
    font-weight: 405;
    transition: all 0.3s ease;
    overflow: hidden;
}

.satellite-oval:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.satellite-emoji {
    font-size: 16px;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    cursor: text;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.satellite-text {
    flex-grow: 1;
    text-align: left;
    line-height: 1.4;
    white-space: normal;
    cursor: text;
    transition: background-color 0.2s;
    border-radius: 5px;
    padding: 2px 4px;
    margin: -2px -4px;
}

[contenteditable]:focus {
    outline: 2px solid var(--accent-color);
    background-color: rgba(144, 202, 249, 0.2);
}

.oval-top-left { top: 20px; left: -62px; }
.oval-top-right { top: 20px; right: -62px; }
.oval-bottom-left { bottom: 20px; left: -62px; }
.oval-bottom-right { bottom: 20px; right: -62px; }

.widget-battery {
    color: #666;
    font-family: var(--font-family);
    text-shadow: 0 5px 3px rgba(0,0,0,0.1);
    font-size: 17px;
    position: absolute;
    display: flex;
    align-items: center;
    bottom: -15px;
    right: -45px;
}

.widget-battery svg {
    margin-right: 5px;
}

.widget-time {
    color: var(--text-color);
    font-family: var(--font-family);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -20px;
    font-size: 25px;
    font-weight: 600;
}

.widget-date {
    color: #666;
    font-family: var(--font-family);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: absolute;
    width: 130px;
    text-align: center;
    bottom: -15px;
    left: -45px;
    font-size: 15px;
}

.widget-signature {
    color: var(--text-color);
    font-family: var(--font-family);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -50px;
    font-size: 14px;
    font-weight: 500;
    width: 90%;
    max-width: 300px;
    background-color: transparent;
    border: none;
    outline: none;
    text-align: center;
    padding: 5px;
    border-radius: 8px;
    transition: background-color 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-signature:focus {
    background-color: rgba(0, 0, 0, 0.05);
    white-space: normal;
    overflow: visible;
}

.widget-signature:empty::before {
    content: attr(placeholder);
    color: #999;
    pointer-events: none;
}

#home-screen.day-mode .widget-signature:focus {
     background-color: rgba(255, 255, 255, 0.1);
}

#home-screen.day-mode .widget-signature:empty::before {
    color: rgba(255, 255, 255, 0.7);
}

#home-screen.day-mode .satellite-oval,
#home-screen.day-mode .widget-time,
#home-screen.day-mode .widget-date,
#home-screen.day-mode .widget-battery,
#home-screen.day-mode .widget-signature,
#home-screen.day-mode .app-icon .app-name {
    color: var(--white-color);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* App Grid */
.app-grid {
    width: 100%;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    justify-content: center;
    align-content: flex-start;
    margin-top: 20px;
    height: calc(100% - 280px);
}

.app-grid-widget-container {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.app-grid-widget {
    width: 85%;
    height: 85%;
    background-color: transparent;
    border-radius: 30px;
    padding: 0;
    box-sizing: border-box;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    transition: transform 0.2s ease;
}

.app-grid-widget:hover { transform: none; }

.app-grid-placeholder-widget {
    grid-column: 3 / 5;
    grid-row: 3 / 5;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 18px;
    border: 2px dashed rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(0,0,0,0.4);
}

/* Heart Photo Widget */
.heart-photo-widget {
    grid-column: 3 / 5;
    grid-row: 3 / 5;
    width: 60%;
    height: auto;
    aspect-ratio: 83 / 95;
    justify-self: center;
    align-self: center;
    background-color: #F0F2F0;
    padding: 12px 12px 35px 12px;
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
    border: 1px solid #DCDCDC;
    border-bottom-color: #B0B0B0;
    border-right-color: #B0B0B0;
    border-radius: 4px;
    transform: rotate(4deg);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.heart-photo-widget:hover {
    transform: rotate(2deg) scale(1.05);
}

.heart-photo-widget::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 35px;
    background-image: url('https://i.postimg.cc/XvFDdTKY/Smart-Select-20251013-023208.jpg');
    background-size: cover;
    background-position: center;
    box-shadow: inset 0px 1px 4px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid #C5C2BE;
}

/* Widget General (for paw button etc) */
.widget-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    color: rgba(0, 0, 0, 0.4);
}
.widget-status-text { font-size: 14px; font-weight: 600; }
.widget-icons { display: flex; align-items: center; gap: 8px; }
.widget-icons svg { width: 18px; height: 18px; fill: rgba(0, 0, 0, 0.4); }
.widget-main-image-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.widget-main-image {
    width: 85%;
    padding-bottom: 85%;
    background-size: cover;
    background-position: center;
    border-radius: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.widget-speech-bubble {
    position: absolute;
    top: 10px;
    right: 0px;
    background-color: #fff;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #555;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.widget-paw-button {
    background-color: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.widget-paw-button img { height: 20px; width: auto; }

/* Dock */
.dock {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: transparent;
    backdrop-filter: none;
    border-radius: var(--border-radius);
    margin: 0 20px;
    min-height: 80px;
    gap: 15px;
    flex-shrink: 0;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
}

.icon-img {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    margin-bottom: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    object-fit: cover;
}

.app-icon:hover .icon-img {
    transform: translateY(-5px);
}

.app-icon .app-name {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 500;
}

/* 自由主屏幕仅在选中该布局时生效，经典布局样式保持原样。 */
#home-screen.free-home-active { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.free-home-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 13px; flex-shrink: 0; }
.free-home-toolbar:empty { display: none; }
.free-home-toolbar-btn, .free-home-pages-btn { appearance: none; border: 0; border-radius: 15px; background: rgba(255,255,255,.36); color: var(--text-color); backdrop-filter: blur(12px); font: inherit; font-size: 12px; padding: 6px 11px; cursor: pointer; }
.free-home-toolbar-btn:disabled { opacity: .4; }
.free-home-viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.free-home-track { display: flex; height: 100%; transition: transform .32s cubic-bezier(.22,.8,.25,1); will-change: transform; }
.free-home-page { flex: 0 0 100%; width: 100%; height: 100%; padding: 12px 12px 0; box-sizing: border-box; overflow: hidden; }
.free-home-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-template-rows: repeat(4,minmax(0,1fr)); grid-auto-flow: row dense; gap: clamp(5px,2vw,12px); width: 100%; height: 100%; }
.free-home-tile { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; box-sizing: border-box; user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer; transition: transform .18s ease, opacity .18s ease; }
.free-home-tile .icon-img { width: min(54px,100%); height: auto; aspect-ratio: 1; margin: 0 0 5px; pointer-events: none; }
.free-home-tile .app-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: var(--text-color); font-size: clamp(10px,2.8vw,12px); text-shadow: 0 1px 3px rgba(0,0,0,.25); pointer-events: none; }
.free-home-widget-square { grid-column: span 2; grid-row: span 2; }
.free-home-widget-wide { grid-column: span 4; grid-row: span 2; }
.free-home-widget-content { width: 100%; height: 100%; min-height: 0; border-radius: 19px; overflow: hidden; background: rgba(255,255,255,.48); backdrop-filter: blur(14px); box-shadow: 0 5px 16px rgba(0,0,0,.11); box-sizing: border-box; padding: 13px; display: flex; flex-direction: column; justify-content: center; gap: 5px; color: var(--text-color); }
.free-home-classic-widget { justify-content: center; padding: 0; overflow: visible; }
.free-home-memory-stage { position: absolute; left: 50%; top: 50%; width: 354px; height: 230px; transform: translate(-50%, -50%) scale(var(--free-home-memory-scale, 1)); transform-origin: center; pointer-events: none; }
.free-home-memory-stage .home-widget-container { position: absolute; left: 62px; top: 16px; width: 230px; height: 150px; margin: 0; }
.free-home-memory-stage .central-circle:hover, .free-home-memory-stage .satellite-oval:hover { transform: none; }
.free-home-kind-ins .app-grid-widget { width: 85%; height: 85%; }
.free-home-kind-photo .heart-photo-widget { grid-column: auto; grid-row: auto; width: 60%; height: auto; margin: 0; align-self: center; justify-self: center; }
.free-home-kind-photo .heart-photo-widget::after { background-image: var(--free-home-photo-image); }
.free-home-clock { font-size: clamp(31px,9vw,48px); line-height: 1.1; }
.free-home-date { font-size: 12px; }
.free-home-photo, .free-home-memory-image { flex: 1; min-height: 0; background-size: cover; background-position: center; border-radius: 12px; }
.free-home-memory-image { border-radius: 50%; width: 60px; max-height: 60px; aspect-ratio: 1; flex: none; }
.free-home-note { font-size: 14px; line-height: 1.4; overflow: hidden; overflow-wrap: anywhere; }
.free-home-folder-preview { display: grid; grid-template-columns: repeat(2,1fr); grid-template-rows: repeat(2,1fr); gap: 3px; width: min(54px,100%); aspect-ratio: 1; padding: 5px; box-sizing: border-box; border-radius: 15px; background: rgba(255,255,255,.45); backdrop-filter: blur(10px); margin-bottom: 5px; pointer-events: none; }
.free-home-folder-preview img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; border-radius: 5px; }
.free-home-tile-manage { display: none; position: absolute; top: 4px; right: 4px; border: 0; border-radius: 50%; width: 26px; height: 26px; background: rgba(255,255,255,.9); color: #333; font-size: 16px; z-index: 2; }
.free-home-editing .free-home-tile-manage { display: block; }
.free-home-editing .free-home-tile:not(.free-home-origin) { animation: free-home-wiggle 180ms ease-in-out infinite alternate; }
.free-home-placing .free-home-tile { animation: none !important; }
@keyframes free-home-wiggle { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
.free-home-origin { opacity: .35; }
.free-home-swap-target, .free-home-folder-pending { outline: 2px solid rgba(255,255,255,.9); outline-offset: 2px; border-radius: 16px; }
.free-home-folder-pending::after, .free-home-folder-ready::after { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); padding: 2px 5px; border-radius: 7px; background: rgba(35,35,35,.82); color: #fff; font-size: 9px; white-space: nowrap; pointer-events: none; }
.free-home-folder-pending::after { content: '换位 · 停留建夹'; }
.free-home-folder-ready { outline: 3px solid #fff; outline-offset: 2px; border-radius: 16px; transform: scale(1.07); }
.free-home-editing .free-home-folder-ready { animation: none; }
.free-home-folder-ready::after { content: '松手建夹'; }
.free-home-insert-before { border-left: 3px solid #fff; }
.free-home-insert-after { border-right: 3px solid #fff; }
.free-home-drag-ghost { position: fixed; top: 0; left: 0; z-index: 20000; pointer-events: none; opacity: .92; filter: drop-shadow(0 13px 14px rgba(0,0,0,.28)); transition: none; }
.free-home-placement-preview { z-index: 3; pointer-events: none; opacity: 1; transition: grid-row .15s ease, grid-column .15s ease, opacity .15s ease; }
.free-home-placement-preview::before { content: '✓'; position: absolute; top: 2px; left: 2px; z-index: 5; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.9); color: #333; font-size: 11px; box-shadow: 0 1px 5px rgba(0,0,0,.15); }
.free-home-placement-preview .free-home-tile-manage { display: none; }
.free-home-placement-invalid { opacity: .55; }
.free-home-placement-invalid::before { content: '×'; background: #f16475; color: #fff; }
.free-home-drop-cell { pointer-events: none; z-index: 2; border: 2px dashed rgba(255,255,255,.94); border-radius: 15px; background: rgba(255,255,255,.13); box-sizing: border-box; }
.free-home-drop-cell-invalid { border-color: #f16475; background: rgba(241,100,117,.13); }
.free-home-page-controls { display: flex; flex-direction: column; align-items: center; gap: 7px; min-height: 26px; flex-shrink: 0; }
.free-home-edit-actions { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; }
.free-home-dots { display: flex; align-items: center; gap: 7px; min-height: 15px; }
.free-home-placement-bar { width: min(100%, 390px); display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 1px 9px; box-sizing: border-box; }
.free-home-placement-hint { min-width: 0; flex: 1; text-align: center; font-size: 11px; color: var(--text-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-home-placement-bar .free-home-pages-btn { flex: none; }
.free-home-placement-bar .free-home-pages-btn:disabled { opacity: .45; }
.free-home-dot { appearance: none; border: 0; border-radius: 50%; width: 7px; height: 7px; padding: 0; background: rgba(255,255,255,.48); }
.free-home-dot.active { width: 9px; height: 9px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
#home-screen .free-home-dock { min-height: 68px; margin: 0 12px; gap: clamp(8px,4vw,20px); justify-content: space-around; }
#home-screen .free-home-dock .icon-img { width: min(54px,13vw); height: auto; aspect-ratio: 1; }
#home-screen.free-home-active.day-mode .free-home-tile .app-name { color: #fff; }
.free-home-sheet-overlay { position: fixed; inset: 0; z-index: 18000; background: rgba(0,0,0,.38); display: flex; align-items: flex-end; justify-content: center; }
.free-home-sheet-overlay.free-home-sheet-centered { align-items: center; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); box-sizing: border-box; }
.free-home-sheet { width: min(100%,480px); max-height: min(78vh,650px); overflow-y: auto; box-sizing: border-box; border-radius: 22px 22px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); background: #fff; color: #222; box-shadow: 0 -8px 30px rgba(0,0,0,.14); }
.free-home-sheet-centered .free-home-sheet { width: min(100%, 360px); max-height: min(76dvh, 590px); border-radius: 20px; padding: 15px 16px; box-shadow: 0 12px 34px rgba(0,0,0,.19); }
.free-home-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 11px; font-size: 16px; }
.free-home-sheet-close { appearance: none; border: 0; background: #f2f2f2; border-radius: 12px; padding: 6px 11px; font: inherit; font-size: 12px; }
.free-home-sheet-row { appearance: none; border: 0; border-top: 1px solid #eee; width: 100%; background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 44px; padding: 9px 2px; color: #222; font: inherit; font-size: 14px; text-align: left; }
.free-home-sheet-row > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-home-sheet-row small { flex: none; max-width: 45%; font-size: 11px; color: #777; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-home-sheet-row.selected { color: #9b5367; background: #fff4f7; }
.free-home-sheet-row:disabled { opacity: .4; }
.free-home-sheet-subtitle { display: block; margin: 13px 0 5px; font-size: 13px; }
.free-home-widget-choice { appearance: none; border: 0; border-top: 1px solid #eee; background: transparent; color: #222; width: 100%; min-width: 0; display: grid; grid-template-columns: 114px minmax(0,1fr); grid-template-rows: auto auto; align-items: center; gap: 2px 11px; padding: 8px 2px; font: inherit; font-size: 14px; text-align: left; }
.free-home-widget-choice > .free-home-tile { grid-row: 1 / 3; grid-column: 1; width: 110px; height: 82px; padding: 0; pointer-events: none; animation: none; }
.free-home-widget-choice .free-home-widget-content { border-radius: 12px; padding: 6px; }
.free-home-widget-choice .free-home-clock { font-size: 18px; }
.free-home-widget-choice .free-home-date { font-size: 8px; }
.free-home-widget-choice .free-home-tile-manage { display: none; }
.free-home-widget-choice > .free-home-tile { overflow: hidden; isolation: isolate; }
.free-home-widget-choice > .free-home-kind-ins .app-grid-widget { position: absolute; left: 50%; top: 50%; width: 220px; height: 164px; margin: 0; transform: translate(-50%, -50%) scale(.48); transform-origin: center; }
.free-home-widget-choice .ins-widget-bubble { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.free-home-widget-choice > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-home-widget-choice > small { grid-column: 2; color: #777; font-size: 11px; }
.free-home-preset-row { display: flex; align-items: center; min-width: 0; border-top: 1px solid #eee; }
.free-home-preset-row .free-home-widget-choice { min-width: 0; flex: 1; border-top: 0; }
.free-home-legacy-preset-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.free-home-folder-app-icon { width: 27px; height: 27px; object-fit: cover; flex: none; border-radius: 7px; }
.free-home-sheet-help { font-size: 12px; line-height: 1.5; color: #666; }
.free-home-field-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; margin: 8px 0; }
.free-home-field { appearance: none; border: 1px solid #ddd; border-radius: 12px; background: #f8f8f8; color: #222; font: inherit; font-size: 14px; padding: 10px; min-height: 42px; box-sizing: border-box; width: 100%; }
.free-home-upload-btn { display: block; border-radius: 12px; background: #f4f4f4; padding: 10px; text-align: center; font-size: 12px; margin: 8px 0; cursor: pointer; }
.free-home-hidden-file { display: none; }
textarea.free-home-field { min-height: 84px; resize: vertical; }
.free-home-page-row { display: flex; align-items: center; gap: 7px; padding: 8px 0; border-top: 1px solid #eee; font-size: 13px; }
.free-home-page-preview { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 2px; flex: 0 0 35px; height: 35px; padding: 3px; border-radius: 7px; background: #eee; box-sizing: border-box; }
.free-home-page-preview span { border-radius: 2px; background: #aaa; }
.free-home-page-preview .is-widget { background: #d28d9e; }
.free-home-page-row span { flex: 1; min-width: 0; }
.free-home-mini-btn { appearance: none; border: 0; border-radius: 9px; background: #f1f1f1; color: #333; padding: 6px 9px; font: inherit; font-size: 12px; }
.free-home-mini-btn:disabled { opacity: .35; }
@media (max-width: 350px) { .free-home-page { padding-inline: 7px; } .free-home-grid { gap: 5px; } .free-home-widget-content { padding: 9px; border-radius: 15px; } }
@media (prefers-reduced-motion: reduce) { .free-home-track, .free-home-tile { transition: none; } .free-home-editing .free-home-tile { animation: none !important; } }

.free-home-custom-frame { display:block; width:100%; height:100%; min-width:0; min-height:0; border:0; border-radius:12px; background:#fff; }
.free-home-kind-custom { padding:4px; box-sizing:border-box; }
.free-home-editing .free-home-custom-frame, .free-home-placing .free-home-custom-frame { pointer-events:none; }
.free-home-code-examples { display:flex; flex-wrap:wrap; gap:6px; }
.free-home-code-examples .free-home-mini-btn { max-width:100%; }
textarea.free-home-code-field { min-height:105px; font:12px/1.5 monospace; tab-size:2; }
.free-home-code-preview { width:100%; height:170px; min-width:0; border-radius:12px; overflow:hidden; }
.free-home-code-preview:empty { display:none; }
.free-home-code-cover { display:grid; place-items:center; background:#f4f4f4; border-radius:12px; font-size:11px; color:#777; }
.free-home-sheet-head > strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.free-home-sheet-close { flex-shrink:0; }

/* 底部导航栏 */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #fcfcfc;
    border-top: 1px solid #f0f0f0;
    padding: 5px 0;
    flex-shrink: 0;
    height: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
}

.nav-item {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    position: relative;
    color: var(--nav-icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.nav-item svg {
    stroke-width: 2px;
    width: 26px;
    height: 26px;
    fill: currentColor;
    stroke: none;
}

.nav-item.active {
    color: var(--nav-active-icon-color);
}

.nav-item:nth-child(1) svg { transform: scale(1.1); }
.nav-item:nth-child(2) svg { transform: scale(0.9); }
.nav-item:nth-child(3) svg { transform: scale(0.85); }
.nav-item:nth-child(4) svg { transform: scale(1.2); }
.nav-item:nth-child(4) svg circle { fill: currentColor; }

.nav-icon-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: none;
}

.nav-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
