/* The engine room, sign-in from the page and the creature's glyphs (#82, #49, ADR 048).
   Icon first: a glyph per state and per engine, a few words, the rest behind a tap. Tokens only
   (app.css :root), so light and dark follow the page. Loaded after app.css. */

/* State glyphs: the chip's light becomes the state's outline glyph (masks drawn from engine.js GLYPHS). */
.state-chip .state-light,.talk-status .state-light{width:18px;height:18px;border-radius:0;box-shadow:none;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")}
.talk-status .state-light{width:14px;height:14px;box-shadow:none}
.state-chip[data-state=idle] .state-light,.talk-status[data-state=idle] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")}
.state-chip[data-state=thinking] .state-light,.talk-status[data-state=thinking] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.9 6.1L20 11l-6.1 1.9L12 19l-1.9-6.1L4 11l6.1-1.9z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.9 6.1L20 11l-6.1 1.9L12 19l-1.9-6.1L4 11l6.1-1.9z'/%3E%3C/svg%3E")}
.state-chip[data-state=working] .state-light,.talk-status[data-state=working] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2zM9 4v14M15 6v14'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2zM9 4v14M15 6v14'/%3E%3C/svg%3E")}
.state-chip[data-state=needs] .state-light,.talk-status[data-state=needs] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 12V6.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6a1.5 1.5 0 0 1 3 0v7.5a6.5 6.5 0 0 1-6.5 6.5h-.3A6.2 6.2 0 0 1 5 13.8V11a1.5 1.5 0 0 1 3 0v2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 12V6.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6a1.5 1.5 0 0 1 3 0v7.5a6.5 6.5 0 0 1-6.5 6.5h-.3A6.2 6.2 0 0 1 5 13.8V11a1.5 1.5 0 0 1 3 0v2'/%3E%3C/svg%3E")}
.state-chip[data-state=resting] .state-light,.talk-status[data-state=resting] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z'/%3E%3C/svg%3E")}
.state-chip[data-state=sleeping] .state-light,.talk-status[data-state=sleeping] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9h5l-5 6h5M13 5h6l-6 8h6'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9h5l-5 6h5M13 5h6l-6 8h6'/%3E%3C/svg%3E")}
.state-chip[data-state=happy] .state-light,.talk-status[data-state=happy] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.5v4M12 17.5v4M2.5 12h4M17.5 12h4M5.3 5.3l2.8 2.8M15.9 15.9l2.8 2.8M5.3 18.7l2.8-2.8M15.9 8.1l2.8-2.8'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.5v4M12 17.5v4M2.5 12h4M17.5 12h4M5.3 5.3l2.8 2.8M15.9 15.9l2.8 2.8M5.3 18.7l2.8-2.8M15.9 8.1l2.8-2.8'/%3E%3C/svg%3E")}
.state-chip[data-state=away] .state-light,.talk-status[data-state=away] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 18.5h9.5a4 4 0 0 0 .4-8A5.8 5.8 0 0 0 6.3 9.7 4.4 4.4 0 0 0 7.5 18.5z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 18.5h9.5a4 4 0 0 0 .4-8A5.8 5.8 0 0 0 6.3 9.7 4.4 4.4 0 0 0 7.5 18.5z'/%3E%3C/svg%3E")}
.state-chip[data-state=thoughtful] .state-light,.talk-status[data-state=thoughtful] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20v-6a5 5 0 0 1 5-5h9M15 5l4 4-4 4'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20v-6a5 5 0 0 1 5-5h9M15 5l4 4-4 4'/%3E%3C/svg%3E")}

/* A chip with its own sign (#232): Ari's own updates paused. */
.state-chip[data-glyph=pause] .state-light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M9 6v12M15 6v12'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M9 6v12M15 6v12'/%3E%3C/svg%3E")}
/* The badge on Ari's portraits and the hero: a glyph in a small glass circle, ringed in the state's colour. */
.creature{--state-ring:var(--mint)}
.creature[data-state=thinking]{--state-ring:var(--violet)}
.creature[data-state=working],.creature[data-state=thoughtful]{--state-ring:var(--cyan)}
.creature[data-state=needs],.creature[data-state=happy]{--state-ring:var(--amber)}
.creature[data-state=resting],.creature[data-state=sleeping]{--state-ring:var(--violet)}
.creature[data-state=away]{--state-ring:var(--text-3)}
.creature-badge{position:absolute;z-index:3;right:4%;bottom:6%;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:var(--surface);color:var(--state-ring);border:1.5px solid var(--state-ring);box-shadow:0 0 14px color-mix(in srgb,var(--state-ring) 45%,transparent)}
.creature-badge .glyph{width:17px;height:17px;stroke-width:2}
.creature-mini .creature-badge{display:none}
.creature-mini{border:2px solid var(--state-ring);box-shadow:0 0 12px color-mix(in srgb,var(--state-ring) 40%,transparent)}
/* #280: the badge follows Ari's drawn size (the figure is a size container): when Ari steps back for a
   sign-in card on a short laptop window, the badge stays beside Ari instead of floating far right. */
.creature-hero{container-type:size}
.creature-hero .creature-badge{right:auto;left:calc(50% + min(20vw,150px,36cqmin));bottom:auto;top:16%;width:52px;height:52px;background:var(--scene-chip);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.creature-hero .creature-badge .glyph{width:26px;height:26px}
.creature-grow .creature-badge{display:none}
.creature-rail .creature-badge{right:0;bottom:12%}
/* The engine room's portrait: Ari's head in a ringed circle (the image is clipped, never the badge). */
.creature-portrait{width:64px;height:64px;flex-shrink:0;border-radius:50%;border:2px solid var(--state-ring);background:radial-gradient(circle at 50% 35%,rgba(139,124,255,.35),var(--surface));box-shadow:0 0 18px color-mix(in srgb,var(--state-ring) 35%,transparent)}
.creature-portrait::before,.creature-portrait::after{display:none}
/* The image is 170% of the circle, moved so the head (about 60% across, 28% down every pose) sits in it. */
.creature-portrait .creature-img{inset:auto;left:-52%;top:2%;width:170%;height:170%;object-fit:contain;object-position:50% 0;-webkit-clip-path:circle(29.4% at 60.6% 28.2%);clip-path:circle(29.4% at 60.6% 28.2%);animation:none!important}
.creature-portrait .creature-badge{width:26px;height:26px;right:-6px;bottom:-4px}
.creature-portrait .creature-badge .glyph{width:14px;height:14px}

/* The engine room (Home & care). */
.engine-room{padding:18px}
.engine-head{display:flex;align-items:center;gap:14px}
.engine-head-words{min-width:0}
.engine-title{margin:0;font-size:24px;line-height:30px;font-weight:620;letter-spacing:-.02em}
.engine-line{margin:2px 0 0;color:var(--text-2);font-size:15px;line-height:20px}
.engine-line:empty{display:none}
.engine-body{display:grid;gap:16px;margin-top:16px}
.engine-main{min-width:0;display:flex;flex-direction:column;gap:12px}
.engine-subtitle{margin:4px 0 0;font-size:17px;font-weight:620}
.engine-list{list-style:none;margin:0;padding:0;border:1px solid var(--stroke);border-radius:16px;background:var(--glass-soft);overflow:hidden}
.engine-row{display:flex;align-items:center;gap:12px;min-height:60px;padding:8px 14px;border-top:1px solid var(--stroke-soft)}
.engine-row:first-child{border-top:0}
.engine-mark{width:40px;height:40px;flex-shrink:0;border-radius:50%;display:grid;place-items:center;border:1px solid var(--stroke);color:var(--text-2)}
.engine-row-words{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.engine-row-name{font-size:16px;font-weight:600}
.engine-row-state{display:inline-flex;align-items:center;justify-content:flex-end;gap:6px;margin-left:auto;min-width:0;flex:0 1 auto;font-size:14px;line-height:18px;color:var(--text-2);text-align:right}
.engine-row-state .glyph{flex-shrink:0}
.engine-row-state .glyph{width:16px;height:16px}
.engine-row.tone-ok .engine-row-state{color:var(--mint)}
.engine-row.tone-amber .engine-row-state{color:var(--amber)}
.engine-row.tone-rest .engine-row-state{color:var(--violet)}
.engine-row.tone-muted .engine-row-state{color:var(--text-3)}
.engine-row.tone-unknown .engine-row-state{color:var(--text-3)}
.engine-row.tone-off .engine-row-state{color:var(--text-3)}
/* The owner's power switch (#188): drawn small (32x18, under the #182 32 px chip size), tapped on
   the usual 44 px. On/Off never touches sign-in, so this sits beside the state, not in its place. */
.engine-power{width:44px;height:44px;min-width:44px;flex-shrink:0;padding:0;margin-left:4px;border:0;
  background:transparent;display:inline-flex;align-items:center;justify-content:center;border-radius:14px;cursor:pointer}
.engine-power-track{position:relative;width:32px;height:18px;border-radius:999px;background:var(--text-3);
  transition:background var(--fast) var(--ease)}
.engine-power-track::before{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.28);transition:transform var(--fast) var(--ease)}
.engine-power[aria-checked=true] .engine-power-track{background:var(--violet)}
.engine-power[aria-checked=true] .engine-power-track::before{transform:translateX(14px)}
.engine-power:disabled{opacity:.5;cursor:default}
.engine-power:focus-visible{outline:2px solid var(--violet);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.engine-power-track,.engine-power-track::before{transition:none}}
.engine-signout{color:var(--text-3);margin-left:-4px}
.engine-signout:hover{color:var(--text)}
.engine-signout .glyph{width:18px;height:18px}
.signout-sheet{max-width:360px}
.signout-title{margin:0 0 16px;font-size:19px;line-height:26px;font-weight:620}
.signout-error{margin:0 0 14px;font-size:15px}
.signout-actions{display:flex;justify-content:flex-end;gap:10px}
.signout-actions button{min-height:48px;min-width:112px;border-radius:999px}
.signout-confirm{background:transparent;color:var(--rose);border:1.5px solid var(--rose)}
.engine-signin-mini{min-height:44px;padding:6px 12px;display:inline-flex;align-items:center;gap:6px;color:var(--amber)}
.engine-energy{margin:0;padding:0 14px 10px;font-size:15px;line-height:21px;color:var(--text)}
.engine-energy:empty{display:none}
.engine-room .engine-choice{padding-top:4px}
/* Saving energy (#115): Ari's second line under "Ari's mind", an amber battery; the when is behind its ⓘ.
   Some and little left are amber too (colour and icon follow the amount); light mode uses the darker
   amber the care rows use for contrast. */
.engine-saving{display:flex;align-items:center;gap:6px;margin:2px 0 0;min-height:24px;font-size:15px;line-height:20px;color:var(--amber)}
.engine-saving[hidden]{display:none}
/* Ari's own work (#249): the same row shape as saving energy, in the quiet text colour. */
.engine-budget{display:flex;align-items:center;gap:6px;margin:2px 0 0;min-height:24px;font-size:15px;line-height:20px;color:var(--text-2)}
.engine-budget[hidden]{display:none}
.engine-budget .glyph{width:18px;height:18px;flex-shrink:0}
.engine-budget-value{color:var(--text);font-variant-numeric:tabular-nums}
.engine-saving .glyph{width:18px;height:18px;flex-shrink:0}
.engine-row.tone-low .engine-row-state{color:var(--amber)}
:root[data-theme=light] :is(.engine-saving,.engine-row.tone-low .engine-row-state){color:#8A5200}
@media (prefers-color-scheme:light){:root:not([data-theme]) :is(.engine-saving,.engine-row.tone-low .engine-row-state){color:#8A5200}}
/* Side by side only when the engine room itself is wide (#280): Energy is a sheet of at most 640 px
   inside a wide window, and a window-wide rule squeezed the rows until their words overlapped. Today
   the sheet is never 760 px wide, so this applies only if a wider host shows the engine room later. */
.engine-room{container-type:inline-size}
@container (min-width:760px){
  .engine-body:has(>.engine-signin:not([hidden])){grid-template-columns:minmax(0,1fr) minmax(300px,360px);align-items:start}
  .engine-body>.engine-signin{order:2}
}

/* The sign-in card: the same amber card on Home, in a quest's question and in the engine room. */
.home-signin{width:100%;max-width:1060px;display:flex;flex-direction:column;gap:8px}
.engine-signin{min-width:0;order:-1}
.signin-card{display:flex;flex-direction:column;gap:14px;padding:16px;border:1.5px solid var(--amber);border-radius:22px;background:linear-gradient(160deg,rgba(255,198,109,.10),transparent 55%),var(--glass);box-shadow:var(--glow-reward);color:var(--text);-webkit-backdrop-filter:blur(var(--blur-compact));backdrop-filter:blur(var(--blur-compact))}
.signin-card[data-state=done]{border-color:var(--mint);box-shadow:none}
.signin-head{display:flex;align-items:center;gap:12px}
.signin-mark{width:48px;height:48px;flex-shrink:0;border-radius:50%;display:grid;place-items:center;color:var(--amber);border:1.5px solid var(--amber);background:rgba(255,198,109,.10)}
.signin-card[data-state=done] .signin-mark{color:var(--mint);border-color:var(--mint);background:transparent}
.signin-mark .glyph{width:24px;height:24px}
.signin-words{min-width:0}
.signin-eyebrow{margin:0;font-size:13px;line-height:18px;color:var(--amber);font-weight:560}
.signin-card[data-state=done] .signin-eyebrow{color:var(--mint)}
.signin-title{margin:0;font-size:22px;line-height:28px;font-weight:650;letter-spacing:-.015em}
.signin-steps{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.signin-step{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center;color:var(--text-2);font-size:13px;line-height:17px;min-width:0}
.signin-step>.glyph{display:none}
.signin-step-mark{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;border:1.5px solid var(--stroke);font-weight:650;font-size:15px}
.signin-step.current{color:var(--text)}
.signin-step.current .signin-step-mark{border-color:var(--amber);color:var(--amber);box-shadow:0 0 14px rgba(255,198,109,.30)}
.signin-step.done .signin-step-mark{border-color:var(--mint);color:var(--mint)}
.signin-step-mark .glyph{width:18px;height:18px}
.signin-card button{min-height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:16px}
.signin-open{width:100%;background:rgba(255,198,109,.14);color:var(--amber);border:1.5px solid var(--amber);box-shadow:var(--glow-reward);font-weight:650}
.signin-open-link{display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;border-radius:999px;text-decoration:none;font-size:16px;box-sizing:border-box}
.signin-open-link:focus-visible{outline:2px solid var(--amber);outline-offset:3px}
.signin-site{align-self:flex-start}
.signin-open .glyph{width:18px;height:18px}
.signin-later{align-self:center;background:transparent;border:0;color:var(--text-2);font-weight:560;min-width:120px}
.signin-quiet{align-self:flex-start;display:inline-flex;align-items:center;gap:8px;color:var(--amber);border:1px solid var(--stroke)}
.signin-quiet .glyph{width:16px;height:16px;flex-shrink:0}
/* Two engines at once (#238 review): one card, a compact row per engine, steps only while signing in. */
.signin-multi{gap:10px;padding:14px 16px}
.signin-multi .signin-mark{width:40px;height:40px}
.signin-multi .signin-mark .glyph{width:20px;height:20px}
.signin-multi .signin-title{font-size:18px;line-height:24px}
.signin-engine-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--stroke-soft)}
.signin-engine-label{display:inline-flex;align-items:center;gap:8px;min-width:0;font-size:16px;font-weight:600}
.signin-engine-label .glyph{width:16px;height:16px;color:var(--amber);flex-shrink:0}
.signin-card .signin-row-open{min-width:112px;padding:0 16px;background:rgba(255,198,109,.14);color:var(--amber);border:1.5px solid var(--amber);box-shadow:inset 0 0 0 1.5px var(--amber);font-weight:650}
.signin-row-open .glyph{width:16px;height:16px}
.signin-engine{display:flex;flex-direction:column;gap:10px;padding-top:10px;border-top:1px solid var(--stroke-soft)}
.signin-engine-name{margin:0;font-size:16px;line-height:22px;font-weight:650}
.signin-multi>.signin-later{min-height:40px}
.home-signin:has(>.signin-quiet+.signin-quiet){flex-direction:row;flex-wrap:wrap}
/* Laptop (#238 review): a card that grows (a sign-in's steps and code) never slides under the greeting.
   The greeting and chips keep their own height; the page scrolls when it must, never clips. */
#tab-home:has(#home-signin:not([hidden])>.signin-card),#tab-home:has(#home-question:not([hidden])){overflow:auto}
.home-main:has(#home-signin:not([hidden])>.signin-card),.home-main:has(#home-question:not([hidden])){grid-template-rows:minmax(min-content,1fr) auto auto}
/* Laptop, short windows (#285, review N6 of #283): beside a sign-in card or a quest's question Ari was
   stamp-sized (123 px at 1700x800 and on every laptop window up to 860 px tall). The stage keeps about
   a third of the window's height (180-260 px, Ari about 125-205 px); the card and the rest move down and
   the page scrolls when it must. Ari is still scenery: it ends above the card and covers nothing, and
   it starts under the greeting's line, so a taller Ari never reaches into "Anton." on narrower laptops. */
@media (min-width:1181px){
  .home-main:has(#home-signin:not([hidden])>.signin-card) .home-stage,.home-main:has(#home-question:not([hidden])) .home-stage{min-height:clamp(180px,32dvh,260px)}
  .home-main:has(#home-signin:not([hidden])>.signin-card) .creature-hero,.home-main:has(#home-question:not([hidden])) .creature-hero{top:56px}
}
/* Phone (#238 review): while Home asks for a sign-in, Ari steps back so the card's Open buttons are on
   the first screen (375x667 included); the full-size creature returns once signed in. */
@media (max-width:760px){
  .home-main:has(#home-signin:not([hidden])>.signin-card) .creature-hero{height:clamp(120px,22dvh,200px);margin-top:-10px}
  .home-main:has(#home-signin:not([hidden])>.signin-card) .home-stage{gap:8px}
}
.signin-private{display:flex;align-items:center;justify-content:center;gap:6px;margin:0;padding-top:10px;border-top:1px solid var(--stroke-soft);font-size:13px;color:var(--text-3)}
.signin-private .glyph{width:15px;height:15px}
.signin-code{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 12px 12px 18px;border:1px solid var(--stroke);border-radius:16px;background:var(--field)}
.signin-code-text{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:clamp(24px,7vw,34px);letter-spacing:.06em;font-weight:700;overflow-wrap:anywhere}
.signin-card .signin-copy{min-height:44px;padding:6px 14px;border-radius:12px;border:1.5px solid var(--violet);color:var(--text);background:rgba(139,124,255,.14);font-size:15px}
.signin-copy .glyph{width:16px;height:16px}
.signin-paste{display:flex;gap:8px}
.signin-paste input{flex:1;min-width:0;min-height:48px;border-radius:14px;border:1px solid var(--stroke);background:var(--field);color:var(--text);padding:0 14px;font-size:16px}
.signin-paste input:focus-visible{outline:none;border-color:var(--amber)}
.signin-card .signin-send{min-width:96px;padding:0 16px;background:var(--amber);color:var(--on-accent);font-weight:650}
.signin-send .glyph{width:16px;height:16px}
.signin-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.signin-site{display:inline-flex;align-items:center;gap:6px;min-height:44px;color:var(--cyan);font-size:15px}
.signin-site .glyph{width:16px;height:16px}
.signin-live{display:inline-flex;align-items:center;gap:8px;margin:0;font-size:15px;color:var(--text-2)}
.signin-live-mark{width:10px;height:10px;border-radius:50%;background:var(--cyan);box-shadow:0 0 10px var(--cyan);animation:ari-pulse 1.4s ease-in-out infinite}
.signin-live.checking .signin-live-mark{width:16px;height:16px;background:transparent;box-shadow:none;border:2px solid var(--stroke);border-top-color:var(--cyan);animation:signin-turn 900ms linear infinite}
.signin-live.done{color:var(--mint);font-weight:600;font-size:17px}
.signin-live.done .signin-live-mark{background:var(--mint);box-shadow:0 0 10px var(--mint);animation:none}
.signin-live.offline .signin-live-mark{background:var(--text-3);box-shadow:none;animation:none}
@keyframes signin-turn{to{transform:rotate(1turn)}}
.signin-problem{display:flex;align-items:center;gap:8px;margin:0;color:var(--amber);font-size:16px;font-weight:600}
.signin-problem .glyph{width:20px;height:20px}
.signin-manual{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.signin-manual-label{font-size:14px;color:var(--text-2)}
.signin-manual code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:15px;padding:8px 10px;border-radius:10px;background:var(--code);border:1px solid var(--stroke)}
.signin-error{margin:0;font-size:14px}
/* #129: "Code copied — paste it on the next page" under Open, and Claude's way back with its code. */
.signin-copied,.signin-return{display:flex;align-items:center;gap:8px;margin:0;font-size:15px;line-height:20px}
.signin-copied{color:var(--mint);font-weight:600}
.signin-copied.failed{color:var(--text)}
.signin-return{color:var(--text)}
.signin-copied .glyph,.signin-return .glyph{width:18px;height:18px;flex-shrink:0}
/* A sign-in inside a quest's question card keeps the question's own frame. */
.question-card .signin-steps,.question-card .signin-open{margin-top:2px}
.question-card .signin-card button,.question-card .signin-open{text-align:center}
@media (prefers-reduced-motion:reduce){
  .signin-live-mark,.signin-live.checking .signin-live-mark{animation:none!important}
  .signin-live.checking .signin-live-mark{border-color:var(--cyan)}
}
@media (prefers-reduced-transparency:reduce){.signin-card{background:var(--surface);-webkit-backdrop-filter:none;backdrop-filter:none}}
/* A running quest's live progress (#117): icon first, one short line per item. */
.quest-live{display:flex;flex-direction:column;gap:10px;margin:0;padding:14px 16px;border-radius:var(--r-control);background:var(--glass-raised);border:1px solid var(--stroke)}
.quest-live-now{display:flex;align-items:center;gap:10px;margin:0;font-size:17px;line-height:24px;font-weight:600}
.quest-live-now .glyph{width:22px;height:22px;color:var(--cyan)}
.quest-live-facts{display:flex;flex-wrap:wrap;gap:6px 16px;margin:0;font-size:14px;line-height:20px;color:var(--text-2)}
.quest-live-fact{display:inline-flex;align-items:center;gap:6px;min-width:0}
.quest-live-fact .glyph{width:16px;height:16px}
.quest-milestones{list-style:none;margin:0;padding:10px 0 0;border-top:1px solid var(--stroke-soft);display:flex;flex-direction:column;gap:6px}
.quest-milestone{display:flex;align-items:center;gap:8px;font-size:14px;line-height:20px;color:var(--text)}
.quest-milestone .glyph{width:16px;height:16px;color:var(--mint)}
.quest-milestone.earlier{color:var(--text-2)}
.quest-milestone.earlier .glyph{color:var(--text-3)}
.work-doing,.inline-doing{display:flex;align-items:center;gap:6px;min-width:0;font-size:13px;line-height:18px;color:var(--text)}
.work-doing{margin:4px 0 0}
.work-doing span,.inline-doing span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.work-doing .glyph,.inline-doing .glyph{width:16px;height:16px;color:var(--cyan);flex-shrink:0}
.inline-engine{display:flex;align-items:center;gap:6px;margin:0}
.inline-engine .glyph{width:15px;height:15px}
/* #117 text budget: each word group is its own node; a middle dot separates them. */
.live-time::before,.live-model::before{content:"·";margin:0 6px;color:var(--text-3)}
/* #349: the depth Ari chose when it is not the usual one: one mark after the model, violet layers when
   deeper than usual, a muted bolt for a quick pass. */
.glyph.live-depth{width:15px;height:15px;margin-left:2px;color:var(--text-2)}
.glyph.live-depth.deeper{color:var(--violet)}
.live-depth-word{margin-left:-2px}
.live-depth-group{display:inline-flex;align-items:center;white-space:nowrap}
.live-depth-group .info-btn{margin:-12px -10px -12px -4px}
.only-time .live-time::before{content:none;margin:0}
.quest-milestone time{margin-left:6px;color:var(--text-2)}
/* #145 review: a short state stays on one line beside the engine name and its First badge. #280: the
   name never shrinks under the state; on a narrow row a long state wraps under itself instead of
   drawing over the name ("Claude" over "Signed out"). */
.engine-row-words{flex:1 0 auto;flex-wrap:wrap}
.engine-row-name{white-space:nowrap}
.engine-row-state{white-space:normal;flex:0 1 auto;min-width:0;overflow-wrap:anywhere}
/* The calm line under Default (#280): a signed-out engine asked for, never a red error. */
.engine-switch-signin{display:flex;align-items:center;gap:6px;color:var(--amber)}
.engine-switch-signin .glyph{width:16px;height:16px;flex-shrink:0}
:root[data-theme=light] .engine-switch-signin{color:#8A5200}
@media (prefers-color-scheme:light){:root:not([data-theme]) .engine-switch-signin{color:#8A5200}}
/* Ari's share inside the Own-work ⓘ (#249): the Quests-at-once stepper's buttons (44 px hit, drawn small). */
.info-extra{margin:12px 0 0}
.info-extra[hidden]{display:none}
.budget-share{display:flex;align-items:center;gap:4px}
.budget-share-label{flex:1;min-width:0;color:var(--text)}
.budget-share-value{min-width:40px}
.budget-share-note{margin:4px 0 0}
.budget-share .lanes-step[aria-disabled=true]{opacity:.4;cursor:default}
