:root { 
    --ios-yellow: #e5a90f; 
    --bg: #f4f4f6; 
    --text: #000; 
    --delete-red: #ff3b30;
    --pin-yellow: #ff9500;
    --lock-purple: #5856d6;
    --card-bg: #ffffff;

    --pinned-bg: #fef8cc;
    --pinned-border: #f8ec9a;
    --locked-bg: #e6f7f2;
    --locked-border: #c8ece2;
}

* { box-sizing: border-box; }

body { 
    margin: 0 auto; 
    max-width: 600px; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    -webkit-tap-highlight-color: transparent; 
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 70px;
    user-select: none;
    -webkit-user-select: none;
}

header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; font-size: 24px; font-weight: bold; background: var(--bg); }
.header-left { display: flex; align-items: center; gap: 12px; }
.menu-btn { font-size: 24px; cursor: pointer; color: var(--ios-yellow); background: none; border: none; padding: 0; }
.btn { color: var(--ios-yellow); background: none; border: none; font-size: 17px; cursor: pointer; padding: 0; display: flex; align-items: center; gap: 4px; }

.tab-view { display: none; }
.tab-view.active { display: block; }

.section-title { padding: 12px 20px 6px; font-size: 13px; color: #8e8e93; font-weight: 600; text-transform: uppercase; }
#notes-list { padding: 0 20px 20px; }

#sidebar-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
#sidebar-overlay.active { opacity: 1; pointer-events: auto; }

.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 280px;
    background: rgba(248, 248, 248, 0.92);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    z-index: 310; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 20px; display: flex; flex-direction: column; box-shadow: 5px 0 25px rgba(0,0,0,0.1);
}
.sidebar.active { transform: translateX(0); }
.sidebar-title { font-size: 22px; font-weight: bold; margin-bottom: 20px; }
.sidebar-menu { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.sidebar-item { padding: 12px 14px; border-radius: 10px; margin-bottom: 6px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.sidebar-item.active { background: rgba(229, 169, 15, 0.15); color: var(--ios-yellow); font-weight: 600; }
.add-folder-btn { margin-top: 10px; padding: 12px; border: 1px dashed var(--ios-yellow); color: var(--ios-yellow); border-radius: 10px; text-align: center; font-weight: 500; cursor: pointer; }

.note-container { position: relative; margin-bottom: 12px; border-radius: 16px; overflow: hidden; background: #c7c7cc; }
.swipe-actions { position: absolute; right: 0; top: 0; bottom: 0; display: flex; width: 210px; z-index: 1; }
.action-btn { flex: 1; border: none; color: white; font-size: 15px; font-weight: 500; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.action-btn.pin { background: var(--pin-yellow); }
.action-btn.lock { background: var(--lock-purple); }
.action-btn.delete { background: var(--delete-red); }

.note-item { 
    background: white; padding: 16px 18px; position: relative; z-index: 2; 
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1); touch-action: pan-y; cursor: pointer; border-radius: 16px;
    border: 1px solid transparent;
}
.note-item.pinned { background-color: var(--pinned-bg); border-color: var(--pinned-border); }
.note-item.locked { background-color: var(--locked-bg); border-color: var(--locked-border); }

.note-title { font-weight: 700; font-size: 18px; color: #1c1c1e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-meta-line { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: #8a8a8e; }
.note-date-tag { background: rgba(0,0,0,0.04); padding: 2px 6px; border-radius: 6px; }
.mini-icon-box { 
    background: rgba(0,0,0,0.05); border-radius: 5px; width: 20px; height: 20px; 
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #666;
}
.locked-dots { color: #ff8599; font-size: 14px; letter-spacing: 2px; font-weight: bold; margin-left: 2px; }

.profile-header { padding: 20px 24px; display: flex; align-items: center; gap: 16px; }
.avatar-wrapper { position: relative; width: 68px; height: 68px; cursor: pointer; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #e5e5ea; }
.avatar-edit-icon { position: absolute; bottom: 0; right: 0; background: rgba(0,0,0,0.5); color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.user-info { flex: 1; }
.user-nickname { font-size: 22px; font-weight: 800; color: #000; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.user-account { font-size: 14px; color: #8e8e93; margin-top: 4px; }

.mine-card { background: var(--card-bg); border-radius: 20px; padding: 20px; margin: 0 20px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.card-header-title { font-size: 18px; font-weight: bold; margin-bottom: 16px; color: #1c1c1e; }

.creation-stats { display: flex; justify-content: space-around; align-items: flex-end; text-align: left; padding: 10px 0; }
.stat-item { flex: 1; text-align: center; }
.stat-label { font-size: 14px; color: #8e8e93; margin-bottom: 8px; }
.stat-num { font-size: 28px; font-weight: 800; color: #000; line-height: 1; }
.stat-unit { font-size: 13px; color: #8e8e93; font-weight: normal; margin-left: 2px; }

.list-card { background: var(--card-bg); border-radius: 20px; margin: 0 20px 16px; overflow: hidden; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; font-size: 16px; color: #1c1c1e; cursor: pointer; border-bottom: 0.5px solid #f2f2f7; }
.list-row:last-child { border-bottom: none; }
.list-row-right { display: flex; align-items: center; gap: 8px; color: #8e8e93; font-size: 15px; }
.chevron { color: #c7c7cc; font-size: 18px; font-family: monospace; }

.ios-switch { position: relative; width: 51px; height: 31px; appearance: none; background: #e9e9ea; border-radius: 31px; outline: none; transition: 0.25s; cursor: pointer; }
.ios-switch:checked { background: var(--ios-yellow); }
.ios-switch::after { content: ''; position: absolute; width: 27px; height: 27px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: 0.25s; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.ios-switch:checked::after { transform: translateX(20px); }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto; height: 60px;
    background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(0,0,0,0.1); display: flex; justify-content: space-around; align-items: center; z-index: 150;
}
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #8e8e93; font-size: 11px; cursor: pointer; flex: 1; height: 100%; }
.nav-item.active { color: var(--ios-yellow); font-weight: 600; }
.nav-icon { font-size: 20px; }

.sub-view { 
    position: fixed; inset: 0; margin: 0 auto; max-width: 600px; background: var(--bg); z-index: 250; display: flex; flex-direction: column; 
    opacity: 0; pointer-events: none; transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.sub-view.active { opacity: 1; pointer-events: auto; transform: translateX(0); }
.sub-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--bg); font-size: 18px; font-weight: bold; }
.editor-header-icon { font-size: 20px; color: #8e8e93; cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(5px); z-index: 400; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.lock-modal-card {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.9);
    width: 320px; background: #f9f9f9; border-radius: 18px; padding: 22px 0 0;
    z-index: 410; opacity: 0; pointer-events: none; transition: all 0.25s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); overflow: hidden;
}
.lock-modal-card.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.lock-modal-title { font-size: 18px; font-weight: bold; text-align: center; margin-bottom: 20px; padding: 0 20px; color: #000; }
.lock-option-row { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 16px 20px; font-size: 15px; color: #1c1c1e; 
    border-top: 0.5px solid #e5e5ea; cursor: pointer; text-align: left; 
}

.lock-radio-dot { 
    width: 22px; height: 22px; border-radius: 50%; 
    border: 2.5px solid #e5e5ea; 
    background: transparent; 
    cursor: pointer; 
    flex-shrink: 0; 
    transition: all 0.2s ease;
}

.lock-cancel-btn { 
    text-align: center; padding: 14px; font-size: 17px; font-weight: bold; 
    color: var(--ios-yellow); border-top: 0.5px solid #e5e5ea; 
    cursor: pointer; background: #f9f9f9; margin-top: 8px; 
}

#context-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(10px); z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
#context-overlay.active { opacity: 1; pointer-events: auto; }
.context-menu { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.8); width: 250px; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(20px); border-radius: 14px; z-index: 310; opacity: 0; pointer-events: none; box-shadow: 0 20px 40px rgba(0,0,0,0.2); transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); overflow: hidden; }
.context-menu.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.menu-item { padding: 14px 18px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 0.5px solid rgba(0,0,0,0.1); cursor: pointer; }
.menu-item.danger { color: var(--delete-red); }

.auth-card { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.9); width: 300px; background: white; border-radius: 16px; padding: 24px; z-index: 410; opacity: 0; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,0.2); transition: all 0.25s ease; }
.auth-card.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.auth-title { font-size: 20px; font-weight: bold; text-align: center; margin-bottom: 20px; }
.auth-input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #e5e5ea; border-radius: 10px; font-size: 15px; outline: none; background: #f9f9f9; }
.auth-btn { width: 100%; padding: 12px; background: var(--ios-yellow); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 6px; }
.auth-switch { text-align: center; font-size: 13px; color: #8e8e93; margin-top: 14px; cursor: pointer; }

/* 编辑器与图3样式还原 */
#editor-view { background: white; display: flex; flex-direction: column; height: 100vh; }
.title-input { border: none; outline: none; font-size: 24px; font-weight: bold; padding: 16px 20px 4px; width: calc(100% - 40px); font-family: inherit; }
.editor-meta-info { padding: 0 20px 8px; font-size: 13px; color: #8a8a8e; }
.editor-content { flex: 1; padding: 12px 20px 180px; font-size: 16px; line-height: 1.6; outline: none; overflow-y: auto; word-break: break-word; user-select: text; -webkit-user-select: text; }
.editor-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; display: block; }

/* 展开排版面板（修复被遮挡问题：调高 padding-bottom 保证所有色彩和字号不被底部工具栏截断） */
.format-panel { 
    background: #fbfbfd; border-top: 0.5px solid #e5e5ea; padding: 12px 16px 65px; 
    display: none; flex-direction: column; gap: 12px; max-height: 35vh; overflow-y: auto;
}
.format-panel.active { display: flex; }

.format-row { display: flex; align-items: center; justify-content: space-around; }
.style-btns-row { background: #eeeeef; border-radius: 10px; padding: 4px; }
.fmt-btn { border: none; background: transparent; font-size: 16px; padding: 6px 16px; border-radius: 6px; cursor: pointer; }

.format-section { display: flex; flex-direction: column; gap: 6px; }
.format-label { font-size: 12px; color: #8e8e93; }

.size-selector-row { display: flex; justify-content: space-between; align-items: center; background: #f2f2f7; border-radius: 10px; padding: 8px 12px; }
.size-opt { font-size: 14px; color: #3a3a3c; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.size-opt.active { color: var(--ios-yellow); font-weight: bold; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.08); }

.color-palette-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; overflow-x: auto; gap: 6px; }
.color-block { width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; flex-shrink: 0; }

/* 精简后的底部工具栏 */
.editor-bottom-bar { 
    position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto; height: 50px; 
    background: rgba(255,255,255,0.95); backdrop-filter: blur(15px); border-top: 0.5px solid #e5e5ea; 
    display: flex; justify-content: space-between; align-items: center; padding: 0 12px; z-index: 260;
}
.bottom-tool-btn { background: none; border: none; font-size: 18px; color: #333; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 8px; }
.bottom-tool-btn.active { color: var(--ios-yellow); font-weight: bold; }
.ai-badge { font-size: 11px; font-weight: 800; border: 1.5px solid #333; border-radius: 5px; padding: 0 3px; }
.word-count-badge { 
    font-size: 12px; color: #8e8e93; position: absolute; right: 12px; bottom: 16px; 
    pointer-events: none; /* 可选，如果不想挡住其他按钮 */
}

/* 优雅的 Toast 成功提示动画 */
.app-toast {
    position: fixed; top: 15%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px; border-radius: 20px;
    font-size: 14px; font-weight: 500; z-index: 9999; opacity: 0; pointer-events: none;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}
.app-toast.active { opacity: 1; transform: translate(-50%, -50%) scale(1); }