/* Responsive foundation: safe areas, readable controls and content-sized layouts. */
:root {
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --header-height: 68px;
  --nav-height: 72px;
  --page-gutter: clamp(16px, 3vw, 32px);
  --content-width: 1120px;
  --keyboard-inset: 0px;
  --visual-height: 100vh;
  --visual-top: 0px;
}
@supports (height: 100dvh) { :root { --visual-height: 100dvh; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block: calc(var(--header-height) + var(--safe-t) + 16px) calc(var(--nav-height) + var(--safe-b) + 24px); }
body { min-width: 0; }
#app { width: 100%; min-width: 0; min-height: calc(100svh - var(--header-height) - var(--safe-t)); padding-bottom: calc(var(--nav-height) + var(--safe-b) + 24px); }
#app :where(h1,h2,h3,p,small,b,strong,label,.title,.sub,.grow,.v,.pill) { overflow-wrap: anywhere; }
#app :where(section,article,form,.card,.game-card,.shop-layout>*,.game-grid>*,.program-grid>*,.life-grid>*,.grid2>*) { min-width: 0; }
img,video,canvas { max-width: 100%; }
video { width: 100%; height: auto; max-height: 65svh; object-fit: contain; }
button,a,input,select,textarea { touch-action: manipulation; }
button { white-space: normal; }
:where(input,textarea,select) { max-width: 100%; }
.in,.ta,.composer textarea,.session #stepsel { font-size: 16px !important; line-height: 1.45; }
.in,select.in { min-height: 48px; }
:where(input,textarea,select,button,a) { scroll-margin-block: 20px; }
.btn,.btn.sm,.btn.xs,.icon-button,.text-button,.sheet-close,.chip,.back,.unit-head .g { min-height: 44px; }
.btn { max-width: 100%; line-height: 1.35; }
.icon-button,.sheet-close { min-width: 44px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 5px; }
.chip { display: inline-flex; align-items: center; justify-content: center; white-space: normal; }
.feature-page,.page:not(.feature-page),.game-page { width: 100%; max-width: var(--content-width); margin-inline: auto; padding: 24px var(--page-gutter) 36px; }
.game-page { padding-top: 12px; }
.feature-page h1,.game-title h1,.section-title h1 { font-size: clamp(26px, 2.5vw, 36px); line-height: 1.2; }
.game-title p,.section-title p { font-size: 15px; line-height: 1.55; }
.game-nav { gap: 2px; margin-inline: 0; }
.game-nav a { display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: 13px; padding: 12px; }
.club-header { height: calc(var(--header-height) + var(--safe-t)); padding: var(--safe-t) max(var(--page-gutter), var(--safe-r)) 0 max(var(--page-gutter), var(--safe-l)); gap: 10px; }
.mobile-brand { min-width: 0; font-size: clamp(22px, 4vw, 27px); }
.mobile-brand img { width: 36px; height: 40px; flex: none; }
.club-stats { gap: clamp(6px, 1.5vw, 20px); flex: none; }
.club-stats>a { min-height: 44px; font-size: 14px; gap: 4px; }
.club-stats .game-icon { width: 22px; height: 22px; }
.tabs { width: 100%; max-width: none; height: calc(var(--nav-height) + var(--safe-b)); padding: 4px max(4px,var(--safe-r)) var(--safe-b) max(4px,var(--safe-l)); }
.tabs a { min-width: 0; flex: 1 1 0; min-height: 52px; font-size: 11px; letter-spacing: 0; }
.tabs a .nav-icon,.tabs a.on .nav-icon { padding: 4px 10px; }
.top { width: 100%; max-width: var(--content-width); padding: 20px var(--page-gutter) 8px; gap: 10px; }
.top>.avatar { flex: none; }
.top .title { font-size: clamp(17px, 2vw, 21px); }
.top .stat { flex: none; font-size: 12px; padding: 6px; }
.heading-row { flex-wrap: wrap; }
.heading-row>a { min-height: 44px; display: inline-flex; align-items: center; white-space: normal; }
.action-row { min-height: 60px; }
.action-row .grow,.plan-item .grow { overflow-wrap: anywhere; }
.program-grid,.life-grid,.game-grid,.grid2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.program-body h2,.program-body p { min-height: 0; }
.program-body h2 { font-size: 19px; line-height: 1.3; }
.program-body p { font-size: 14px; line-height: 1.5; }
.program-body>small,.program-footer { font-size: 11px; }
.program-body { padding: 18px; }
.program-card { display: flex; flex-direction: column; }
.program-body { flex: 1; display: flex; flex-direction: column; }
.program-footer { margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.home-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.metric strong { font-size: clamp(17px, 2vw, 23px); }
.metric small,.quick-grid small,.coach-invite small,.mission small { font-size: 12px; }
.quick-grid b,.coach-invite b,.mission .grow>span { font-size: 14px; }
.quick-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.quick-grid>a { padding: 18px 8px; }
.mission-go { flex: none; }
.welcome-card { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(100px,1fr); align-items: center; padding: clamp(20px,3vw,32px); gap: 10px; min-height: 0; }
.welcome-copy { width: auto; min-width: 0; position: relative; z-index: 2; }
.welcome-copy h2 { font-size: clamp(24px, 2.8vw, 33px); }
.welcome-copy p { font-size: 14px; max-width: 360px; }
.welcome-copy>.pill { font-size: 10px; white-space: normal; }
.welcome-copy .btn { font-size: 12px; min-height: 48px; max-width: 340px; padding: 12px; }
.welcome-dog { position: relative; inset: auto; width: 100%; height: auto; max-height: 290px; z-index: 1; align-self: center; }
.hero-circle { pointer-events: none; }
.hero-spark { display: none; }
.pet-profile { grid-template-columns: minmax(200px,.9fr) minmax(0,1.1fr); }
.pet-backdrop { display: flex; align-items: center; justify-content: center; padding: 16px 16px 44px; }
.pet-backdrop .pet-stage { max-width: 300px; max-height: none; height: auto; }
.pet-bio { padding: clamp(20px,3vw,32px); }
.pet-bio h2 { font-size: clamp(29px,3vw,42px); }
.pet-bio .btn { font-size: 13px; }
.profile-health { font-size: 13px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.profile-metrics small { font-size: 12px; }
.profile-metrics { gap: 8px; }
.game-footnote { font-size: 12px; }
.shop-layout { grid-template-columns: minmax(180px,240px) minmax(0,1fr); }
.shop-items { grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); }
.shop-preview { top: calc(var(--header-height) + var(--safe-t) + 20px); }
.shop-item .btn { min-height: 44px; font-size: 12px; }
.shop-item h3 { font-size: 15px; min-height: 40px; }
.shop-item>small,.collection-item small { font-size: 10px; letter-spacing: .3px; }
.shop-item .small,.shop-preview>p { font-size: 12px; }
.shop-filters button,.quest-tabs button { min-height: 44px; font-size: 12px; padding: 9px 12px; }
.shop-preview .btn { font-size: 12px; }
.quest-content h3 { font-size: 16px; }
.quest-content p { font-size: 14px; }
.quest-content small,.claimed-label { font-size: 12px; }
.quest-reward { width: 116px; }
.quest-reward .btn { min-height: 44px; font-size: 11px; }
.quest-card { gap: 14px; }
.collection-item b { font-size: 13px; }
.unequip-row { gap: 10px; }
.calendar-grid { grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-day { min-width: 0; }
.day-options { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; }
.day-options label,.day-options span { width: 100%; min-width: 0; }
.day-options span { min-height: 44px; width: 100%; }
.awards-grid { grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); }
.member-grid { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); }
.member-card b { overflow-wrap: anywhere; }
.note-card,.empty-card { overflow-wrap: anywhere; }
/* Forms remain within the visible viewport, including the iOS keyboard. */
.sheet-bg { z-index: 100; top: var(--visual-top); bottom: auto; height: var(--visual-height); padding: max(8px,var(--safe-t)) max(8px,var(--safe-r)) max(0px,var(--safe-b)) max(8px,var(--safe-l)); }
.sheet { max-width: 680px; max-height: 100%; margin: 0 auto; padding: 16px clamp(16px,3vw,26px) max(24px,var(--safe-b)); overscroll-behavior: contain; scroll-padding-block: 62px 28px; -webkit-overflow-scrolling: touch; }
.sheet-close { position: sticky; top: 0; z-index: 4; width: 44px; height: 44px; background: #edf0ec; }
.sheet-open { overflow: hidden; }
.sheet h2 { padding-right: 40px; overflow-wrap: anywhere; }
.sheet .row { flex-wrap: wrap; }
.sheet .row>.btn { flex: 1 1 140px; }
.sheet .row>input,.sheet .row>select { flex: 1 1 130px; }
.sheet .purchase-confirm h2 { padding-right: 0; }
.avatar-picker { grid-template-columns: repeat(auto-fit,minmax(115px,1fr)); }
.avatar-option b { font-size: 12px; }
.avatar-option img { height: 130px; }
.sheet .btn { font-size: 13px; }
.photo-picker { grid-template-columns: repeat(auto-fit,minmax(115px,1fr)); }
/* Keep suggestions in one horizontal strip instead of covering the conversation. */
.composer { left: 0; right: 0; width: auto; max-width: none; bottom: calc(var(--nav-height) + var(--safe-b)); padding: 8px max(var(--page-gutter),var(--safe-r)) 12px max(var(--page-gutter),var(--safe-l)); }
.composer>div { max-width: 100%; }
.composer .chips { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; gap: 8px; margin: 0 0 8px; padding: 2px 2px 5px; scrollbar-width: thin; }
.composer .chip { flex: none; max-width: min(320px,85vw); font-size: 13px; white-space: nowrap; }
.composer .ctx { flex: none; white-space: normal; max-width: 75%; }
.chat { padding-bottom: calc(var(--composer-height,150px) + 30px); }
.chat .msg { max-width: min(90%,720px); }
.composer .send { min-width: 48px; min-height: 48px; }
.keyboard-open .tabs { visibility: hidden; pointer-events: none; }
.keyboard-open .composer { bottom: var(--keyboard-inset); padding-bottom: 10px; }
.keyboard-open .composer .chips { display: none; }
.keyboard-open .club-header { position: relative; }
.toast { z-index: 110; max-width: min(560px,calc(100% - 32px)); bottom: calc(var(--nav-height) + var(--safe-b) + var(--keyboard-inset) + 20px); overflow-wrap: anywhere; }
/* Session controls use available space rather than an extra full viewport. */
.session { min-height: calc(100svh - var(--header-height) - var(--safe-t)); padding: 16px var(--page-gutter) max(24px,var(--safe-b)); max-width: 860px; }
.session .reps { margin-top: 20px; }
.session .reps button { min-height: 70px; padding: 14px; }
.session .timer { font-size: clamp(40px,7vh,64px); }
.session #stepsel { max-width: 130px; }
body.session-active #app { padding-bottom: 0; }
@media(min-width:700px) and (max-width:999px) {
  .feature-page,.page:not(.feature-page),.game-page { max-width: 900px; --page-gutter: 32px; }
  .game-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(min-width:1000px) {
  :root { --header-height: 76px; --nav-height: 0px; }
  body { padding-left: 212px; padding-right: 0; }
  .desktop-nav { width: 212px; padding: max(24px,var(--safe-t)) 16px 16px max(16px,var(--safe-l)); overflow-y: auto; overscroll-behavior: contain; }
  .desktop-nav .wordmark { font-size: 26px; margin: 0 0 24px; }
  .desktop-nav>a[data-nav] { padding: 11px; min-height: 48px; flex: none; margin: 3px 0; font-size: 12px; }
  .desktop-nav .nav-foot { margin-top: 22px; }
  .club-header { margin-right: 0; padding-inline: var(--page-gutter); }
  #app { max-width: var(--content-width); margin-inline: auto; }
  .club-rail { display: none; }
  .composer { left: 212px; bottom: 0; max-width: var(--content-width); margin-inline: auto; }
  .sheet-bg { align-items: center; justify-content: center; padding-block: max(20px,var(--safe-t)) max(20px,var(--safe-b)); }
  .sheet { border-radius: 24px; }
  .toast { left: calc(50% + 106px); bottom: calc(var(--keyboard-inset) + 24px); }
  .feature-page,.page:not(.feature-page),.game-page { padding-top: 32px; }
  .program-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(min-width:1500px) {
  body { padding-right: 284px; }
  .club-rail { display: block; width: 252px; right: 16px; top: calc(var(--header-height) + var(--safe-t) + 24px); bottom: 24px; overflow-y: auto; overscroll-behavior: contain; }
  .club-header { margin-right: -284px; }
  .composer { right: 284px; }
  .toast { left: calc(50% - 36px); }
}
@media(max-width:699px) {
  .game-grid { grid-template-columns: 1fr; }
  .duo-card { display: block; }
  .duo-card img { height: 100px; }
  .pet-profile { grid-template-columns: 1fr; }
  .pet-backdrop { padding: 6px 20px 42px; }
  .pet-backdrop .pet-stage { width: min(100%,200px); height: auto; }
  .pet-bio { padding: 22px; }
  .pet-bio>.pill { font-size: 11px; }
  .shop-layout { grid-template-columns: 1fr; }
  .shop-preview { position: relative; top: auto; display: grid; grid-template-columns: 116px minmax(0,1fr); gap: 6px 12px; padding: 12px; }
  .shop-preview .pet-stage { width: 116px; height: 145px; grid-row: 1/5; }
  .shop-preview .wallet { font-size: 21px; }
  .shop-preview .wallet span { font-size: 12px; }
  .shop-preview .text-button { font-size: 12px; }
  .shop-items { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .shop-item { padding: 12px 10px; }
  .shop-item h3 { font-size: 14px; }
  .shop-filters { gap: 6px; }
  .shop-filters button { padding-inline: 10px; }
  .quest-card { flex-wrap: wrap; padding: 16px; }
  .quest-content { min-width: calc(100% - 55px); }
  .quest-reward { margin-left: 48px; flex: 1; width: auto; justify-content: flex-start; }
  .quest-reward .btn,.quest-reward a,.claimed-label { margin: 0 0 0 auto; width: auto; }
  .quest-hero { padding: 22px 16px; }
  .quest-hero h2 { font-size: 24px; }
  .quest-hero .pill { font-size: 10px; white-space: normal; }
  .quest-hero p { font-size: 14px; }
  .collection-hero h2 { font-size: 24px; }
  .collection-hero p { font-size: 14px; }
  .collection-hero .btn { font-size: 12px; }
  .streak-card { flex-direction: column; align-items: stretch; }
  .streak-card>img { width: 130px; height: 105px; }
  .context-sprite { width: 64px; height: 85px; flex: none; }
  .daily-game-teaser b { font-size: 14px; }
  .daily-game-teaser small { font-size: 12px; }
  .quick-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .lesson-tools { flex-wrap: wrap; }
  .lesson-tools>.btn { flex: 1 1 140px; font-size: 12px; }
  .program-banner { flex-wrap: wrap; }
  .program-banner>div { min-width: 0; }
  .program-large-icon { flex: none; }
  .sheet-bg { padding: 8px 0 0; }
  .sheet { border-radius: 22px 22px 0 0; padding-inline: max(16px,var(--safe-l)) max(16px,var(--safe-r)); }
}
@media(max-width:419px) {
  :root { --page-gutter: 16px; }
  .club-header { padding-inline: 12px; }
  .mobile-brand { font-size: 22px; letter-spacing: -.8px; }
  .club-stats { gap: 7px; }
  .club-stats>a { font-size: 12px; }
  .club-stats .game-icon { width: 19px; height: 19px; }
  .tabs a { font-size: 10px; }
  .game-nav a { flex: 1; padding: 10px 5px; font-size: 12px; }
  .welcome-card { grid-template-columns: 1fr; padding: 22px; }
  .welcome-copy h2 { font-size: 28px; }
  .welcome-copy p { max-width: none; font-size: 15px; }
  .welcome-copy .btn { max-width: none; width: 100%; font-size: 12px; }
  .welcome-dog { width: 140px; height: 160px; justify-self: center; grid-row: 1; }
  .welcome-copy>.pill { font-size: 10px; }
  .program-grid,.life-grid,.grid2 { grid-template-columns: 1fr; }
  .program-card { display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: stretch; }
  .program-art { height: auto; min-height: 130px; border-radius: 0; }
  .program-art>.ico { width: 42px; height: 42px; }
  .program-body { padding: 15px; }
  .program-body h2 { font-size: 17px; }
  .program-body p { font-size: 13px; }
  .metric { padding: 12px 10px; flex-wrap: wrap; }
  .metric small { font-size: 11px; }
  .top { flex-wrap: wrap; }
  .top>.grow { flex: 1 1 calc(100% - 64px); }
  .top .stat { min-height: 32px; }
  .quest-hero { flex-direction: column-reverse; align-items: stretch; }
  .quest-hero>img { width: 130px; height: 150px; align-self: center; }
  .quest-hero .wallet { font-size: 20px; }
  .quest-hero .wallet span { font-size: 12px; }
  .collection-hero { flex-direction: column; align-items: stretch; text-align: center; }
  .collection-hero>img { width: 145px; height: 160px; align-self: center; }
  .quest-card { gap: 10px; padding: 14px; }
  .quest-reward { margin-left: 0; }
  .quest-content { min-width: calc(100% - 48px); }
  .shop-preview { grid-template-columns: 98px minmax(0,1fr); }
  .shop-preview .pet-stage { width: 98px; height: 123px; }
  .shop-item>small { font-size: 9px; }
  .shop-item h3 { font-size: 13px; }
  .profile-metrics small { font-size: 11px; }
  .avatar-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .avatar-option img { height: 120px; }
  .counter { gap: 14px; font-size: 18px; flex-wrap: wrap; }
}
/* Landscape phones and short split-screen windows. */
@media(max-height:520px) and (min-width:540px) {
  :root { --header-height: 52px; --nav-height: 58px; }
  .club-header { position: relative; }
  .tabs a { min-height: 46px; gap: 0; }
  .tabs .ico { width: 21px; height: 21px; }
  .tabs a .nav-icon,.tabs a.on .nav-icon { padding: 0 10px; }
  .sheet-bg { align-items: center; padding: 8px max(16px,var(--safe-r)) 8px max(16px,var(--safe-l)); }
  .sheet { border-radius: 20px; }
  .avatar-picker { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .avatar-option img { height: 95px; }
  .composer .chips { display: none; }
  .pet-profile { grid-template-columns: 40% minmax(0,1fr); }
  .pet-backdrop .pet-stage { max-width: 200px; }
  .pet-bio { padding: 20px; }
  .pet-bio h2 { font-size: 28px; }
  .profile-metrics { margin-block: 12px; }
  .shop-preview { position: relative; top: auto; }
  .session { display: grid; grid-template-columns: minmax(0,1fr) minmax(220px,.9fr); gap: 8px 20px; align-content: start; min-height: 0; }
  .session>.row:first-child { grid-column: 1/-1; }
  .session>.session-instructions { grid-column: 1; min-width: 0; }
  .session>.session-controls { grid-column: 2; min-width: 0; position: sticky; top: 8px; align-self: start; max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 0 5px 12px; }
  .session .timer { font-size: 38px; line-height: 1.15; margin-bottom: 8px; }
  .session .counter { font-size: 16px; gap: 10px; margin: 12px 0; }
  .session .reps { margin-top: 12px; }
  .session .reps button { min-height: 56px; padding: 7px; font-size: 30px; }
  .session .session-clicker { margin: 14px 0; min-height: 44px; padding: 8px; }
  .session .hero .n { font-size: 18px !important; }
  .session-reward-sprite { height: 110px; }
  .celebrate { padding-top: 20px; }
}
@media(prefers-reduced-motion:reduce) { html { scroll-behavior: auto; } }

.session-controls,.session-instructions { min-width: 0; }
img[src$="claudette-celebrate.png"] { clip-path: inset(0 8% 0 0); }
@media(max-width:419px) { .club-header { padding-inline: max(12px,var(--safe-l)) max(12px,var(--safe-r)); } }
.game-page,.feature-page,.page,.sheet { overflow-wrap: anywhere; }
.rail-pet>div:not(.pet-stage) { min-width: 0; }
.rail-pet b { overflow-wrap: anywhere; }
.club-stats b { max-width: 9ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feature-page,.page:not(.feature-page),.game-page,.session,.top {
  padding-inline: max(var(--page-gutter),var(--safe-l)) max(var(--page-gutter),var(--safe-r));
}
.toast { max-width: min(560px,calc(100% - var(--safe-l) - var(--safe-r) - 32px)); }
