/* --- 偷看手机：可编辑主屏幕 (css/modules/peek_home.css) --- */

#peek-screen.peek-home-mode > main.content {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
}

.peek-home-swiper,
.peek-home-swiper * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.peek-home-swiper img {
    -webkit-user-drag: none;
    pointer-events: none;
}
.peek-home-swiper {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.peek-home-swiper::-webkit-scrollbar { display: none; }

.peek-home-page {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    box-sizing: border-box;
    padding: 14px 14px 6px;
}

.peek-home-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, 1fr);
    grid-auto-flow: row dense;
    gap: 6px 8px;
}

.peek-home-indicator {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 7px;
    padding: 8px 0 14px;
}
.peek-home-indicator .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transition: all 0.2s;
}
.peek-home-indicator .dot.active {
    background: #fff;
    transform: scale(1.25);
}

#peek-screen .peek-home-grid .app-icon {
    align-self: center;
    justify-self: center;
    min-width: 0;
    width: 100%;
}
#peek-screen .peek-home-grid .app-icon .app-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

/* ---- 编辑模式 ---- */
@keyframes peekWiggle {
    0%, 100% { transform: rotate(-1.6deg); }
    50% { transform: rotate(1.6deg); }
}
#peek-screen.peek-editing .peek-home-grid .app-icon,
#peek-screen.peek-editing .peek-widget {
    animation: peekWiggle 0.28s ease-in-out infinite;
}
#peek-screen.peek-editing .peek-widget:nth-child(2n),
#peek-screen.peek-editing .peek-home-grid .app-icon:nth-child(2n) {
    animation-delay: -0.14s;
}
#peek-screen.peek-editing .peek-home-grid.edit-mode {
    outline: 1px dashed rgba(255, 255, 255, 0.35);
    outline-offset: -4px;
    border-radius: 18px;
}
#peek-screen.peek-editing .peek-home-grid .sortable-ghost { opacity: 0.35; animation: none; }
#peek-screen.peek-editing .peek-home-grid .sortable-drag { animation: none; }

#peek-edit-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: none;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}
#peek-edit-bar button {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: #333;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
}
#peek-edit-bar button.primary {
    background: var(--primary-color, #cee4f1);
    font-weight: 600;
}

