:root{--paper:#f8f5ee;--paper-deep:#f1ede3;--ink:#27342a;--muted:#777e72;--green:#456547;--green-dark:#304d37;--sage:#e6eddf;--line:#e7e5dd;--white:#fffefa;--shadow:0 10px 30px rgba(46,68,46,.08)}
*{box-sizing:border-box}
html{background:#e8e5dc}
body{margin:0;color:var(--ink);font-family:"PingFang SC","Microsoft YaHei",sans-serif;-webkit-font-smoothing:antialiased}
button,input,textarea{font:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid #7d9c71;outline-offset:3px}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.desktop-wash{position:fixed;inset:0;background:radial-gradient(circle at 15% 20%,#f6efdc 0,transparent 30%),radial-gradient(circle at 83% 73%,#cdd7bf 0,transparent 34%),#e8e5dc;pointer-events:none}
.app-shell{position:relative;width:min(100%,430px);min-height:100dvh;margin:auto;background:var(--paper);box-shadow:0 10px 80px rgba(55,62,45,.19);overflow:hidden}
.screen{min-height:100dvh}
.home-screen{background:#fffdf8}
.home-hero{position:relative;height:clamp(352px,calc(89vw + 32px),412px);background-image:linear-gradient(180deg,rgba(255,252,246,.22),rgba(255,252,246,.04) 58%,rgba(255,253,248,.18) 72%,rgba(255,253,248,.78) 90%,#fffdf8 100%),url("./assets/story-room-v2.png");background-position:center,center 85%;background-size:cover;overflow:hidden}
.home-topbar{position:relative;z-index:1;display:flex;align-items:flex-start;justify-content:space-between;padding:27px 24px 0}
.brand{display:flex;flex-direction:column;gap:1px}
.brand-name{font-family:"Kaiti SC","STKaiti","KaiTi","Songti SC",serif;font-size:32px;font-weight:700;letter-spacing:3px;line-height:1.2;transform:rotate(-3deg);transform-origin:left center}
.brand-subtitle{font-size:10px;letter-spacing:4px;color:#606b5c;margin-top:6px}
.prototype-label{border:1px solid rgba(58,85,62,.18);border-radius:50%;width:42px;height:42px;display:grid;place-items:center;font-size:10px;color:#49644d;background:rgba(255,255,250,.88);white-space:nowrap;box-shadow:0 2px 8px rgba(44,55,43,.07)}
.hero-quote{position:relative;z-index:1;width:max-content;margin:35px 0 0 25px;color:#61745f;font-family:"Kaiti SC","STKaiti","KaiTi","Songti SC",serif;font-style:italic;font-size:15px;line-height:1.4;transform:rotate(-7deg)}
.hero-quote:after{content:"";display:block;width:51px;height:1px;margin-top:10px;background:#abaca0}
.hero-copy{position:relative;z-index:1;padding:0 24px;margin-top:42px;text-shadow:0 1px 7px rgba(255,251,242,.75)}
.article-label{margin:0;color:#587052;letter-spacing:3px;font-size:11px;font-weight:600}
.hero-copy h1{font-family:"Songti SC","STSong","SimSun",serif;font-size:clamp(24px,6.9vw,30px);line-height:1.18;letter-spacing:.2px;margin:0 0 9px;font-weight:700}
.hero-copy p{font-family:"Songti SC","STSong","SimSun",serif;font-size:14px;line-height:1.45;color:#3f4c42;margin:0}
.home-content{position:relative;margin-top:-50px;padding:0 23px 15px;background:linear-gradient(180deg,transparent 0 50px,#fffdf8 50px)}
.primary-button{border:0;background:linear-gradient(145deg,#718761,#446347);color:#fff;border-radius:28px;min-height:50px;padding:0 23px;box-shadow:0 7px 15px rgba(49,80,54,.15),inset 0 1px rgba(255,255,255,.24);font-size:15px;font-weight:600;letter-spacing:1px}
.primary-button:active{transform:translateY(1px)}
.start-button{width:calc(100% - 14px);min-height:clamp(50px,13.3vw,57px);margin-left:7px;display:flex;align-items:center;justify-content:center;gap:12px;position:relative;z-index:1}
.mic-icon{width:22px;height:22px;flex:none}
.start-arrow{font-size:22px;font-weight:400;line-height:1;margin-left:3px}
.start-button:disabled{opacity:.7;cursor:wait}
.startup-status{margin:10px 0 0;text-align:center;font-size:11px;line-height:1.5;color:var(--muted)}
.startup-status a{color:var(--green)}
.resume-button{display:flex;width:100%;align-items:center;justify-content:center;gap:8px;border:0;background:transparent;color:var(--green);min-height:42px;font-size:13px;margin-top:5px}
.topic-section{padding:14px 2px 0}
.topic-list{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.topic-chip{min-height:clamp(34px,9.1vw,39px);border:1px solid transparent;border-radius:100px;background:#edf0e8;color:#344436;font-size:13px;white-space:nowrap}
.topic-chip.selected{background:#e4ece0;border-color:#a8bba0;color:#284b33}
.topic-chip:active{transform:scale(.97)}
.memory-section{padding:clamp(25px,6.7vw,29px) 1px 0}
.memory-section h2{font-family:"Songti SC","STSong","SimSun",serif;font-size:20px;line-height:1.3;letter-spacing:.5px;margin:0 0 5px}
.memory-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.memory-card{display:flex;flex-direction:column;min-width:0;min-height:clamp(140px,37.3vw,160px);padding:0 0 7px;overflow:hidden;text-align:left;border:1px solid #eae8df;border-radius:13px;background:#fffefa;color:#26352a;box-shadow:0 3px 12px rgba(43,62,39,.04)}
.memory-card img{width:100%;height:clamp(76px,20.3vw,87px);object-fit:cover;display:block;margin-bottom:6px}
.memory-card:first-child img{object-position:center 31%}
.memory-card:nth-child(2) img{object-position:center 44%}
.memory-card:nth-child(3) img{object-position:center 65%}
.memory-card-title{font-family:"Songti SC","STSong","SimSun",serif;font-size:11px;font-weight:700;line-height:1.3;margin:0 6px 3px;white-space:nowrap;letter-spacing:-.5px}
.memory-card-copy{font-size:10px;line-height:1.3;color:#899187;margin:0 6px}
.notebook-section{padding:29px 1px 9px}
.notebook-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:11px}
.notebook-heading h2{font-family:"Songti SC","STSong","SimSun",serif;font-size:20px;letter-spacing:.5px;margin:0}
.notebook-heading span{font-size:11px;color:#929a8d}
.story-list{display:grid;gap:9px}
.story-list-item{width:100%;text-align:left;border:1px solid #e8e8de;border-radius:14px;background:#fffefa;padding:13px 15px;color:var(--ink);box-shadow:0 3px 12px rgba(43,62,39,.035)}
.story-list-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
.story-list-head strong{font-family:"Songti SC","STSong","SimSun",serif;font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.story-list-head time{flex:none;font-size:10px;color:#98a095}
.story-list-preview{display:block;margin-top:6px;color:#879184;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.chat-screen,.article-screen{height:100dvh;display:flex;flex-direction:column;background:#faf8f3}
.screen-header{height:77px;flex:none;display:flex;align-items:center;justify-content:space-between;padding:16px 16px 11px;background:rgba(250,248,243,.96);border-bottom:1px solid #ebe9e2;z-index:3}
.icon-button{width:42px;height:42px;display:grid;place-items:center;background:transparent;border:0;border-radius:50%;font-size:29px;color:#25372a;line-height:1}
.more-button{font-size:27px;padding-bottom:12px}
.header-title{text-align:center;display:flex;flex-direction:column;gap:2px}
.header-title h1{font-family:"Songti SC","STSong","SimSun",serif;font-size:18px;letter-spacing:1px;margin:0;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.header-title span{font-size:10px;color:#7a8875;letter-spacing:1px}
.demo-banner{display:flex;align-items:flex-start;gap:9px;margin:14px 16px 0;border:1px solid #dce7d7;background:#f2f7ee;border-radius:13px;padding:10px 12px;color:#56705a;flex:none}
.demo-banner>span{font-size:17px;line-height:1}
.demo-banner p{font-size:11px;line-height:1.5;margin:0}
.demo-banner strong{font-weight:700;color:#3f6245}
.chat-scroll{flex:1;min-height:0;overflow:auto;padding:18px 17px 24px;scroll-behavior:smooth;overscroll-behavior:contain}
.chat-date{text-align:center;color:#a0a59e;font-size:11px;margin:3px 0 20px}
.messages{display:flex;flex-direction:column;gap:18px}
.message-row{display:flex;gap:8px;align-items:flex-end;max-width:100%}
.message-row.user{flex-direction:row-reverse}
.bot-avatar,.user-avatar{width:29px;height:29px;flex:none;display:grid;place-items:center;border-radius:50%;font-size:20px;background:#e3ebdc;color:#537050;font-family:Georgia,serif}
.user-avatar{font-family:"Songti SC","STSong",serif;background:#d9e6e4;color:#3d625d;font-size:12px}
.message-stack{display:flex;flex-direction:column;align-items:flex-start;max-width:min(78%,310px)}
.user .message-stack{align-items:flex-end}
.bubble{border-radius:17px 17px 17px 4px;background:#fff;border:1px solid #f0eee9;padding:12px 14px;color:#303b30;font-size:14px;line-height:1.62;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 3px 12px rgba(48,58,45,.035)}
.user .bubble{background:#e2eddf;border-color:#dfebdd;border-radius:17px 17px 4px 17px}
.message-time{font-size:10px;color:#a3a89f;margin:5px 3px 0}
.typing-indicator{display:flex;gap:8px;align-items:flex-end;margin-top:17px}
.typing-bubble{display:flex;align-items:center;gap:4px;background:#fff;border-radius:15px 15px 15px 4px;padding:15px 17px;border:1px solid #f0eee9}
.typing-bubble i{width:5px;height:5px;border-radius:50%;background:#a3b19e;animation:pulse 1.1s infinite ease-in-out}
.typing-bubble i:nth-child(2){animation-delay:.15s}.typing-bubble i:nth-child(3){animation-delay:.3s}
@keyframes pulse{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
.chat-bottom{flex:none;padding:12px 15px max(10px,env(safe-area-inset-bottom));background:rgba(250,248,243,.98);border-top:1px solid #eae8e0;box-shadow:0 -7px 25px rgba(65,68,55,.04)}
.retry-wrap{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:7px 2px 12px;color:#8a6247;font-size:11px}
.retry-wrap button{border:0;background:#edf2e9;color:#3f6645;border-radius:100px;padding:8px 11px;white-space:nowrap;font-size:11px}
.composer{min-height:51px;border-radius:25px;background:#fff;border:1px solid #e4e3dc;display:flex;align-items:flex-end;padding:4px 5px 4px 18px;box-shadow:0 3px 12px rgba(43,55,42,.035)}
.composer textarea{flex:1;min-width:0;min-height:40px;max-height:120px;resize:none;border:0;outline:0;background:transparent;color:#263b2a;font-size:14px;line-height:1.5;padding:9px 8px 8px 0;overflow-y:auto;font-family:inherit}
.composer textarea::placeholder{color:#a4a8a0}
.composer button{width:41px;height:41px;flex:none;border:0;border-radius:50%;background:var(--green);color:#fff;font-size:23px;line-height:1}
.composer button:disabled{opacity:.52;cursor:wait}
.composer-caption{font-size:10px;text-align:center;color:#a2a79e;margin:8px 0 0}
.sheet-backdrop{position:absolute;inset:0;background:rgba(31,42,30,.26);z-index:8}
.menu-sheet{position:absolute;z-index:9;bottom:0;left:0;right:0;background:#fffefa;border-radius:22px 22px 0 0;padding:10px 22px max(18px,env(safe-area-inset-bottom));box-shadow:0 -12px 35px rgba(22,36,22,.12)}
.sheet-grip{width:35px;height:4px;background:#d6d9d0;border-radius:5px;margin:0 auto 17px}
.menu-sheet h2{font-family:"Songti SC","STSong",serif;font-size:19px;margin:0 0 14px}
.menu-sheet button{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:48px;border:0;border-top:1px solid #f0eee8;background:transparent;text-align:left;color:#314335;font-size:14px}
.menu-sheet button:last-child{justify-content:center;color:#8c9489}
.debug-sheet{position:absolute;z-index:11;bottom:0;left:0;right:0;height:min(78dvh,680px);display:flex;flex-direction:column;background:#fffefa;border-radius:22px 22px 0 0;box-shadow:0 -12px 35px rgba(22,36,22,.15)}
#debugBackdrop{z-index:10}
.debug-head{display:flex;justify-content:space-between;align-items:flex-start;padding:20px 20px 14px;border-bottom:1px solid #e9ece5}
.debug-head small{font-size:10px;color:#70816d;letter-spacing:2px}
.debug-head h2{font-family:"Songti SC","STSong",serif;margin:4px 0;font-size:23px}
.debug-head span{font-size:11px;color:#8c958a}
.debug-head button{border:0;background:#f0f3ed;border-radius:50%;height:34px;width:34px;color:#38533c;font-size:22px}
.debug-scroll{overflow:auto;padding:6px 20px 28px;overscroll-behavior:contain}
.debug-note{color:#9b6b44;background:#fff5e9;border-radius:9px;padding:9px;font-size:11px}
.debug-group{padding:13px 0;border-bottom:1px solid #eeeee9}
.debug-group h3{display:flex;justify-content:space-between;margin:0 0 7px;font-size:13px;color:#36543d}
.debug-group h3 small{font-size:11px;color:#9aa39a}
.debug-empty{margin:0;color:#adb3aa;font-size:11px}
.debug-item{padding:8px 10px;margin:6px 0;background:#f7f8f3;border-radius:10px;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.debug-item.recent{background:#eef5e9;border-left:3px solid #7ca46f}
.debug-item strong{font-weight:500}
.debug-item em{font-style:normal;color:#8a967f;font-size:10px;margin-left:6px}
.debug-item p{margin:5px 0 0;color:#8b9488;font-size:10px}
.debug-raw{margin:17px 0;color:#5c6c5d;font-size:12px}
.debug-raw pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:10px;background:#f5f6f1;padding:10px;border-radius:8px}

.article-screen{background:#faf8f3}
.article-scroll{flex:1;min-height:0;overflow:auto;padding:24px 16px 32px;overscroll-behavior:contain}
.article-label{text-align:center;font-size:10px;letter-spacing:3px;margin:0 0 19px}
.mode-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;background:#f0eee7;border:1px solid #e7e4dc;border-radius:13px;padding:3px}
.mode-tab{border:0;border-radius:10px;background:transparent;min-height:44px;color:#697166;font-size:12px;white-space:nowrap}
.mode-tab.selected{background:var(--green);color:#fff;box-shadow:0 3px 7px rgba(51,79,53,.15)}
.mode-explainer{text-align:center;color:#8b9286;font-size:10px;min-height:17px;margin:11px 3px 20px;line-height:1.5}
.article-paper{position:relative;background:#fffefa;border:1px solid #eceae1;border-radius:19px;padding:34px 22px 25px;box-shadow:var(--shadow);overflow:hidden}
.article-paper:before{content:"";position:absolute;left:0;right:0;top:0;height:5px;background:linear-gradient(90deg,#e5ebda,#a5b99b,#e5ebda)}
.article-ornament{text-align:center;color:#8ba283;font-size:17px}
.article-paper h2{font-family:"Songti SC","STSong","SimSun",serif;font-size:28px;line-height:1.25;letter-spacing:2px;text-align:center;margin:15px 0 12px;color:#28372c}
.article-deck{font-family:"Songti SC","STSong","SimSun",serif;text-align:center;color:#939a8d;font-size:12px;margin:0 0 26px}
.article-body{font-family:"Songti SC","STSong","SimSun",serif;color:#3d463e;font-size:16px;line-height:1.95;letter-spacing:.3px}
.article-body p{margin:0 0 17px;text-indent:2em;overflow-wrap:anywhere}
.article-body p:last-child{margin-bottom:0}
.article-editor{width:100%;min-height:400px;border:1px solid #d9e4d4;border-radius:10px;background:#fffefa;padding:13px;resize:vertical;font-family:"Songti SC","STSong","SimSun",serif;color:#3d463e;font-size:16px;line-height:1.8}
.article-endmark{text-align:center;color:#a8b7a0;font-family:Georgia,serif;font-size:20px;margin-top:23px}
.source-card{margin-top:16px;border:1px solid #e2e9dc;border-radius:16px;padding:16px;background:#f4f7f0}
.source-title{display:flex;gap:8px;align-items:center;font-size:12px;color:#456449}.source-title span{font-size:18px}
.source-card p{font-size:12px;line-height:1.7;color:#68766a;margin:8px 0 0;overflow-wrap:anywhere}
.article-disclaimer{text-align:center;color:#a0a69b;font-size:10px;line-height:1.6;margin:18px 11px 0}
.article-bottom{flex:none;display:grid;grid-template-columns:1fr 1fr 1.15fr;gap:7px;padding:11px 13px max(13px,env(safe-area-inset-bottom));background:#faf8f3;border-top:1px solid #eae8e0}
.secondary-button{border:1px solid #e3e3d9;background:#fffefa;border-radius:13px;min-height:47px;color:#405043;font-size:12px}
.save-button{min-height:47px;border-radius:13px;box-shadow:none;padding:0 6px;font-size:12px;letter-spacing:0}
.toast{position:absolute;left:50%;bottom:90px;z-index:12;transform:translate(-50%,15px);opacity:0;pointer-events:none;background:#304d37;color:#fff;border-radius:100px;padding:11px 17px;white-space:nowrap;font-size:12px;transition:opacity .2s,transform .2s;box-shadow:0 7px 20px rgba(29,51,32,.25)}
.toast.show{opacity:1;transform:translate(-50%,0)}
@media (max-width:380px){.hero-quote{margin-top:20px}.hero-copy{margin-top:26px}.hero-copy h1{font-size:25px}.topic-chip{font-size:12px}.article-paper{padding-left:17px;padding-right:17px}}
@media (min-width:600px){.app-shell{margin:24px auto;min-height:calc(100dvh - 48px);border-radius:28px}.screen{min-height:calc(100dvh - 48px)}.chat-screen,.article-screen{height:calc(100dvh - 48px)}.home-hero{border-radius:28px 28px 0 0}}
@media (prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
