.habitat-heading{display:flex;align-items:center;justify-content:space-between;flex:none;gap:12px}
.habitat-heading .kid-action{--control-size:62px}.habitat-heading h1{font-size:30px}
.habitat-scene{position:relative;flex:1;min-height:430px;border:4px solid #a6c6b0;border-radius:40px;background:linear-gradient(#cee5d8 0 30%,#99c5bb 31% 62%,#78b3ab);box-shadow:inset 0 3px 8px #f5ffef,0 9px 0 #8eac95,0 16px 25px #3c60452c;isolation:isolate;padding-bottom:26px}
.habitat-sun{position:absolute;top:7%;left:11%;width:52px;height:52px;border-radius:50%;background:#fff0bd;box-shadow:0 0 0 12px #fff1ba33,0 0 0 23px #fff1ba11}
.habitat-distant{position:absolute;top:18%;right:3%;width:28%;height:18%;border-radius:80% 30% 90% 30%;background:#8aad963f;box-shadow:-440px 36px 0 #8aad962e}
.habitat-land{position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none}
.habitat-spot{position:absolute;z-index:3;left:var(--hx);top:var(--hy);translate:-50% -50%;width:18%;height:32%;min-width:64px;min-height:65px;background:transparent;border:0;padding:0!important;outline-offset:4px;cursor:pointer;border-radius:45%;box-shadow:none!important;transform:none!important;animation:none!important}
.habitat-spot>.button-art{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:none!important;box-shadow:none!important;border:0!important;padding:0!important}
.habitat-pedestal{position:absolute;width:64%;height:20%;bottom:0;left:18%;border-radius:50%;background:#adc48b;border:2px dashed #67895b;box-shadow:0 4px 0 #8f9e72;}
.habitat-spot.occupied .habitat-pedestal{border:0;background:#a5bb8738;box-shadow:none}
.habitat-plus{color:#5c8264;font-size:32px;line-height:1;align-self:flex-end;z-index:1;}
.habitat-item-art{position:relative;width:100%;height:100%;z-index:2;filter:drop-shadow(0 5px 3px #44694430);pointer-events:none}
.habitat-spot:focus-visible{outline:4px solid #215c51;background:#fff4b344}
.habitat-spot:hover .habitat-pedestal{border-color:#3c7258;background:#d3de96}
.habitat-scene.theme-evening{background:linear-gradient(#ead4c1 0 32%,#b1c7b1 33% 65%,#84aaa2);border-color:#c6bba7}
.habitat-scene.theme-evening .habitat-sun{background:#efc696;left:75%;top:12%}
.habitat-scene.theme-night{background:linear-gradient(#39516a 0 32%,#5f8693 33% 65%,#517f89);border-color:#869fab}
.habitat-scene.theme-night .habitat-sun{background:#e8eacb;box-shadow:0 0 0 12px #fff1ba11;left:78%;top:7%;width:39px;height:39px}
.habitat-actions{display:flex;align-items:center;justify-content:center;gap:15px;margin-top:12px;flex:none}.habitat-caption{margin:0;text-align:center;color:#3e6957;font-size:13px;flex:none}
.habitat-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;max-width:500px;margin:10px auto;width:100%}
.habitat-choice{border:0;border-radius:24px;background:transparent;padding:0 0 7px;min-width:0;min-height:142px;color:#224d43;cursor:pointer}
.habitat-choice>.toy-face{min-width:0;min-height:135px;padding:9px;border-radius:24px;background:linear-gradient(#fff4d1,#f1dfb4);box-shadow:0 7px 0 #b59b6b,inset 0 3px 1px #fffbea,0 10px 13px #5c664b22;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}
.habitat-choice .habitat-item-art{width:90px;height:84px}.habitat-choice span:not(.toy-face){font:600 14px/1.2 var(--font-child);white-space:normal;max-width:100%;text-align:center}
.habitat-choice:focus-visible{outline:4px solid #215c51;outline-offset:4px}.habitat-choice[aria-pressed=true]>.toy-face{background:#cce3b3}
.habitat-counter{font-size:13px;text-align:center;color:#486952;margin:3px}
.habitat-preview-art{width:155px;height:135px;margin:5px auto}.habitat-preview-art>.icon{width:115px;height:115px;display:block;margin:auto}
.habitat-next-badge{padding:8px 14px;border-radius:18px;background:#e9edcd;color:#386551;display:flex;gap:10px;align-items:center;justify-content:center;max-width:450px;margin:8px auto;font-size:15px}
.habitat-next-badge .icon{width:32px;height:32px;flex:none}
@media(max-width:680px){.habitat-scene{min-height:380px;border-radius:30px}.habitat-heading .kid-action{--control-size:56px}.habitat-caption{font-size:11px;line-height:1.3}.habitat-actions{gap:8px;margin-top:9px}.habitat-spot{width:26%;height:31%}.habitat-walkers{left:4%;right:4%;height:26%}.habitat-character-body{width:48px;height:68px}.char-head{left:13px;width:22px;height:22px}.char-body{left:7px;width:34px;height:30px}.char-name{font-size:11px;padding:3px 6px}.habitat-distant{box-shadow:-180px 18px 0 #8aad9633}.habitat-choice{min-height:115px}.habitat-choice>.toy-face{min-height:109px;padding:8px}.habitat-choices{gap:8px}.habitat-choice .habitat-item-art{height:65px;width:68px}.habitat-choice span:not(.toy-face){font-size:12px}.habitat-preview-art{width:130px;height:110px}}
@media(prefers-reduced-motion:reduce){.workbench *,.habitat-scene *{animation:none!important;transition:none!important}}
body.reduce-motion .workbench *,body.reduce-motion .habitat-scene *{animation:none!important;transition:none!important}

/* Expanded habitat: regular document flow, never squeeze eighteen places into a viewport. */
body[data-route="collection"] .workspace{height:auto;min-height:100dvh}
body[data-route="collection"] .main{display:block;flex:none;padding-bottom:36px}
.habitat-heading{margin:4px 0 24px;align-items:flex-start}.habitat-heading h1{margin-bottom:8px!important}
.habitat-intro{font-size:16px;line-height:1.5;max-width:640px;color:#537160;margin:8px 0 0}
.habitat-scene{height:840px;min-height:840px!important;flex:none;width:100%;max-width:1160px;margin:0 auto 28px;padding:0;border-radius:38px;overflow:hidden;background:linear-gradient(#d9ecde,#a3ced0 37%,#7cb9b9)}
.habitat-sun{top:4%;left:8%;width:60px;height:60px}.habitat-land{inset:0;width:100%;height:100%}
.habitat-spot{width:14%;height:12%;min-width:70px;max-width:132px;min-height:72px;max-height:120px;z-index:3}
.habitat-spot>.button-art{padding:0!important}.habitat-spot:not(.occupied) .habitat-pedestal{width:60%;left:20%;bottom:14%;height:32%;border-color:#769667;background:#d0dfb4aa}.habitat-spot:not(.occupied) .habitat-plus{position:absolute;bottom:18%;font-size:27px}.habitat-spot:focus-visible{outline-offset:0}
.habitat-walkers{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:4;overflow:hidden}
.habitat-walker{position:absolute;left:0;top:0;width:78px;height:105px;will-change:transform;pointer-events:none;display:flex;flex-direction:column;align-items:center;gap:0}
.companion-art{width:100%;height:100%;display:block;overflow:visible;flex:none}.habitat-walker>.companion-art{height:86px;transform:scaleX(var(--facing,1));transform-origin:50% 70%}
.walker-name{font:600 11px/1.1 var(--font-child);padding:3px 7px;border-radius:10px;background:#fff7dacf;color:#355846;white-space:nowrap}
.habitat-walker[data-pose="sit"] .companion-body{transform:translateY(6px)}
.habitat-walker[data-pose="look"] .companion-body{transform:rotate(-6deg);transform-origin:50% 90%}
.habitat-walker[data-pose="meet"] .companion-body{transform:rotate(4deg);transform-origin:50% 90%}
.habitat-scene[data-life-moving="true"] .habitat-walker[data-pose="walk"] .companion-body{animation:companion-step 700ms ease-in-out infinite alternate}
.habitat-actions{margin:26px 0 18px;gap:22px;flex-wrap:wrap}.habitat-caption{font-size:14px;line-height:1.5;margin:8px 0 36px}
.companion-section{border-top:1px solid #bfd2bd;padding-top:26px;margin-top:24px}.companions-heading{display:flex;justify-content:space-between;align-items:center;gap:24px;margin-bottom:22px}.companions-heading h2{font:700 26px/1.2 var(--font-child);margin:8px 0}.companions-heading>p{max-width:360px;font-size:14px;line-height:1.5;color:#567261}
.companion-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.companion-card{border:2px solid #c1cdb1;border-radius:26px;background:linear-gradient(#fffae9,#f2ebd5);padding:20px;box-shadow:0 6px 0 #adba9c;min-width:0}
.companion-portrait{height:155px;width:160px;max-width:100%;margin:0 auto 16px}
.companion-card.waiting .companion-portrait{filter:saturate(.55)}.companion-copy h3{font:700 23px/1.3 var(--font-child);color:#345948;margin:4px 0}.companion-copy p{font:400 14px/1.5 var(--font-child);color:#577161;margin:8px 0}.companion-copy .companion-origin{font-size:12px;color:#6d7858;font-weight:700}.companion-copy .companion-progress{font-size:12px;border-top:1px solid #d9dabd;padding-top:10px;min-height:65px}
.companion-open,.wardrobe-choice{border:2px solid #81a48b;background:#dcebd0;color:#2b5440;border-radius:15px;padding:12px 16px;min-height:48px;cursor:pointer;font:700 14px/1.4 var(--font-child);box-shadow:0 4px 0 #829a73;white-space:normal;overflow-wrap:anywhere}
.companion-open{width:100%;margin:8px 0 4px}.companion-open:hover,.wardrobe-choice:hover:not(:disabled){background:#eaf3dc}.companion-open:active,.wardrobe-choice:active:not(:disabled){translate:0 3px;box-shadow:0 1px 0 #829a73}
.companion-open:focus-visible,.wardrobe-choice:focus-visible{outline:3px solid #326751;outline-offset:4px}
.modal-habitat-character{max-width:640px}.wardrobe-preview{width:130px;height:145px;margin:0 auto 12px}.wardrobe-options{min-width:0;border:0;border-top:1px solid #d2dabb;margin:14px 0;padding:15px 0 0;display:flex;flex-wrap:wrap;gap:10px}.wardrobe-options legend{font:700 16px/1.3 var(--font-child);padding-right:12px}.wardrobe-choice{flex:1 1 140px;font-size:13px;text-align:center}.wardrobe-choice small{display:block;font-size:11px;font-weight:400;margin-top:5px}.wardrobe-choice[aria-pressed="true"]{background:#a8c9ad;border-color:#46795a}.wardrobe-choice:disabled{background:#eee9d5;color:#737461;border-color:#c5c2a4;box-shadow:0 3px 0 #bfba99;cursor:default}.wardrobe-next,.wardrobe-note{font-size:13px!important;line-height:1.5!important}.wardrobe-next{background:#edf0d9;padding:12px;border-radius:15px}
@keyframes companion-step{from{transform:translateY(0)}to{transform:translateY(-2px)}}
@media(max-width:950px){.companion-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.habitat-scene{height:1010px;min-height:1010px!important;border-radius:28px}.habitat-heading{gap:12px;margin-bottom:20px}.habitat-intro{font-size:13px}.habitat-spot{width:24%;height:10%;min-width:64px;max-width:90px;max-height:100px}.habitat-walker{width:60px;height:83px}.habitat-walker>.companion-art{height:66px}.habitat-actions{gap:14px;justify-content:space-around}.habitat-actions .kid-action{--control-size:58px}.habitat-actions .kid-label{font-size:12px}.habitat-caption{font-size:12px}.companions-heading{display:block}.companions-heading>p{font-size:13px}.companion-grid{grid-template-columns:1fr}.companion-card{display:grid;grid-template-columns:90px minmax(0,1fr);gap:12px;padding:16px}.companion-portrait{height:115px;width:90px;margin:12px 0}.companion-copy h3{font-size:20px}.companion-copy p{font-size:13px}.companion-copy .companion-progress{min-height:0}.wardrobe-choice{flex-basis:95px}.wardrobe-preview{height:118px;width:108px}}
body.large-text .companion-copy p,body.large-text .companion-open,body.large-text .wardrobe-choice{font-size:16px!important}body.large-text .companions-heading{display:block}
body.high-contrast .companion-copy p,body.high-contrast .habitat-intro{color:#234a34}body.high-contrast .companion-card{border-color:#42684a}
@media(prefers-reduced-motion:reduce){.habitat-scene *{animation:none!important;transition:none!important}}
body.reduce-motion .habitat-scene *,body.access-calm .habitat-scene *{animation:none!important;transition:none!important}

.dialog.modal-habitat-character>*{flex-shrink:0}

/* F16: one authored message, normal document flow; no speech bubble covering play. */
.companion-message-slot[hidden]{display:none!important}
.companion-message-slot{margin:0 0 24px;max-width:1160px}
.companion-greeting{display:grid;grid-template-columns:76px minmax(0,1fr) auto;align-items:center;gap:16px;border:2px solid #c6d7ba;border-radius:24px;background:#fff9e9;padding:18px 20px;box-shadow:0 4px 0 #b8c8a7}
.greeting-portrait{height:88px}.greeting-copy{min-width:0}.greeting-label{font:700 15px/1.4 var(--font-child);margin:0 0 7px;color:#386148}
.companion-quote p{font:500 17px/1.6 var(--font-child);margin:0;color:#304f42;overflow-wrap:anywhere}
.companion-dismiss{min-height:48px;border:2px solid #afbea0;border-radius:14px;padding:10px 14px;background:#edf3df;font:600 13px/1.4 var(--font-child);color:#31513d;cursor:pointer}
.companion-dismiss:focus-visible{outline:3px solid #326751;outline-offset:3px}
.companion-greet{background:#fff2cf;border-color:#c1aa73;box-shadow:0 4px 0 #ae965f}
.companion-profile{border-top:1px solid #d0d9c1;margin:8px 0;padding-top:4px}.companion-profile p{font:400 15px/1.6 var(--font-child);color:#3d5b4a;margin:8px 0}
.companion-dialog-message{background:#edf3e2;border-left:4px solid #86ab8a;border-radius:12px;padding:14px 16px;margin:12px 0}
.companion-profile .companion-activity{font-size:14px;color:#52725b}
.companion-copy .companion-message-slot{margin:12px 0}.companion-copy .companion-greeting{grid-template-columns:minmax(0,1fr);padding:14px;gap:10px}.companion-copy .greeting-portrait{display:none}.companion-copy .companion-quote p{font-size:15px}
.companion-gesture{position:absolute;top:0;left:0;width:100%;height:86px;display:none;transform:scaleX(var(--facing,1));pointer-events:none}
.habitat-walker[data-pose="favorite"] .companion-gesture{display:block}
.habitat-walker[data-gesture="beacon"][data-pose="favorite"] .companion-body{transform:rotate(-5deg);transform-origin:50% 80%}
.habitat-walker[data-gesture="moor"][data-pose="favorite"] .companion-body{transform:translateY(4px) rotate(5deg);transform-origin:50% 85%}
.habitat-walker[data-gesture="ripple"][data-pose="favorite"] .companion-body{transform:translateY(3px)}
.habitat-walker[data-gesture="arrange"][data-pose="favorite"] .companion-body{transform:rotate(7deg);transform-origin:50% 90%}
.habitat-walker[data-gesture="repair"][data-pose="favorite"] .companion-body{transform:rotate(-7deg);transform-origin:50% 95%}
.habitat-walker[data-gesture="trace"][data-pose="favorite"] .companion-body{transform:rotate(9deg);transform-origin:50% 80%}
.habitat-walker[data-gesture="stargaze"][data-pose="favorite"] .companion-body{transform:rotate(-11deg);transform-origin:50% 85%}
.habitat-scene[data-life-moving="true"] .habitat-walker[data-pose="favorite"] .companion-gesture{animation:companion-observe 2200ms ease-in-out infinite alternate}
.habitat-scene[data-life-moving="true"] .habitat-walker[data-gesture="repair"][data-pose="favorite"] .companion-gesture{animation:companion-tap 1100ms ease-in-out infinite alternate}
@keyframes companion-observe{from{opacity:.55}to{opacity:1}}
@keyframes companion-tap{from{translate:0 -2px}to{translate:0 2px}}
body.high-contrast .companion-profile p,body.high-contrast .companion-quote p,body.high-contrast .greeting-label{color:#183e27}
body.high-contrast .companion-greeting,body.high-contrast .companion-dismiss{border-color:#33563c}
body.large-text .companion-profile p,body.large-text .companion-quote p{font-size:19px!important;line-height:1.65!important}
@media(max-width:600px){.companion-greeting{grid-template-columns:58px minmax(0,1fr);padding:15px;gap:12px}.greeting-portrait{height:72px}.companion-dismiss{grid-column:1/-1;width:100%}.companion-quote p{font-size:15px}.companion-gesture{height:66px}.companion-profile p{font-size:15px}.companion-copy .companion-greeting{grid-template-columns:minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){.companion-gesture{animation:none!important;transition:none!important}}
body.reduce-motion .companion-gesture,body.access-calm .companion-gesture{animation:none!important;transition:none!important}

/* Keep the origin away from the close button; compact ficha with optional detail. */
.dialog.modal-habitat-character>.modal-eyebrow{padding-right:58px;align-self:stretch;text-align:left;white-space:normal;font-size:14px!important;line-height:1.55!important;overflow-wrap:break-word;min-height:44px;margin-top:0}
.companion-profile summary{font:700 15px/1.5 var(--font-child);cursor:pointer;min-height:44px;padding:10px 0;color:#315540}
.companion-profile summary:focus-visible{outline:3px solid #326751;outline-offset:3px;border-radius:8px}
.companion-summary{font:500 17px/1.6 var(--font-child);color:#3b5b47;margin:10px 0}
body.large-text .companion-summary{font-size:19px!important;line-height:1.6!important}

/* F17: one optional notice rather than a cascade of reward cards. */
.reward-celebration{display:flex;align-items:center;justify-content:center;gap:1rem;flex-wrap:wrap;max-width:100%;}
.reward-celebration>span{flex:1 1 16rem;min-width:0;overflow-wrap:anywhere;}
.reward-celebration>button{min-height:48px;flex:0 0 auto;}

/* F17: leave room for the sticky close control, including enlarged text. */
.dialog.modal-habitat-rewards>.modal-eyebrow{padding-right:64px;align-self:stretch;text-align:left;white-space:normal;overflow-wrap:break-word;min-height:48px;margin-top:0}

/* F18: individual conditions, readable without animation, drag or colour perception. */
.habitat-heading-links{display:flex;flex-wrap:wrap;align-items:center;gap:16px;max-width:360px}
.goal-summary{border-top:1px solid #d0dac1;margin:12px 0;padding-top:12px;min-height:0!important}
.goal-summary>strong{display:block;font:700 15px/1.5 var(--font-child);color:#28543e}
.goal-summary>p{margin:10px 0!important;font-size:14px!important}
.goal-indicators{list-style:none;padding:0!important;margin:16px 0!important;display:grid;gap:12px;width:100%;text-align:left}
.goal-indicator{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;align-items:baseline;min-width:0;font:500 16px/1.55 var(--font-child);color:#2d513d}
.goal-indicator strong{font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:750}
.goal-metric-label{overflow-wrap:anywhere}
.goal-condition{grid-column:1/-1;font-size:14px;color:#43624d}
.goal-meter{grid-column:1/-1;display:block;height:8px;border-radius:8px;background:#d8e1c9;overflow:hidden}
.goal-meter>span{display:block;width:var(--goal-fill);height:100%;background:#487855;border-radius:8px}
.goal-indicators-compact{gap:6px;margin:10px 0!important}
.goal-indicators-compact .goal-indicator{font-size:14px;gap:3px 8px}
.visitor-objectives{background:#f3f6e9;border:2px solid #c2d2b4;border-radius:22px;padding:20px;margin:18px 0;width:100%;box-sizing:border-box;text-align:left}
.visitor-objectives h3{margin:6px 0 12px!important;font:750 22px/1.4 var(--font-child);color:#234c36}
.visitor-objectives p{font:500 16px/1.6 var(--font-child);color:#375b42;margin:12px 0;overflow-wrap:anywhere}
.visitor-objectives .goal-eyebrow{font-size:13px;font-weight:700;letter-spacing:.02em;margin:0;color:#4e704c}
.visitor-objectives .goal-map-note{font-size:14px}
.goal-island{font-weight:700!important}
.goal-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:16px}
.goal-actions .companion-open{flex:1 1 155px;margin:0;min-height:48px;font-size:15px;padding:12px 14px;white-space:normal}
.goal-primary{background:#d1e5c7;border-color:#709168;box-shadow:0 4px 0 #789664}
.goal-preserved,.goal-unavailable{padding:12px 14px;border-left:4px solid #9aa26c;border-radius:8px;background:#fff8df}
.goal-help,.goal-milestones{border-top:1px solid #bccdad;margin-top:16px;padding-top:8px}
.goal-help summary,.goal-milestones summary{cursor:pointer;min-height:48px;padding:12px 0;box-sizing:border-box;font:700 16px/1.6 var(--font-child);color:#2c5439}
.goal-help summary:focus-visible,.goal-milestones summary:focus-visible{outline:3px solid #285c3c;outline-offset:3px;border-radius:6px}
.goal-milestone{padding:12px 0;border-top:1px dashed #aebe9f}
.goal-milestone h4{font:700 18px/1.5 var(--font-child);margin:6px 0}
.goal-preview-note{padding:14px;border-radius:16px;background:#edf3e0}
.dialog.modal-habitat-proposal>.modal-eyebrow,.dialog.modal-habitat-goal-confirm>.modal-eyebrow{padding-right:52px;white-space:normal;line-height:1.6!important;align-self:stretch}
body.large-text .goal-indicator,body.large-text .visitor-objectives p,body.large-text .goal-actions .companion-open,body.large-text .goal-help summary,body.large-text .goal-milestones summary{font-size:19px!important;line-height:1.65!important}
body.large-text .goal-summary>strong{font-size:19px!important}
body.high-contrast .visitor-objectives,body.high-contrast .goal-actions .companion-open{border-color:#294b32}
body.high-contrast .visitor-objectives p,body.high-contrast .goal-indicator,body.high-contrast .goal-condition,body.high-contrast .goal-summary>strong{color:#173d25}
@media(max-width:600px){.habitat-heading-links{max-width:none;gap:12px}.visitor-objectives{padding:14px;border-radius:18px}.visitor-objectives h3{font-size:20px}.goal-actions{flex-direction:column}.goal-actions .companion-open{flex:none;width:100%}.goal-summary{grid-column:1/-1}}
@media(max-width:360px){body.large-text .goal-indicator{grid-template-columns:minmax(0,1fr)}body.large-text .goal-indicator strong{justify-self:start}.goal-indicator{column-gap:8px}}
