:root{--navy:#103d55;--navy-2:#1b687d;--teal:#23a69a;--ink:#14252e;--muted:#6b7b82;--paper:#f1f5f3;--card:#fff;--line:#dbe4e2;--soft:#e7f3f0;--danger:#b84f4b;color-scheme:light;font-family:system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--paper);color:var(--ink)}button,input,textarea{font:inherit}.memory-app{min-height:100vh;padding-bottom:96px}.app-header{min-height:142px;padding:calc(26px + env(safe-area-inset-top)) max(24px,calc((100vw - 1160px)/2)) 28px;display:flex;align-items:center;gap:18px;color:#fff;background:linear-gradient(135deg,#0e384e 0%,#176078 62%,#2a8c8d 100%);border-radius:0 0 30px 30px;box-shadow:0 18px 44px #123e5526}.app-header h1{margin:0 0 4px;font-size:32px;letter-spacing:-.04em}.app-header p{margin:0;color:#dcecef}.home-button{width:54px;height:54px;display:grid;place-items:center;flex:0 0 auto;color:#fff;border:1px solid #ffffff24;border-radius:18px;background:#ffffff14;text-decoration:none;box-shadow:inset 0 1px #ffffff25}.home-button svg{width:27px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}main{width:min(1160px,calc(100% - 32px));margin:28px auto}.page[hidden]{display:none}.search-hero,.editor-card{border:1px solid #ffffff;background:#ffffffd9;box-shadow:0 18px 55px #15384812;border-radius:28px;padding:30px;backdrop-filter:blur(16px)}.eyebrow{display:block;color:var(--teal);font-size:11px;font-weight:900;letter-spacing:.16em}.search-hero h2,.editor-heading h2{margin:7px 0 22px;font-size:29px;letter-spacing:-.04em}.search-box{height:62px;display:flex;align-items:center;gap:14px;padding:0 18px;border:1px solid #cfdbd8;border-radius:18px;background:#fff;box-shadow:inset 0 1px 2px #173c4d08}.search-box:focus-within{border-color:#62bcb4;box-shadow:0 0 0 4px #44b7ab18}.search-box svg{width:23px;fill:none;stroke:#5e747c;stroke-width:1.8}.search-box input{width:100%;border:0;outline:0;background:transparent;font-size:18px;color:var(--ink)}.search-hint{margin-top:12px;color:var(--muted);font-size:12px}.section-heading{display:flex;align-items:end;justify-content:space-between;margin:30px 4px 15px}.section-heading div>span{font-size:11px;color:var(--teal);font-weight:800}.section-heading h2{margin:2px 0 0;font-size:24px}.section-heading>span{color:var(--muted);font-size:13px}.note-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.note-card{min-width:0;border:1px solid var(--line);border-radius:23px;background:var(--card);box-shadow:0 13px 35px #1538480e;overflow:hidden}.note-main{padding:22px}.note-card h3{margin:0 0 8px;font-size:19px;line-height:1.35}.keywords{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.keyword{padding:4px 9px;border-radius:999px;background:var(--soft);color:#23766f;font-size:11px;font-weight:700}.note-text{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;white-space:pre-wrap;color:#53666e;font-size:13px;line-height:1.7}.note-meta{display:flex;gap:14px;margin-top:16px;color:#7b898f;font-size:11px}.note-assets{display:flex;gap:8px;overflow:auto;padding:0 22px 18px}.asset-pill,.link-pill{border:0;max-width:220px;display:flex;align-items:center;gap:7px;border-radius:12px;padding:9px 11px;background:#f1f5f4;color:#234752;text-decoration:none;white-space:nowrap;font-size:12px}.asset-pill span,.link-pill span{overflow:hidden;text-overflow:ellipsis}.asset-pill.image{padding:0;width:62px;height:62px;overflow:hidden;flex:0 0 auto}.asset-pill.image img{width:100%;height:100%;object-fit:cover}.note-actions{display:flex;border-top:1px solid #e8eeec}.note-actions button{flex:1;border:0;padding:12px;background:#fff;color:#547078;font-size:12px}.note-actions button+button{border-left:1px solid #e8eeec}.note-actions .delete{color:var(--danger)}.empty-state{grid-column:1/-1;min-height:230px;display:grid;place-items:center;text-align:center;padding:35px;border:1px dashed #cbd9d6;border-radius:25px;background:#ffffff73;color:#75868c}.empty-state b{display:block;margin-bottom:5px;color:#34505b;font-size:17px}.editor-heading{display:flex;justify-content:space-between;align-items:start}.text-button{border:0;background:transparent;color:var(--teal);font-weight:700}.field{display:block;margin-top:17px}.field>span{display:block;margin:0 0 7px;color:#536870;font-size:12px;font-weight:700}.field input,.field textarea,.link-entry input{width:100%;border:1px solid #d5dfdd;border-radius:14px;background:#fbfcfc;padding:13px 14px;outline:0;color:var(--ink)}.field textarea{resize:vertical;min-height:120px}.field input:focus,.field textarea:focus,.link-entry input:focus{border-color:#69bdb5;box-shadow:0 0 0 4px #46b6aa12}.sub-card{margin-top:18px;padding:17px;border-radius:19px;background:#f6f8f7;border:1px solid #e2e9e7}.sub-card-title{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:12px}.sub-card-title span{color:#7a898e;font-size:11px}.link-entry{display:grid;grid-template-columns:1fr 1.4fr auto;gap:9px}.secondary-button,.primary-button{border:0;border-radius:13px;padding:0 18px;font-weight:800}.secondary-button{background:#dfeeea;color:#24766f}.primary-button{min-height:48px;background:linear-gradient(135deg,var(--navy),var(--navy-2));color:#fff;box-shadow:0 10px 22px #12445d25}.draft-list,.attachment-drafts{display:flex;gap:8px;flex-wrap:wrap;margin-top:11px}.draft-item{display:flex;align-items:center;gap:7px;max-width:100%;padding:7px 9px;border:1px solid #dde6e4;border-radius:11px;background:#fff;font-size:12px}.draft-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.draft-item button{border:0;background:transparent;color:#8a5653}.upload-zone{min-height:82px;display:flex;align-items:center;justify-content:center;gap:13px;border:1px dashed #aebfbb;border-radius:16px;background:#fff;cursor:pointer;color:#385862}.upload-zone svg{width:29px;fill:none;stroke:var(--teal);stroke-width:1.8}.upload-zone span{display:flex;flex-direction:column}.upload-zone small{margin-top:3px;color:#849196}.form-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:20px}.form-actions>span{color:#819096;font-size:11px}.library-heading{margin-top:32px}.bottom-nav{position:fixed;z-index:50;left:50%;bottom:max(12px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(680px,calc(100% - 24px));height:70px;padding:4px;display:grid;grid-template-columns:repeat(2,1fr);border:1px solid #ffffffc9;border-radius:22px;background:#fbfdfcf2;backdrop-filter:blur(24px) saturate(150%);box-shadow:0 18px 50px #10374d26}.nav-button{border:0;border-radius:18px;background:transparent;color:#77888e;display:flex;align-items:center;justify-content:center;gap:8px;font-weight:700}.nav-button svg{width:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}.nav-button.active{background:#dff2ee;color:#168d83;box-shadow:inset 0 1px #fff}.toast{position:fixed;z-index:80;left:50%;bottom:98px;transform:translate(-50%,15px);padding:10px 16px;border-radius:999px;background:#143d50;color:#fff;opacity:0;pointer-events:none;transition:.2s;font-size:12px;box-shadow:0 10px 30px #123b4c35}.toast.show{opacity:1;transform:translate(-50%,0)}.preview-dialog{width:min(900px,94vw);max-height:90vh;padding:0;border:0;border-radius:20px;background:#0c1b22;box-shadow:0 25px 90px #0008}.preview-dialog::backdrop{background:#06151dbd;backdrop-filter:blur(7px)}.preview-dialog img{display:block;max-width:100%;max-height:86vh;margin:auto}.preview-dialog button{position:absolute;right:10px;top:10px;width:40px;height:40px;border:0;border-radius:50%;background:#ffffffdf;font-size:24px}.file-icon{width:24px;height:24px;display:grid;place-items:center;border-radius:7px;background:#dfece9;color:#27756f;font-size:9px;font-weight:900;flex:0 0 auto}
.sync-button{margin-left:auto;min-width:88px;height:45px;padding:0 15px;display:flex;align-items:center;justify-content:center;gap:7px;border:1px solid #ffffff2e;border-radius:15px;background:#ffffff15;color:#fff;font-weight:800}.sync-button svg{width:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.sync-button.syncing svg{animation:memory-spin 1s linear infinite}.sync-button.offline{color:#ffe0bd;background:#7b3e2b35}@keyframes memory-spin{to{transform:rotate(360deg)}}.sync-settings{margin:0 0 18px;border:1px solid #dfe8e5;border-radius:16px;background:#f5f8f7;overflow:hidden}.sync-settings summary{padding:13px 15px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;list-style:none}.sync-settings summary::-webkit-details-marker{display:none}.sync-settings summary>span:first-child{display:flex;align-items:baseline;gap:9px}.sync-settings summary small{color:#71858c}.sync-settings summary>span:last-child{color:var(--teal);font-size:12px;font-weight:700}.sync-settings-body{padding:0 15px 15px;border-top:1px solid #e3ebe9}.sync-setting-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px}.sync-setting-actions small{color:#78898f}.sync-setting-actions .secondary-button{min-height:42px}
@media(max-width:700px){.memory-app{padding-bottom:92px}.app-header{min-height:126px;padding:calc(18px + env(safe-area-inset-top)) 18px 24px;border-radius:0 0 25px 25px}.app-header h1{font-size:27px}.home-button{width:49px;height:49px;border-radius:16px}.sync-button{min-width:48px;width:48px;padding:0}.sync-button span{display:none}main{width:calc(100% - 24px);margin-top:18px}.search-hero,.editor-card{padding:21px;border-radius:23px}.search-hero h2,.editor-heading h2{font-size:25px}.search-box{height:56px;padding:0 14px}.search-box input{font-size:16px}.note-list{grid-template-columns:1fr}.link-entry{grid-template-columns:1fr}.secondary-button{min-height:43px}.form-actions{align-items:stretch;flex-direction:column}.primary-button{width:100%}.sub-card{padding:14px}.sub-card-title{align-items:start;flex-direction:column;gap:2px}.sync-setting-actions{align-items:stretch;flex-direction:column}.bottom-nav{height:66px;border-radius:20px}.nav-button{border-radius:16px}}
@media(min-width:1000px){.page[data-page="library"]{display:grid;grid-template-columns:minmax(380px,.82fr) minmax(0,1.18fr);gap:26px;align-items:start}.page[data-page="library"][hidden]{display:none}.page[data-page="library"] .editor-card{position:sticky;top:24px;grid-row:1/3}.library-heading{grid-column:2;margin-top:4px}.page[data-page="library"] #libraryList{grid-column:2;grid-template-columns:1fr}}

/* Three-page memory navigation and standalone library. */
.bottom-nav{grid-template-columns:repeat(3,1fr)}
.library-heading{margin-top:6px}
.library-tools{display:flex!important;align-items:flex-end!important;gap:14px}
.preview-dialog .preview-download{left:10px;right:auto;width:auto;padding:0 16px;border-radius:999px;background:#ffffffeb;color:#143d50;font-size:13px;font-weight:800}
.library-tools>span{color:var(--muted);font-size:13px}
.library-tools label{display:flex;align-items:center;gap:8px;padding:8px 11px;border:1px solid var(--line);border-radius:13px;background:#fff}
.library-tools label>span{color:#6b7b82;font-size:11px}
.library-tools select{border:0;outline:0;background:transparent;color:var(--ink);font-weight:700}
@media(min-width:1000px){
  .page[data-page="record"] .editor-card{max-width:760px;margin:auto}
  .page[data-page="library"]{display:block}
  .page[data-page="library"][hidden]{display:none}
  .page[data-page="library"] #libraryList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
  .library-heading{align-items:flex-start}
  .library-tools{align-items:flex-end!important;flex-direction:column;gap:7px}
  .library-tools label{padding:7px 9px}
  .nav-button{gap:5px}
  .nav-button svg{width:21px}
}

/* Keep actions identical and anchored to the bottom of every memory card. */
.note-card{display:flex;flex-direction:column}
.note-actions{width:100%;min-height:48px;margin-top:auto;flex:0 0 48px}
.note-actions button{display:flex;align-items:center;justify-content:center;min-width:0;height:48px;padding:0 12px}

/* Wrap attachments and links instead of creating a clipped horizontal row. */
.note-assets{flex-wrap:wrap;overflow:visible}
.note-assets .asset-pill,.note-assets .link-pill{max-width:100%;min-width:0}
