.companion-dialog [hidden]{display:none!important}
.companion-dialog{position:fixed;inset:auto 0 0;margin:0 auto;width:min(100%,480px);max-width:calc(100vw - 20px);height:auto;max-height:50dvh;border:1px solid #d6c4a8;border-radius:26px 26px 0 0;padding:0;color:#624d3a;background:#fbf5e8;box-shadow:0 -12px 55px #493b3424;overflow:auto;overscroll-behavior:contain;font-size:13px;scrollbar-width:thin}
.companion-dialog::backdrop{background:#2d2b2926;backdrop-filter:none}
.companion-inner{padding:18px 22px max(22px,env(safe-area-inset-bottom));background:radial-gradient(ellipse at 90% 0%,#f0dfbd70,transparent 65%)}
.companion-grip{width:34px;height:3px;border-radius:4px;background:#c8b797;margin:0 auto 14px}
.companion-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:6px}.companion-head small{color:#94816a;font-size:10px;letter-spacing:2px}.companion-close{background:transparent;font-size:21px;width:44px;height:44px;border-radius:50%;margin:-9px -10px -9px 0}
.companion-dialog h2{margin:10px 0 7px;font-size:21px;font-weight:500;color:#66513b}.companion-dialog h3{font-weight:500;font-size:15px;margin:18px 0 8px}.companion-note{color:#97816a;line-height:1.75;font-size:12px;margin:6px 0 14px}.companion-hand{font-family:HarryHand,serif;font-size:20px;line-height:1.65;color:#8b6b54;margin:6px 0 16px}
.companion-modes{display:grid;grid-template-columns:1fr 1fr;gap:10px}.companion-mode{text-align:left;padding:14px;border-radius:17px;border:1px solid #ddd0b8;background:#fffbf3;color:#725c44;min-height:106px}.companion-mode[aria-pressed=true]{border-color:#83956d;background:#eff1e4;box-shadow:inset 0 0 0 1px #83956d}.companion-mode svg{display:block;color:#8d9a75;width:29px;height:29px;margin-bottom:10px}.companion-mode strong{display:block;font-size:14px;font-weight:500}.companion-mode span{display:block;font-size:11px;color:#99866d;margin-top:6px;line-height:1.5}
.companion-fields{display:grid;gap:10px;margin:16px 0}.companion-fields label{display:grid;gap:7px;font-size:12px;color:#806a52}.companion-fields input,.companion-fields select{width:100%;min-height:44px;border:1px solid #daceb9;border-radius:11px;background:#fffdf6;padding:10px 12px;box-sizing:border-box;font:inherit;color:#6e5941}.companion-fields input:focus,.companion-fields select:focus{outline:2px solid #9cab7b;outline-offset:2px}.companion-split{display:grid;grid-template-columns:1fr 1fr;gap:10px}.companion-check{display:flex!important;align-items:center;gap:8px!important;line-height:1.5;min-height:44px}.companion-check input{width:17px;min-height:17px;accent-color:#819367;padding:0}
.companion-primary,.companion-secondary,.companion-text{min-height:44px;border-radius:12px;font-size:13px;padding:11px 15px;line-height:1.5}.companion-primary{background:#829268;color:#fffaf0}.companion-secondary{background:#ede5d5;color:#735c43}.companion-text{background:transparent;color:#92785a}.companion-wide{width:100%}.companion-actions{display:flex;gap:9px;margin-top:16px}.companion-actions>*{flex:1}.companion-actions-wrap{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:12px 0}.companion-actions-wrap button:last-child:nth-child(odd){grid-column:1/-1}
.companion-clock{margin:14px 0;font-size:23px;letter-spacing:2px;font-variant-numeric:tabular-nums;color:#839069}.companion-status{display:flex;align-items:center;gap:9px;color:#86916c;font-size:12px;margin:14px 0}.companion-dot{width:7px;height:7px;background:#9ca97f;border-radius:50%;box-shadow:0 0 0 5px #9ca97f1a}
.companion-goal{padding:12px 0;border-top:1px solid #e7dbc8;border-bottom:1px solid #e7dbc8;margin:12px 0;line-height:1.8;overflow-wrap:anywhere}.companion-goal small{display:block;color:#a08c72;font-size:10px}.companion-options{margin-top:15px}.companion-options summary{cursor:pointer;color:#957d5e;min-height:44px;line-height:44px}
.companion-memory{margin:14px 0 4px;padding:17px 16px;background:repeating-linear-gradient(transparent 0 32px,#ddceb42d 32px 33px),#fffaf0;border-radius:4px 14px 14px 14px;box-shadow:0 3px 14px #8e745710;transform:rotate(-.35deg)}.companion-memory time{display:block;color:#aa9377;font-size:11px}.companion-memory p{font-family:HarryHand,serif;line-height:1.8;font-size:19px;color:#85684e;overflow-wrap:anywhere;margin:12px 0}.companion-memory small{color:#a08b71;font-size:10px}.companion-error{color:#a45f47;font-size:12px;line-height:1.7;margin-top:9px}.companion-error:empty{display:none}
#companionButton.companion-ongoing{position:relative;color:#70855e}#companionButton.companion-ongoing::after{content:'';position:absolute;top:3px;right:19%;width:5px;height:5px;background:#a2b382;border-radius:50%;box-shadow:0 0 7px #a2b38299;animation:companion-glow 3s ease-in-out infinite}#companionButton .companion-cups{width:27px;height:27px}.companion-history{border-top:1px solid #decdb1;margin-top:25px;padding-top:16px}.companion-history h3{font-size:16px;color:#796049}.companion-history-empty{font-family:HarryHand,serif;font-size:18px;color:#9d846a;line-height:1.7}.companion-history article{margin:15px 0 20px}.companion-history button{font-size:12px;min-height:44px;padding:8px 12px;border-radius:10px;background:#eee5d2}.companion-history-tools{display:flex;justify-content:space-between;align-items:center;gap:8px;color:#9c8669;font-size:11px}.companion-history-tools a{color:inherit}
@keyframes companion-glow{50%{opacity:.45;box-shadow:0 0 4px #a2b38250}}@media(prefers-reduced-motion:reduce){#companionButton.companion-ongoing::after{animation:none}.companion-memory{transform:none}}@media(max-width:360px){.companion-inner{padding-left:15px;padding-right:15px}.companion-modes{gap:7px}.companion-mode{padding:11px}.companion-actions{gap:6px}.companion-split{grid-template-columns:1fr}}

@media(prefers-reduced-motion:no-preference){.companion-dialog[open]{animation:companion-enter .18s ease-out}}@keyframes companion-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

/* A: mist glass, ceramic cups and a quiet circular entry. */
.companion-dialog{inset:auto;margin:0;z-index:60;max-width:none;width:calc(100vw - 24px);max-height:32dvh;padding:0;border:1px solid #fffdebdb;border-radius:26px;color:#60452f;background:linear-gradient(135deg,#fff9e46b,#ffedc28c 60%,#fff6df73);box-shadow:inset 0 1px 1px #fffdf6b0,inset 0 -1px 12px #ffefd72e,0 8px 30px #5f432022;backdrop-filter:blur(12px) saturate(1.08);-webkit-backdrop-filter:blur(12px) saturate(1.08);scrollbar-width:thin;scroll-padding:52px 0 10px}
.companion-dialog::backdrop{background:transparent}
.companion-inner{padding:5px 20px 15px;background:none}
.companion-grip{display:none}
.companion-head{position:sticky;top:-5px;z-index:2;display:flex;justify-content:center;min-height:44px;margin:0 -12px;background:linear-gradient(#fff6df9e,#fff6df00);border:0}
.companion-glass-cups{display:block;pointer-events:none;width:82px;height:47px;margin-top:-1px}
.companion-glass-cups img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 2px #6345261f)}
.companion-close{position:absolute;right:0;top:0;margin:0;width:44px;height:44px;color:#8e7454;font-size:19px;background:transparent}
.companion-dialog h2{font-family:Georgia,'Songti SC',SimSun,serif;font-size:21px;font-weight:500;text-align:center;letter-spacing:2px;color:#60452f;margin:0 0 15px}
.companion-dialog h2::before{content:'❧';font-size:15px;color:#7f8d5e;margin-right:8px;display:inline-block;transform:rotate(-22deg)}
.companion-dialog h3{font-size:12px;font-weight:400;text-align:center;color:#7c694c;margin:0 0 6px;letter-spacing:.5px}
.companion-hand{font-family:HarryHand,serif;font-size:18px;line-height:1.6;margin:4px 0 13px;color:#775d42}
.companion-dialog[data-phase=setup] #companionLine,.companion-dialog[data-phase=active] #companionLine{display:none}
.companion-modes{gap:10px}
.companion-mode{display:flex;align-items:center;justify-content:center;gap:7px;min-height:48px;padding:9px 7px;text-align:center;background:linear-gradient(#fff9eac4,#fff5e1a1);border:1px solid #cdb58bc2;border-radius:28px;box-shadow:0 3px 8px #9c7c4220,inset 0 1px #fffdf3d9;transition:background .18s,transform .18s}
.companion-mode svg{display:block;width:20px;height:20px;color:#7c8d5e;margin:0;stroke-width:1.5}
.companion-mode strong{font-family:Georgia,'Songti SC',SimSun,serif;display:block;font-size:14px;font-weight:400;letter-spacing:1px;white-space:nowrap}
.companion-mode span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.companion-mode:hover{background:#fffaf0e8;transform:translateY(-1px)}
.companion-mode:active{transform:translateY(1px)}
.companion-fields{margin:8px 0 12px;gap:9px}
.companion-fields label{font-size:11px;color:#745d41}
.companion-fields input,.companion-fields select{background:#fff8e6ac;border:1px solid #d1bb97a6;font-size:13px;color:#604b34;border-radius:14px}
.companion-check{font-size:11px;line-height:1.6;color:#7c694e}
.companion-primary{background:linear-gradient(#8a9a73,#788b61);box-shadow:inset 0 1px #b9c4a390,0 3px 8px #6d7c4e1c;border-radius:24px;font-size:13px;letter-spacing:.5px}
.companion-secondary{background:#fff7e5a6;border:1px solid #cdb58b88;border-radius:24px;color:#745b3d}
.companion-text{min-height:38px;padding:6px 9px;color:#846b4a;font-size:12px}
.companion-note{font-size:11px;color:#806d50;margin:8px 0 0;line-height:1.7}
.companion-goal{font-size:12px;line-height:1.8;margin:9px 0;padding:8px 0;border-color:#ccb08655}
.companion-status{justify-content:center;font-size:11px;color:#7a8861;margin:9px 0}
.companion-clock{font-size:20px;margin:8px 0;color:#7a8b62}
.companion-dialog[data-phase=active] .companion-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);margin:0}
.companion-dialog[data-phase=active][data-session-state=paused] #companionActiveTitle::after{content:' · 暂停中';color:#957c5d}
.companion-dialog[data-phase=active]>.companion-inner>section>.companion-actions{padding-top:7px;border-top:1px solid #c6ab7f6b;margin-top:8px;gap:0}
.companion-dialog[data-phase=active] #pauseTimer,.companion-dialog[data-phase=active] #endTimer{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:7px 12px;background:transparent;border:0;border-radius:12px;color:#755739;box-shadow:none;letter-spacing:1px;font-size:12px}
.companion-dialog[data-phase=active] #pauseTimer{position:relative}
.companion-dialog[data-phase=active] #pauseTimer::after{content:'';position:absolute;right:0;height:15px;width:1px;background:#c7ae87}
.companion-action-symbol{width:19px;height:19px;display:grid;place-items:center;border:1px solid #a88c62;border-radius:50%;font-size:11px;letter-spacing:0}
.companion-extra{font-size:11px;margin-top:5px}
.companion-extra>summary{width:max-content;margin:auto;min-height:36px;display:flex;align-items:center;gap:5px;cursor:pointer;color:#957b59;list-style:none;padding:8px 12px}
.companion-extra>summary::-webkit-details-marker{display:none}
.companion-extra>summary span{transition:transform .16s}
.companion-extra[open]>summary span{transform:rotate(180deg)}
.companion-extra-body{padding:4px 0 9px}
.companion-options{margin-top:6px;border-top:1px solid #cfb98f52}
.companion-options summary{color:#7d694a;font-size:12px}
.companion-memory{background:repeating-linear-gradient(transparent 0 32px,#c9b18733 32px 33px),#fff8e7aa;box-shadow:none}
.companion-dock{position:absolute;z-index:9;bottom:calc(78px + env(safe-area-inset-bottom));right:17px;left:auto;display:grid;place-items:center;width:58px;min-width:58px;height:58px;min-height:58px;padding:3px;border:1px solid #fffbeaeb;border-radius:50%;background:radial-gradient(circle at 30% 20%,#fff9e6a8,#f9dfaa54 70%);box-shadow:inset 0 1px 3px #fff9e99c,0 3px 12px #89602c22,0 0 14px #ffe6ad45;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);transition:opacity .22s,transform .22s}
.companion-cup-art{position:relative;display:grid;place-items:center;width:49px;height:43px;background:none;border-radius:0}
.companion-cup-art img{width:100%;height:100%;object-fit:contain}
.companion-cup-art i{position:absolute;top:0;right:4px;width:3px;height:3px;border-radius:50%;background:#fff4c7;box-shadow:0 0 5px 2px #fff0b9aa;animation:companion-glow 3.5s ease-in-out infinite}
.companion-dock-copy{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.companion-dock-arrow{display:none}
.companion-dock[data-state=paused] .companion-cup-art i{animation:none;opacity:.35}
.companion-dock[data-state=due]::after{content:'';position:absolute;right:4px;top:3px;width:6px;height:6px;border-radius:50%;background:#d8aa65;box-shadow:0 0 0 3px #fff1ceae}
.companion-live .speech{opacity:0;visibility:hidden;transition:opacity .25s,visibility .25s}
.companion-live.companion-speaking .speech{opacity:1;visibility:visible;background:#fff9eaef;border:1.5px solid #ccb48d;border-radius:18px 17px 20px 5px;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:0 3px 0 #80613c12;color:#6b4a35}
.companion-live.companion-speaking .speech::before{background:#fff9ea;border-color:#ccb48d}
.companion-live.companion-speaking .speech p{font-family:inherit;font-size:13px;line-height:1.7;letter-spacing:.3px}
.app.night.companion-live.companion-speaking .speech{background:#e7d6baed;border-color:#b49b7a;color:#554238;box-shadow:0 5px 18px #111a2926}
.app.night.companion-live.companion-speaking .speech::before{background:#e7d6ba;border-color:#b49b7a}
.companion-card-open .speech{opacity:0!important;visibility:hidden!important}
.companion-speaking .companion-dock,.app:has(.wardrobe:not([hidden])) .companion-dock,.app:has(dialog[open]) .companion-dock{opacity:0;visibility:hidden;pointer-events:none}
body:has(.app.night) .companion-dialog{background:linear-gradient(140deg,#f4e2c49e,#e3c8959e);border-color:#fff2d4cb;box-shadow:inset 0 1px #fff9e580,0 6px 25px #2c241e22}
body:has(.app.night) .companion-head{background:linear-gradient(#f4e4c79c,#f4e4c700)}
.app.night .companion-dock{background:radial-gradient(circle at 30% 20%,#ffecc58c,#ddb77d54 70%);border-color:#ffefd4c7}
.companion-dialog h2{color:#493527}
.companion-dialog h3,.companion-fields label{color:#57442e}
.companion-note,.companion-check,.companion-extra>summary{color:#665139}
.companion-goal{padding:0;margin:5px 0 8px;border:0;text-align:center;line-height:1.6;color:#57442e}
.companion-goal small{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-height:700px){.companion-live.companion-speaking .speech p{font-size:12px}}
@media(max-height:600px){.companion-inner{padding:2px 15px 10px}.companion-head{top:-2px;min-height:33px}.companion-glass-cups{height:35px;width:65px}.companion-dialog h2{font-size:18px;margin-bottom:9px}.companion-mode{min-height:44px;padding:7px}.companion-dock{width:52px;height:52px;min-width:52px;min-height:52px;bottom:72px}}
@media(max-width:350px){.companion-modes{gap:7px}.companion-mode strong{font-size:12px}.companion-mode svg{width:18px}}
@media(prefers-reduced-motion:reduce){.companion-cup-art i{animation:none}.companion-mode,.companion-extra>summary span{transition:none}.companion-mode:hover{transform:none}}

/* Tap-through pages: every choice stays on one small, non-scrolling card. */
.companion-dialog{overflow:hidden;scrollbar-width:none;touch-action:manipulation}
.companion-inner{padding:5px 18px 14px;overflow:hidden}
.companion-head{position:relative;top:auto;background:none;margin:0;min-height:44px}
.companion-back{position:absolute;left:-10px;top:0;width:44px;height:44px;border:0;background:transparent;border-radius:50%;font-size:25px;color:#775d40}
.companion-close{right:-10px}
.companion-dialog h2{margin:0 25px 12px;font-size:18px;line-height:1.35;letter-spacing:1px}
.companion-dialog h2::before{content:none}
.companion-page-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.companion-page-grid button{width:100%;min-height:42px;padding:7px 6px;font-size:12px;white-space:normal;line-height:1.4}
.companion-page-grid button[aria-pressed=true]{border-color:#7f9467;background:#edf1daca}
.companion-main-actions{display:flex;gap:7px;margin:0}
.companion-main-actions button{flex:1;min-width:0;min-height:42px;padding:8px 6px;font-size:12px}
.companion-dialog[data-phase=active] #pauseTimer,.companion-dialog[data-phase=active] #endTimer{min-height:42px;padding:8px 6px;background:#fff7e5a6;border:1px solid #cdb58b88;border-radius:24px}
.companion-dialog[data-phase=active] #pauseTimer::after,.companion-dialog[data-phase=active] #companionActiveTitle::after{content:none}
.companion-dialog[data-phase=active] .companion-text,.companion-dialog[data-phase=ready] .companion-text{width:100%;min-height:30px;padding:5px 0;margin-top:4px;font-size:11px}
.companion-page-caption{display:block;text-align:center;font-size:11px;line-height:1.5;margin:0 0 7px;color:#6a533b;overflow-wrap:anywhere}
.companion-input-row{display:flex;gap:6px}
.companion-input-row input{min-width:0;flex:1;width:100%;height:42px;padding:8px 10px;background:#fff8e6bf;border:1px solid #cdb58b;border-radius:12px;font:inherit;color:#493527}
.companion-input-row button{min-height:42px;white-space:nowrap;padding:8px 12px}
.companion-input-row input:focus{outline:2px solid #829268;outline-offset:1px}
.companion-pager{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:4px;border-top:1px solid #c6ab7f66}
.companion-pager button{min-height:30px;min-width:64px;padding:5px 8px;background:transparent;color:#715238;font-size:11px;border-radius:12px}
.companion-pager button:disabled{opacity:.35}
.companion-pager span{font-size:10px;letter-spacing:1px;color:#7c674a}
.companion-dialog .companion-clock{text-align:center;font-size:19px;line-height:1.3;margin:0 0 5px}
.companion-paper-fragment{font-family:HarryHand,serif;font-size:18px;line-height:27px;letter-spacing:0;color:#654c35;overflow-wrap:anywhere;white-space:pre-wrap;margin:0 0 4px}
.companion-dialog[data-density=compact] .companion-inner{padding:8px}
.companion-dialog[data-density=compact] .companion-head{height:0;min-height:0;margin:0}
.companion-dialog[data-density=compact] .companion-glass-cups{display:none}
.companion-dialog[data-density=compact] .companion-close,.companion-dialog[data-density=compact] .companion-back{top:-10px;left:-6px;right:auto}
.companion-dialog[data-density=compact] .companion-close{left:auto;right:-6px}
.companion-dialog[data-density=compact] h2{font-size:16px;line-height:22px;margin:0 32px 6px;white-space:nowrap;letter-spacing:0}
.companion-dialog[data-density=compact] #companionReadySummary,.companion-dialog[data-density=compact] #companionActiveTitle{display:none}
.companion-dialog[data-density=compact] .companion-page-grid button,.companion-dialog[data-density=compact] .companion-main-actions button,.companion-dialog[data-density=compact] .companion-primary{min-height:40px;padding:7px 6px}
.companion-dialog[data-density=compact] .companion-pager{margin-top:5px;padding-top:1px}
.companion-dialog[data-density=compact] .companion-check{margin:0;min-height:40px;font-size:12px;justify-content:center}
.companion-dialog[data-density=compact] .companion-page-caption{margin:0 0 4px}
.companion-dialog[data-density=compact] .companion-error{font-size:11px;line-height:16px;margin:3px 0 0}
.companion-dialog :focus-visible{outline:2px solid #708453;outline-offset:1px}
.companion-dialog[data-phase=active][data-session-state=paused] #companionActiveTitle::after{content:none}
.companion-dialog .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.companion-dialog[data-tight=true] .companion-inner{padding:6px}
.companion-dialog[data-tight=true] h2{font-size:14px;line-height:20px;margin-bottom:4px}
.companion-dialog[data-tight=true] .companion-page-caption{font-size:10px;line-height:14px}
.companion-dialog[data-tight=true] .companion-primary,.companion-dialog[data-tight=true] .companion-secondary,.companion-dialog[data-tight=true] .companion-main-actions button{min-height:36px;padding-top:5px;padding-bottom:5px}
.companion-dialog[data-tight=true] .companion-text{min-height:26px;padding-top:3px;padding-bottom:3px}
.companion-dialog[data-tight=true]:has(.companion-error:not(:empty)) .companion-page-caption{display:none}
.companion-dialog[data-phase=paper]:has(.companion-error:not(:empty)) .companion-paper-fragment{display:none}
.companion-dialog[data-phase=paper] .companion-error{font-size:11px;line-height:16px;margin:4px 0 0}
