@charset "UTF-8";
:root{color-scheme:dark;--bg:#172431;--ink:#f5f0e6;--muted:#aebcc4;--line:#cfbd9630;--gold:#e2c89b;--serif:'Noto Serif SC','SimSun',serif;--sans:'Microsoft YaHei UI','PingFang SC',system-ui,sans-serif;--safe-bottom:env(safe-area-inset-bottom,0px);--top:72px;--bottom:77px}
*{box-sizing:border-box}html,body{height:100%;margin:0;overflow:hidden}body{background:var(--bg);color:var(--ink);font:14px/1.8 var(--sans);-webkit-font-smoothing:antialiased}button,input,textarea,select{font:inherit}button{border:0;background:none;color:inherit;cursor:pointer;touch-action:manipulation}button:disabled{opacity:.45;cursor:default}a{color:inherit}button,a,input,textarea,select{-webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--gold);outline-offset:3px}h1,h2,h3,p,blockquote{margin:0}h1,h2,h3{font-family:var(--serif);font-weight:400;line-height:1.6}h2{font-size:25px}h3{font-size:20px}p{margin:12px 0}blockquote{font-family:var(--serif);line-height:1.9}[hidden]{display:none!important}.sr-only{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0);white-space:nowrap;border:0!important}.muted{color:var(--muted)}.small{font-size:11px}.eyebrow{font-size:9px;color:var(--gold);letter-spacing:.12em}.source-label{display:block;color:var(--muted);font-size:10px;overflow-wrap:anywhere}.portrait{pointer-events:none;user-select:none}.primary,.secondary,.ghost-light{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:44px;padding:11px 20px;border-radius:5px;border:1px solid var(--line);font-size:13px}.primary{background:#e2c89b;color:#28333a;border-color:#e2c89b}.primary:hover{background:#f0dbb5}.secondary{background:#ffffff07}.secondary:hover,.ghost-light:hover{background:#dec89612;border-color:#dbc59780}.ghost-light{color:#e3dac8}.text-link{font-size:11px;color:var(--gold);padding:6px 0;min-height:28px}.text-link:hover{text-decoration:underline;text-underline-offset:4px}.full{width:100%}.danger{color:#ebb4a2}.primary.danger{background:#d1a291;border-color:#d1a291;color:#352724}.icon-button{width:38px;height:38px;display:grid;place-items:center;border-radius:5px;font-size:22px;flex-shrink:0}.icon-button:hover{background:#e2c89b16}.chips{display:flex;flex-wrap:wrap;gap:7px}.chip{font-size:10px;border:1px solid var(--line);border-radius:18px;padding:5px 12px}.chip.selected{background:#dcc49916;border-color:#dcc49970;color:var(--gold)}

.app-shell,.workspace{height:100dvh;position:relative;isolation:isolate}.world-backdrop{position:absolute;inset:0;z-index:-2}.world-backdrop:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,#152434f5,#152434a3 42%,#15243411),linear-gradient(0deg,#152434ee,transparent 65%,#152434a1)}.app-shell[data-view=companion] .world-backdrop:after{background:#14232fdf}.app-shell[data-view=memories] .world-backdrop:after,.app-shell[data-view=settings] .world-backdrop:after{background:#142330ed}.topbar{position:absolute;top:0;left:0;right:0;height:var(--top);padding:0 35px;display:flex;align-items:center;justify-content:space-between;z-index:20;pointer-events:none}.topbar>*{pointer-events:auto}.brand{font:29px var(--serif);letter-spacing:.12em;text-decoration:none;color:#e9d3aa}.top-actions{display:flex;align-items:center;gap:18px}.save-status{font-size:10px;color:#c3cdc9}.save-status:before{content:'';display:inline-block;vertical-align:middle;width:4px;height:4px;border-radius:50%;background:#b9c8ac;margin-right:8px}.hud-button{font-size:20px;min-width:34px;min-height:34px;opacity:.8}.hud-button:hover{opacity:1}.rail{position:absolute;bottom:calc(16px + var(--safe-bottom));left:50%;transform:translateX(-50%);z-index:30;background:#152633ef;border:1px solid var(--line);border-radius:30px;padding:4px;backdrop-filter:blur(14px)}.rail nav{display:flex;gap:5px}.nav-item{min-width:100px;min-height:39px;font-size:12px;padding:8px 22px;border-radius:25px;color:#b9c5cb;position:relative}.nav-item.active{color:#f0ddba;background:#dcc39719}.nav-item i{position:absolute;right:19px;top:11px;background:#dcb493;width:4px;height:4px;border-radius:50%}#main{height:100dvh;overflow:hidden;position:relative;outline:none}.loading-state{height:100%;display:grid;place-items:center;color:var(--gold)}

/* The title screen has a single clear primary action. */
.hero{height:100%;position:relative;overflow:hidden}.hero-character{position:absolute;height:100%;left:47%;bottom:-12%;width:auto;filter:drop-shadow(-20px 5px 30px #10233480)}.hero-content{position:absolute;left:9%;top:27%;width:43%;z-index:2}.hero-pretitle{font-size:12px;letter-spacing:.13em;color:#c6d0d2;margin:0 0 12px}.hero h2{font-size:clamp(38px,5vw,70px);letter-spacing:.08em;white-space:nowrap;line-height:1.6}.hero blockquote{font-size:18px;color:#e9d5b3;margin:23px 0 30px;max-width:420px}.hero-actions{display:flex;gap:18px;align-items:center;flex-wrap:wrap;max-width:460px}.start-game{min-width:260px;justify-content:space-between;text-align:left;padding:14px 20px;min-height:69px}.start-game>span:nth-child(2){flex:1;font-size:16px;letter-spacing:.08em}.start-game small{display:block;font:9px/1.8 var(--sans);opacity:.65;margin-top:4px;letter-spacing:.02em}.play-symbol{font-size:23px}.hero-actions>.ghost-light{min-height:30px;padding:6px 0;border:0;border-bottom:1px solid var(--line);border-radius:0;font-size:11px}.home-bottom{position:absolute;left:9%;bottom:112px;z-index:2}.home-bottom>.eyebrow{font-size:10px;color:#c3ccce;margin-bottom:12px;display:block;letter-spacing:0}.character-tabs{display:flex;gap:12px}.character-tab{display:flex;align-items:center;gap:10px;min-width:166px;background:#1b3041c7;border:1px solid var(--line);padding:7px 12px 7px 7px;border-radius:5px;text-align:left}.character-tab.selected{background:#e2c89b12;border-color:#d1b67d9c}.character-thumb{width:36px;height:41px;overflow:hidden;background:#5b706b;display:block;border-radius:3px}.character-thumb img{width:55px;transform:translate(-10px,-2px)}.character-tab>span:nth-child(2){font:16px var(--serif)}.character-tab small{display:block;font:8px/1.8 var(--sans);color:#b6c3c8;margin-top:4px}.tab-mark{margin-left:auto;color:var(--gold);font-size:11px}

/* Fixed workspace. Only the message list and history list scroll. */
.companion-layout{position:absolute;top:var(--top);left:28px;right:28px;bottom:calc(var(--bottom) + var(--safe-bottom));display:grid;grid-template-columns:240px minmax(300px,1fr) minmax(150px,24%);gap:18px;min-height:0}.history-sidebar{border:1px solid #b5c3c31c;border-radius:8px;background:#172936ef;display:flex;flex-direction:column;min-height:0;padding:17px 12px 12px;overflow:hidden}.history-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:0 5px;margin-bottom:13px}.history-heading h2{font:15px var(--sans);color:#e4ded0}.history-heading .icon-button{display:none}.history-search{display:block;margin-bottom:12px}.history-search input{font-size:11px;padding:9px 10px;border-color:#bac5c52b;background:#0d1e2b80;border-radius:5px}.history-list{overflow:auto;flex:1;min-height:0;scrollbar-width:thin;scrollbar-color:#b0b8ad30 transparent}.history-item{width:100%;border:1px solid transparent;padding:12px 10px;border-radius:5px;text-align:left;display:flex;flex-direction:column;gap:6px;margin-bottom:5px}.history-item:hover{background:#d6c29c08}.history-item.selected{background:#d6c29c12;border-color:#d6c29c29}.history-person{font-size:11px;color:#ddc698;display:flex;align-items:center;justify-content:space-between}.history-person small{font-size:8px;color:#9eafb9}.history-item strong{font-size:12px;line-height:1.6;font-weight:400;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}.history-preview{color:#9fafb9;font-size:10px;line-height:1.8;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}.history-meta{font-size:8px;color:#859ba8}.history-foot{font-size:9px;color:#8097a5;padding:12px 6px 0}.history-empty{font-size:11px;line-height:1.8;color:#a4b4bd;padding:10px}.history-shade{display:none}.chat-panel{min-width:0;min-height:0;display:flex;flex-direction:column;border:1px solid #c7bb9730;border-radius:8px;background:#1d303ded;overflow:hidden;box-shadow:0 15px 55px #0a152522}.conversation-head{display:flex;align-items:center;gap:12px;border-bottom:1px solid #c4c7bf17;padding:18px 22px;flex-shrink:0;min-height:77px}.conversation-head>div{flex:1;min-width:0}.conversation-head h2{font:18px var(--serif)}.conversation-head>div>span{font-size:10px;color:#a8bac4;display:block;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conversation-head>.icon-button:first-child{display:none}.conversation-head>.text-link{white-space:nowrap;font-size:10px}.messages{flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:#a0acaa45 transparent;padding:24px 25px;overscroll-behavior:contain;scroll-behavior:auto}.message{max-width:94%;padding:12px 15px;margin:0 0 19px;border-radius:3px 13px 13px 13px;background:#ffffff05;border:1px solid #cbd8d00f;overflow-wrap:anywhere}.message.user{max-width:85%;margin-left:auto;border-radius:13px 3px 13px 13px;background:#b5a07615;border-color:#e1c39620}.message-label{font-size:10px;color:#d9c49d;display:flex;gap:7px;align-items:center;flex-wrap:wrap}.message-label>span{font-size:7px;color:#a5b3bd;border:1px solid #c2ccc320;border-radius:3px;padding:0 4px}.message-label>.message-state{font-size:9px;line-height:1.6;color:#cbbd9f;border:1px solid #c2ccc326;border-radius:3px;padding:1px 5px;letter-spacing:.02em;margin-left:auto}.message-label .turn-delete{margin-left:auto;display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:2px 9px;border:1px solid #cfbd9626;border-radius:4px;background:#0f2431a8;color:#b9c6ca;font-size:10px;line-height:1.4;letter-spacing:.03em}.message-label .turn-delete:hover,.message-label .turn-delete:focus-visible{color:#f0c6b4;border-color:#dfa99273;background:#432f30cc}.message p{margin:6px 0;font-size:14px;line-height:2;white-space:pre-wrap;color:#e5e8e6}.message-tools,.message-actions{display:flex;gap:15px;margin-top:7px;flex-wrap:wrap;align-items:center}.message-tools .text-link,.message-actions .text-link{font-size:10px;color:#a7b6bd;padding:0;min-height:24px}.message.search-hit{border-color:#e4c38cb3;box-shadow:0 0 0 2px #e4c38c15}.error-message p{color:#e5bca8}.error-message{border-color:#e5bca83b}.optimistic-message{opacity:.96}.cancelled-message{border-color:#c8b9a52e}.cancelled-message .message-state{color:#c9b7a8}.pending-message{border-color:#d9be8a2e}.message-status{display:flex;align-items:center;gap:8px;margin:7px 0 2px;font-size:13px;line-height:1.8;color:#c4d0d3}.message-status.message-error{color:#e5bca8}.pending-dots{color:var(--gold);letter-spacing:2px;animation:pending-pulse 1.3s ease-in-out infinite}.message-error{padding-top:2px}@keyframes pending-pulse{0%,100%{opacity:.35}50%{opacity:1}}.chat-composer{flex-shrink:0;min-width:0}.chat-composer .chat-form{margin-bottom:6px}.chat-hint{margin:0 22px 14px;font-size:10px;line-height:1.7;color:#91a6b1;letter-spacing:.01em;overflow-wrap:anywhere}.chat-hint.waiting{color:#d8c49a}.chat-form:focus-within{box-shadow:0 0 0 1px #d9c9a51f}.send-button:disabled{opacity:.4;background:#8f9d97}.chat-form{display:flex;align-items:flex-end;gap:12px;margin:0 20px 18px;padding:11px 12px 11px 17px;border:1px solid #d9c9a54d;background:#142633;border-radius:7px;flex-shrink:0}.chat-form:focus-within{border-color:#d9c9a59c}.chat-form textarea{width:100%;border:0!important;background:none!important;resize:none;outline:none!important;padding:3px 0;font-size:13px;min-height:31px;line-height:1.9;color:#f2e8d2}.chat-form textarea::placeholder{color:#a3b4bf}.send-button{width:34px;height:34px;border-radius:50%;background:#dec69b;color:#293438;font-size:21px;flex-shrink:0;display:grid;place-items:center}.chat-empty{min-height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:20px}.chat-empty>span{font-size:32px;color:#d3bd96}.chat-empty p{font:15px/2 var(--serif);color:#a9bbc4;margin:15px 0}.chat-scene{position:relative;overflow:hidden;min-width:0;border-radius:7px;background:linear-gradient(0deg,#142632bb,#53656633);pointer-events:none}.companion-character{position:absolute;height:95%;bottom:-5%;left:50%;transform:translateX(-50%);width:auto;opacity:.85}.chat-scene>span{position:absolute;bottom:25px;left:15px;right:15px;text-align:center;color:#e3cfad;font:13px/2 var(--serif);text-shadow:0 1px 8px #000;z-index:2}.chat-scene:after{content:'';position:absolute;inset:60% 0 0;background:linear-gradient(0deg,#142632,transparent)}

/* Visual-novel story. The page itself never scrolls. */
.story-stage{position:absolute;inset:0;overflow:hidden;pointer-events:none}.stage-vignette{position:absolute;inset:0;background:linear-gradient(0deg,#17243480,transparent)}.stage-character{position:absolute;height:110vh;left:calc(58% - 24vh);bottom:-18vh;filter:drop-shadow(-15px 10px 25px #0c182c55)}.scene-label{position:absolute;left:6%;top:135px}.scene-label>span{font-size:10px;color:#d9c69d;letter-spacing:.1em}.scene-label h2{font-size:27px;letter-spacing:.07em;margin:9px 0}.scene-label small{font-size:10px;color:#bac7ca}.scene-chapter{display:none}.story-toolbar{position:absolute;top:var(--top);left:4%;right:4%;display:flex;align-items:center;justify-content:space-between;z-index:5}.story-toolbar>div{display:flex;gap:7px}.round-tool{background:#1a2c3ac2;border:1px solid #c9b78d25;border-radius:20px;padding:5px 13px;min-height:31px;font-size:10px}.vn-bottom{position:absolute;left:6%;right:6%;bottom:calc(var(--bottom) + var(--safe-bottom));max-height:calc(100% - 130px);display:flex;flex-direction:column;gap:22px;padding-top:18px;z-index:5;overflow:visible}.choices{width:min(460px,46%);display:grid;gap:8px;flex-shrink:0;margin-left:2%;max-height:min(46vh,360px);overflow:auto;padding-right:2px;scrollbar-width:thin;overscroll-behavior:contain}.choice-prompt{font:10px var(--serif);text-align:center;color:#e7d9bd;margin-bottom:3px}.choices button{min-height:50px;padding:12px 20px;display:flex;align-items:center;gap:15px;background:#243c4eea;border:1px solid #dfca9c80;border-radius:4px;text-align:left;font:15px/1.65 var(--serif);backdrop-filter:blur(15px)}.choices button:hover{background:#496073e8;border-color:#edcf98}.choices button:focus-visible{outline:2px solid var(--gold);outline-offset:2px;border-color:#edcf98;background:#415a6bec}.choices button:active{background:#314b5de8}.choice-index{font:9px Georgia,serif;color:#ddc39a}.choices button>b{margin-left:auto;color:#d0b88e;font-size:13px;font-weight:400;flex-shrink:0}.dialogue{position:relative;background:#1a2c3cf2;border:1px solid #d7bf8b73;border-radius:4px 14px 4px 4px;padding:34px 34px 12px;box-shadow:0 15px 40px #08121c55;backdrop-filter:blur(12px);flex-shrink:1;min-height:0}.speaker-name{position:absolute;top:-16px;left:28px;background:#d9bf8e;color:#30322d;display:flex;align-items:center;gap:12px;padding:5px 23px 5px 14px;font:18px/1.5 var(--serif);clip-path:polygon(0 0,calc(100% - 14px) 0,100% 100%,0 100%)}.speaker-name small{font:7px var(--sans);color:#6e654f}.speaker-diamond{font-size:7px;color:#89734c}.dialogue-corner{display:none}.narrative{font:19px/2 var(--serif);letter-spacing:.035em;min-height:65px;max-height:25vh;overflow:auto;scrollbar-width:thin;padding-right:5px;overflow-wrap:anywhere}.narrative p{margin:0}.dialogue-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid #c9c0a51c;margin-top:10px;padding-top:7px;color:#bec9cc}.read-controls,.dialogue-tools{display:flex;gap:17px;align-items:center}.line-back{font-size:20px;padding:0 8px;min-height:30px}.read-controls>span{font:10px Georgia,serif;color:#dbca9f}.read-controls i{font-style:normal;color:#94a8b5}.dialogue-foot .text-link{font-size:10px}.advance-line{font-size:12px;color:#e9d2a9;display:flex;gap:16px;align-items:center;min-height:30px;padding:0 6px}.advance-line span{font-size:20px}.waiting-choice{font-size:10px;color:#d6c8ad}.waiting-choice>span{margin-left:12px}.voice-caption{position:absolute;top:27%;left:7%;max-width:290px;font:14px/2 var(--serif);color:#f0dfba;padding:12px 17px;border:1px solid #dcc39450;background:#172b3ce8}.story-chat-drawer{position:absolute;right:4%;top:120px;bottom:calc(var(--bottom) + var(--safe-bottom));width:min(430px,92vw);padding:22px;background:#1b2d3df9;border:1px solid #d9be8a77;border-radius:6px;z-index:16;display:flex;flex-direction:column;min-height:0;box-shadow:0 15px 70px #0008}.drawer-heading{display:flex;gap:10px;justify-content:space-between;align-items:center}.drawer-heading h2{font-size:19px}.drawer-heading .eyebrow{display:none}.close-drawer{font-size:25px;width:34px;height:34px}.story-chat-drawer>.small{font-size:10px}.story-chat-drawer .messages{padding:12px 0;margin:0}.story-chat-drawer .chat-form{margin:0;padding:9px 10px}.story-chat-drawer .chat-hint{margin:5px 2px 0;font-size:9px;line-height:1.5}.script-log article{padding:13px 0;border-bottom:1px solid var(--line)}.script-log article>span{font-size:10px;color:var(--gold)}.script-log p{font:16px/2 var(--serif);margin:6px 0}.script-log .current{border-left:2px solid var(--gold);padding-left:13px;background:#d5bd8909}.script-log{margin:15px 0 23px}.chapter-finish{position:absolute;inset:var(--top) 20px calc(var(--bottom) + var(--safe-bottom));display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:15px;background:radial-gradient(ellipse,#21384ba8,transparent);padding:10px;overflow:hidden}.chapter-finish .eyebrow{font-size:9px}.finish-mark{font-size:55px;color:var(--gold);line-height:1}.chapter-finish>p:first-of-type{font-size:11px;letter-spacing:.1em;color:#b8c5cb;margin:0}.chapter-finish h2{font-size:33px;letter-spacing:.08em}.chapter-finish blockquote{font-size:18px;color:#eddbb9;max-width:700px}.finish-summary{font-size:12px;color:#ccd6d8;max-width:650px;margin:0}.finish-actions{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center}.finish-letter{font-size:10px;color:#bdc8cb}.relationship-result{font:22px var(--serif);color:var(--gold)}.relationship-result small{display:block;font:10px var(--sans);color:#bec9cb;margin-top:8px}

/* Collections and settings stay within a fixed frame. */
.collection-page,.settings-screen{position:absolute;inset:var(--top) max(30px,calc((100vw - 1150px)/2)) calc(var(--bottom) + var(--safe-bottom));display:flex;flex-direction:column;min-height:0;overflow:hidden}.collection-heading{flex-shrink:0;margin:8px 0 20px}.collection-heading h2{font-size:30px;letter-spacing:.06em}.memory-header{display:flex;justify-content:space-between;align-items:center;gap:20px;border-bottom:1px solid var(--line);padding-bottom:16px;margin-bottom:20px;flex-shrink:0}.segmented{display:flex;gap:24px}.segmented button{font-size:12px;color:#adbec8;padding:9px 0;min-height:40px;white-space:nowrap;position:relative}.segmented .active{color:var(--gold)}.segmented .active:after{content:'';position:absolute;bottom:0;left:0;right:0;height:1px;background:var(--gold)}.segmented button:hover{color:#e3d6bb}.memory-header>.secondary{min-height:40px;font-size:11px;padding:7px 15px}.collection-body{overflow:auto;flex:1;min-height:0;padding-right:7px;scrollbar-width:thin;scrollbar-color:#b6baa03f transparent}.memory-context{display:flex;justify-content:space-between;gap:15px;align-items:center;font-size:10px;color:#b5c4cb;margin-bottom:16px}.timeline{margin-left:7px;padding-left:25px;border-left:1px solid #d8c39750}.timeline-card{background:#273f516b;border:1px solid var(--line);border-radius:5px;padding:23px 27px;position:relative;margin-bottom:19px}.timeline-dot{position:absolute;left:-30px;top:34px;width:8px;height:8px;background:#d4ba88;transform:rotate(45deg)}.timeline-card h2{font-size:24px;margin:9px 0}.timeline-card>p{font:16px/2 var(--serif);color:#dee5e4}.card-footer{display:flex;align-items:center;flex-wrap:wrap;gap:15px;margin-top:15px}.card-footer .source-label{margin-right:auto}.artifact-grid,.bookmark-grid,.notes-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:25px;padding:4px}.artifact-visual{background:#eee3ca;border:6px solid #d1bc8d;box-shadow:inset 0 0 0 1px #ad9260;color:#4a5146;padding:35px;min-height:290px;display:flex;flex-direction:column;justify-content:center}.artifact-visual>span{font-size:8px;letter-spacing:.1em;color:#87754e}.artifact-visual h3{font-size:26px;margin:25px 0 15px}.artifact-visual p{font:16px/2 var(--serif)}.artifact-visual small{font-size:9px;margin-top:auto;text-align:right}.paper-blue{background:#dce4da;border-color:#9faa9b}.artifact-card>.source-label{margin-top:12px}.bookmark-card,.note-card{padding:23px;background:#243c4c94;border:1px solid var(--line);border-radius:5px;overflow-wrap:anywhere}.bookmark-card h3{margin:12px 0;font-size:22px}.bookmark-card blockquote,.note-card>p{font:16px/2 var(--serif);white-space:pre-wrap}.note-kind{font-size:10px;color:#dac49b}.note-intro{margin-bottom:20px;font-size:11px;color:#b5c4cc}.note-intro p{margin:0 0 15px}.settings-screen{max-width:900px;margin:0 auto}.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;flex-shrink:0;margin:8px 0 17px}.settings-heading h2{font-size:29px}.settings-tabs{display:flex;gap:7px;border-bottom:1px solid var(--line);padding-bottom:12px;margin-bottom:20px;flex-shrink:0;flex-wrap:wrap}.settings-tabs button{font-size:12px;padding:8px 15px;min-height:40px;color:#a9bdc9;border:1px solid transparent;border-radius:5px}.settings-tabs button:hover{background:#dcc3970d;color:#dce4e2}.settings-tabs .active{color:#f1dfbd;background:#dcc39716;border-color:#d3b98038}.settings-tabs .active:hover{background:#dcc3971f}.settings-content{flex:1;overflow:auto;min-height:0;scrollbar-width:thin}.settings-card{padding:25px 30px;border:1px solid var(--line);border-radius:6px;background:#20384782}.settings-card h3{font-size:22px}.settings-card>p{font-size:12px;color:#b7c7cf}.settings-form{display:flex;flex-direction:column;gap:0;min-width:0}.settings-form-body{display:flex;flex-direction:column;gap:14px;min-width:0}.settings-form h3{font-size:20px}.settings-lead{font-size:11px;color:#a9bcc6;margin:-6px 0 2px}.setting-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;margin-bottom:0}.settings-card label,.dialog-content label:not(.check-row){display:flex;flex-direction:column;gap:8px;font-size:12px;color:#d7dfde}.settings-card label{margin:0}.setting-field{min-width:0}.setting-label{color:#e8e0d2;line-height:1.5}.setting-field input,.setting-field select{min-width:0}.field-hint{display:block;font-size:10px;line-height:1.6;color:#91a6b1;font-weight:400;overflow-wrap:anywhere}.settings-card .switch-row{flex-direction:row;justify-content:space-between;align-items:center;padding:10px 12px;gap:14px;min-height:48px;border:1px solid #cbb98d2b;border-radius:5px;background:#122a3a66}.switch-row>span{display:grid;gap:2px;min-width:0}.switch-row strong{font-size:12px;font-weight:400;color:#e8e0d2}.switch-row small{font-size:9px;line-height:1.55;color:#95aab5}.settings-card .switch-row:focus-within,.settings-card .setting-field:focus-within{outline:1px solid #d8ba8054;outline-offset:2px}.settings-save-row{display:flex;align-items:center;gap:13px;flex-wrap:wrap;border-top:1px solid var(--line);padding:12px 0 2px;margin-top:12px;flex-shrink:0;background:transparent}.settings-save-row .primary{min-width:160px;min-height:44px;padding:10px 22px;font-size:12px}.settings-save-note{font-size:10px;line-height:1.6;color:#9db1bb;flex:1;min-width:150px}.settings-form input:user-invalid{border-color:#d99b88;background:#341f23}.settings-actions{display:flex;flex-wrap:wrap;gap:10px;margin:22px 0}.settings-actions button{font-size:12px}.settings-card[tabindex]:focus-visible{outline:1px solid #d8ba8054;outline-offset:2px}.settings-card h3.service-title{margin:26px 0 10px}.settings-card p.service-state{font-size:12px;color:#cfc6a7;display:flex;align-items:center;gap:6px;margin:12px 0}.settings-card p.service-state.paused{color:#e4cda9}.settings-card p.service-state.off{color:#a9beca}.usage-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:16px 0 8px;padding:14px;border:1px solid #cbb98d2b;border-radius:5px;background:#122a3a66}.usage-summary>div{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}.usage-summary span{font-size:10px;line-height:1.5;color:#95aab5}.usage-summary strong{font-size:17px;line-height:1.3;font-weight:400;color:#f1dfbd;font-variant-numeric:tabular-nums}.settings-card p.small{font-size:11px}.settings-card>.primary{min-width:150px}.empty-state{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:14px;min-height:0;flex:1;padding:30px 20px}.empty-state>span{font-size:38px;line-height:1;color:var(--gold)}.empty-state h2{font-size:25px}.empty-state p{color:#adbec6;font-size:12px;max-width:400px;margin:0 0 8px}.collection-body>.empty-state{height:100%}

/* Secondary functions are menus, rather than permanent buttons. */
input:not([type=checkbox]),textarea,select{width:100%;border:1px solid #cbb98d40;border-radius:4px;background:#132735;color:#eee6d7;padding:9px 12px;outline:none}input:focus,textarea:focus,select:focus{border-color:#d5ba8299}option{background:#203544;color:#eee4d0}input[type=checkbox]{accent-color:#d7c08f;width:18px;height:18px;flex-shrink:0}dialog{margin:auto;padding:0;border:1px solid #d2bb8470;border-radius:7px;background:#203545;color:var(--ink);width:min(550px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;scrollbar-width:thin;box-shadow:0 20px 90px #0009}dialog::backdrop{background:#07131fba;backdrop-filter:blur(7px)}.dialog-content{padding:35px 33px 29px}.dialog-content>h2{font-size:26px;margin:8px 0 19px}.dialog-content>p{font-size:12px;color:#c4d0d5;line-height:1.9}.dialog-content label:not(.check-row){margin:18px 0}.dialog-content>.primary{margin-top:8px}.dialog-content>.text-link{display:block;margin-top:13px}.dialog-close{position:absolute;top:8px;right:8px;width:40px;height:40px;display:grid;place-items:center;border-radius:50%;font-size:22px;line-height:1;background:#193040e6;border:1px solid #d7c29935;color:#e9dcc4;z-index:4}.dialog-close:hover,.dialog-close:focus-visible{background:#d7c2991f;border-color:#d7c29970;color:#f3e4c8}.dialog-content>h2{padding-right:36px}.menu-options{display:grid;gap:7px}.menu-options button{justify-content:flex-start;min-height:44px;padding:10px 14px;border:1px solid transparent;border-radius:5px}.menu-options button:hover{background:#e2c89b10;border-color:#cfbd9630}.menu-options .danger,.menu-options [data-action=clearChat]{color:#ebb4a2;border-color:#e5bca826;margin-top:4px}.menu-options .danger:hover,.menu-options [data-action=clearChat]:hover{background:#e5bca810;border-color:#e5bca852}.modal-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:23px}.gate-art{height:145px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:linear-gradient(90deg,#152b3edb,#152b3ec5),url('../images/story/bookshop.svg') center/cover}.gate-art>span{font:36px var(--serif);letter-spacing:.25em;color:#eed6a9}.gate-art small{font:10px var(--serif);letter-spacing:.1em;color:#d7c6a4}#gate .dialog-content{padding-top:21px}#gate h2{font-size:24px}.check-row{display:flex;align-items:center;gap:10px;margin:17px 0;font-size:11px}.check-row:last-of-type{margin-bottom:22px}.preview-scene{height:220px;position:relative;overflow:hidden;background-size:cover;background-position:center;margin:18px -33px}.preview-scene[data-scene=bookshop]{background-image:url('../images/story/bookshop.svg')}.preview-scene[data-scene=studio]{background-image:url('../images/story/studio.svg')}.preview-scene .portrait{height:400px;position:absolute;bottom:-140px;left:calc(50% - 118px)}.chapter-grid{display:grid;gap:11px;margin-top:20px}.chapter-card{display:flex;align-items:center;gap:17px;text-align:left;padding:18px;border:1px solid var(--line);border-radius:4px;background:#122a3a66}.chapter-card.current{border-color:#d3b78088;background:#cdb27d0a}.chapter-number{font:30px Georgia,serif;color:#c8b184}.chapter-status{font-size:8px;color:#b4c0bd}.chapter-card h3{font-size:20px;margin:4px 0}.chapter-card p{font-size:10px;color:#a3b9c6;line-height:1.7;margin:0}.card-arrow{margin-left:auto;color:#dbc28f}.branch-list{display:grid;gap:10px;margin:20px 0}.branch-list button{border:1px solid var(--line);padding:14px;display:flex;justify-content:space-between;align-items:center;font-size:12px;text-align:left;border-radius:4px;background:#132a3a7a}.branch-list .selected{border-color:#d3b98177}.branch-list small{display:block;font-size:9px;color:#a8bdc7;margin-top:5px}.activity-choices{display:grid;gap:10px;margin:20px 0}.activity-choices button{justify-content:flex-start}.character-contribution{font-family:var(--serif);border-left:1px solid var(--gold);padding-left:14px;color:#ecd7b2!important}.source-choices{padding-left:20px;font-size:12px}.source-choices li{padding:8px 0;border-bottom:1px solid var(--line)}.source-choices button{display:block;font-size:10px}.letter-body{font:17px/2 var(--serif)!important;color:#e5dfd2!important;white-space:pre-line}.letter-reactions{display:flex;flex-wrap:wrap;gap:7px;margin-top:20px}.reaction-reply{font:14px/2 var(--serif);color:#e0ccaa;border-top:1px solid var(--line);padding-top:14px}.toast{position:fixed;bottom:calc(85px + var(--safe-bottom));left:50%;transform:translateX(-50%);z-index:100;pointer-events:none;background:#1b3445f5;border:1px solid #cfb47d80;box-shadow:0 5px 30px #0005;border-radius:4px;padding:12px 22px;max-width:calc(100vw - 35px);font-size:11px;color:#f1dfbd;text-align:center}

html[data-text=large] .narrative{font-size:23px}html[data-text=large] .message p{font-size:18px}html[data-text=large] .message-status{font-size:15px}html[data-text=large] .message-label{font-size:11px}html[data-text=large] .message-label .turn-delete{font-size:11px}html[data-text=large] .chat-hint{font-size:11px}html[data-text=large] .chat-form textarea{font-size:15px}html[data-text=large] .choices button{font-size:16px}html[data-text=large] .history-item strong{font-size:13px}html[data-text=large] .history-preview{font-size:11px}html[data-text=large] .settings-card label,html[data-text=large] .settings-card .switch-row strong,html[data-text=large] .setting-label{font-size:13px}html[data-text=large] .field-hint,html[data-text=large] .switch-row small{font-size:11px}html[data-text=large] .settings-tabs button{font-size:13px}html[data-text=large] .setup-option-body strong{font-size:14px}html[data-text=large] .setup-option-body small{font-size:11px}html[data-text=large] .settings-save-note{font-size:11px}
@media(max-width:1100px){.companion-layout{grid-template-columns:220px minmax(280px,1fr);gap:14px;left:22px;right:22px}.chat-scene{display:none}.hero-content{left:7%;width:50%;top:26%}.hero h2{font-size:53px}.hero blockquote{font-size:17px;max-width:330px}.hero-character{left:44%;height:95%;bottom:-6%}.home-bottom{left:7%}.hero-actions{max-width:360px;gap:14px}.start-game{min-width:265px}.hero-actions>.start-game{flex-basis:100%}.stage-character{left:calc(55% - 24vh)}.collection-page,.settings-screen{left:30px;right:30px}.artifact-grid{gap:20px}.artifact-visual{padding:25px}.settings-card{padding:24px}.conversation-head{padding:17px 20px}.messages{padding:22px}.history-sidebar{padding:15px 10px 10px}.choices{width:49%}}
@media(max-width:800px){.companion-layout{grid-template-columns:1fr;left:22px;right:22px}.conversation-head>.icon-button:first-child{display:grid}.history-sidebar{display:none}.history-open .history-sidebar{display:flex;position:absolute;top:0;bottom:0;left:0;width:min(300px,85%);z-index:26;box-shadow:15px 0 40px #0005}.history-heading .icon-button{display:grid}.history-open .history-shade{display:block;position:absolute;inset:0;background:#071723a8;z-index:25}.history-list{padding-right:3px}.hero-content{width:56%;top:27%}.hero h2{font-size:47px}.hero blockquote{font-size:16px;max-width:270px}.hero-character{left:30%;height:84%;bottom:3%}.home-bottom{bottom:115px}.choices{width:64%;margin-left:0}.stage-character{height:94vh;left:calc(54% - 24vh);bottom:0}.scene-label h2{font-size:24px}.narrative{font-size:18px}.bookmark-grid,.notes-grid{grid-template-columns:1fr}.collection-heading{margin-bottom:15px}.collection-heading h2{font-size:27px}.segmented{gap:18px}}
@media(max-width:600px){
 :root{--top:67px;--bottom:76px}.topbar{padding:0 23px}.brand{font-size:26px}.save-status{font-size:8px}.top-actions{gap:12px}.hud-button{font-size:18px;min-width:30px;min-height:30px}.rail{bottom:calc(14px + var(--safe-bottom));padding:4px;width:calc(100% - 60px);max-width:360px}.rail nav{gap:3px}.nav-item{min-width:0;flex:1;min-height:37px;padding:7px 12px;font-size:11px}.nav-item i{right:16px;top:10px}.hero-character{height:78%;left:calc(55% - 15vh);bottom:12%;opacity:.94}.hero:after{content:'';position:absolute;inset:23% 0 0;background:linear-gradient(0deg,#152736f7,#15273696 62%,transparent);pointer-events:none}.hero-content{left:7%;right:7%;width:auto;top:auto;bottom:223px;z-index:2}.hero-pretitle{font-size:10px;letter-spacing:.05em;margin-bottom:9px}.hero h2{font-size:43px;line-height:1.6;letter-spacing:.05em}.hero blockquote{font-size:14px;margin:16px 0 24px;max-width:260px}.hero-actions{display:grid;grid-template-columns:auto auto;gap:13px 23px;justify-content:start;max-width:none}.hero-actions>.start-game{grid-column:1/-1;min-width:0;width:260px;min-height:61px;padding:12px 18px}.start-game>span:nth-child(2){font-size:14px;letter-spacing:.04em}.start-game small{font-size:8px}.hero-actions>.ghost-light{font-size:10px;width:max-content;justify-content:flex-start;min-height:28px}.home-bottom{left:7%;right:7%;bottom:103px}.home-bottom>.eyebrow{font-size:9px;margin-bottom:10px}.character-tabs{gap:10px}.character-tab{min-width:0;flex:1;padding:6px 9px 6px 6px;gap:8px}.character-thumb{width:32px;height:37px;flex-shrink:0}.character-thumb img{width:50px;transform:translate(-9px,-2px)}.character-tab>span:nth-child(2){font-size:14px}.character-tab small{font-size:7px;white-space:nowrap;margin-top:3px}.tab-mark{font-size:10px}
 .companion-layout{left:14px;right:14px;gap:0}.chat-panel{border-radius:6px}.conversation-head{padding:14px 15px;min-height:73px;gap:9px}.conversation-head h2{font-size:18px}.conversation-head>div>span{font-size:9px;max-width:175px;margin-top:3px}.conversation-head>.text-link{font-size:9px}.conversation-head .icon-button{width:36px;height:36px;font-size:20px}.messages{padding:20px 15px}.message{padding:10px 12px;margin-bottom:15px;max-width:96%}.message.user{max-width:88%}.message p{font-size:13px;line-height:1.95}.message-label{font-size:10px}.message-label .turn-delete{min-height:32px;font-size:10px;padding:2px 10px}.message-state{font-size:9px}.message-status{font-size:12px}.message-tools,.message-actions{gap:14px;margin-top:6px}.message-tools .text-link,.message-actions .text-link{font-size:10px;min-height:24px}.chat-composer .chat-form{margin-bottom:5px}.chat-form{margin:0 12px 12px;padding:10px 10px 10px 13px;gap:9px}.chat-form textarea{font-size:12px;min-height:30px}.chat-hint{margin:0 15px 10px;font-size:10px}.send-button{height:31px;width:31px;font-size:19px}.chat-empty p{font-size:14px}.chat-empty>span{font-size:28px}.history-open .history-sidebar{width:min(285px,87%)}.history-sidebar{padding:17px 12px}.history-heading h2{font-size:16px}.history-item{padding:13px 11px}.history-preview{font-size:11px}.history-item strong{font-size:13px}
 .story-toolbar{left:20px;right:20px;top:var(--top)}.round-tool{font-size:9px;padding:5px 11px;min-height:29px}.story-toolbar>div{gap:6px}.scene-label{top:122px;left:23px}.scene-label>span{font-size:8px}.scene-label h2{font-size:22px;margin:6px 0}.scene-label small{font-size:9px}.stage-character{height:87vh;bottom:6vh;left:calc(54% - 24vh)}.vn-bottom{left:16px;right:16px;gap:20px;max-height:calc(100% - 126px)}.choices{width:100%;margin-left:0;gap:7px}.choice-prompt{font-size:9px;margin-bottom:1px}.choices button{min-height:46px;padding:11px 14px;font-size:14px;gap:12px}.choice-index{font-size:8px}.choices button>b{font-size:12px}.dialogue{padding:28px 20px 10px;border-radius:4px 12px 4px 4px}.speaker-name{top:-14px;left:17px;font-size:16px;padding:5px 20px 5px 12px;gap:9px}.speaker-name small{font-size:6px}.speaker-diamond{font-size:6px}.narrative{font-size:16px;line-height:1.95;min-height:63px;max-height:25vh;letter-spacing:.025em}.dialogue-foot{gap:8px;margin-top:8px;padding-top:6px}.read-controls,.dialogue-tools{gap:11px}.read-controls>span{font-size:8px}.line-back{font-size:18px;padding:0 5px;min-height:28px}.dialogue-foot .text-link{font-size:9px}.advance-line{font-size:10px;gap:10px;padding:0 2px;min-height:28px}.advance-line span{font-size:18px}.waiting-choice{font-size:9px}.waiting-choice>span{margin-left:5px}.voice-caption{left:22px;top:25%;font-size:12px;max-width:225px;padding:9px 12px}.story-chat-drawer{right:16px;width:calc(100% - 32px);top:110px;padding:20px}.drawer-heading h2{font-size:18px}.story-chat-drawer>.small{font-size:10px}.story-chat-drawer .chat-hint{margin:4px 2px 0;font-size:9px;line-height:1.5}.close-drawer{font-size:23px}.chapter-finish{gap:16px;left:23px;right:23px}.chapter-finish h2{font-size:26px}.finish-mark{font-size:43px}.chapter-finish blockquote{font-size:16px}.finish-summary{font-size:11px}.chapter-finish>p:first-of-type{font-size:10px}.finish-actions{gap:10px;max-width:300px}.finish-actions .primary,.finish-actions .secondary{width:100%;font-size:11px;min-height:37px;padding:8px 15px}.finish-letter{font-size:9px;max-width:280px}.relationship-result{font-size:20px}.relationship-result small{font-size:9px}
 .collection-page,.settings-screen{left:22px;right:22px}.collection-heading{margin:3px 0 14px}.collection-heading h2{font-size:25px}.memory-header{gap:12px;flex-wrap:wrap;margin-bottom:15px;padding-bottom:14px}.segmented{width:100%;justify-content:space-between;gap:9px}.segmented button{font-size:10px;padding:7px 0}.memory-header>.secondary{font-size:10px;margin-left:auto;min-height:31px;padding:5px 12px}.collection-body{padding-right:2px}.memory-context{font-size:9px;gap:9px;margin-bottom:13px}.memory-context .text-link{font-size:9px}.timeline{padding-left:18px;margin-left:3px}.timeline-card{padding:20px 17px;margin-bottom:16px}.timeline-dot{left:-23px;width:7px;height:7px;top:28px}.timeline-card .eyebrow{font-size:8px;letter-spacing:.04em}.timeline-card h2{font-size:21px}.timeline-card>p{font-size:14px;line-height:1.95}.card-footer{gap:12px}.card-footer .source-label{font-size:9px;width:100%}.card-footer .text-link{font-size:10px}.artifact-grid,.bookmark-grid,.notes-grid{grid-template-columns:1fr;gap:18px}.artifact-visual{min-height:280px;padding:26px}.artifact-visual h3{font-size:24px}.artifact-visual p{font-size:15px}.artifact-card .source-label{font-size:9px}.bookmark-card,.note-card{padding:20px}.bookmark-card blockquote,.note-card>p{font-size:15px}.note-intro{font-size:10px;margin-bottom:17px}.chip{font-size:9px;padding:5px 10px}.settings-heading{margin:3px 0 14px}.settings-heading h2{font-size:25px}.settings-tabs{gap:6px;margin-bottom:15px}.settings-tabs button{font-size:11px;padding:7px 12px;min-height:38px}.settings-card{padding:20px}.settings-form{gap:12px}.setting-fields{grid-template-columns:1fr;gap:13px;margin-bottom:0}.settings-card label{font-size:11px;gap:6px}.settings-card .switch-row{padding:9px 11px;min-height:48px}.setting-fields input:not([type=checkbox]),.setting-fields select{padding:8px 10px;font-size:12px}.settings-card h3{font-size:20px}.settings-card>p{font-size:11px}.settings-actions{gap:9px;margin:18px 0}.settings-actions button{font-size:11px;padding:9px 12px;min-height:39px}.settings-save-row{padding-top:14px;gap:10px}.settings-save-row .primary{width:100%;min-height:42px;font-size:12px}.settings-save-note{display:none}.settings-card>.primary{min-height:38px;font-size:11px}.empty-state{gap:13px;padding:20px 15px}.empty-state>span{font-size:31px}.empty-state h2{font-size:22px}.empty-state p{font-size:11px}.empty-state .primary{font-size:11px;min-height:38px}
 dialog{max-height:calc(100dvh - 28px)}.dialog-content{padding:31px 25px 25px}.dialog-content>h2{font-size:23px}.dialog-content>p{font-size:11px}.dialog-content .eyebrow{font-size:8px}.dialog-content label:not(.check-row){font-size:11px}.gate-art{height:110px}.gate-art>span{font-size:31px}.gate-art small{font-size:9px}#gate h2{font-size:22px}.check-row{font-size:10px;align-items:flex-start;line-height:1.7}.check-row input{margin-top:0;width:17px;height:17px}.preview-scene{margin-left:-25px;margin-right:-25px;height:195px}.preview-scene .portrait{height:360px;bottom:-130px;left:calc(50% - 106px)}.chapter-card{gap:13px;padding:15px 12px}.chapter-card h3{font-size:18px}.chapter-card p{font-size:9px}.chapter-number{font-size:27px}.chapter-status{font-size:7px}.letter-body{font-size:15px!important}.letter-reactions .chip{font-size:9px}.reaction-reply{font-size:12px}.script-log p{font-size:15px}.toast{bottom:calc(83px + var(--safe-bottom));font-size:10px;padding:10px 17px;width:max-content}html[data-text=large] .narrative{font-size:19px}html[data-text=large] .message p{font-size:16px}html[data-text=large] .choices button{font-size:15px}html[data-text=large] .chat-form textarea{font-size:14px}html[data-text=large] .settings-card label,html[data-text=large] .setting-label,html[data-text=large] .settings-card .switch-row strong{font-size:12px}html[data-text=large] .field-hint,html[data-text=large] .switch-row small{font-size:10px}html[data-text=large] .settings-tabs button{font-size:12px}html[data-text=large] .setup-option-body strong{font-size:13px}html[data-text=large] .setup-option-body small{font-size:10px}
}
@media(max-height:720px) and (min-width:601px){.hero-content{top:23%}.hero h2{font-size:49px}.hero blockquote{font-size:16px;margin:16px 0 23px}.hero-actions{max-width:440px;gap:14px}.hero-actions>.start-game{flex-basis:auto;min-width:235px;padding:11px 17px;min-height:62px}.home-bottom{bottom:103px}.hero-pretitle{font-size:10px}.hero-character{height:104%;bottom:-15%}.scene-label{top:122px}.narrative{font-size:17px;min-height:50px}.dialogue{padding:29px 26px 10px}.choices{gap:6px}.choices button{min-height:44px;padding:9px 17px;font-size:14px}.vn-bottom{gap:19px}.settings-heading{margin-bottom:12px}.settings-tabs{margin-bottom:15px}.settings-card{padding:21px}.setting-fields{gap:13px 25px;margin-bottom:0}.chapter-finish{gap:12px}.finish-mark{font-size:42px}.chapter-finish h2{font-size:28px}.chapter-finish blockquote{font-size:16px}.finish-summary{font-size:11px}}
@media(max-width:600px) and (max-height:650px){.hero-content{bottom:204px}.hero h2{font-size:35px}.hero blockquote{font-size:13px;margin:12px 0 19px}.hero-pretitle{font-size:9px;margin-bottom:7px}.hero-actions>.start-game{width:235px;min-height:55px;padding:10px 14px}.home-bottom{bottom:96px}.home-bottom>.eyebrow{font-size:8px;margin-bottom:8px}.character-tab{gap:6px;padding:5px 6px}.character-thumb{width:28px;height:32px}.character-thumb img{width:44px;transform:translate(-8px,-2px)}.character-tab>span:nth-child(2){font-size:13px}.character-tab small{font-size:6px}.hero-character{bottom:15%;height:82%;left:38%}.scene-label{top:116px}.scene-label h2{font-size:19px}.scene-label small{display:none}.dialogue{padding:25px 15px 8px}.narrative{font-size:14px;min-height:48px;line-height:1.9;max-height:24vh}.vn-bottom{gap:18px;max-height:calc(100% - 118px)}.choices{gap:5px}.choices button{font-size:13px;min-height:40px;padding:9px 12px}.choice-prompt{font-size:8px}.speaker-name{font-size:14px;top:-13px;padding:4px 18px 4px 11px}.dialogue-foot{margin-top:6px;padding-top:4px}.read-controls,.dialogue-tools{gap:8px}.dialogue-foot .text-link,.waiting-choice{font-size:8px}.settings-card{padding:17px}.setting-fields{gap:10px;margin-bottom:0}.settings-tabs{margin-bottom:12px;padding-bottom:7px}.setting-fields input:not([type=checkbox]),.setting-fields select{padding:6px 9px}.settings-card label{gap:5px;font-size:11px}.settings-card .switch-row{padding:8px 10px;min-height:44px}.settings-save-row{padding-top:10px;gap:8px}.settings-save-row .primary{min-height:38px;padding:8px 16px;font-size:11px}.settings-save-note{display:none}.settings-heading{margin-bottom:9px}.chapter-finish{gap:10px}.chapter-finish h2{font-size:24px}.finish-mark{font-size:34px}.chapter-finish blockquote{font-size:14px}.finish-summary{font-size:10px}.finish-actions{gap:8px}.finish-actions .primary,.finish-actions .secondary{min-height:33px;font-size:10px;padding:7px 12px}.finish-letter{font-size:8px}.relationship-result{font-size:18px}.relationship-result small{font-size:8px}.memory-header{padding-bottom:12px;margin-bottom:12px}.collection-heading{margin-bottom:10px}.conversation-head{min-height:66px;padding:12px 12px}.messages{padding:15px 12px}.chat-form{margin-bottom:10px}
}
@media(max-height:480px) and (min-width:601px){:root{--top:55px;--bottom:58px}.topbar{padding:0 28px}.brand{font-size:24px}.rail{bottom:8px;padding:3px}.nav-item{min-height:31px;min-width:88px;font-size:10px;padding:5px 19px}.hero-content{top:22%;left:6%;width:48%}.hero h2{font-size:39px}.hero-pretitle{font-size:9px;margin-bottom:6px}.hero blockquote{font-size:12px;margin:10px 0 16px;max-width:340px}.hero-actions{gap:12px;max-width:380px}.hero-actions>.start-game{min-width:210px;min-height:49px;padding:8px 13px;gap:12px}.start-game>span:nth-child(2){font-size:13px}.start-game small{font-size:7px}.hero-actions>.ghost-light{font-size:9px;min-height:27px}.hero-character{height:124%;bottom:-29%;left:47%}.home-bottom{left:auto;right:4%;bottom:78px}.home-bottom>.eyebrow{display:none}.character-tab{min-width:0;padding:5px 8px;gap:8px}.character-tab>span:nth-child(2){font-size:12px}.character-tab small{font-size:6px}.character-thumb{width:27px;height:31px}.character-thumb img{width:42px;transform:translate(-8px,-2px)}.character-tabs{gap:8px}.companion-layout{left:20px;right:20px;grid-template-columns:200px minmax(280px,1fr);gap:12px}.conversation-head{min-height:58px;padding:9px 15px}.conversation-head h2{font-size:17px}.conversation-head>div>span{font-size:8px;margin-top:1px}.history-sidebar{padding:10px}.history-heading{margin-bottom:6px}.history-heading h2{font-size:12px}.history-search{margin-bottom:5px}.history-search input{padding:6px 8px;font-size:10px}.history-foot{display:none}.history-item{padding:8px;gap:4px}.history-preview{font-size:9px;-webkit-line-clamp:1}.history-meta{font-size:7px}.messages{padding:14px 17px}.message p{font-size:12px}.chat-form{padding:7px 10px;margin:0 14px 10px}.chat-form textarea{font-size:12px;min-height:27px}.chat-hint{margin:2px 16px 5px;font-size:9px;line-height:1.4}.send-button{width:29px;height:29px}.scene-label{top:94px;left:5%}.scene-label>span{font-size:8px}.scene-label h2{font-size:19px;margin:5px 0}.scene-label small{display:none}.story-toolbar{top:56px}.round-tool{font-size:8px;min-height:26px;padding:4px 10px}.stage-character{height:145vh;bottom:-46vh;left:46%}.vn-bottom{left:5%;right:5%;gap:14px;padding-top:14px;max-height:calc(100% - 94px)}.vn-bottom.choosing .choices{position:absolute;bottom:calc(100% + 12px);width:43%;margin:0;gap:5px;max-height:44vh;overflow:auto}.choice-prompt{display:none}.choices button{font-size:12px;min-height:36px;padding:7px 12px;gap:10px}.dialogue{padding:22px 21px 7px}.narrative{font-size:14px;min-height:37px;line-height:1.8;max-height:20vh}.speaker-name{font-size:14px;top:-13px;left:20px;padding:4px 18px 4px 12px;gap:9px}.speaker-name small{font-size:6px}.dialogue-foot{padding-top:2px;margin-top:5px}.line-back{min-height:23px;font-size:18px}.dialogue-foot .text-link,.waiting-choice{font-size:9px}.advance-line{min-height:25px;font-size:10px}.story-chat-drawer{top:90px;width:45vw;padding:15px}.story-chat-drawer>.small{font-size:9px;margin:6px 0}.drawer-heading h2{font-size:17px}.voice-caption{top:28%;font-size:11px;max-width:250px}.chapter-finish{gap:7px}.finish-mark{display:none}.chapter-finish h2{font-size:24px}.chapter-finish blockquote{font-size:13px}.finish-summary{font-size:10px;max-width:600px}.finish-actions{gap:10px}.finish-actions button{min-height:32px;padding:7px 14px;font-size:10px}.finish-letter{font-size:9px}.settings-heading{margin:0 0 8px}.settings-heading h2,.collection-heading h2{font-size:23px}.settings-tabs{padding-bottom:6px;margin-bottom:10px}.settings-tabs button{font-size:10px;padding:4px 10px;min-height:36px}.settings-card{padding:15px 20px}.setting-fields{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 18px;margin-bottom:0}.settings-card label{font-size:11px;gap:4px}.setting-fields input:not([type=checkbox]),.setting-fields select{padding:6px 8px;font-size:11px}.settings-save-row{padding-top:10px;gap:8px}.settings-save-row .primary{min-height:34px;padding:6px 16px;font-size:11px}.settings-save-note{display:none}.settings-card .switch-row{padding:6px 9px;min-height:40px}.settings-card>p{font-size:10px;margin:9px 0}.settings-card h3{font-size:18px}.settings-actions{margin:12px 0}.settings-actions button{min-height:32px;font-size:10px;padding:7px 12px}.collection-heading{margin:0 0 8px}.memory-header{padding-bottom:10px;margin-bottom:12px}.segmented button{font-size:10px}.empty-state{padding:12px 15px;gap:10px}.empty-state h2{font-size:21px}.empty-state p{font-size:11px}.empty-state>span{font-size:28px}.history-open .history-sidebar{display:flex}.history-shade{display:none!important}html[data-text=large] .narrative{font-size:18px}html[data-text=large] .choices button{font-size:13px}html[data-text=large] .chat-form textarea{font-size:13px}}
@media(min-width:601px) and (max-width:800px) and (max-height:480px){.companion-layout{grid-template-columns:minmax(0,1fr);gap:0}.history-open .history-sidebar{display:flex;width:265px}.history-open .history-shade{display:block!important}.chat-panel{width:100%}}
@media(max-width:600px) and (max-height:650px){.chapter-finish .finish-mark{display:none}.chapter-finish{gap:8px}}
@media(max-height:480px){.chat-empty>span{display:none}.chat-empty p{margin:8px 0}.chapter-finish>p:first-of-type{display:none}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}html[data-motion=reduce] *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
.scene-label{z-index:1}.story-free .stage-character{left:calc(42% - 24vh)}.setup-form{display:grid;gap:17px;min-width:0}.setup-heading h2{padding-right:36px}.setup-heading p{font-size:12px;color:var(--muted);margin:4px 0 0}.setup-group{border:0;border-top:1px solid var(--line);padding:13px 0 0;margin:0;min-width:0}.setup-group legend{font-size:13px;color:var(--gold);padding:0 9px 0 0}.setup-mode-grid,.setup-choice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.dialog-content label.setup-option{position:relative;display:flex;flex-direction:row;align-items:flex-start;gap:10px;padding:11px 12px;margin:0;border:1px solid #cbb98d35;border-radius:6px;background:#142a38;cursor:pointer;min-width:0;min-height:54px}.setup-option:hover{border-color:#d8c49866;background:#19313f}.setup-option:has(input:checked){border-color:#e2c89bd9;background:#2b433f;box-shadow:inset 0 0 0 1px #e2c89b3d}.setup-option:has(input:focus-visible){outline:2px solid var(--gold);outline-offset:2px}.setup-option input{width:16px;height:16px;margin:3px 0 0;flex:0 0 16px;accent-color:var(--gold)}.setup-option-body{display:grid;gap:3px;min-width:0;flex:1}.setup-option-body strong{font-size:13px;color:#f4ecde;line-height:1.5}.setup-option-body small{font-size:10px;line-height:1.65;color:#b7c5cb}.setup-mode-description{font-size:11px;color:#b3c3ca;margin:8px 0 0}.setup-opening{display:grid;gap:5px;font-size:12px;color:#e2d7c2}.setup-opening span{font-size:10px;line-height:1.6;color:var(--muted)}.setup-opening textarea{min-height:70px;resize:vertical}.setup-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;padding-top:8px;border-top:1px solid var(--line);flex-wrap:wrap}.setup-footer .primary{min-width:140px}dialog:has(#storySetupForm){width:min(710px,calc(100vw - 32px))}.dialog-content:has(.setup-form){padding:27px 30px 24px}.dialog-content:has(.setup-form) .setup-pace-grid .setup-option{padding:9px}.dialog-content:has(.setup-form) .setup-pace-grid .setup-option-body small{font-size:9px}
.dialog-content label.setup-opening{margin:0;gap:7px}.setup-field-label{display:flex;align-items:baseline;gap:10px;font-size:16px;line-height:1.6;font-weight:600;color:var(--ink)}.setup-field-label small{font-size:10px;font-weight:400;color:var(--muted)}.setup-opening>.field-hint{font-size:11px;line-height:1.7}.history-actions{display:flex;justify-content:flex-end;gap:6px;margin:0 8px 4px}.history-actions .history-delete{margin:0}.history-rename{min-height:32px;padding:3px 9px;font-size:10px;color:var(--gold);border:1px solid var(--line);border-radius:4px}.history-rename:hover,.history-rename:focus-visible{background:var(--surface-choice-hover);border-color:var(--gold)}.conversation-head h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:600px){.story-free .stage-character{left:calc(45% - 24vh)}.setup-mode-grid,.setup-choice-grid{grid-template-columns:1fr;gap:6px}.setup-option{padding:10px;min-height:52px}.setup-option-body strong{font-size:12px}.setup-option-body small{font-size:10px;line-height:1.6}.setup-form{gap:13px}.dialog-content:has(.setup-form){padding:24px 19px 20px}}
.settings-content:has(.settings-form){display:flex;flex-direction:column;overflow:hidden}.settings-card:has(.settings-form){flex:1;min-height:0;display:flex;flex-direction:column}.settings-form{flex:1;min-height:0;gap:0}.settings-form-body{flex:1;min-height:0;overflow:auto;padding-right:4px;scrollbar-width:thin;scrollbar-color:#b6baa03f transparent;overscroll-behavior:contain}.settings-save-row{flex-shrink:0}
@media(max-height:480px) and (min-width:601px){.settings-form-body>h3,.settings-form-body>.settings-lead{display:none}}
.setting-sound-field{grid-column:1/-1}.sound-volume{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.sound-volume input[type=range]{flex:1;min-width:100px;padding:0;border:0;background:transparent;accent-color:#d8ba80}.sound-volume output{min-width:3em;text-align:right;color:#e8e0d2;font-size:11px;font-variant-numeric:tabular-nums}.sound-volume button{min-height:34px;padding:6px 11px;font-size:11px}.sound-volume button:disabled{opacity:.45;cursor:default}.sound-volume .field-hint{flex-basis:100%}html[data-text=large] .sound-volume output{font-size:12px}html[data-text=large] .sound-volume button{font-size:12px}
.world-scene{position:absolute;width:100%;height:100%;inset:0;object-fit:cover;object-position:center}.conversation-head>div>.chat-place{font-size:9px;color:#cebd99;white-space:normal;line-height:1.5;margin-top:3px}
.history-entry{border:1px solid transparent;border-radius:6px;margin-bottom:7px;padding-bottom:3px}.history-entry.selected{border-color:#d6c29c29;background:#d6c29c08}.history-entry .history-item{margin:0;border-color:transparent}.history-entry .history-item.selected{border-color:transparent;background:none}.history-delete{display:block;margin:0 8px 4px auto;min-height:32px;padding:3px 9px;font-size:10px;color:#cbb6aa;border:1px solid #cfbd9626;border-radius:4px}.history-delete:hover,.history-delete:focus-visible{background:#432f30cc;color:#f0c6b4;border-color:#dfa99273}.message-narration{border-left:2px solid #bca57866;margin:8px 0 12px;padding:4px 0 4px 12px}.message-narration>span{font-size:9px;color:#c9bd9f;letter-spacing:.04em}.message-narration p{color:#b8c6c9;font-size:13px;line-height:1.9}.rephrase-preview>p{white-space:pre-wrap}
html[data-text=large] .usage-summary strong{font-size:19px}html[data-text=large] .usage-summary span{font-size:12px}html[data-text=large] .settings-card p.small{font-size:12px}html[data-text=large] .settings-card p.service-state{font-size:14px}
@media(max-width:600px),(max-height:720px){.usage-summary{grid-template-columns:1fr;gap:7px;padding:12px}.usage-summary>div{grid-template-columns:auto minmax(0,1fr);align-items:baseline;gap:10px}.usage-summary strong{text-align:right}}
.usage-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.usage-heading .secondary{min-height:40px;padding:8px 13px;font-size:12px;white-space:nowrap}.usage-heading button:disabled{opacity:.55;cursor:wait}
.message-expression{border-left-style:dotted}.message-narration p{white-space:pre-wrap}html[data-text=large] .message-narration p{font-size:17px}html[data-text=large] .message-narration>span{font-size:11px}
:root{--surface-backdrop:#152434;--surface-panel:#1d303d;--surface-raised:#203847;--surface-input:#132735;--surface-nav:#152633;--surface-story:#1a2c3c;--surface-choice:#243c4e;--surface-choice-hover:#496073;--surface-dialog:#203545;--accent-contrast:#28333a}
html[data-theme="pine"]{--bg:#14241d;--ink:#eef3eb;--muted:#b3c1b5;--line:#bfd0b533;--gold:#c8d8b8;--surface-backdrop:#13221b;--surface-panel:#1d3328;--surface-raised:#244033;--surface-input:#132a20;--surface-nav:#182c22;--surface-story:#1b3025;--surface-choice:#284538;--surface-choice-hover:#365b49;--surface-dialog:#20362b;--accent-contrast:#26352b}
html[data-theme="plum"]{--bg:#211a28;--ink:#f4edf4;--muted:#c2b2c8;--line:#d7b7dc38;--gold:#e2c1df;--surface-backdrop:#211a28;--surface-panel:#33283a;--surface-raised:#3b2e43;--surface-input:#281e30;--surface-nav:#2a2032;--surface-story:#302438;--surface-choice:#46344d;--surface-choice-hover:#5c4564;--surface-dialog:#35283c;--accent-contrast:#382c3c}
html[data-theme="coffee"]{--bg:#271f19;--ink:#f4eee5;--muted:#c6b8a7;--line:#d6bd9838;--gold:#e5c18f;--surface-backdrop:#261e18;--surface-panel:#382b21;--surface-raised:#433326;--surface-input:#2d221a;--surface-nav:#30251d;--surface-story:#392a20;--surface-choice:#4a3829;--surface-choice-hover:#624932;--surface-dialog:#3a2a20;--accent-contrast:#423326}
html[data-theme="paper"]{color-scheme:light;--bg:#f4efe5;--ink:#342c24;--muted:#6b5c4e;--line:#b7a48c88;--gold:#765338;--surface-backdrop:#f4efe5;--surface-panel:#fffbf3;--surface-raised:#f3eadd;--surface-input:#fffdf8;--surface-nav:#f0e6d6;--surface-story:#fffaf1;--surface-choice:#f5e8d6;--surface-choice-hover:#e8d5b8;--surface-dialog:#fffbf3;--accent-contrast:#fffaf3}
html[data-theme="mist"]{color-scheme:light;--bg:#eaf2f7;--ink:#243746;--muted:#50697b;--line:#a4bacb99;--gold:#2d617e;--surface-backdrop:#eaf2f7;--surface-panel:#f7fbfe;--surface-raised:#e2edf5;--surface-input:#fbfdff;--surface-nav:#dce9f2;--surface-story:#f4faff;--surface-choice:#dcebf5;--surface-choice-hover:#c5dce9;--surface-dialog:#f6fbff;--accent-contrast:#f8fcff}
html[data-theme="blossom"]{color-scheme:light;--bg:#f7edf0;--ink:#472f38;--muted:#795c68;--line:#c5a6b399;--gold:#895066;--surface-backdrop:#f7edf0;--surface-panel:#fff8fb;--surface-raised:#f3e3e9;--surface-input:#fffbfd;--surface-nav:#f0dfe6;--surface-story:#fff6fa;--surface-choice:#f4dfe8;--surface-choice-hover:#e8c9d6;--surface-dialog:#fff7fb;--accent-contrast:#fff9fc}
html[data-theme] .world-backdrop:after{background:linear-gradient(90deg,color-mix(in srgb,var(--surface-backdrop) 96%,transparent),color-mix(in srgb,var(--surface-backdrop) 67%,transparent) 42%,transparent),linear-gradient(0deg,color-mix(in srgb,var(--surface-backdrop) 93%,transparent),transparent 65%,color-mix(in srgb,var(--surface-backdrop) 63%,transparent))}
html[data-theme] .app-shell[data-view=companion] .world-backdrop:after{background:color-mix(in srgb,var(--surface-backdrop) 87%,transparent)}
html[data-theme] .app-shell[data-view=memories] .world-backdrop:after,html[data-theme] .app-shell[data-view=settings] .world-backdrop:after{background:color-mix(in srgb,var(--surface-backdrop) 93%,transparent)}
html[data-theme] .rail,html[data-theme] .chat-panel,html[data-theme] .history-sidebar,html[data-theme] .story-chat-drawer{background-color:var(--surface-panel)}
html[data-theme] .rail{background:color-mix(in srgb,var(--surface-nav) 94%,transparent)}
html[data-theme] .conversation-head,html[data-theme] .chat-form,html[data-theme] .history-search input,html[data-theme] .branch-list button,html[data-theme] .character-tab,html[data-theme] .chapter-card,html[data-theme] .usage-summary,html[data-theme] .settings-card .switch-row{background-color:var(--surface-input)}
html[data-theme] .settings-card,html[data-theme] .timeline-card,html[data-theme] .bookmark-card,html[data-theme] .note-card{background-color:var(--surface-raised)}
html[data-theme] .dialogue{background-color:var(--surface-story)}
html[data-theme] .choices button{background-color:var(--surface-choice)}
html[data-theme] .choices button:hover,html[data-theme] .choices button:focus-visible{background-color:var(--surface-choice-hover)}
html[data-theme] dialog{background-color:var(--surface-dialog)}
html[data-theme] input:not([type=checkbox]),html[data-theme] textarea,html[data-theme] select,html[data-theme] option{background-color:var(--surface-input)}
html[data-theme] .primary:not(.danger){background-color:var(--gold);border-color:var(--gold);color:var(--accent-contrast)}
html[data-theme] .primary:not(.danger):hover{background-color:color-mix(in srgb,var(--gold) 84%,white)}
html[data-theme] .speaker-name{background-color:var(--gold);color:var(--accent-contrast)}
html[data-theme] .character-tab.selected,html[data-theme] .settings-tabs .active{background-color:color-mix(in srgb,var(--gold) 11%,var(--surface-panel));border-color:color-mix(in srgb,var(--gold) 40%,transparent)}
html[data-theme] .settings-tabs .active,html[data-theme] .settings-tabs button:hover,html[data-theme] .brand,html[data-theme] .hero blockquote{color:var(--gold)}
html[data-theme] .character-thumb{background-color:var(--surface-raised)}
.theme-setting{grid-column:1/-1;border:0;border-top:1px solid var(--line);padding:12px 0 0;margin:0;min-width:0}
.theme-setting legend{font-size:12px;color:var(--gold);padding:0 8px 0 0}
.theme-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.settings-card .theme-choice{display:flex;flex-direction:row;align-items:center;gap:10px;min-height:54px;padding:8px 10px;border:1px solid var(--line);border-radius:5px;background:color-mix(in srgb,var(--surface-input) 72%,transparent);cursor:pointer}
.settings-card .theme-choice:has(input:checked){border-color:var(--gold);background:color-mix(in srgb,var(--gold) 9%,var(--surface-input))}
.settings-card .theme-choice input{width:16px;height:16px;margin:0;accent-color:var(--gold);flex:none}
.theme-swatch{width:36px;height:30px;border-radius:3px;flex:none;background:linear-gradient(135deg,var(--swatch-a) 0 50%,var(--swatch-b) 50%)}
.theme-swatch:after{content:"";display:block;width:10px;height:10px;border-radius:50%;margin:10px 0 0 20px;background:var(--swatch-c);border:1px solid color-mix(in srgb,var(--swatch-c) 70%,white)}
.theme-swatch[data-palette="deep"]{--swatch-a:#172431;--swatch-b:#304657;--swatch-c:#e2c89b}
.theme-swatch[data-palette="pine"]{--swatch-a:#14241d;--swatch-b:#315043;--swatch-c:#c8d8b8}
.theme-swatch[data-palette="plum"]{--swatch-a:#211a28;--swatch-b:#493752;--swatch-c:#e2c1df}
.theme-swatch[data-palette="coffee"]{--swatch-a:#271f19;--swatch-b:#4c392a;--swatch-c:#e5c18f}
.theme-swatch[data-palette="paper"]{--swatch-a:#f4efe5;--swatch-b:#fffbf3;--swatch-c:#765338}
.theme-swatch[data-palette="mist"]{--swatch-a:#eaf2f7;--swatch-b:#f7fbfe;--swatch-c:#2d617e}
.theme-swatch[data-palette="blossom"]{--swatch-a:#f7edf0;--swatch-b:#fff8fb;--swatch-c:#895066}
.theme-choice-copy{display:grid;gap:1px;min-width:0}
.settings-card .theme-choice-copy strong{font-size:11px;color:var(--ink);font-weight:400}
.settings-card .theme-choice-copy small{font-size:9px;line-height:1.45;color:var(--muted);overflow-wrap:anywhere}
@media(max-width:360px){.theme-options{grid-template-columns:1fr}.settings-card .theme-choice{min-height:48px}}
html[data-theme] .send-button{background:var(--gold);color:var(--accent-contrast)}
html[data-theme] .send-button:disabled{background:var(--muted)}
html[data-theme] .chat-scene{background:linear-gradient(0deg,var(--surface-input),color-mix(in srgb,var(--surface-raised) 35%,transparent))}
html[data-theme] .chat-scene:after{background:linear-gradient(0deg,var(--surface-input),transparent)}
html[data-theme] .stage-vignette{background:linear-gradient(0deg,color-mix(in srgb,var(--surface-backdrop) 50%,transparent),transparent)}
html[data-theme] .message p{color:var(--ink)}
html[data-theme] .message-narration p,html[data-theme] .field-hint,html[data-theme] .switch-row small,html[data-theme] .settings-lead,html[data-theme] .settings-card>p,html[data-theme] .settings-save-note,html[data-theme] .conversation-head>div>span,html[data-theme] .history-preview,html[data-theme] .chat-hint,html[data-theme] .chat-form textarea::placeholder{color:var(--muted)}
html[data-theme] .message-label,html[data-theme] .history-person,html[data-theme] .chat-place,html[data-theme] .usage-summary strong,html[data-theme] .nav-item.active,html[data-theme] .advance-line,html[data-theme] .message-narration>span{color:var(--gold)}
html[data-theme] input[type=checkbox],html[data-theme] .sound-volume input[type=range]{accent-color:var(--gold)}
html[data-theme] .dialog-close,html[data-theme] .round-tool,html[data-theme] .message-label .turn-delete,html[data-theme] .toast{background-color:var(--surface-nav)}
html[data-theme] .dialog-close{color:var(--ink)}
html[data-theme] .dialog-content label.setup-option{background-color:var(--surface-input)}
html[data-theme] .setup-option:has(input:checked){border-color:var(--gold);background:color-mix(in srgb,var(--gold) 13%,var(--surface-panel))}
@media(max-width:600px){html[data-theme] .hero:after{background:linear-gradient(0deg,var(--surface-backdrop),color-mix(in srgb,var(--surface-backdrop) 60%,transparent) 62%,transparent)}}
html[data-text=large] .theme-setting legend{font-size:13px}html[data-text=large] .theme-choice-copy strong{font-size:13px}html[data-text=large] .theme-choice-copy small{font-size:11px}
html[data-theme] .hero h2,html[data-theme] .narrative,html[data-theme] .choices button,html[data-theme] .character-tab,html[data-theme] .dialog-content label,html[data-theme] .setup-option-body strong,html[data-theme] .setting-label,html[data-theme] .switch-row strong,html[data-theme] .dialog-content input,html[data-theme] .dialog-content textarea,html[data-theme] .dialog-content select,html[data-theme] .chapter-card strong,html[data-theme] .branch-list button{color:var(--ink)}
html[data-theme] .hero-pretitle,html[data-theme] .hero-actions>.ghost-light,html[data-theme] .start-game small,html[data-theme] .character-tab small,html[data-theme] .home-bottom>.eyebrow,html[data-theme] .character-tabs .tab-mark,html[data-theme] .settings-tabs button,html[data-theme] .settings-card label,html[data-theme] .setup-option-body small,html[data-theme] .setup-mode-description,html[data-theme] .setup-opening span,html[data-theme] .history-foot,html[data-theme] .history-meta,html[data-theme] .read-controls,html[data-theme] .dialogue-foot .text-link,html[data-theme] .segmented button,html[data-theme] .note-intro,html[data-theme] .note-card>p,html[data-theme] .bookmark-card blockquote,html[data-theme] .timeline-card>p,html[data-theme] .timeline-card .source-label,html[data-theme] .sound-volume output,html[data-theme] .usage-summary span,html[data-theme] .settings-card p.service-state,html[data-theme] .chat-empty p{color:var(--muted)}
html[data-theme] .hero-actions>.start-game{color:var(--accent-contrast)}
html[data-theme] .hero-actions .start-game small{color:inherit;opacity:.8}
html[data-theme] .ghost-light:hover,html[data-theme] .round-tool:hover,html[data-theme] .dialog-close:hover,html[data-theme] .history-item:hover,html[data-theme] .chapter-card:hover,html[data-theme] .branch-list button:hover,html[data-theme] .dialog-content label.setup-option:hover{background-color:var(--surface-choice-hover);color:var(--ink)}
html[data-theme] .history-item strong,html[data-theme] .history-item.selected strong,html[data-theme] .timeline-card h2,html[data-theme] .collection-heading h2{color:var(--ink)}
html[data-theme] .scene-label h2,html[data-theme] .scene-label small,html[data-theme] .scene-label>span,html[data-theme] .scene-chapter{color:var(--ink);text-shadow:0 1px 6px var(--surface-backdrop)}
html[data-theme] .message-tools .text-link,html[data-theme] .settings-tabs .active,html[data-theme] .settings-tabs button:hover{color:var(--gold)}
html[data-theme] .primary.danger{background-color:var(--surface-choice);color:var(--ink);border-color:var(--gold)}
html[data-theme] input:not([type=checkbox]),html[data-theme] textarea,html[data-theme] select,html[data-theme] option,html[data-theme] .history-heading h2,html[data-theme] .chat-form textarea,html[data-theme] .message-label .turn-delete,html[data-theme] .toast{color:var(--ink)}
html[data-theme] .nav-item,html[data-theme] .save-status,html[data-theme] .history-person small,html[data-theme] .message-label>span,html[data-theme] .message-actions .text-link,html[data-theme] .round-tool,html[data-theme] .history-delete,html[data-theme] .read-controls>span,html[data-theme] .read-controls i,html[data-theme] .waiting-choice,html[data-theme] .choice-prompt,html[data-theme] .finish-summary,html[data-theme] .finish-letter,html[data-theme] .chapter-finish>p:first-of-type{color:var(--muted)}
html[data-theme] .chat-scene>span{color:var(--gold);text-shadow:0 1px 6px var(--surface-backdrop)}
html[data-theme] .chapter-finish{background:radial-gradient(ellipse,color-mix(in srgb,var(--surface-raised) 75%,transparent),transparent)}
html[data-theme] .chapter-finish blockquote{color:var(--ink)}
html[data-theme] .nav-item.active{color:var(--gold)}
html[data-theme] .message.user{background:color-mix(in srgb,var(--gold) 7%,var(--surface-panel));border-color:var(--line)}
html[data-theme] .message.assistant,html[data-theme] .history-sidebar,html[data-theme] .chat-panel,html[data-theme] .chat-form,html[data-theme] .history-search input{border-color:var(--line)}
html[data-theme] .message-narration{border-color:var(--line)}
/* Latest user turn: edit and regenerate. */
.message-edit{display:flex;justify-content:flex-end;margin-top:8px}
.turn-edit{display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:4px 12px;border:1px solid #d8bd8359;border-radius:999px;background:#d8bd8314;color:var(--gold);font-size:10px;line-height:1.4;letter-spacing:.04em}
.turn-edit:before{content:'✎';font-size:11px;line-height:1}
.turn-edit:hover,.turn-edit:focus-visible{background:#d8bd832b;border-color:#e2c89b9e;color:var(--gold)}
.edit-message-error{margin:13px 0 0;padding:9px 11px;border:1px solid #cf9a8466;border-radius:4px;background:#cf9a8417;color:#e5bca8;font-size:11px;line-height:1.75}
.edit-message-error[hidden]{display:none}
html[data-theme=paper] .edit-message-error,html[data-theme=mist] .edit-message-error,html[data-theme=blossom] .edit-message-error{color:#8d4438;border-color:#b77b6e80}
@media(max-width:600px){.message-edit{margin-top:6px}.turn-edit{min-height:34px;padding:5px 13px;font-size:11px}}
html[data-text=large] .message-edit .turn-edit{font-size:12px}

/* First-run prerequisite form. The game stays inert until this is saved. */
body:has(#gate[open]) #shell{visibility:hidden}
#gate{width:min(620px,calc(100vw - 24px));max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);padding:0;overflow:hidden;border-radius:12px;overscroll-behavior:contain}
#gate:focus{outline:none}
#accountGate{width:min(460px,calc(100vw - 24px));max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);padding:0;overflow:hidden;border-radius:12px;overscroll-behavior:contain}
#accountGate:focus{outline:none}
body:has(#accountGate[open]) #shell{visibility:hidden}
.account-note{font-size:11px;line-height:1.7;color:var(--muted);margin:0}
.onboarding-form{display:flex;flex-direction:column;max-height:calc(100vh - 26px);max-height:calc(100dvh - 26px);min-width:0;padding:0;color:var(--ink)}
.onboarding-body{padding:26px 30px 8px;display:grid;gap:16px;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch;scroll-padding-block:12px 20px}
.onboarding-heading{text-align:left}
.onboarding-heading .eyebrow{font-size:9px;letter-spacing:.14em;color:var(--gold)}
.onboarding-brand{font:30px/1.2 var(--serif);letter-spacing:.14em;color:var(--gold);margin:4px 0 8px}
.onboarding-heading h2{font-size:25px;margin:0 0 4px}
.onboarding-heading h2:focus{outline:none}
.onboarding-heading>p:last-child{font-size:12px;color:var(--muted);line-height:1.7;margin:0}
.onboarding-section-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:14px}
.onboarding-section-head h3{font:500 14px/1.5 var(--sans);margin:0}
.onboarding-section-head p{flex:1 1 170px;font-size:10px;line-height:1.6;color:var(--muted);margin:0}
.onboarding-basics{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:12px;min-width:0}
.onboarding-form label{display:flex;flex-direction:column;gap:6px;min-width:0;font-size:13px}
.onboarding-field-label{display:flex;align-items:baseline;justify-content:space-between;gap:8px;line-height:1.5;color:var(--ink)}
.onboarding-field-label small{font-size:10px;font-weight:400;color:var(--muted);line-height:1.4}
.onboarding-field-label .required{color:var(--gold);font-size:9px;letter-spacing:.08em;white-space:nowrap}
.onboarding-form input:not([type=checkbox]):not([type=radio]),.onboarding-form select{width:100%;min-width:0;min-height:44px;border:1px solid var(--line);border-radius:6px;background:var(--surface-input);color:var(--ink);padding:9px 11px;font-size:14px}
.onboarding-gender-note{font-size:10px;line-height:1.7;color:var(--muted);margin:-5px 0 0;padding-left:10px;border-left:2px solid var(--line)}
.onboarding-characters{margin:0;padding:0;border:0;min-width:0}
.onboarding-characters legend{font-size:14px;color:var(--ink);padding:0}
.onboarding-characters legend small{font-size:10px;color:var(--gold);font-weight:400;margin-left:5px;white-space:nowrap}
.onboarding-characters>p{font-size:11px;color:var(--muted);margin:2px 0 9px;line-height:1.65}
.onboarding-character-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;min-width:0}
.onboarding-character{position:relative;cursor:pointer}
.onboarding-character input{position:absolute;left:12px;top:12px;width:18px;height:18px;margin:0;opacity:0}
.onboarding-character-body{position:relative;display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--line);border-radius:8px;min-height:82px;background:var(--surface-input);min-width:0;transition:border-color .16s,background-color .16s,box-shadow .16s}
.onboarding-character-body>img{width:44px;height:58px;object-fit:cover;object-position:top;background:var(--surface-raised);border-radius:5px;flex-shrink:0}
.onboarding-character-body>span:not(.onboarding-check){flex:1;min-width:0}
.onboarding-character-body strong{display:block;font-size:15px;font-weight:500;overflow-wrap:anywhere;color:var(--ink)}
.onboarding-character-body strong>small{font-size:11px;font-weight:400;color:var(--muted);margin-left:4px}
.onboarding-character-body span>small{display:block;font-size:11px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
.onboarding-check{position:absolute;left:12px;top:12px;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border:1px solid var(--gold);border-radius:50%;font-size:10px;line-height:1;color:var(--bg);background:var(--gold);opacity:0}
.onboarding-character input:checked+.onboarding-character-body{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 14%,var(--surface-input));box-shadow:inset 0 0 0 1px var(--gold)}
.onboarding-character input:checked+.onboarding-character-body .onboarding-check{opacity:1}
.onboarding-character input:focus-visible+.onboarding-character-body{outline:2px solid var(--gold);outline-offset:3px}
.onboarding-interests .onboarding-field-label small{font-size:10px;color:var(--muted);font-weight:400}
.onboarding-privacy{font-size:12px;color:var(--muted);line-height:1.7}
.onboarding-privacy summary{cursor:pointer;min-height:36px;display:list-item;padding-top:4px;color:var(--gold)}
.onboarding-privacy p{margin:6px 0 0}
.onboarding-consent{display:grid;gap:9px;margin-top:-7px}
.onboarding-consent .check-row{display:flex;flex-direction:row;gap:8px;align-items:flex-start;font-size:12px;margin:0;line-height:1.65}
.onboarding-consent input{width:18px;height:18px;flex-shrink:0;margin:1px 0 0;accent-color:var(--gold)}
.onboarding-error{font-size:11px;line-height:1.65;color:#e5bca8;margin:0}
html[data-theme=paper] .onboarding-error,html[data-theme=mist] .onboarding-error,html[data-theme=blossom] .onboarding-error{color:#8d4438}
.onboarding-submit{position:relative;z-index:1;flex-shrink:0;padding:12px 30px calc(12px + var(--safe-bottom));background:var(--surface-dialog);border-top:1px solid var(--line);display:grid;gap:7px;box-shadow:0 -12px 22px -20px #000}
.onboarding-submit button{font-size:14px;min-height:48px}
@media(max-width:600px){.onboarding-body{padding:20px 18px 6px;gap:14px}.onboarding-brand{font-size:29px}.onboarding-heading h2{font-size:23px}.onboarding-heading>p:last-child{font-size:11px}.onboarding-character-body{padding:8px;gap:7px;min-height:76px}.onboarding-character-body>img{width:34px;height:48px}.onboarding-character-body strong{font-size:14px}.onboarding-character-body strong>small{font-size:10px}.onboarding-character-body span>small{font-size:10px}.onboarding-character-options{gap:8px}.onboarding-basics{gap:10px}.onboarding-submit{padding:10px 18px calc(10px + var(--safe-bottom))}}
@media(max-width:350px){#gate{width:calc(100vw - 16px);max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px)}.onboarding-form{max-height:calc(100vh - 18px);max-height:calc(100dvh - 18px)}.onboarding-body{gap:12px;padding:18px 15px 6px}.onboarding-submit{padding:9px 15px calc(9px + var(--safe-bottom))}.onboarding-brand{font-size:26px;margin:3px 0 8px}.onboarding-section-head{padding-top:10px}.onboarding-character-body>img{display:none}.onboarding-character-body{min-height:64px;padding:8px 7px}.onboarding-character-body strong{font-size:13px}.onboarding-character-body strong>small{font-size:9px}.onboarding-character-body span>small{font-size:10px}.onboarding-check{left:auto;right:7px;top:7px}.onboarding-basics{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)}.onboarding-consent .check-row{font-size:11px}}
@media(max-height:480px){.onboarding-body{padding-top:14px;gap:10px}.onboarding-submit{padding-top:8px;padding-bottom:calc(8px + var(--safe-bottom))}.onboarding-section-head{padding-top:8px}.onboarding-brand{font-size:24px;margin:3px 0 6px}.onboarding-heading h2{font-size:21px}.onboarding-character-body{min-height:64px}.onboarding-character-body>img{height:44px}}

/* Header and home entries for the VIP surface. */
.membership-entry{font-family:var(--sans);font-size:11px;line-height:1.2;letter-spacing:.01em;padding:6px 11px;min-width:0;min-height:32px;border:1px solid var(--line);border-radius:999px;background:color-mix(in srgb,var(--surface-panel) 82%,transparent);color:var(--gold);white-space:nowrap;opacity:1}
.membership-entry:hover,.membership-entry:focus-visible,.membership-entry.active{background:color-mix(in srgb,var(--gold) 12%,var(--surface-panel));border-color:var(--gold);color:var(--gold);opacity:1}
.vip-home-entry{display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:1px;min-height:44px;padding:6px 13px;border:1px solid var(--gold);border-radius:6px;background:color-mix(in srgb,var(--gold) 11%,var(--surface-panel));color:var(--gold);text-align:left;font-size:12px;line-height:1.35}
.vip-home-entry small{display:block;font-size:9px;line-height:1.45;color:var(--muted);font-weight:400;white-space:nowrap}
.vip-home-entry:hover,.vip-home-entry:focus-visible{background:color-mix(in srgb,var(--gold) 17%,var(--surface-panel));border-color:var(--gold);color:var(--gold)}
.app-shell[data-view=vip] .world-backdrop:after{background:color-mix(in srgb,var(--surface-backdrop) 95%,transparent)}
html[data-theme] .app-shell[data-view=vip] .world-backdrop:after{background:color-mix(in srgb,var(--surface-backdrop) 95%,transparent)}

/* Opening form: explicit opening content and the VIP expansion entry. */
.setup-opening{display:flex;flex-direction:column;gap:7px;min-width:0}
.opening-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;min-width:0}
.dialog-content label.setup-field-label{display:inline-flex;flex:0 1 auto;margin:0;font-size:16px;line-height:1.6;font-weight:600;color:var(--ink);gap:10px;align-items:baseline}
.opening-polish{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:38px;padding:7px 12px;border:1px solid var(--gold);border-radius:999px;background:color-mix(in srgb,var(--gold) 10%,var(--surface-input));color:var(--gold);font-size:11px;line-height:1.3;white-space:nowrap;flex-shrink:0}
.opening-polish:hover,.opening-polish:focus-visible{background:color-mix(in srgb,var(--gold) 18%,var(--surface-input));border-color:var(--gold);color:var(--gold)}
.opening-polish span{font-size:12px;line-height:1}
.opening-benefit{margin:0;padding:2px 0 2px 9px;border-left:2px solid var(--gold);font-size:11px;line-height:1.75;color:var(--muted);overflow-wrap:anywhere}
.opening-benefit strong{font-weight:400;color:var(--gold)}

/* VIP surface: compact current plan, aligned comparison, test checkout. */
.vip-head-actions{display:flex;align-items:center;gap:14px;flex-shrink:0}
.vip-content{display:flex;flex-direction:column;gap:14px;padding:2px 2px 26px;min-width:0}
.vip-return{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;border:1px solid var(--gold);border-radius:8px;background:color-mix(in srgb,var(--gold) 10%,var(--surface-raised));padding:10px 14px;margin:0;min-width:0}
.vip-return span{font-size:11px;line-height:1.65;color:var(--ink);min-width:0}
.vip-return .primary{min-height:40px;font-size:11px;padding:8px 14px}
.vip-test-state{display:flex;align-items:flex-start;gap:8px 10px;flex-wrap:wrap;margin:0;padding:9px 12px;border:1px solid var(--line);border-radius:7px;background:color-mix(in srgb,var(--surface-input) 72%,transparent);font-size:10px;line-height:1.65;color:var(--muted);min-width:0}
.vip-test-state strong{font-size:11px;line-height:1.5;font-weight:500;color:var(--gold);white-space:nowrap}
.vip-test-state span{flex:1 1 240px;min-width:0;overflow-wrap:anywhere}
.vip-test-state.on{border-color:color-mix(in srgb,var(--gold) 65%,transparent);background:color-mix(in srgb,var(--gold) 8%,var(--surface-input))}
.vip-test-state.off{border-style:dashed}
.vip-current,.vip-compare,.vip-shop{border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);padding:16px 18px;min-width:0}
.vip-shop{border-color:color-mix(in srgb,var(--gold) 58%,transparent);background:var(--surface-input)}
.vip-current-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;flex-wrap:wrap}
.vip-status{font-size:9px;line-height:1.5;color:var(--gold);border:1px solid var(--gold);border-radius:999px;padding:3px 8px;background:color-mix(in srgb,var(--gold) 8%,transparent);white-space:nowrap}
.vip-current h3{font-size:23px;margin:4px 0 2px;overflow-wrap:anywhere}
.vip-current h3 .vip-plan-badge{vertical-align:middle;margin-left:4px}
.vip-current-note{font-size:11px;line-height:1.75;color:var(--muted);margin:0 0 10px;overflow-wrap:anywhere}
.vip-balance{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:0}
.vip-balance>div{border-top:1px solid var(--line);padding-top:6px;min-width:0}
.vip-balance dt{font-size:9px;line-height:1.5;color:var(--muted)}
.vip-balance dd{margin:2px 0 0;font-family:var(--serif);font-size:16px;line-height:1.4;color:var(--gold);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.vip-warning{margin:10px 0 0;padding:7px 9px;border-left:2px solid var(--gold);background:color-mix(in srgb,var(--gold) 7%,transparent);color:var(--muted);font-size:10px;line-height:1.65;overflow-wrap:anywhere}
.vip-section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.vip-section-head h3{font-size:19px;margin:0}
.vip-section-head p{font-size:10px;line-height:1.55;color:var(--muted);margin:0;flex:1 1 220px}
.vip-matrix-wrap{max-width:100%;overflow-x:auto;overflow-y:hidden;border:1px solid var(--line);border-radius:7px;background:var(--surface-input);overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:#b6baa03f transparent;-webkit-overflow-scrolling:touch}
.vip-matrix-wrap:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.vip-matrix{width:100%;min-width:440px;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:10px;line-height:1.55;color:var(--ink)}
.vip-matrix th:first-child{width:34%}
.vip-matrix th:not(:first-child){width:22%}
.vip-matrix thead th{padding:9px 8px;text-align:center;vertical-align:top;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--surface-input) 72%,transparent)}
.vip-matrix thead th:first-child{position:sticky;left:0;z-index:4;text-align:left;vertical-align:middle;background:color-mix(in srgb,var(--surface-raised) 88%,var(--surface-panel))}
.vip-matrix thead th.current{background:color-mix(in srgb,var(--gold) 11%,var(--surface-input))}
.vip-matrix-tier{display:block;font-size:8px;letter-spacing:.08em;line-height:1.4;color:var(--muted)}
.vip-matrix thead strong{display:block;font-size:13px;line-height:1.4;font-weight:500;color:var(--ink);overflow-wrap:anywhere}
.vip-matrix thead small{display:block;font-size:8px;line-height:1.45;color:var(--muted);margin-top:2px;overflow-wrap:anywhere}
.vip-matrix thead .vip-plan-badge{display:inline-block;margin-top:4px}
.vip-matrix tbody th,.vip-matrix tbody td{padding:8px 9px;text-align:center;vertical-align:middle;border-bottom:1px solid var(--line)}
.vip-matrix tbody th{position:sticky;left:0;z-index:2;text-align:left;font-weight:400;color:var(--ink);background:var(--surface-raised);overflow-wrap:anywhere}
.vip-matrix tbody td{color:var(--muted);font-variant-numeric:tabular-nums}
.vip-matrix tbody tr:last-child>*{border-bottom:0}
.vip-matrix .current{background:color-mix(in srgb,var(--gold) 8%,var(--surface-input))}
.vip-matrix tbody th.current{background:var(--surface-raised)}
.vip-matrix-headline td{font-family:var(--serif);font-size:13px;line-height:1.4;color:var(--gold)}
.vip-matrix-headline th{font-weight:500}
.vip-matrix tbody .vip-matrix-group th{position:static;width:auto;text-align:left;background:color-mix(in srgb,var(--surface-raised) 78%,var(--surface-panel));color:var(--muted);font-size:9px;letter-spacing:.03em;line-height:1.5;padding:7px 9px}
.vip-matrix tbody th small{display:block;font-size:8px;line-height:1.45;color:var(--muted);margin-top:2px;font-weight:400}
.vip-mark{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;font-size:13px;line-height:1}
.vip-mark.yes{color:var(--gold);background:color-mix(in srgb,var(--gold) 12%,transparent);border:1px solid color-mix(in srgb,var(--gold) 50%,transparent)}
.vip-mark.no{color:var(--muted);background:color-mix(in srgb,var(--surface-panel) 60%,transparent);border:1px solid var(--line)}
.vip-planned{display:inline-block;font-size:9px;line-height:1.4;color:var(--muted);border:1px dashed var(--line);border-radius:999px;padding:2px 8px;white-space:nowrap}
.vip-matrix-hint{margin:7px 0 0;font-size:9px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere}
.vip-shop-head{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;flex-wrap:wrap;min-width:0}
.vip-shop-head h3{font-size:21px;margin:4px 0 0;overflow-wrap:anywhere}
.vip-shop-current{font-size:10px;line-height:1.6;color:var(--muted);margin:0;border:1px solid var(--line);border-radius:999px;padding:4px 9px;background:color-mix(in srgb,var(--surface-panel) 70%,transparent);min-width:0}
.vip-shop-current strong{font-weight:400;color:var(--gold);white-space:nowrap}
.vip-tier-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:11px;min-width:0}
.vip-tier{display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-height:112px;min-width:0;padding:11px 13px;border:1px solid var(--line);border-radius:7px;background:color-mix(in srgb,var(--surface-raised) 72%,transparent);color:var(--ink);text-align:left;transition:border-color .18s,background .18s,box-shadow .18s}
.vip-tier:hover{border-color:var(--gold)}
.vip-tier.selected{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 11%,var(--surface-panel));box-shadow:inset 0 0 0 1px var(--gold)}
.vip-tier:disabled{opacity:.55;cursor:wait}
.vip-tier-label{display:flex;align-items:center;gap:6px;font-size:9px;line-height:1.5;letter-spacing:.08em;color:var(--muted)}
.vip-tier-state{font-size:8px;line-height:1.4;color:var(--gold);border:1px solid var(--gold);border-radius:999px;padding:1px 5px;letter-spacing:0}
.vip-tier strong{font-family:var(--serif);font-size:19px;line-height:1.3;font-weight:400;color:var(--ink);overflow-wrap:anywhere}
.vip-tier-values{font-size:9px;line-height:1.55;color:var(--muted);overflow-wrap:anywhere}
.vip-tier-price{margin-top:auto;padding-top:5px;border-top:1px solid var(--line);width:100%;font-size:9px;line-height:1.5;color:var(--gold);overflow-wrap:anywhere}
.vip-method-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:9px;margin-top:10px;min-width:0}
.vip-method{display:flex;flex-direction:column;gap:6px;min-width:0;padding:9px 10px;border:1px solid var(--line);border-radius:7px;background:color-mix(in srgb,var(--surface-raised) 58%,transparent)}
.vip-method-label{font-size:9px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.vip-monthly-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;min-height:60px;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:color-mix(in srgb,var(--surface-input) 64%,transparent);color:var(--ink);text-align:left}
.vip-monthly-option:hover{border-color:var(--gold)}
.vip-monthly-option.selected{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 10%,var(--surface-panel));box-shadow:inset 0 0 0 1px var(--gold)}
.vip-monthly-option:disabled{opacity:.55;cursor:wait}
.vip-monthly-option strong{font-family:var(--serif);font-size:17px;line-height:1.3;font-weight:400;color:var(--gold)}
.vip-monthly-option small{font-size:9px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.vip-topups{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;min-width:0}
.vip-topup{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:60px;min-width:0;padding:6px 4px;border:1px solid var(--line);border-radius:6px;background:color-mix(in srgb,var(--surface-input) 64%,transparent);color:var(--ink)}
.vip-topup:hover{border-color:var(--gold)}
.vip-topup.selected{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 10%,var(--surface-panel));box-shadow:inset 0 0 0 1px var(--gold)}
.vip-topup:disabled{opacity:.55;cursor:wait}
.vip-topup strong{font-family:var(--serif);font-size:17px;line-height:1.2;font-weight:400;color:var(--gold)}
.vip-topup small{font-size:8px;line-height:1.4;color:var(--muted);white-space:nowrap}
.vip-choice{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:11px;padding-top:11px;border-top:1px solid var(--line);min-width:0}
.vip-choice-copy{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 280px}
.vip-choice-copy strong{font-family:var(--serif);font-size:16px;line-height:1.35;font-weight:400;color:var(--ink);overflow-wrap:anywhere}
.vip-choice-copy small{font-size:10px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
.vip-test-button{min-height:44px;padding:9px 16px;font-size:11px;white-space:normal;text-align:center;max-width:100%}
.vip-test-button:disabled{opacity:.5;cursor:not-allowed}
.vip-confirm{min-height:44px;padding:9px 16px;border:1px dashed var(--line);border-radius:5px;background:color-mix(in srgb,var(--surface-panel) 64%,transparent);color:var(--muted);font-size:11px;white-space:nowrap;cursor:not-allowed}
.vip-confirm:disabled{opacity:1;color:var(--muted)}
.vip-shop-note{margin:10px 0 0;padding-left:8px;border-left:2px solid var(--gold);font-size:10px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere}
.vip-shop-closed .vip-shop-note{margin-bottom:12px}
.vip-checkout-error{margin:10px 0 0;padding:8px 10px;border:1px solid #cf9a8466;border-radius:5px;background:#cf9a8417;color:#e5bca8;font-size:10px;line-height:1.7;overflow-wrap:anywhere}
.vip-checkout-success{margin:10px 0 0;padding:8px 10px;border:1px solid color-mix(in srgb,var(--gold) 50%,transparent);border-radius:5px;background:color-mix(in srgb,var(--gold) 8%,transparent);color:var(--ink);font-size:10px;line-height:1.7;overflow-wrap:anywhere}
html[data-theme=paper] .vip-checkout-error,html[data-theme=mist] .vip-checkout-error,html[data-theme=blossom] .vip-checkout-error{color:#8d4438}
.vip-plan-badge{display:inline-block;font-size:8px;line-height:1.4;color:var(--gold);border:1px solid var(--gold);border-radius:999px;padding:2px 6px;white-space:nowrap}
.vip-footnote{margin:0;padding:0 2px;font-size:10px;line-height:1.7;color:var(--muted);overflow-wrap:anywhere}
@media(max-width:800px){.vip-content{gap:12px}.vip-balance{grid-template-columns:repeat(2,minmax(0,1fr))}.vip-method-grid{grid-template-columns:1fr}}
@media(max-width:600px){
 .membership-entry{font-size:10px;padding:4px 8px;min-height:28px}
 .top-actions{gap:9px}
 .vip-home-entry{min-height:40px;padding:5px 9px;font-size:11px}
 .vip-home-entry small{font-size:8px}
 .vip-head-actions{gap:10px}
 .vip-head-actions .text-link,.settings-heading>.text-link{min-height:44px}
 .top-actions>.hud-button[data-page=settings]{min-width:44px;min-height:44px}
 /* Keep the compact pills, but give each a 44px-tall touch area. */
 .membership-entry,.round-tool{position:relative}
 .membership-entry:after,.round-tool:after{content:'';position:absolute;left:0;right:0;top:50%;height:44px;transform:translateY(-50%)}
 .vip-current,.vip-compare,.vip-shop{padding:14px}
 .vip-current h3{font-size:21px}
 .vip-current-note{font-size:10px}
 .vip-balance dd{font-size:15px}
 .vip-shop-head{align-items:flex-start}
 .vip-shop-head h3{font-size:19px}
 .vip-shop-current{font-size:9px;padding:4px 8px}
 .vip-tier-grid{grid-template-columns:1fr;gap:6px}
 .vip-tier{min-height:0;padding:9px 11px}
 .vip-tier strong{font-size:17px}
 .vip-method-grid{gap:8px}
 .vip-topups{gap:6px}
 .vip-topup{min-height:56px;padding:6px 4px}
 .vip-topup strong{font-size:16px}
 .vip-topup small{font-size:8px;white-space:normal;text-align:center}
 .vip-choice{align-items:stretch;gap:8px}
 .vip-test-button,.vip-confirm{width:100%;min-height:44px;font-size:11px}
 .vip-return{padding:9px 12px}
 .vip-return .primary{width:100%;min-height:42px}
 .vip-matrix{min-width:440px}
 .vip-matrix th:first-child{width:36%}
 .vip-matrix th:not(:first-child){width:21.33%}
 .vip-matrix thead th{padding:8px 6px}
 .vip-matrix thead strong{font-size:12px}
 .vip-matrix thead small{font-size:7px}
 .vip-matrix tbody th,.vip-matrix tbody td{padding:7px 7px}
 .vip-matrix tbody th small{font-size:7px}
 .vip-matrix-hint{font-size:9px}
 .opening-polish{min-height:36px;font-size:10px;padding:6px 10px}
 .opening-benefit{font-size:10px}
 .dialog-content label.setup-field-label{font-size:15px}
}
@media(max-width:380px){
 .vip-test-state strong{white-space:normal}
 .vip-topup strong{font-size:15px}
 .vip-tier-values{font-size:9px}
}
html[data-text=large] .vip-matrix{font-size:11px}
html[data-text=large] .vip-matrix thead strong{font-size:14px}
html[data-text=large] .vip-matrix tbody th,html[data-text=large] .vip-matrix tbody td{font-size:11px}
html[data-text=large] .vip-tier-values,html[data-text=large] .vip-shop-note{font-size:11px}
.field-error{display:block;margin:6px 0 0;color:#b45745;font-size:11px;line-height:1.6;overflow-wrap:anywhere}
.field-error[hidden],.opening-candidate[hidden]{display:none}
html[data-theme=paper] .field-error,html[data-theme=mist] .field-error,html[data-theme=blossom] .field-error{color:#8d4438}
.opening-candidate{margin-top:10px;padding:12px 14px;border:1px solid var(--line);border-radius:6px;background:var(--surface-raised);min-width:0}
.opening-candidate-head{display:flex;flex-direction:column;gap:2px;min-width:0}
.opening-candidate-head .eyebrow{font-size:8px;letter-spacing:.12em;color:var(--gold)}
.opening-candidate-head strong{font:500 15px/1.5 var(--sans);color:var(--ink)}
.opening-candidate-head small{font-size:10px;line-height:1.6;color:var(--muted)}
.opening-candidate-text{margin:8px 0;font:15px/1.9 var(--serif);white-space:pre-wrap;overflow-wrap:anywhere;max-height:260px;overflow-y:auto;color:var(--ink)}
.opening-candidate-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.opening-candidate-actions small{color:var(--muted);font-size:10px;line-height:1.6}
.settings-profile{border-top:1px solid var(--line);padding-top:14px;min-width:0}
.settings-profile h4{margin:0 0 2px;font:500 15px/1.5 var(--sans);color:var(--ink)}
.settings-profile>.field-hint{margin:0}
.settings-customization{border:1px solid var(--line);border-radius:6px;padding:10px 12px;background:color-mix(in srgb,var(--surface-input) 60%,transparent);min-width:0}
.settings-customization summary{cursor:pointer;font:500 14px/1.6 var(--sans);color:var(--ink);min-height:32px;display:flex;align-items:center}
.settings-customization[open] summary{margin-bottom:6px}
.settings-customization .setting-field textarea{min-height:76px}
.settings-customization summary::before{content:'▸';margin-right:6px;color:var(--gold);font-size:11px}
.settings-customization[open] summary::before{content:'▾'}
@media(max-width:390px){
 .topbar{padding:0 18px}
 .top-actions{gap:6px}
 .membership-entry{font-size:10px;padding:5px 8px;min-height:30px}
 .hero-content{left:6%;right:6%;width:auto}
 .vip-home-entry{min-height:42px}
}
@media(max-width:360px){
 .save-status{display:none}
 .brand{font-size:24px}
 .membership-entry{font-size:9px;padding:4px 6px}
 .top-actions{gap:5px}
 .hero-actions{gap:9px 14px}
 .vip-home-entry small{display:none}
}

.chat-continuity{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 16px 4px;color:var(--muted);font-size:10px;line-height:1.5;min-width:0}
.chat-continuity>span{overflow-wrap:anywhere}
.chat-continuity .text-link{flex-shrink:0;min-height:32px;padding:4px;font-size:11px}
.story-chat-drawer .chat-continuity{margin:0 0 4px}

/* UI hierarchy, mobile send, coin wallet and first-submit warning. */
.hero-actions{display:flex;flex-direction:column;align-items:stretch;gap:12px;max-width:520px}
.continue-story{display:flex;flex-direction:column;gap:7px}
.continue-story .start-game{width:100%;min-width:0}
.start-choices{display:flex;flex-direction:column;gap:8px}
.start-choices>.eyebrow{font-size:9px;color:var(--muted);letter-spacing:.12em}
.mode-start-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.mode-start{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:66px;padding:11px 14px;border:1px solid var(--line);border-radius:6px;background:var(--surface-raised);color:var(--ink);text-align:left;transition:background .18s,border-color .18s}
.mode-start:hover,.mode-start:focus-visible{background:var(--surface-choice-hover);border-color:var(--gold)}
.mode-start-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
.mode-start-copy strong{font:18px/1.35 var(--serif);font-weight:400;letter-spacing:.06em;color:var(--ink)}
.mode-start-copy small{font-size:10px;line-height:1.55;color:var(--muted);font-weight:400}
.mode-start-arrow{flex-shrink:0;color:var(--gold);font-size:18px}
.advanced-actions{display:flex;flex-wrap:wrap;align-items:center;gap:0 14px}
.advanced-actions .text-link,.advanced-actions a.text-link{display:inline-flex;align-items:center;min-height:44px;padding:3px 0;font-size:11px;color:var(--muted);background:none;text-decoration:none}
.advanced-actions a.text-link:hover{color:var(--gold)}
.hero-actions>.vip-home-entry{align-self:flex-start;min-height:44px}
a.text-link{color:var(--gold);text-decoration:none}
.input-warning{margin:8px 0 0;padding:9px 12px;border:1px solid color-mix(in srgb,var(--gold) 45%,transparent);border-radius:5px;background:color-mix(in srgb,var(--gold) 13%,var(--surface-panel));color:var(--ink);font-size:11px;line-height:1.7}
.chat-composer>.input-warning{margin:8px 16px 0}
.setup-option{min-height:52px}
.setup-option-body{position:relative;padding-right:24px}
.setup-option-check{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:19px;height:19px;border-radius:50%;display:grid;place-items:center;background:var(--gold);color:var(--surface-panel);font-size:11px;opacity:0;transition:opacity .15s}
.setup-option input:checked+.setup-option-body .setup-option-check{opacity:1}
.setup-option input:checked+.setup-option-body{border-color:var(--gold)}
.setup-footer{flex-wrap:wrap}
.setup-footer-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.settings-disclaimer{margin:16px 0 0;padding-top:12px;border-top:1px solid var(--line);font-size:11px;line-height:1.75;color:var(--muted)}
.settings-disclaimer strong{color:var(--gold);font-weight:500}
.model-setting{margin-top:16px}
.model-form{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.model-form .setting-field{flex:1;min-width:220px;margin:0}
.model-form button{min-height:44px}
.model-setting .muted.small a{color:var(--gold)}
.vip-area{margin:0 0 18px;padding:19px 20px;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised)}
.vip-area-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:14px}
.vip-area-head h3{font-size:22px}
.vip-area-head>p{max-width:340px;margin:0;font-size:11px;line-height:1.7;color:var(--muted)}
.vip-tier-current{display:inline-block;margin-left:5px;padding:1px 6px;border:1px solid var(--line);border-radius:9px;font:8px var(--sans);color:var(--gold)}
.vip-topup{min-height:64px}
.vip-test-button,.vip-confirm{min-height:46px}
.redeem-row{display:flex;gap:10px;align-items:center}
.redeem-row input{flex:1;min-width:0}
.redeem-row button{flex-shrink:0;min-height:44px}
.vip-redeem{margin:18px 0 0;padding-top:14px;border-top:1px solid var(--line)}
.vip-redeem summary{min-height:44px;display:flex;align-items:center;font:500 14px var(--sans);cursor:pointer}
.vip-redeem[open] summary{margin-bottom:4px}
.vip-redeem form label{font-size:11px;color:var(--muted)}
@media(min-width:1024px){
 .hero-actions.has-continue{display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.15fr);align-items:start;gap:12px}
 .hero-actions.has-continue .continue-story{grid-column:1}
 .hero-actions.has-continue .start-choices{grid-column:2}
 .hero-actions.has-continue .vip-home-entry{grid-column:1/-1}
 .hero-actions.has-continue .mode-start{min-height:58px;padding:9px 11px}
 .hero-actions.has-continue .mode-start-copy strong{font-size:16px}
 .hero-actions.has-continue .mode-start-copy small{font-size:9px}
}
@media(max-width:700px){
 .hero-actions{max-width:none}
 .mode-start{min-height:62px;padding:10px 11px;gap:7px}
 .mode-start-copy strong{font-size:16px}
 .mode-start-copy small{font-size:9px}
 .advanced-actions{gap:0 10px}
 .vip-area{padding:15px 14px}
 .vip-area-head{flex-direction:column;gap:6px}
 .vip-area-head>p{max-width:none}
 .vip-membership-area .vip-tier-grid{grid-template-columns:1fr}
 .vip-choice{flex-direction:column;align-items:stretch;gap:10px}
 .vip-choice .primary,.vip-choice .vip-confirm{width:100%;min-height:48px}
 .vip-topups{grid-template-columns:repeat(3,minmax(0,1fr))}
 .redeem-row{flex-wrap:wrap}
 .redeem-row button{width:100%}
 .model-form{flex-direction:column;align-items:stretch}
 .model-form button{width:100%}
}
@media(max-width:420px){
 .mode-start-grid{gap:8px}
 .mode-start-copy strong{font-size:15px}
 .mode-start-copy small{font-size:8px}
}
@media(max-width:600px) and (max-height:650px){
 .hero-pretitle,.hero blockquote,.start-choices>.eyebrow,.continue-story>.eyebrow{display:none}
 .hero-content{bottom:190px}
 .hero-actions{gap:9px}
 .mode-start{min-height:50px}
 .continue-story .start-game{min-height:48px;padding:8px 12px}
}
@media(max-height:480px) and (min-width:601px){
 .hero-pretitle,.hero blockquote,.start-choices>.eyebrow{display:none}
 .hero-actions{gap:8px}
 .mode-start{min-height:46px;padding:7px 10px}
 .mode-start-copy small{font-size:8px}
 .advanced-actions .text-link,.advanced-actions a.text-link{min-height:44px}
 .vip-home-entry{min-height:44px}
}



