/* Shared flat UI only. Never targets manor world, canvas, model or scene artwork. */
body.ys-letter-ui{--paper:#f7f5f1;--ink:#6e564d;--muted:#978579;--wash:#8f6c571c;--surface-border:#97857950;--paper-grain-opacity:.10;--surface-radius:12px 16px 11px 14px;--surface-gap:12px;--bg:var(--paper);--text:var(--ink);--text-soft:var(--ink);--text-faint:var(--muted);--accent:var(--ink);--hairline:var(--surface-border);--card-line:var(--surface-border);--card-bg:transparent;--input-bg:var(--wash);--row-press:var(--wash);--seg-track:var(--wash);--seg-thumb:color-mix(in srgb,var(--ink) 15%,var(--paper));--seg-thumb-shadow:none;--font-cn:YoseiWenKai,sans-serif;--font-en:YoseiAllura,cursive;--soft-shadow:0 2px 8px #00000008;--card-shadow:none;--field-line:var(--surface-border);--letter-font:YoseiAllura,YoseiWenKai,sans-serif}
body.ys-letter-ui[data-letter-theme=sepia]{--paper:#322d28;--ink:#ddc6b6;--muted:#bea894;--wash:#e8c9ae20;--surface-border:#c4ae984d;--paper-grain-opacity:.08}
body.ys-letter-ui[data-letter-theme=black]{--paper:#0c0c0c;--ink:#f3f3f2;--muted:#b9b3aa;--wash:#efe8da14;--surface-border:#b9b3aa45;--paper-grain-opacity:.07}
.ys-letter-ui :is(.profile-page,.villa-room-panel,.wb-panel){background-color:var(--paper);background-image:none;color:var(--ink);font-family:YoseiAllura,YoseiWenKai,sans-serif}
.ys-letter-ui :is(.profile-page,.villa-room-panel)::before{content:'';position:absolute;inset:0;background:url('../../assets/letter/paper-grain.svg') repeat;background-size:200px;opacity:var(--paper-grain-opacity);pointer-events:none;z-index:0}
.ys-letter-ui #ysWorkbench{background:var(--paper);color:var(--ink)}
.ys-letter-ui #ysWorkbench::before{content:'';position:absolute;inset:0;background:url('../../assets/letter/paper-grain.svg') repeat;background-size:200px;opacity:var(--paper-grain-opacity);pointer-events:none;z-index:0}
.ys-letter-ui #ysWorkbench>*{position:relative}
body.ys-letter-ui #ysWorkbench .wb-header>button{background:none;color:var(--ink);text-shadow:none;border:0;box-shadow:none}
.ys-letter-ui[data-yosei-route]:not([data-yosei-route=chat]) #app{visibility:hidden;pointer-events:none}
.ys-letter-ui :is(.profile-topbar,.wb-header){border-bottom:1px solid var(--surface-border);min-height:62px;height:auto;padding-top:calc(8px + env(safe-area-inset-top));padding-bottom:8px;gap:12px;background:transparent;box-shadow:none}
.ys-letter-ui :is(.profile-topbar,.wb-header) h2{font:22px/1.35 YoseiAllura,YoseiWenKai;margin:0;color:var(--ink)}
.ys-letter-ui :is(.settings-heading,.personal-heading,.resident-system-heading,.villa-heading)>p,.ys-letter-ui .wb-header small{font-size:11px;letter-spacing:.08em;color:var(--muted)}
.ys-letter-ui :is(.profile-back,.wb-header>button){min-height:44px;min-width:44px;border:0;background:none;color:var(--ink);box-shadow:none;border-radius:8px;padding:8px}
.ys-letter-ui :is(.profile-scroll,.wb-content){scrollbar-width:none;overscroll-behavior:contain;gap:var(--surface-gap)}
.ys-letter-ui :is(.profile-scroll,.wb-content)::-webkit-scrollbar{display:none}
.ys-letter-ui :is(.settings-card,.wb-card,.villa-room-card,.resident-system-card){background:transparent;border:1px solid var(--surface-border);border-radius:var(--surface-radius);padding:18px;box-shadow:none;color:var(--ink)}
.ys-letter-ui :is(.settings-card,.wb-card,.resident-system-card)>h3{font-size:19px;font-weight:400;color:var(--ink)}
.ys-letter-ui :is(.action-row,.wb-entry,.settings-source-card,.personal-section .action-row){background:transparent;border-color:var(--surface-border);border-radius:10px 13px 9px 12px;box-shadow:none;color:var(--ink);min-height:48px}
.ys-letter-ui :is(.action-row,.wb-entry,.villa-room-card):hover{background:var(--wash)}
.ys-letter-ui :is(.profile-panel,.wb-panel) button{font-family:inherit;transition:background-color .18s ease,color .18s ease,transform .18s ease}
.ys-letter-ui :is(.profile-panel,.wb-panel) button:active{transform:scale(.98)}
.ys-letter-ui :is(.profile-panel,.wb-panel) :is(input,textarea,select){background:var(--wash);color:var(--ink);border-color:var(--surface-border);border-radius:9px 12px 10px 11px;font-family:YoseiWenKai,sans-serif;box-shadow:none}
.ys-letter-ui :is(.profile-panel,.wb-panel) :focus-visible{outline:2px solid var(--muted);outline-offset:3px}
.ys-letter-ui :is(.wb-content,.profile-scroll) pre{background:var(--wash);color:var(--ink);border-radius:8px;white-space:pre-wrap;overflow-wrap:anywhere;font-family:ui-monospace,monospace}
.ys-letter-ui :is(.wb-note,.wb-empty,.resident-system-note,.resident-system-empty,.settings-note,.personal-footnote){color:var(--muted);line-height:1.75;font-family:YoseiWenKai,sans-serif}
.ys-letter-ui :is(.wb-badge,.personal-mark,.villa-room-mark){background:var(--wash);border-color:var(--surface-border);color:var(--ink);box-shadow:none}
.ys-letter-ui :is(.settings-intro,.personal-intro,.resident-system-intro) h1{font-family:YoseiAllura,YoseiWenKai;font-size:clamp(25px,4vw,32px);line-height:1.45;font-weight:400}
.ys-letter-ui :is(.profile-panel,.wb-panel) .segmented{background:var(--wash);border-color:var(--surface-border);box-shadow:none}
.ys-letter-ui :is(.profile-panel,.wb-panel) .segmented .active{background:var(--seg-thumb);box-shadow:none;color:var(--ink)}
.ys-letter-ui:not(.ys-letter-chat) #ysGlobalNav{background:var(--paper);background-image:none;backdrop-filter:none;color:var(--ink);border-color:var(--surface-border)}
.ys-letter-ui:not(.ys-letter-chat) #ysGlobalNav::before{display:none}
.ys-letter-ui #ysGlobalNav .menu-item{border:0;color:var(--ink)}
.ys-letter-ui #ysGlobalNav :is(.menu-sub,.menu-chev,.menu-dot){display:none}
.ys-letter-ui #ysGlobalNav .active{background:var(--wash)}
.ys-letter-ui:not(.ys-letter-chat) #ysNavToggle{background:none;color:var(--ink);box-shadow:none;border:0;border-radius:10px;width:44px;height:44px;left:10px;top:10px}
.ys-letter-ui .flat-theme-choices{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 0;color:var(--ink)}
.ys-letter-ui .flat-theme-choices button{min-height:44px;padding:8px 14px;border:1px solid var(--surface-border);border-radius:9px;background:none;color:inherit}
.ys-letter-ui .flat-theme-choices button[aria-pressed=true]{background:var(--wash)}
@media(min-width:1000px){.ys-letter-ui:not(.ys-letter-chat) .profile-topbar{padding-left:20px}.ys-letter-ui #ysGlobalNav .menu-name{font-size:22px}}
@media(max-width:999px){.ys-letter-ui:not(.ys-manor-visible):not(.ys-letter-chat) #ysNavToggle{display:grid!important;z-index:261}.ys-letter-ui:not(.ys-letter-chat) .profile-topbar,.ys-letter-ui .wb-header{padding-left:64px}.ys-letter-ui.ys-nav-collapsed:not(.ys-manor-visible) #ysGlobalNav{transform:translateY(110%);opacity:0;pointer-events:none}.ys-letter-ui:not(.ys-letter-chat) #ysGlobalNav{transition:transform .3s ease,opacity .24s ease}.ys-letter-ui :is(.profile-scroll,.wb-content){padding-bottom:calc(90px + env(safe-area-inset-bottom))}}
@media(prefers-reduced-motion:reduce){.ys-letter-ui :is(.profile-panel,.wb-panel) *{transition:none!important;animation:none!important}}
@media(max-width:999px){.ys-letter-ui #ysGlobalNav .menu-copy{display:none}.ys-letter-ui #ysGlobalNav .active{background:none}.ys-letter-ui #ysGlobalNav .active:after{content:'';position:absolute;bottom:2px;left:calc(50% - 10px);width:20px;height:2px;border-radius:50%;background:var(--ink)}}

/* One global navigation geometry: route changes only change the active item. */
body.ys-letter-ui #ysGlobalNav{position:fixed;z-index:260;opacity:1;visibility:visible;pointer-events:auto;transform:none;background:var(--paper);color:var(--ink);transition:width .3s ease,padding .3s ease,transform .3s ease,opacity .24s ease}
body.ys-letter-ui #ysGlobalNav .menu-item{font-family:YoseiAllura,YoseiWenKai,sans-serif}
@media(min-width:1000px){
 body.ys-letter-ui .manor-page{left:var(--ys-nav-offset)!important;right:0;width:calc(100% - var(--ys-nav-offset));transition:left .3s ease,width .3s ease}
 body.ys-letter-ui #ysGlobalNav{left:0;right:auto;top:0;bottom:0;width:var(--ys-sidebar-width);padding:36px 24px}
 body.ys-letter-ui.ys-nav-collapsed #ysGlobalNav{width:var(--ys-sidebar-compact-width);padding:68px 8px 20px;transform:none;opacity:1;visibility:visible;pointer-events:auto}
}
@media(max-width:999px){
 body.ys-letter-ui #ysGlobalNav{left:0;right:0;top:auto;bottom:0;width:100%;height:calc(65px + env(safe-area-inset-bottom));padding:4px 8px env(safe-area-inset-bottom);transform:none}
 body.ys-letter-ui.ys-nav-collapsed #ysGlobalNav{transform:translateY(100%);opacity:0;visibility:hidden;pointer-events:none}
}

/* A compact ink-and-paper control sheet shared by all three themes. */
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,#ysConnectionPanel){--panel-gap:14px;--panel-radius:10px 14px 18px 12px;background:var(--paper);color:var(--ink);border:1px solid var(--surface-border);border-radius:var(--panel-radius);box-shadow:0 12px 32px #0003;backdrop-filter:none;z-index:270;padding:18px;width:min(calc(100% - 28px),440px);max-height:calc(100dvh - var(--ys-chat-header-bottom,80px) - 92px);overflow:auto;scrollbar-width:thin;scrollbar-color:var(--muted) transparent;font:15px/1.5 YoseiWenKai,sans-serif}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,#ysConnectionPanel) :is(.settings-label,.ys-runtime-note,.push-hint){color:var(--muted);font-family:YoseiWenKai,sans-serif}
.ys-letter-ui .letter-panel-heading{font:21px/1.4 YoseiWenKai,sans-serif;margin:0 0 14px;color:var(--ink)}
.ys-letter-ui .letter-water-summary{padding:12px 14px;background:var(--wash);border-radius:5px 12px 8px 5px;border-left:2px solid var(--muted);margin-bottom:18px}
.ys-letter-ui .letter-water-summary .ys-water-row{gap:12px;color:var(--muted);font-size:13px}
.ys-letter-ui .letter-water-summary strong{color:var(--ink);font:14px/1.5 YoseiWenKai,sans-serif}
.ys-letter-ui .ys-water-track{background:var(--surface-border)}
.ys-letter-ui .ys-water-track i{background:var(--muted)}
.ys-letter-ui #ysModelPanel{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:14px;position:static;width:auto;transform:none;border:0;padding:0;background:none;box-shadow:none}
.ys-letter-ui #ysModelPanel .ys-panel-label{margin-top:0}
.ys-letter-ui #ysModelPanel .ys-runtime-field{min-width:0;margin:0}
.ys-letter-ui #ysModelPanel :is(#ysSpeedField,.letter-theme-picker){grid-column:1/-1}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) :is(select,input){box-sizing:border-box;width:100%;min-width:0;height:44px;padding:8px 10px;background:var(--wash);color:var(--ink);border:1px solid var(--surface-border);border-radius:7px 10px 6px 9px;font:14px YoseiWenKai,sans-serif;box-shadow:none}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) option{background:var(--paper);color:var(--ink)}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) button{min-height:44px;width:auto;padding:8px 12px;color:var(--ink);background:var(--wash);border:1px solid var(--surface-border);border-radius:7px 10px 6px 9px;font:14px/1.4 YoseiWenKai,sans-serif;box-shadow:none}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) button[hidden]{display:none}
.ys-letter-ui #ysSpeedSeg{display:flex;width:max-content;max-width:100%;gap:8px;padding:0;background:none;border:0;box-shadow:none}
body.ys-letter-ui #ysSpeedSeg button{flex:0 1 auto}
body.ys-letter-ui :is(#ysSpeedSeg,.letter-theme-picker) button:is(.active,[aria-pressed=true]){background:var(--ink);color:var(--paper);border-color:var(--ink)}
.ys-letter-ui #ysWaterPanel .letter-theme-picker{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0;padding:12px 0 0;border-top:1px solid var(--surface-border)}
.ys-letter-ui .letter-theme-picker>span{width:100%;font-size:12px;color:var(--muted)}
.ys-letter-ui .letter-panel-details{margin-top:16px;border-top:1px solid var(--surface-border);padding-top:10px}
.ys-letter-ui .letter-panel-details>summary{cursor:pointer;padding:8px 0;color:var(--muted);font:14px YoseiWenKai,sans-serif}
.ys-letter-ui .letter-panel-details .ys-water-actions{display:flex;flex-wrap:wrap;gap:8px}
.ys-letter-ui .letter-panel-details .ys-water-actions button{flex:0 1 auto}
.ys-letter-ui .letter-panel-details .ys-water-actions button:disabled{opacity:.55;cursor:not-allowed}
.ys-letter-ui .letter-panel-details .ys-rollover-box{background:none;border:0;padding:10px 0}
.ys-letter-ui #ysWindowPanel .ys-id-row{display:block;width:100%;text-align:left;overflow-wrap:anywhere;margin-top:8px;background:none;font-size:12px}
.ys-letter-ui #ysWindowPanel .ys-window-tools{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.ys-letter-ui #ysWindowPanel #ysCreateWindow{width:100%;margin-top:12px;text-align:left}
.ys-letter-ui #ysWindowPanel .ys-window-item{grid-template-columns:minmax(0,1fr);gap:4px;padding:10px 0;background:none}
body.ys-letter-ui #ysWindowPanel .ys-window-open{width:100%;background:none;border:0;padding:6px 0}
.ys-letter-ui #ysWindowPanel .ys-window-open b{font-size:15px}
.ys-letter-ui #ysWindowPanel .ys-window-open small{font-size:12px}
.ys-letter-ui #ysWindowPanel .ys-window-actions{gap:8px;flex-wrap:wrap;padding:0}
body.ys-letter-ui #ysWindowPanel .ys-window-actions button{font-size:13px;padding:6px 12px}
.ys-letter-ui #ysWindowPanel .ys-window-item.active{border-left:2px solid var(--muted);padding-left:10px}
.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) :focus-visible{outline:2px solid var(--muted);outline-offset:3px}
@media(prefers-reduced-motion:reduce){body.ys-letter-ui #ysGlobalNav{transition:none}}

/* Dark overlays share raised paper, distinct from the page beneath them. */
body.ys-letter-ui[data-letter-theme=sepia]{--overlay-paper:#403832;--overlay-field:#4c423a;--overlay-line:#827164;--overlay-shadow:0 10px 30px #0005}
body.ys-letter-ui[data-letter-theme=black]{--overlay-paper:#242321;--overlay-field:#302e2b;--overlay-line:#625d55;--overlay-shadow:0 10px 30px #0008}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) :is(#ysMobileMore,#ysWaterPanel,#ysWindowPanel,#ysConnectionPanel,.ys-plus-menu,.ys-tool-page,.ys-attachment-preview,.ys-quote-preview,.ys-branch-preview,.msg-menu-actions,.ys-thinking-sheet section,.file-viewer-panel,.letter-dialog:not(.letter-reading-dialog)){
 background:var(--overlay-paper);color:var(--ink);border-color:var(--overlay-line);box-shadow:var(--overlay-shadow);backdrop-filter:none;
 --field-bg:var(--overlay-field);--composer-bg:var(--overlay-paper);--think-body:var(--ink);
}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) #ysMobileMore :is(.menu-item,.menu-name,.menu-ic,.menu-chev){color:var(--ink)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) #ysMobileMore .menu-sub{color:var(--muted)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) #ysMobileMore .menu-item{background:transparent;border-color:var(--surface-border)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) :is(.ys-tool-card,.ys-memory-search-form,#ysWaterPanel,#ysWindowPanel) :is(input,textarea,select){background:var(--overlay-field);color:var(--ink);border-color:var(--overlay-line);box-shadow:none}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) :is(#ysWaterPanel,#ysWindowPanel) option{background:var(--overlay-paper);color:var(--ink)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) :is(.ys-tool-page,.ys-plus-menu,.ys-thinking-sheet section) :is(button,h3,h4){color:var(--ink)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) :is(.ys-tool-page,.ys-plus-menu) :is(small,.ys-runtime-note){color:var(--muted)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) .letter-reading-dialog{--paper:var(--overlay-paper)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) .file-viewer-card{background:var(--overlay-paper);color:var(--ink);border-color:var(--overlay-line)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]) .file-viewer-content{background:transparent;color:var(--ink)}

/* Pressed paper controls: a shared relief treatment, not glossy pills. */
body.ys-letter-ui{--relief-light:#ffffff50;--relief-shade:#503c2810;--relief-shadow:0 1px 2px var(--relief-shade);--control-paper:color-mix(in srgb,var(--paper) 96%,var(--ink));--selection-shadow:inset 0 1px 4px var(--relief-shade),0 1px 0 var(--relief-light)}
body.ys-letter-ui:is([data-letter-theme=sepia],[data-letter-theme=black]){--relief-light:#ffffff08;--relief-shade:#0003;--control-paper:var(--overlay-paper)}
body.ys-letter-ui #ysGlobalNav{border:1px solid var(--surface-border);box-shadow:inset 0 1px 0 var(--relief-light),0 -2px 7px var(--relief-shade);background-color:var(--paper);background-image:linear-gradient(color-mix(in srgb,var(--paper) 93%,transparent),color-mix(in srgb,var(--paper) 93%,transparent)),url('../../assets/letter/paper-grain.svg');background-size:200px}
body.ys-letter-ui #ysGlobalNav .menu-item{border-radius:8px 11px 7px 10px}
body.ys-letter-ui #ysGlobalNav .menu-item.active{box-shadow:var(--relief-shadow);background:var(--wash)}
body.ys-letter-ui .ys-select-wrap::after{display:none}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,.ys-tool-page,.flat-theme-choices) :is(select,button,input){appearance:none;border-radius:7px;border:1px solid var(--surface-border);box-shadow:var(--relief-shadow);background:var(--control-paper);transition:box-shadow .18s ease,background-color .18s ease,transform .18s ease}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel) select{padding-right:12px;cursor:pointer}
body.ys-letter-ui :is(#ysSpeedSeg,.letter-theme-picker,.flat-theme-choices) button:is(.active,[aria-pressed=true]){background-color:var(--wash);color:var(--ink);border-color:var(--muted);box-shadow:inset 1px 2px 4px var(--relief-shade),0 1px 0 var(--relief-light)}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,.ys-tool-page,.flat-theme-choices) button:not(:disabled):active{transform:translateY(1px);box-shadow:inset 1px 2px 4px var(--relief-shade)}
body.ys-letter-ui .letter-panel-details>summary{list-style:none}
body.ys-letter-ui .letter-panel-details>summary::-webkit-details-marker{display:none}
body.ys-letter-ui .letter-panel-details>summary::after{content:'＋';float:right;color:var(--muted)}
body.ys-letter-ui .letter-panel-details[open]>summary::after{content:'−'}
.ys-letter-chat #ysResidentToggle{height:44px;overflow:hidden;display:flex;justify-content:center;align-items:flex-start}
.ys-letter-chat #ysResidentToggle svg.letter-asset{width:22px;height:60px;flex-shrink:0;stroke:none;transform:translateY(-38px)}
.ys-letter-chat #ysResidentToggle.letter-pulling svg{animation:letter-pull-cord .48s ease-in-out}
@keyframes letter-pull-cord{0%,100%{transform:translateY(-38px)}45%{transform:translateY(-18px)}}
@media(max-width:999px){body.ys-letter-ui #ysGlobalNav{border-radius:10px 13px 0 0}}
@media(prefers-reduced-motion:reduce){.ys-letter-chat #ysResidentToggle svg{animation:none!important}}

/* The navigation is part of the paper, not a tray of separate keycaps. */
body.ys-letter-ui #ysGlobalNav{border-radius:0;border-color:var(--surface-border);box-shadow:inset 0 1px 0 var(--relief-light)}
body.ys-letter-ui #ysGlobalNav .menu-item.active{background:none;box-shadow:none}
body.ys-letter-ui #ysGlobalNav .menu-ic{width:36px;height:36px;min-width:36px;display:grid;place-items:center}
body.ys-letter-ui #ysGlobalNav .menu-ic svg{width:34px;height:34px;max-width:none}
body.ys-letter-ui #ysGlobalNav .ys-more-icon{font-size:30px}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel){--flat-paper:var(--overlay-paper,var(--paper));--field-bg:var(--wash);--row-hover:var(--wash);--think-body:var(--ink);--composer-bg:var(--flat-paper)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) :is(button,input,select,textarea){border-color:var(--surface-border);color:var(--ink);border-radius:6px 9px 7px 8px;font-family:YoseiWenKai,sans-serif}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) :is(.action-row,.wb-entry,.wb-actions button,.wb-grid>button,.wb-form button,.segmented button,.flat-theme-choices button){background:var(--control-paper);box-shadow:var(--relief-shadow);min-height:44px;border-radius:7px}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) :is(input,select,textarea){background:var(--wash);box-shadow:var(--relief-shadow);max-width:100%}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) select{appearance:none;padding-right:12px}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) option{background:var(--flat-paper);color:var(--ink)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) :is(.settings-card,.wb-card,.resident-system-card,.villa-room-card){background:color-mix(in srgb,var(--flat-paper) 55%,transparent);box-shadow:0 1px 0 var(--relief-light);border-radius:var(--surface-radius)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) details{box-sizing:border-box;border-color:var(--surface-border);color:var(--ink)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) summary{list-style:none;min-height:44px;cursor:pointer}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) summary::-webkit-details-marker{display:none}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) summary::after{content:'＋';float:right;color:var(--muted);margin-left:10px}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) details[open]>summary::after{content:'−'}
body.ys-letter-ui .wb-status-building{color:var(--muted);border-color:var(--surface-border);background:var(--wash)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) :focus-visible{outline:2px solid var(--muted);outline-offset:3px}
.ys-letter-chat .ys-injection-card>.act-toggle{font:14px/1.6 YoseiWenKai,sans-serif;color:var(--letter-tool-ink);gap:0}
.ys-letter-chat .ys-injection-card .act-label{background:none;color:inherit;-webkit-text-fill-color:currentColor}
.ys-letter-chat .ys-injection-body{width:fit-content;max-width:100%;margin:3px 0 7px;padding:8px 12px;border:0;border-left:1px solid var(--hairline);background:linear-gradient(90deg,var(--wash),transparent);color:var(--muted);font:14px/1.8 YoseiWenKai,sans-serif;overflow:hidden}
.ys-letter-chat .ys-injection-body pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere}
/* One continuous torn-paper boundary; switch to a full-height sidebar at 1000px. */
body.ys-letter-ui #ysGlobalNav{box-sizing:border-box;overflow:visible}
body.ys-letter-ui #ysGlobalNav>.letter-nav-edge{position:absolute;left:0;top:-8px;width:100%;height:13px;color:var(--ink);pointer-events:none;filter:drop-shadow(0 -1px 1px var(--relief-shade))}
@media(max-width:999px){
 body.ys-letter-ui #ysGlobalNav{left:0;right:0;width:100%;max-width:none;border:0;border-radius:0;box-shadow:none}
}
@media(min-width:1000px){
 body.ys-letter-ui #ysGlobalNav{top:0;bottom:0;height:100dvh;max-width:none;border:0;border-right:1.6px solid var(--ink);box-shadow:2px 0 3px var(--relief-shade)}
 body.ys-letter-ui #ysGlobalNav>.letter-nav-edge{display:none}
}
/* Selection is a soft paper indentation, never two competing underline markers. */
body.ys-letter-ui #ysGlobalNav .menu-item::after{display:none!important}
body.ys-letter-ui :is(#ysGlobalNav,#ysMobileMore) .menu-item.active{background:var(--wash);box-shadow:var(--selection-shadow);border-radius:9px}
body.ys-letter-ui #ysMobileMore .menu-item:not(.active){background:none;box-shadow:none}
body.ys-letter-ui #ysGlobalNav .menu-ic{border-radius:9px;transition:background-color .18s ease,box-shadow .18s ease}
@media(max-width:999px){
 body.ys-letter-ui #ysGlobalNav .menu-item.active{background:var(--wash);box-shadow:none}
 body.ys-letter-ui #ysGlobalNav .menu-item.active .menu-ic{background:none;box-shadow:none}
}
body.ys-letter-ui #ysGlobalNav .menu-item:is(:active,.active){transform:none;scale:1}
body.ys-letter-ui .settings-source-mark{background:none;border-radius:0;color:var(--muted)}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) .action-value{color:var(--muted);font-size:12px}

/* Chat sheets start below the complete paper silhouette, never over the header controls. */
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,#ysConnectionPanel){top:calc(var(--ys-chat-header-bottom,46px) + 32px);max-height:calc(100dvh - var(--ys-chat-header-bottom,46px) - 124px)}
/* Actions are typography; borders remain reserved for editable fields. */
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,#ysConnectionPanel,.ys-tool-page,.profile-page,.wb-panel,.villa-room-panel) button:not([role=switch]){background:none;background-image:none;border:0;border-radius:0;box-shadow:none;color:var(--ink)}
body.ys-letter-ui :is(#ysWaterPanel,#ysWindowPanel,.ys-tool-page,.profile-page,.wb-panel,.villa-room-panel) button:not(:disabled):is(:hover,:active){background:none;box-shadow:none;color:var(--ink);text-decoration:underline;text-decoration-color:var(--muted);text-underline-offset:5px}
body.ys-letter-ui :is(#ysSpeedSeg,.letter-theme-picker,.flat-theme-choices) button:is(.active,[aria-pressed=true]){background:none;border:0;box-shadow:none;text-decoration:underline;text-underline-offset:5px;text-decoration-color:var(--muted)}
body.ys-letter-ui :is(.action-chevron,.menu-chev,#ysWindowPanel .ys-window-open i){display:none}
body.ys-letter-ui .letter-panel-details>summary::after,
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) summary::after{display:none}
body.ys-letter-ui #ysCreateWindow .action-value{display:none}
body.ys-letter-ui :is(.profile-page,.wb-panel,.villa-room-panel) .action-row{padding-block:12px;gap:12px}
/* Avatar is an image picker, not a text action. Keep its circle and image. */
body.ys-letter-ui #profilePanel #profileAvatarBtn{flex-shrink:0;border:1.3px solid var(--muted);border-radius:50%;padding:0;overflow:hidden;background-color:var(--wash);background-image:var(--avatar-default);background-size:cover;background-position:center;box-shadow:0 1px 3px var(--relief-shade);text-decoration:none}
body.ys-letter-ui #profilePanel #profileAvatarBtn:is(:hover,:active){border:1.3px solid var(--ink);border-radius:50%;background-color:var(--wash);background-image:var(--avatar-default);box-shadow:0 1px 3px var(--relief-shade);text-decoration:none}
body.ys-letter-ui #ysGlobalNav .menu-item.active{background-color:var(--wash)!important}
