/* Shared living presence: the landing page's drifting colour fields and orbit. */
.companion{--presence-speed:6s;--presence-scale:1.06;--presence-glow:#d9a7d980;--presence-shadow:#8d78b32b;--presence-spark:#a080b6;position:relative;display:block;width:112px;height:112px;flex-shrink:0;margin:0 auto;isolation:isolate;pointer-events:none;align-self:center;justify-self:center}
.companion *{position:absolute;display:block;pointer-events:none}
.companion .presence-halo{inset:0;border-radius:50%;background:radial-gradient(ellipse,#dfc1e270 10%,#b2dce54d 49%,#eedda736 64%,transparent 73%);filter:blur(6px);animation:companion-halo 8s ease-in-out infinite alternate;transition:opacity .6s;opacity:.7}
.companion .presence-core{inset:18%;overflow:hidden;border-radius:48% 52% 53% 47%;background:radial-gradient(circle at 36% 30%,#fff1d6,#edc6d5 38%,#bdafe0 69%,#b8d7df);box-shadow:inset -5px -7px 16px #8d78b32b,0 0 20px #e2c3dd50;animation:companion-breathe var(--presence-speed) ease-in-out infinite;transition:background .5s,box-shadow .5s}
.companion .presence-core i{width:95%;height:120%;left:-25%;top:-15%;border-radius:50%;filter:blur(5px);background:radial-gradient(ellipse,#efd4a4c9,#e8b0cd80 40%,transparent 69%);animation:companion-drift 7s ease-in-out infinite alternate}
.companion .presence-core i:nth-child(2){left:30%;top:6%;background:radial-gradient(ellipse,#b1d6e8c9,#bba2dd88 45%,transparent 70%);animation-duration:9s;animation-delay:-4s}
.companion .presence-core i:nth-child(3){left:6%;top:40%;background:radial-gradient(ellipse,#d8b8e4b0,#fff0c780 40%,transparent 70%);animation-duration:8s;animation-delay:-2s}
.companion .presence-ring{inset:10%;border:1px solid #9c80b85c;border-radius:50%;transform:rotate(-30deg) scaleY(.65);animation:companion-orbit 24s linear infinite;opacity:.65}
.companion .companion-satellite{width:5px;height:5px;left:calc(50% - 2.5px);top:-3px;border-radius:50%;background:var(--presence-spark);box-shadow:0 0 7px var(--presence-glow);animation:companion-spark 6s ease-in-out infinite alternate}
.companion[data-state=listening]{--presence-speed:4s;--presence-scale:1.12}.companion[data-state=listening] .presence-halo{opacity:1}
.companion[data-state=hearing]{--presence-speed:1.35s;--presence-scale:1.22}.companion[data-state=hearing] .presence-core{box-shadow:0 0 24px var(--presence-glow),inset -5px -7px 16px var(--presence-shadow)}.companion[data-state=hearing] .presence-ring{animation-duration:8s;opacity:1}
.companion[data-state=guiding]{--presence-speed:2.7s;--presence-scale:1.14}.companion[data-state=guiding] .presence-halo{opacity:1}
.companion[data-state=preparing] .presence-ring,.companion[data-state=checking] .presence-ring{animation-duration:10s}
.companion[data-state=error]{--presence-speed:7s;--presence-scale:1.02}.companion[data-state=error] .presence-halo{opacity:.35}
.companion-today{width:112px;height:112px;flex-shrink:0;margin:10px auto}
[data-theme=dark] .companion{--presence-glow:#8cc4ae70;--presence-shadow:#122e3866;--presence-spark:#e8ae68}
[data-theme=dark] .companion .presence-core{background:conic-gradient(from 20deg,#eec78e,#bc795b,#83b5a4,#294f51,#d5a564,#eec78e);box-shadow:inset 0 0 0 1px #ead5a86b,0 0 20px #77b5a230}
[data-theme=dark] .companion .presence-core i{background:radial-gradient(ellipse,#e6b978b0,#a1694f88 40%,transparent 70%)}[data-theme=dark] .companion .presence-core i:nth-child(2){background:radial-gradient(ellipse,#91c4b5b0,#294f5188 40%,transparent 70%)}[data-theme=dark] .companion .presence-halo{background:radial-gradient(ellipse,#78baa340,transparent 73%)}[data-theme=dark] .companion .presence-ring{border-color:#e8ae6870}
[data-theme=dark] .companion .presence-core i:nth-child(3){background:radial-gradient(ellipse,#c68c64b0,#e6c28b70 40%,transparent 70%)}
.companion[data-state=preparing] .presence-ring{border-style:dashed;opacity:.55}
.companion[data-state=checking] .presence-ring{border-width:2px;opacity:.85}
.companion[data-state=guiding] .presence-ring{opacity:1;animation-duration:18s}
.companion[data-state=error] .presence-ring{border-style:dotted;opacity:.45;animation-play-state:paused}
@keyframes companion-breathe{0%,100%{transform:scale(.96) rotate(-4deg);border-radius:48% 52% 53% 47%}50%{transform:scale(var(--presence-scale)) rotate(5deg);border-radius:54% 46% 46% 54%}}
@keyframes companion-drift{from{transform:translate(-10%,-8%) rotate(-20deg)}to{transform:translate(18%,14%) rotate(25deg)}}
@keyframes companion-halo{from{transform:scale(.94) rotate(-8deg)}to{transform:scale(1.09) rotate(10deg)}}
@keyframes companion-orbit{from{transform:rotate(-30deg) scaleY(.65)}to{transform:rotate(330deg) scaleY(.65)}}
@keyframes companion-spark{from{opacity:.3;transform:translate(0,0)}to{opacity:.8;transform:translate(5px,-4px)}}
/* The frame remains viewport-sized; its content scrolls only when necessary.
   Scope beats app.css's compact mode without hiding the shared companion. */
body[data-screen=practice] .app-screen.practice-screen{
  height:100%;min-height:0;display:flex;flex-direction:column;gap:8px;
  overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
  padding:12px 20px max(16px,env(safe-area-inset-bottom));scroll-padding-block:16px;
}
body[data-screen=practice] .practice-screen>*{flex-shrink:0;min-width:0}
body[data-screen=practice] .practice-screen .affirmation-area{
  flex:1 0 auto;container-type:normal;min-height:0;display:grid;
  grid-template-columns:minmax(0,1fr);grid-template-rows:112px auto minmax(min-content,1fr) auto;
  gap:6px;padding:0;
}
body[data-screen=practice] .affirmation-area>.companion{display:block;grid-column:1;grid-row:1;margin:0 auto}
body[data-screen=practice] .affirmation-area>.eyebrow{display:block;grid-column:1;grid-row:2;line-height:1.5}
body[data-screen=practice] .practice-screen .affirmation-text{
  grid-column:1;grid-row:3;max-height:none;overflow:visible;min-width:0;
  font-size:clamp(23px,4vw,34px);line-height:1.3;overflow-wrap:anywhere;
}
body[data-screen=practice] .practice-screen .affirmation-text:lang(yue),
body[data-screen=practice] .practice-screen .affirmation-text:lang(zh-Hant){font-size:clamp(22px,3.5vw,28px);line-height:1.5}
body[data-screen=practice] .practice-screen .line-tools{grid-column:1;grid-row:4;flex-wrap:wrap;gap:4px 12px}
body[data-screen=practice] .practice-screen .line-tools .quiet-button{min-height:36px}
body[data-screen=practice] .practice-screen #practice-controls,
body[data-screen=practice] .practice-screen #practice-controls:has(textarea){
  height:auto;min-height:0;grid-template-rows:auto minmax(52px,auto) auto auto;gap:6px;
}
body[data-screen=practice] .practice-screen .field-label,
body[data-screen=practice] .practice-screen .field-note{display:block;line-height:1.5}
body[data-screen=practice] .practice-screen .mic-status{height:auto;min-height:18px}
body[data-screen=practice] .practice-screen textarea{height:64px;min-height:64px}
body[data-screen=practice] .practice-screen .heard{height:auto;min-height:52px;max-height:96px;padding:8px 12px}
body[data-screen=practice] .practice-screen .speech-tools,
body[data-screen=practice] .practice-screen .practice-action{height:auto;min-height:44px}
body[data-screen=practice] .practice-screen .button,
body[data-screen=practice] .practice-screen .self-confirm{height:auto;min-height:44px;white-space:normal}
body[data-screen=practice] .practice-screen .practice-feedback{height:auto;min-height:0;overflow:visible;line-height:1.5}
body[data-screen=practice] .practice-screen .practice-feedback:empty{display:none}
body[data-screen=practice] .practice-screen .speech-recovery{height:auto;min-height:32px}
body[data-screen=practice] .practice-screen .speech-recovery[hidden]{display:none!important}
@media(max-width:360px){
  body[data-screen=practice] .app-screen.practice-screen{padding-inline:14px;gap:6px}
  body[data-screen=practice] .practice-screen .line-tools{gap:2px 6px}
}
/* Preserve the side-by-side landscape layout, with natural row heights. */
@media(max-height:480px) and (min-width:600px){
  body[data-screen=practice] .app-screen.practice-screen{
    display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-rows:auto 4px auto auto auto auto;align-content:start;column-gap:20px;
  }
  body[data-screen=practice] .practice-screen .practice-top{grid-column:1/-1;grid-row:1}
  body[data-screen=practice] .practice-screen .progress-track{grid-column:1/-1;grid-row:2}
  body[data-screen=practice] .practice-screen>.mode-toggle{grid-column:1;grid-row:3}
  body[data-screen=practice] .practice-screen .affirmation-area{grid-column:1;grid-row:4/7}
  body[data-screen=practice] .practice-screen #practice-controls{grid-column:2;grid-row:3/5;align-self:start}
  body[data-screen=practice] .practice-screen .practice-feedback{grid-column:2;grid-row:5}
  body[data-screen=practice] .practice-screen .speech-recovery{grid-column:2;grid-row:6}
}
/* Enlarged labels stay in the reading flow and can grow with system text size. */
body[data-screen=practice][data-large-text=true] .app-screen.practice-screen{display:flex}
body[data-screen=practice][data-large-text=true] .practice-screen .mode-toggle,
body[data-screen=practice][data-large-text=true] .practice-screen .practice-top{height:auto}
body[data-screen=practice][data-large-text=true] .practice-screen .speech-tools{grid-template-columns:1fr}
body[data-screen=practice][data-large-text=true] .practice-screen textarea{min-height:6em}
body[data-screen=practice][data-large-text=true] .practice-screen .heard{max-height:none}
[data-motion=off] .companion,[data-motion=off] .companion *,[data-page-hidden=true] .companion,[data-page-hidden=true] .companion *{animation-play-state:paused!important;transition:none!important}
@media(prefers-reduced-motion:reduce){.companion,.companion *{animation:none!important;transition:none!important}}
