#ms-cook-companion{--mc-bg:#fcf3df;--mc-ink:#30251c;--mc-muted:#62513d;--mc-line:#b39a73;--mc-accent:#85442c;--mc-button:#fff5e4;color:var(--mc-ink);font-family:Arial,sans-serif;position:relative;z-index:60}
#ms-cook-companion [hidden]{display:none!important}
#ms-cook-companion button,#ms-cook-companion select,#ms-cook-companion textarea{font:inherit;border:1px solid var(--mc-line);border-radius:6px;background:var(--mc-bg);color:var(--mc-ink)}
#ms-cook-companion button{cursor:pointer;min-height:44px;padding:9px 14px;font-weight:600}
#ms-cook-companion button:hover{border-color:var(--mc-accent)}
#ms-cook-companion :is(button,input,textarea,select,summary):focus-visible{outline:3px solid var(--mc-accent);outline-offset:3px}
#ms-cook-companion button:disabled{cursor:wait;opacity:.65}
/* Minimized Ms. Cook is a floating head on the right edge: tap to talk; a dot means an answer is waiting. */
#mc-launch{position:fixed;right:14px;bottom:calc(18px + env(safe-area-inset-bottom,0px));display:flex;align-items:center;justify-content:center;width:66px;height:66px;border-radius:50%;box-shadow:0 5px 20px #1d160b45;padding:3px!important;gap:0}
#ms-cook-companion #mc-launch{border-radius:50%}#mc-launch img{border-radius:50%;width:58px;height:58px}#mc-launch>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}#mc-launch.mc-news::after{content:'';position:absolute;top:1px;right:1px;width:15px;height:15px;border-radius:50%;background:#b3401f;border:2px solid #fff5e4}
#mc-panel{position:fixed;right:18px;bottom:18px;width:400px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 36px);background:var(--mc-bg);border:1px solid var(--mc-line);box-shadow:0 10px 45px #17120a55;border-radius:12px;display:flex;flex-direction:column;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
#mc-panel>*{flex-shrink:0}#mc-panel>.mc-header{position:sticky;top:0;z-index:1}
.mc-header{display:flex;align-items:center;gap:10px;padding:10px 12px 10px 14px;border-bottom:1px solid var(--mc-line);flex-shrink:0;background:url('/brand/papyrus.png') center/600px}
.mc-header h2{font:700 21px Georgia,serif;margin:0;color:var(--mc-ink)}.mc-header small{display:block;font-size:12px;color:var(--mc-muted);margin-top:2px}
#mc-avatar{border-radius:50%;width:40px;height:40px;border:2px solid var(--mc-line)}#mc-avatar.thinking{outline:3px dashed var(--mc-accent);outline-offset:3px}
#mc-close{margin-left:auto;font-size:22px!important;padding:2px 12px!important;min-width:44px}
/* Live controls: one primary action at a time. */
#mc-voice-controls{flex-shrink:0;padding:12px 14px 10px}
.mc-call-actions{display:flex;gap:6px;flex-wrap:wrap}#ms-cook-companion .mc-call-actions button{font-size:14px;padding:8px 12px;min-height:44px}
#ms-cook-companion #mc-start-call{flex:1;background:var(--mc-accent);color:var(--mc-button);border-color:var(--mc-accent);font-size:16px}
#ms-cook-companion #mc-mic[aria-pressed=true]{background:var(--mc-ink);color:var(--mc-bg);border-color:var(--mc-ink)}
#ms-cook-companion #mc-interrupt{border-color:var(--mc-accent);color:var(--mc-accent)}
#mc-voice-status{font-size:13px;line-height:1.45;color:var(--mc-muted);margin:8px 0 0}
#ms-cook-companion[data-voice-stage=listening] #mc-voice-status,#ms-cook-companion[data-voice-stage=speaking] #mc-voice-status{color:var(--mc-ink);font-weight:600}
#mc-live-stage{position:relative;height:200px;margin:-12px -14px 10px;overflow:hidden;background:#382d22}
#mc-video{display:block;width:100%;height:100%;object-fit:contain}#mc-audio{display:none}
#mc-call-time{position:absolute;right:8px;bottom:7px;color:#fff8ed;background:#30251ce8;padding:4px 7px;border-radius:4px;font-variant-numeric:tabular-nums;font-size:11px}
/* Latest reply always readable; full history behind one disclosure. */
#mc-latest{flex-shrink:0;margin:0 14px 10px;padding:10px 12px;background:#fffaf0;max-height:9.5em;overflow:auto;overscroll-behavior:contain}
body.wing-security #mc-latest{background:#1d2b28}
#mc-latest>strong{font-size:12px;color:var(--mc-muted)}#ms-cook-companion #mc-latest .markdown,#ms-cook-companion #mc-latest .markdown p{font-size:15px;line-height:1.55;margin:4px 0}
#mc-transcript{border-top:1px solid var(--mc-line)}
#mc-panel:has(#mc-transcript[open]) #mc-latest{display:none}
#mc-transcript>summary,.mc-secondary summary{cursor:pointer;padding:10px 14px;font-size:13px;font-weight:600;min-height:24px}
#mc-turns{min-height:120px;max-height:min(46dvh,420px);overflow:auto;overscroll-behavior:contain;padding:4px 16px 12px}
.mc-welcome h3{font:700 20px Georgia,serif;margin:6px 0 10px}.mc-welcome p{font-size:15px;line-height:1.6}
.mc-turn{padding:0 0 14px;margin:0 0 14px;border-bottom:1px solid var(--mc-line);overflow-wrap:anywhere}.mc-turn>strong{font-size:13px}.mc-turn>small{display:block;color:var(--mc-muted);font-size:12px;line-height:1.5;margin-top:5px}.mc-user{padding-left:12px}
#ms-cook-companion .markdown{font-size:16px;color:var(--mc-ink);line-height:1.65}#ms-cook-companion .markdown p{font-size:16px;margin:8px 0;white-space:pre-wrap}#ms-cook-companion .markdown :is(h1,h2,h3,h4){font-size:19px;color:var(--mc-ink);margin:16px 0 8px}#ms-cook-companion .markdown pre{overflow:auto;max-width:100%;background:#2a251f;color:#fff4e4;padding:12px;font-size:13px}#ms-cook-companion a{color:var(--mc-accent)}
#mc-form{padding:10px 14px;border-top:1px solid var(--mc-line);flex-shrink:0}#mc-form>label{display:block;font-size:12px;font-weight:600;color:var(--mc-muted);margin-bottom:5px}
.mc-type-row{display:flex;gap:8px;align-items:flex-end}#mc-question{flex:1;min-width:0;min-height:44px;height:44px;max-height:120px;padding:10px;resize:vertical;font-size:16px!important;box-sizing:border-box}#mc-question::placeholder{color:var(--mc-muted)}
#ms-cook-companion #mc-send{background:var(--mc-bg);color:var(--mc-accent);border-color:var(--mc-accent);white-space:nowrap}
#mc-status{display:block;font-size:12px;line-height:1.5;color:var(--mc-muted);margin-top:6px}
.mc-secondary{border-top:1px solid var(--mc-line)}
.mc-settings{font-size:13px;padding:0 14px}.mc-settings summary{padding:10px 0!important}.mc-settings p{font-size:13px;line-height:1.55;margin:10px 0}.mc-settings select{display:block;width:100%;margin:6px 0;padding:9px}.mc-settings>button{margin:0 6px 12px 0}
.mc-check{display:flex;align-items:flex-start;gap:8px;line-height:1.5;margin:8px 0}#ms-cook-companion input[type=checkbox]{accent-color:var(--mc-accent);width:16px;height:16px;flex-shrink:0;margin-top:3px}
.mc-context{display:flex;flex-wrap:wrap;gap:6px 12px;padding:4px 0 10px;font-size:13px;color:var(--mc-muted)}.mc-context label{display:flex;align-items:center;gap:6px;color:var(--mc-ink);white-space:nowrap}.mc-context span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
body.wing-security #ms-cook-companion{--mc-bg:#172321;--mc-ink:#edf2e7;--mc-muted:#c4d1c9;--mc-line:#657971;--mc-accent:#86dfd7;--mc-button:#102421}body.wing-security .mc-header{background:#20302c}
body.activity-expanded #ms-cook-companion{z-index:60}body.cook-open.activity-expanded .play-frame{pointer-events:none}
/* Expanded play: the stage sits above the Library header (z 20-25). Ms. Cook docks as a compact portrait in the toolbar's reserved corner, never over game controls. */
body.activity-expanded .activity-toolbar{padding-right:84px}body.activity-expanded #mc-launch{top:6px;bottom:auto;right:14px;width:58px;height:58px;box-shadow:0 2px 10px #1d160b33}body.activity-expanded #mc-launch img{width:50px;height:50px}
/* Short landscape phones: a smaller head tucked low so the reserved strip stays small (still a 48px target). */
@media(max-height:500px){body:not(.activity-expanded) #mc-launch{bottom:calc(6px + env(safe-area-inset-bottom,0px));right:calc(10px + env(safe-area-inset-right,0px));width:48px;height:48px}body:not(.activity-expanded) #mc-launch img{width:42px;height:42px}}
@media(max-height:500px){body.activity-expanded .activity-toolbar{padding-right:68px}body.activity-expanded #mc-launch{top:3px;width:48px;height:48px}body.activity-expanded #mc-launch img{width:42px;height:42px}}
@media(min-width:1100px){body.cook-open .shell{margin-right:428px}body.cook-open .sidebar{width:calc(100% - 428px);flex-wrap:wrap;gap:8px 18px;padding-inline:24px}body.cook-open .sidebar .brand{flex:1}body.cook-open .sidebar nav{order:3;flex-basis:100%;justify-content:flex-start;overflow-x:auto;padding-bottom:6px}body.cook-open .sidebar nav a{flex-shrink:0}}
/* Phones: a bottom sheet, not a modal — the character and lesson stay visible above it. */
@media(max-width:600px){#mc-launch{right:10px;width:58px;height:58px}#mc-launch img{width:50px;height:50px}#mc-panel{left:8px;right:8px;bottom:8px;width:auto;max-width:none;max-height:min(62dvh,calc(100dvh - 230px));padding-bottom:env(safe-area-inset-bottom)}#mc-latest{max-height:6.5em}}
#mc-panel ::selection{background:var(--mc-accent);color:var(--mc-button)}#mc-question{caret-color:var(--mc-accent)}#mc-turns{scrollbar-color:var(--mc-line) var(--mc-bg)}


.mc-memory{padding:8px 16px;border-top:1px solid var(--mc-line);font-size:13px;flex-shrink:0}.mc-memory[open]{max-height:42%;overflow:auto}.mc-memory summary{cursor:pointer;padding:7px 0;font-weight:600}.mc-memory p{line-height:1.55}.mc-memory textarea{width:100%;box-sizing:border-box;padding:8px;margin:6px 0}.mc-memory article{padding:10px 0;border-bottom:1px solid var(--mc-line)}.mc-memory article p{margin:5px 0}.mc-memory-actions{display:flex;flex-wrap:wrap;gap:6px}#ms-cook-companion .mc-memory button{font-size:12px;min-height:36px;padding:6px 9px}.mc-action-receipt{padding:10px;border:1px solid var(--mc-line);font-size:13px;line-height:1.5}

#mc-panel:has(.mc-memory[open]) :is(#mc-latest,#mc-transcript,#mc-form,.mc-settings){display:none}

#ms-cook-companion .mc-memory textarea{min-height:72px;height:72px;max-height:150px}.mc-memory textarea::placeholder{color:var(--mc-muted)}

/* Voice lives on the page; text, memory and settings are opened on request. */
#mc-conversation{position:fixed;left:50%;bottom:12px;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);background:var(--mc-bg);border:1px solid var(--mc-line);border-radius:10px;box-shadow:0 4px 18px #17120a33}
#mc-conversation #mc-voice-controls{padding:8px 10px}
#mc-conversation .mc-call-actions{justify-content:center}
#mc-conversation #mc-voice-status{max-width:44ch;margin:5px auto 0;text-align:center}
#mc-conversation #mc-live-stage{margin:0 0 8px}
#mc-panel-talk{margin:10px 14px}
/* The character already provides Mute and click-to-interrupt. Keep these
   equivalents when the character is hidden or an activity covers her. */
body.cook-character-visible:not(.activity-expanded) #mc-conversation :is(#mc-mute,#mc-interrupt){display:none}
body.cook-conversing #mc-panel{bottom:calc(var(--mc-conversation-h,90px) + 24px);max-height:calc(100dvh - var(--mc-conversation-h,90px) - 42px)}
@media(max-width:700px){
 #mc-conversation{bottom:max(8px,env(safe-area-inset-bottom));max-width:calc(100vw - 16px)}
 #ms-cook-companion #mc-conversation button{font-size:13px;padding:8px;min-height:44px}
 body.cook-conversing #mc-panel{max-height:calc(100dvh - var(--mc-conversation-h,90px) - 260px)}
}

/* One shared conversation and character, in a larger optional room. */
.mc-view-actions{display:flex;gap:8px;align-items:center;padding:10px 14px}.mc-view-actions #mc-panel-talk{margin:0;flex:1}.mc-view-actions{flex-wrap:wrap}#mc-panel-show{display:none}body:not(.cook-character-visible):not(.activity-expanded) #mc-panel-show{display:block}
#mc-room{position:fixed;inset:12px 12px 12px auto;width:min(56vw,760px);box-sizing:border-box;display:grid;grid-template-rows:auto auto minmax(120px,1fr) auto auto;overflow:auto;overscroll-behavior:contain;border:1px solid var(--mc-line);border-radius:14px;background:var(--mc-bg) url('/brand/papyrus.png') center/700px;box-shadow:0 12px 50px #17120a44}
.mc-room-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:18px 22px 12px}.mc-room-heading h2{font:600 26px/1.2 Georgia,serif;margin:3px 0;color:var(--mc-ink)}.mc-room-heading p{font-size:13px;color:var(--mc-muted);margin:0}.mc-room-heading>div:last-child{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
#ms-cook-companion .mc-room-heading button{font-size:13px;padding:8px 10px}
#mc-room-context{font-size:13px;color:var(--mc-muted);line-height:1.5;margin:0;padding:0 22px 10px;border-bottom:1px solid var(--mc-line);overflow-wrap:anywhere}
#mc-room-stage{min-height:120px;min-width:0;position:relative;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 75%,#ae774225,transparent 65%)}
#mc-room-stage:before{content:'';position:absolute;inset:5% 12% 8%;border:1px solid var(--mc-line);border-radius:48% 48% 8px 8px;opacity:.35;pointer-events:none}
#mc-room-text{min-width:0}#mc-room-controls{border-top:1px solid var(--mc-line);background:var(--mc-bg);padding-bottom:env(safe-area-inset-bottom)}
#mc-room #mc-panel{position:relative;inset:auto!important;width:auto;max-width:none;max-height:min(36dvh,340px)!important;margin:0 12px 10px;border-radius:8px;box-shadow:none}
#mc-room #mc-conversation{position:relative;inset:auto;transform:none;width:auto;max-width:none;border:0;border-radius:0;box-shadow:none}
#mc-room #mc-voice-controls{padding:12px}#mc-room #mc-one-on-one,#mc-room #mc-panel-one,#mc-room .mc-portrait-option,#mc-room #mc-show-character{display:none}
#mc-room .mc-view-actions{display:none}#mc-room #mc-live-stage{display:none}
#mc-room #mc-turns{max-height:24dvh}#mc-room #mc-latest{max-height:7em}
#mc-room-local{margin:12px}
body.cook-room-full #mc-room{inset:12px;width:auto}body.cook-room-modal{overflow:hidden}
@media(min-width:1100px){
 body.cook-one-on-one:not(.cook-room-full) .shell{margin-right:calc(min(56vw,760px) + 24px)}
 body.cook-one-on-one:not(.cook-room-full) .sidebar{width:calc(100% - min(56vw,760px) - 24px);flex-wrap:wrap;gap:8px 18px;padding-inline:24px}
 body.cook-one-on-one:not(.cook-room-full) .sidebar nav{order:3;flex-basis:100%;justify-content:flex-start;overflow-x:auto}
 body.cook-room-full.cook-open .shell{margin-right:0}body.cook-room-full.cook-open .sidebar{width:100%}
}
body.wing-security #mc-room{background:var(--mc-bg)}
@media(max-width:900px){
 #mc-room{inset:6px!important;width:auto!important;border-radius:10px}
 #mc-room-size{display:none}.mc-room-heading{padding:12px;gap:8px}.mc-room-heading h2{font-size:22px}.mc-room-heading p{display:none}
 #mc-room-context{padding:0 12px 8px;font-size:12px}
 #mc-room #mc-panel{max-height:min(34dvh,300px)!important;margin:0 6px 6px}
 #mc-room #mc-voice-controls{padding:8px}#mc-room #mc-voice-status{font-size:12px}
}
