/* ==========================================
   James 小窝样式 — 页面对齐 Claude 风(暖白/深色双主题 + 橙强调)
   便签卡片保留撕纸胶带质感
   ========================================== */

/* Claude 风设计变量(与 /chat 一致) */
:root {
    --cl-bg:        #F8F8F6;   /* 暖白底 */
    --cl-surface:   #F6F6F4;
    --cl-sunken:    #E6E6E4;
    --cl-text:      #1F1E1D;
    --cl-text-sec:  #6E6D66;
    --cl-text-faint:#A6A39A;
    --cl-accent:    #DA7756;   /* Claude 品牌橙 */
    --cl-accent-hover:#C96846;
    --cl-border:    rgba(31,30,29,.10);
    --cl-border-strong: rgba(31,30,29,.18);
    --cl-serif: 'Georgia', 'Times New Roman', 'Songti SC', serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --cl-bg:        #20201F;
        --cl-surface:   #181818;
        --cl-sunken:    #1A1A19;
        --cl-text:      #ECEAE4;
        --cl-text-sec:  #A6A39A;
        --cl-text-faint:#6E6D66;
        --cl-border:    rgba(236,234,228,.10);
        --cl-border-strong: rgba(236,234,228,.22);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

@font-face {
    font-family: 'iOS Bold';
    src: url('font/仿ios粗体.ttf') format('truetype');
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'iOS Bold', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background-color: var(--cl-bg);
    color: var(--cl-text);
    overflow: hidden;
}

body.custom-font-applied {
    font-family: 'CustomFont', 'iOS Bold', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

/* ==========================================
   主容器
   ========================================== */
.james-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--cl-bg);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================
   左上角返回按钮
   ========================================== */
.back-button {
    position: fixed;
    top: calc(env(safe-area-inset-top, 44px) + 8px);
    left: 16px;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cl-surface);
    border: 1px solid var(--cl-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    cursor: pointer;
    transition: transform 0.15s ease;
}

.back-button:active {
    transform: scale(0.92);
}

.back-icon {
    width: 20px;
    height: 20px;
    display: block;
    filter: brightness(0);
    opacity: 0.82;
}

.add-button {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 20px;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;

    background: var(--cl-accent);
    border-radius: 22px;

    box-shadow: 0 2px 8px rgba(218, 119, 86, 0.3);

    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;

    font-size: 24px;
    font-weight: 300;
    color: #fff;
    line-height: 1;
}

.add-button:active {
    transform: scale(0.95);
    background: var(--cl-accent-hover);
}

/* ==========================================
   内容区域
   ========================================== */
.content-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-top: 80px; /* 为返回按钮留出空间 */
}

/* ==========================================
   底部悬浮导航栏
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 56px);
    max-width: 360px;
    height: 85px;
    
    display: flex;
    justify-content: space-around;
    align-items: center;
    
    /* 毛玻璃效果 */
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0.52) 0%,
        rgba(0, 0, 0, 0.38) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 42px;
    
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    
    padding: 0 15px;
}

/* ==========================================
   导航项
   ========================================== */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex: 1;
}

.nav-item:active {
    transform: scale(0.9);
}

/* 导航图标占位 */
.nav-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.nav-icon:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.92);
}

.nav-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    /* 将 SVG 图标颜色改为灰白色 */
    filter: brightness(0) invert(1) opacity(0.55);
}

/* 当前所在 tab:图标用 Claude 橙高亮 */
.nav-item.active .nav-icon {
    background: rgba(218, 119, 86, 0.22);
}
.nav-item.active .nav-icon img {
    /* 橙色着色 #DA7756 */
    filter: brightness(0) saturate(100%) invert(58%) sepia(38%) saturate(900%) hue-rotate(330deg) brightness(92%) contrast(88%);
    opacity: 1;
}

/* 导航文字 */
.nav-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ==========================================
   便签网格
   ========================================== */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 110px;
}

.notes-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 13px;
    padding-top: 2rem;
}

/* ==========================================
   便签卡片结构
   ========================================== */
.note-wrap {
    position: relative;
    padding-top: 12px;
    margin: 4px 2px;
}

.tape {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 17px;
    z-index: 2;
    border-radius: 1px;
}

.t-gold {
    background: rgba(208, 162, 52, 0.87);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.t-clear {
    background: rgba(218, 232, 255, 0.18);
    border: 0.5px solid rgba(200, 218, 255, 0.3);
    height: 15px;
}

.t-duct {
    background: repeating-linear-gradient(
        90deg,
        #7a7a7a 0, #868686 4px,
        #8c8c8c 4px, #7e7e7e 8px
    );
    height: 20px;
}

.note {
    padding: 0.7rem 0.6rem 0.55rem;
    height: 150px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

/* ==========================================
   纸张样式
   ========================================== */
.p-lined {
    background: #f8f6ef;
    background-image: repeating-linear-gradient(
        transparent 0px, transparent 20px,
        rgba(115, 145, 185, 0.3) 20px, rgba(115, 145, 185, 0.3) 21px
    );
    background-position: 0 28px;
}

.p-lined::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: rgba(220, 90, 80, 0.22);
    z-index: 0;
}

.p-kraft {
    background: #c09060;
    background-image:
        repeating-linear-gradient(25deg, rgba(80, 45, 10, 0.09) 0, rgba(80, 45, 10, 0.09) 1px, transparent 1px, transparent 9px),
        repeating-linear-gradient(-25deg, rgba(80, 45, 10, 0.09) 0, rgba(80, 45, 10, 0.09) 1px, transparent 1px, transparent 9px);
}

.p-cream {
    background: #f5efde;
}

/* ==========================================
   便签文字
   ========================================== */
.note-date {
    font-size: 9px;
    color: #a09888;
    margin-bottom: 5px;
    font-family: monospace;
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.note-content {
    flex: 1;
    font-size: 11px;
    line-height: 1.6;
    color: #3a302a;
    position: relative;
    z-index: 1;
    overflow: hidden;
    word-break: break-all;
}

.note-id {
    font-size: 9px;
    color: #bdb0a0;
    margin-top: 5px;
    text-align: right;
    font-family: monospace;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.p-kraft .note-date { color: rgba(55, 28, 6, 0.55); }
.p-kraft .note-content { color: #33180a; }
.p-kraft .note-id { color: rgba(55, 28, 6, 0.38); }

/* ==========================================
   入口方块网格（James 小窝首屏，长按拖拽重排）
   ========================================== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 4px 4px 40px;
}

.home-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;

    background: var(--cl-surface);
    border: 1px solid var(--cl-border);
    border-radius: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.home-tile:active {
    transform: scale(0.96);
    background: var(--cl-sunken);
}

/* 图标：用 mask 把 svg 当蒙版，填充 Claude 橙 #D97757 */
.home-tile-icon {
    width: 64px;
    height: 64px;
    background-color: #D97757;
}

.home-tile-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--cl-text);
    letter-spacing: 0.01em;
}

/* 拖拽编辑态：全体轻微缩小 + 被拖块抖动 */
.home-grid.editing .home-tile {
    animation: tile-jiggle 0.32s infinite;
}
.home-grid.editing .home-tile:nth-child(even) {
    animation-delay: 0.16s;
}

.home-tile.dragging {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    opacity: 0.96;
    animation: none !important;
    transition: none;
}

@keyframes tile-jiggle {
    0%   { transform: rotate(-1.1deg); }
    50%  { transform: rotate(1.1deg); }
    100% { transform: rotate(-1.1deg); }
}