/* ---- 小组件 ---- */
.peek-widget {
    position: relative;
    border-radius: 20px;
    overflow: visible;
    min-width: 0;
    min-height: 0;
    color: #fff;
}
.peek-widget .pw-body {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-sizing: border-box;
}
.peek-widget .pw-del {
    display: none;
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #ff5b5b;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    z-index: 5;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
#peek-screen.peek-editing .peek-widget .pw-del { display: flex; }

.pw-placeholder { opacity: 0.6; font-size: 12px; }

/* 时钟 */
.pw-clock {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.pw-clock-time { font-size: 64px; font-weight: 200; letter-spacing: 2px; line-height: 1; }
.pw-clock-date { font-size: 16px; opacity: 0.85; margin-top: 8px; }
.pw-s-2x2.pw-clock .pw-clock-time { font-size: 34px; letter-spacing: 1px; }
.pw-s-2x2.pw-clock .pw-clock-date { font-size: 12px; margin-top: 4px; }

/* 日历 */
.pw-calendar {
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pw-cal-top { font-size: 13px; color: #e5544b; font-weight: 600; }
.pw-cal-day { font-size: 54px; font-weight: 300; line-height: 1.05; }
.pw-s-4x2.pw-calendar .pw-cal-day { font-size: 64px; }

/* 便签 */
.pw-note {
    height: 100%;
    padding: 12px 12px;
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-all;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* 照片 */
.pw-photo {
    height: 100%;
    background-size: cover;
    background-position: center;
}
.pw-photo-empty {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.pw-photo-empty span { font-size: 30px; line-height: 1; }
.pw-photo-empty small { font-size: 11px; opacity: 0.85; }

/* 备忘录 */
.pw-memo {
    height: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pw-memo-head { font-size: 12px; color: #e5a21b; font-weight: 600; display: flex; justify-content: space-between; }
.pw-memo-lock { color: #999; font-weight: 400; }
.pw-memo-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-memo-text { font-size: 12px; color: #666; line-height: 1.5; overflow: hidden; }

/* 步数 */
.pw-steps {
    height: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}
.pw-steps-head { font-size: 12px; color: #2fb86b; font-weight: 600; }
.pw-steps-num { font-size: 28px; font-weight: 600; line-height: 1.1; }
.pw-steps-bar { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.pw-steps-bar i { display: block; height: 100%; background: #2fb86b; border-radius: 3px; }
.pw-steps-goal { font-size: 11px; color: #999; }

/* ---- 弹窗 ---- */
.peek-home-overlay { z-index: 200; }
.peek-home-sheet {
    max-height: 82%;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.peek-home-sheet-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 4px 2px;
}
.peek-home-sheet-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 12px;
}
.peek-home-sheet-footer .btn { margin: 0; }
.peek-home-sheet .pw-danger { background: #ffe8e8; color: #d9534f; margin-right: auto; }

.pw-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fafafa;
    margin-top: 8px;
}
.pw-textarea { min-height: 90px; resize: none; margin-top: 0; }
.pw-row { display: flex; gap: 8px; margin-top: 10px; }
.pw-row .btn { margin: 0; flex: 1; text-align: center; }
.pw-tip { font-size: 12px; color: #999; margin: 10px 0 0; }
.pw-label { font-size: 13px; color: #888; margin: 14px 0 6px; }

.pw-wall-preview {
    width: 100%;
    height: 200px;
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
}
.pw-photo-preview { height: 140px; }

.pw-sizes { display: flex; gap: 8px; flex-wrap: wrap; }
.pw-size {
    border: 1px solid #e3e3e3;
    background: #fafafa;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.pw-size.on { background: var(--primary-color, #cee4f1); border-color: transparent; font-weight: 600; }

.pw-swatches { display: flex; gap: 10px; margin-top: 12px; }
.pw-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    padding: 0;
}
.pw-swatch.on { border-color: #555; }

.pw-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pw-pick {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    border: 1px solid #ececec;
    background: #fafafa;
    border-radius: 14px;
    padding: 14px 12px;
    cursor: pointer;
}
.pw-pick b { font-size: 15px; color: #333; }
.pw-pick small { font-size: 12px; color: #999; }
.pw-pick:active { transform: scale(0.97); }

.pw-icon-list { display: flex; flex-direction: column; gap: 10px; }
.pw-icon-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid transparent;
}
.pw-icon-row.focus { border-color: var(--primary-color, #cee4f1); background: rgba(206, 228, 241, 0.25); }
.pw-icon-preview { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; }
.pw-icon-fields { flex: 1; min-width: 0; }
.pw-icon-fields .pw-input { margin-top: 4px; padding: 5px 8px; font-size: 12px; }
.pw-icon-fields .pw-input:first-child { margin-top: 0; }
.pw-icon-actions { display: flex; flex-direction: column; gap: 4px; }
.pw-mini-btn {
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    color: #555;
    text-align: center;
    cursor: pointer;
}

/* 批量模式条在编辑栏之上不冲突 */
#peek-screen.peek-editing #peek-batch-bar { display: none !important; }

/* ================= 加密备忘录 ================= */
.memo-section-title {
    padding: 14px 20px 6px;
    font-size: 13px;
    color: #999;
    background: #f9f9f9;
}
.memo-item.locked .memo-item-title::before { content: '🔒 '; }
.memo-item.locked.opened .memo-item-title::before { content: '🔓 '; }
.memo-item.locked .memo-item-preview { color: #aaa; font-style: italic; }

.peek-memo-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.peek-memo-lock-card {
    width: 82%;
    max-width: 320px;
    background: #fff;
    border-radius: 18px;
    padding: 22px 18px 16px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.peek-memo-lock-card .lock-ico { font-size: 34px; }
.peek-memo-lock-card h4 { margin: 6px 0 4px; font-size: 16px; color: #333; }
.peek-memo-lock-card .lock-hint {
    font-size: 13px;
    color: #888;
    margin: 6px 0 12px;
    line-height: 1.5;
}
.peek-memo-lock-card input {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    letter-spacing: 3px;
    font-size: 18px;
    padding: 10px;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #fafafa;
    outline: none;
}
.peek-memo-lock-card input.shake { animation: peekShake 0.35s; border-color: #ff6b6b; }
@keyframes peekShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.peek-memo-lock-card .lock-error { color: #e5544b; font-size: 12px; min-height: 16px; margin-top: 6px; }
.peek-memo-lock-card .lock-actions { display: flex; gap: 8px; margin-top: 10px; }
.peek-memo-lock-card .lock-actions button {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 0;
    font-size: 14px;
    background: #f0f0f0;
    color: #555;
    cursor: pointer;
}
.peek-memo-lock-card .lock-actions button.primary { background: var(--primary-color, #cee4f1); color: #333; font-weight: 600; }
.peek-memo-lock-card .lock-force {
    display: none;
    width: 100%;
    margin-top: 8px;
    border: none;
    background: none;
    color: #aaa;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- 来自主屏幕「小组件市场」的自定义小组件 ---- */
.peek-widget.pw-market { color: initial; }
.peek-widget.pw-market .pw-body {
    overflow: visible;
    position: relative;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.peek-widget.pw-market [data-widget-var] { cursor: pointer; }
