/* Academy: a friendly learning app for business owners.
   Tokens follow docs/product/tokens.md (--ee-*). Titles Afacad Flux, body Source Sans 3. No chips or pills:
   tiles, cards and rows. Motion only answers a tap; all of it stops under prefers-reduced-motion. */
:root {
  color-scheme: light;
  --ee-bg: #F5F7F2; --ee-shell: #FFFFFC; --ee-surface: #FFFFFF; --ee-line: #D8DED6;
  --ee-text: #182231; --ee-muted: #667085;
  --ee-primary: #147D64; --ee-primary-press: #0E5A48; --ee-structure: #006B78;
  --ee-link: #2457D6; --ee-wash: #E8F1EC; --ee-warn: #9A6518; --ee-err: #B42318;
  --ee-ecoai: #0F5B4F; --ee-scrim: rgba(24,34,49,.45); --ee-ink-deep: #0A1628;
  --ee-art: #E4EFE9; --ee-soft: #4B5565;
  --ee-display: "Afacad Flux", system-ui, sans-serif;
  --ee-body: "Source Sans 3", system-ui, sans-serif;
  --ease: cubic-bezier(.22,1,.36,1);
  --header-h: 73px;
  --nav-h: 64px;
  --tone: var(--ee-primary);
}
* { box-sizing: border-box; }
body.academy { margin: 0; background: var(--ee-bg); color: var(--ee-text); font: 400 18px/1.5 var(--ee-body); }
body.academy a { color: var(--ee-link); }
.academy .skip-link { position: absolute; left: -9999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
.academy .skip-link:focus { left: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.academy :focus-visible { outline: 3px solid var(--ee-link); outline-offset: 3px; }
.academy [hidden] { display: none !important; }
.academy h1, .academy h2, .academy h3 { font-family: var(--ee-display); color: var(--ee-structure); line-height: 1.1; letter-spacing: 0; margin: 0; }
.academy h1, .academy h2, .academy h3 { font-weight: 700; }
:where(.academy) p { margin: 0; }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 980px) { :root { --header-h: 74px; } }

/* ---------- Buttons: tactile, a 4px press edge, no shadow ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 16px; background: #fff; color: var(--ee-structure) !important; font: 700 17px/1.2 var(--ee-body); text-decoration: none !important; cursor: pointer; transition: transform 120ms var(--ease), border-bottom-width 120ms var(--ease), background 150ms ease; }
.btn:hover { background: var(--ee-wash); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.primary { background: var(--ee-primary); border-color: var(--ee-primary); border-bottom-color: var(--ee-primary-press); color: #fff !important; }
.btn.primary:hover { background: #118069; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.btn.has-sub { flex-direction: column; gap: 2px; padding-top: 8px; padding-bottom: 8px; }
.btn-sub { display: block; max-width: 100%; font: 400 15px/1.25 var(--ee-body); text-align: center; opacity: .92; }
.btn.has-sub .btn-text { white-space: normal; }
.btn-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { appearance: none; border: 0; background: none; padding: 0; color: var(--ee-link); font: 600 15px/1.4 var(--ee-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ee-structure); cursor: pointer; }
.icon-btn:hover { background: var(--ee-wash); }
.icon-btn .ic { width: 24px; height: 24px; }

/* ---------- App shell ---------- */
.app { display: block; min-height: calc(100dvh - var(--header-h)); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.views { min-width: 0; }
.view { padding: 12px 16px 32px; }

/* Bottom nav on phones */
.rail { position: fixed; z-index: 9000; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--ee-shell); border-top: 1px solid var(--ee-line); }
.rail-title, .rail-foot { display: none; }
.rail-item { appearance: none; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--ee-muted) !important; font: 700 12px/1.2 var(--ee-body); text-decoration: none !important; cursor: pointer; }
.rail-item .ic { width: 24px; height: 24px; }
.rail-item[aria-current="page"], .rail-item[aria-expanded="true"] { color: var(--ee-primary) !important; }
.rail-item:active .ic { transform: scale(.92); }
.app[data-view="lesson"] .rail { display: none; }
.app[data-view="lesson"] { padding-bottom: 0; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; gap: 16px; padding: 12px; background: var(--ee-wash); border-radius: 28px; }
.hero-art { margin: 0; height: 150px; border-radius: 20px; overflow: hidden; background: var(--ee-art); }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.hero-copy { padding: 4px 8px 12px; }
.hero h1 { font-size: clamp(34px, 9vw, 44px); line-height: 1.05; color: var(--ee-ink-deep); max-width: 14ch; }
.hero-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.hero-actions .btn { width: 100%; }
.proof { margin-top: 24px; font-size: 16px; line-height: 1.5; color: var(--ee-text); max-width: 44ch; }
.note { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--ee-soft); max-width: 44ch; }

/* Continue / sample tile */
.tile-slot { min-height: 112px; margin-top: 16px; }
.continue { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px 12px 12px; min-height: 112px; background: var(--ee-surface); border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 24px; color: var(--ee-text) !important; text-decoration: none !important; transition: transform 120ms var(--ease), border-bottom-width 120ms var(--ease); }
.continue:active { transform: translateY(2px); border-bottom-width: 2px; }
.continue-art { width: 88px; height: 88px; border-radius: 18px; overflow: hidden; background: var(--ee-art); }
.continue-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.continue-copy { display: grid; gap: 2px; min-width: 0; }
.continue-k { font-size: 15px; font-weight: 700; color: var(--ee-primary); }
.continue-copy strong { font: 700 21px/1.15 var(--ee-display); color: var(--ee-structure); }
.continue-meta { font-size: 15px; color: var(--ee-muted); }
.continue-go { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--ee-primary); color: #fff; border-bottom: 4px solid var(--ee-primary-press); }
.continue-go .ic { width: 24px; height: 24px; }

/* ---------- Path map ---------- */
.paths { margin-top: 8px; min-height: 900px; }
.outline h2, .outline h3 { margin-top: 16px; }
.outline p { color: var(--ee-muted); }
.outline ol { margin: 8px 0 0; padding-left: 22px; }
.stage { margin-top: 28px; }
.stage-head { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px 16px; align-items: center; padding: 16px; background: var(--ee-surface); border: 1px solid var(--ee-line); border-radius: 24px; }
.stage-art { width: 84px; height: 84px; border-radius: 18px; overflow: hidden; background: var(--ee-art); }
.stage-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.stage-title { font-size: 28px; color: var(--tone) !important; }
.stage-for { font-size: 15px; color: var(--ee-muted); margin-top: 2px; }
.stage-count { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--ee-text); }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--ee-wash); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--ee-primary); transition: width 400ms var(--ease); }
.stage-badge { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 700; color: var(--tone); }
.stage-summary { grid-column: 1 / -1; margin: 0; padding-top: 12px; border-top: 1px solid var(--ee-line); font-size: 16px; line-height: 1.45; color: var(--ee-soft); max-width: 56ch; }

.trail { position: relative; max-width: 520px; margin: 4px auto 0; }
.trail svg.route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.route path { fill: none; vector-effect: non-scaling-stroke; stroke: #C9D2C8; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 10; }
.route path.on { stroke: var(--ee-primary); stroke-dasharray: none; }
.stop { position: absolute; left: var(--x); top: var(--y); width: 76px; height: 76px; transform: translate(-50%, -50%); display: block; text-decoration: none !important; color: var(--ee-text) !important; }
.stop-tile { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 26px; background: var(--ee-surface); border: 2px solid var(--ee-line); border-bottom-width: 6px; color: var(--tone); transition: transform 120ms var(--ease), border-bottom-width 120ms var(--ease); }
.stop-tile .ic { width: 34px; height: 34px; }
.stop:hover .stop-tile { background: var(--ee-wash); }
.stop:active .stop-tile { transform: translateY(3px); border-bottom-width: 3px; }
.stop.is-done .stop-tile { background: var(--tone); border-color: var(--tone); border-bottom-color: color-mix(in srgb, var(--tone) 70%, #000); color: #fff; }
.stop.is-current .stop-tile { background: var(--ee-wash); border-color: var(--tone); border-bottom-color: var(--tone); box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 18%, transparent); }
.stop.is-locked .stop-tile { color: var(--ee-muted); background: var(--ee-surface); }
.stop-mark { position: absolute; right: -6px; top: -6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--ee-line); color: var(--ee-muted); }
.stop-mark .ic { width: 14px; height: 14px; stroke-width: 2.5; }
.stop.is-done .stop-mark { background: #fff; border-color: var(--tone); color: var(--tone); }
.stop-label { position: absolute; top: 50%; transform: translateY(-50%); width: min(40vw, 190px); font: 700 17px/1.2 var(--ee-display); color: var(--ee-text); }
.stop.right .stop-label { left: calc(100% + 14px); text-align: left; }
.stop.left .stop-label { right: calc(100% + 14px); text-align: right; }
.stop-meta { display: block; margin-top: 3px; font: 400 14px/1.2 var(--ee-body); color: var(--ee-muted); }
.stop.is-current .stop-label { color: var(--tone); }
.here { position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%); padding: 5px 10px; border-radius: 10px; background: var(--ee-ink-deep); color: #fff; font: 700 14px/1.2 var(--ee-body); white-space: nowrap; }
.here::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--ee-ink-deep); }
.stop.is-current .stop-tile { animation: halo 2.4s ease-in-out infinite; }
@keyframes halo { 0%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 18%, transparent); } 50% { box-shadow: 0 0 0 11px color-mix(in srgb, var(--tone) 8%, transparent); } }
.stop.capstone, .stop.capstone .stop-tile { width: 88px; height: 88px; }
.stop.capstone .stop-tile .ic { width: 40px; height: 40px; }
.pitch-for .cycle-word { display: inline-block; color: var(--tone); font-weight: 700; transition: opacity 280ms var(--ease), transform 280ms var(--ease); }
.pitch-for .cycle-word.is-out { opacity: 0; transform: translateY(-6px); }
.pitch-for .cycle-word.is-in { opacity: 0; transform: translateY(6px); transition: none; }
@media (prefers-reduced-motion: reduce) { .pitch-for .cycle-word { transition: none; } }
.stop.capstone .stop-label { left: 50%; right: auto; top: calc(100% + 12px); transform: translateX(-50%); width: min(80vw, 280px); text-align: center; }

.legal p { max-width: 62ch; }
.legal { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--ee-line); font-size: 14px; line-height: 1.5; color: var(--ee-muted); display: grid; gap: 8px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-weight: 600; font-size: 15px; margin-top: 4px; }

/* ---------- Lesson view ---------- */
.view.lesson { display: flex; flex-direction: column; min-height: calc(100dvh - var(--header-h)); padding: 0; }
.lesson-top { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px 4px; }
.lesson-top .meter { height: 12px; border-radius: 6px; background: var(--ee-line); }
.lesson-top .meter i { border-radius: 6px; }
.step-count { font-size: 15px; font-weight: 700; color: var(--ee-muted); white-space: nowrap; }
.lesson-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 44px; }
.lesson-sub .link-btn { white-space: nowrap; }
.academy .lesson-name { margin: 0; font: 600 15px/1.3 var(--ee-body); color: var(--ee-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-area { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 16px; touch-action: pan-y; }
.card-area .step { flex: 1; }
.step { position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 360px; padding: 20px; background: var(--ee-surface); border: 1px solid var(--ee-line); border-radius: 28px; overflow: hidden; }
.step.enter-next { animation: slideIn 220ms var(--ease) both; }
.step.enter-back { animation: slideBack 220ms var(--ease) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.step h2 { font-size: 30px; outline: none; }
.step h2 .sub { display: inline-block; margin-left: 8px; font: 600 16px/1 var(--ee-body); color: var(--ee-muted); }
.step .big { font-size: 21px; line-height: 1.45; color: var(--ee-text); max-width: 34em; }
.step .lead { font-size: 20px; line-height: 1.4; max-width: 34em; }
.step .art { margin: -20px -20px 0; height: 190px; background: var(--ee-art); }
.step .art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.step .art.contain img { object-fit: contain; }
.step-meta { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ee-muted); }
.learn { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.learn li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 18px; line-height: 1.35; }
.learn .ic { width: 26px; height: 26px; color: var(--ee-primary); }
.ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ideas li { padding: 14px 16px; background: var(--ee-wash); border-radius: 18px; font-size: 19px; line-height: 1.4; }
.ideas strong { color: var(--ee-structure); }
.mistakes li { background: #FBF4E6; }
.mistakes strong { color: var(--ee-warn); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: flow; }
.flow li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 56px; padding: 6px 14px 6px 6px; background: var(--ee-wash); border-radius: 18px; font: 700 19px/1.2 var(--ee-display); color: var(--ee-structure); }
.flow li::before { counter-increment: flow; content: counter(flow); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--ee-primary); color: #fff; font: 700 20px/1 var(--ee-display); border-bottom: 3px solid var(--ee-primary-press); }
.bubble-ex { position: relative; padding: 16px 18px; background: var(--ee-wash); border-radius: 22px; font-size: 20px; line-height: 1.4; }
.bubble-ex::before { content: ""; position: absolute; left: 28px; top: -10px; width: 20px; height: 20px; background: var(--ee-wash); transform: rotate(45deg); border-radius: 4px; }

.videos { display: grid; gap: 16px; }
.video { margin: 0; max-width: 640px; }
.video-box { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: var(--ee-ink-deep); }
.video-play { position: absolute; inset: 0; display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: var(--ee-ink-deep); cursor: pointer; }
.video-play picture, .video-play img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-play .play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.video-play .play .ic { width: 68px; height: 68px; padding: 20px; border-radius: 50%; color: #fff; background: rgba(10,22,40,.82); fill: currentColor; transition: transform 160ms var(--ease); }
.video-play:hover .play .ic, .video-play:focus-visible .play .ic { transform: scale(1.08); }
.video-play:focus-visible { outline: 3px solid var(--ee-link); outline-offset: -3px; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { display: grid; gap: 2px; margin-top: 10px; font-size: 16px; color: var(--ee-muted); }
.video figcaption strong { font-size: 18px; line-height: 1.3; color: var(--ee-text); }
.video figcaption a { justify-self: start; font-weight: 600; text-underline-offset: 3px; min-height: 32px; display: inline-flex; align-items: center; }

/* Quick check */
.q { font: 700 24px/1.25 var(--ee-display); color: var(--ee-text); }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) 26px; gap: 10px; align-items: center; width: 100%; min-height: 56px; padding: 12px 16px; text-align: left; border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 18px; background: #fff; color: var(--ee-text); font: 400 18px/1.35 var(--ee-body); cursor: pointer; transition: transform 120ms var(--ease), background 150ms ease; }
.opt:hover { background: var(--ee-wash); }
.opt:active { transform: translateY(2px); }
.opt .ic { width: 26px; height: 26px; opacity: 0; }
.opt.ok { border-color: var(--ee-primary); background: #E3F3EB; }
.opt.ok .ic { opacity: 1; color: var(--ee-primary); }
.opt.bad { border-color: var(--ee-err); background: #FCEDEA; }
.opt.bad .ic { opacity: 1; color: var(--ee-err); }
.opt[disabled] { cursor: default; }
.opt[disabled]:not(.ok):not(.bad) { opacity: .6; }
.feedback { min-height: 56px; font-size: 18px; line-height: 1.4; }
.feedback strong { display: block; font: 700 22px/1.2 var(--ee-display); }
.feedback.good strong { color: var(--ee-primary); }
.feedback.close strong { color: var(--ee-warn); }

/* Task + checklist */
.res { display: grid; gap: 12px; padding: 16px; background: var(--ee-wash); border-radius: 20px; }
.res-name { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; font-weight: 600; line-height: 1.3; color: var(--ee-text); }
.res-name .ic { color: var(--ee-structure); width: 26px; height: 26px; }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.checks { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 18px; background: #fff; color: var(--ee-text); font: 400 18px/1.3 var(--ee-body); cursor: pointer; }
.check-row .box { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; border: 2px solid #B7C2BA; color: transparent; background: #fff; }
.check-row .box .ic { width: 18px; height: 18px; stroke-width: 3; }
.check-row[aria-checked="true"] { border-color: var(--ee-primary); background: #E3F3EB; }
.check-row[aria-checked="true"] .box { background: var(--ee-primary); border-color: var(--ee-primary); color: #fff; }
.notes label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--ee-structure); }
.notes textarea { width: 100%; min-height: 96px; padding: 12px 14px; border: 2px solid var(--ee-line); border-radius: 16px; font: 400 18px/1.4 var(--ee-body); color: var(--ee-text); background: #fff; resize: vertical; }
.help-row { display: flex; flex-wrap: wrap; gap: 4px 18px; font-weight: 600; font-size: 16px; }
.help-row a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }

/* Done card */
.step.step-done { align-items: center; text-align: center; gap: 12px; padding-top: 28px; }
.step.step-done .done-art { width: 150px; height: 150px; border-radius: 28px; overflow: hidden; background: var(--ee-art); animation: pop 520ms var(--ease) both; }
.step.step-done .done-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
.step.step-done h2 { font-size: 34px; }
.done-title { font-size: 19px; color: var(--ee-muted); max-width: 26em; }
.week { font-size: 16px; color: var(--ee-muted); }
.done-actions { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: stretch; gap: 10px; width: 100%; max-width: 420px; margin-top: 8px; }
.done-actions .link-btn { justify-self: center; }
.confetti { position: absolute; left: 50%; top: 96px; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; left: 0; top: 0; width: 10px; height: 14px; border-radius: 3px; background: var(--c, var(--ee-primary)); opacity: 0; animation: burst 1100ms var(--ease) var(--dl, 0ms) both; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); } }
.badge-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: center; width: 100%; max-width: 420px; padding: 14px 16px; text-align: left; background: var(--ee-wash); border-radius: 22px; }
.badge-card strong { display: block; font: 700 22px/1.15 var(--ee-display); color: var(--tone); }
.badge-card p { font-size: 16px; color: var(--ee-text); }
.badge { width: 72px; height: 84px; }
.badge.off { filter: grayscale(1); opacity: .35; }

/* Bottom action bar */
.lesson-bar { position: sticky; bottom: 0; display: flex; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ee-shell); border-top: 1px solid var(--ee-line); z-index: 5; }
.lesson-bar .btn { flex: 1; }
.lesson-bar .btn.back { flex: 0 0 auto; min-width: 104px; }
.lesson-bar .spacer { flex: 0 0 104px; }

.gate-card { display: grid; gap: 12px; padding: 4px 0; }
.gate-card .art { margin: -20px -20px 4px; }
.gate-actions { display: grid; gap: 10px; margin-top: 4px; }

/* ---------- Workbook and Me ---------- */
.page-head { display: grid; gap: 6px; padding: 8px 4px 16px; }
.page-head h1, .page-head h2 { font-size: 36px; color: var(--ee-ink-deep); }
.page-head p { color: var(--ee-muted); font-size: 17px; max-width: 46ch; }
.group-title { font-size: 22px; margin: 24px 4px 10px; color: var(--tone); }
.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 68px; padding: 10px 14px 10px 10px; background: var(--ee-surface); border: 1px solid var(--ee-line); border-radius: 18px; color: var(--ee-text) !important; text-decoration: none !important; }
.row:hover { background: var(--ee-wash); }
.row-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--ee-wash); color: var(--tone); }
.row-icon .ic { width: 26px; height: 26px; }
.row strong { display: block; font: 700 18px/1.2 var(--ee-display); color: var(--ee-structure); }
.row span.sm { display: block; font-size: 15px; color: var(--ee-muted); line-height: 1.3; }
.row .go { color: var(--ee-muted); }
.me-card { display: grid; gap: 12px; padding: 16px; background: var(--ee-surface); border: 1px solid var(--ee-line); border-radius: 24px; }
.me-badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.me-badge { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; text-align: center; background: var(--ee-wash); border-radius: 20px; font-size: 14px; color: var(--ee-soft); }
.me-badge strong { font: 700 18px/1.1 var(--ee-display); color: var(--ee-text); }
.me-actions { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.big-num { font: 700 44px/1 var(--ee-display); color: var(--ee-primary); }

/* ---------- ECO panel ---------- */
.scrim { position: fixed; inset: 0; z-index: 9400; background: var(--ee-scrim); }
.eco { position: fixed; z-index: 9500; left: 0; right: 0; bottom: 0; height: min(88dvh, 760px); display: flex; flex-direction: column; background: var(--ee-surface); border-radius: 28px 28px 0 0; border: 1px solid var(--ee-line); border-bottom: 0; animation: sheet 240ms var(--ease) both; }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.eco-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 20px; }
.eco-head h2 { font-size: 26px; color: var(--ee-ecoai); outline: none; }
.eco-context { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 20px; padding: 8px 12px; background: var(--ee-wash); border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--ee-structure); }
.eco-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 20px; }
.eco-empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding-top: 4px; }
.eco-empty img { width: 120px; height: 120px; border-radius: 24px; background: var(--ee-art); }
.eco-empty-title { font: 700 24px/1.15 var(--ee-display); color: var(--ee-ecoai); }
.eco-empty-sub { font-size: 16px; color: var(--ee-muted); max-width: 30em; }
.eco-starters-label { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--ee-muted); }
.eco-starters { display: grid; gap: 8px; width: 100%; }
.starter { display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 8px; align-items: center; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 16px; background: #fff; color: var(--ee-text); font: 600 17px/1.3 var(--ee-body); cursor: pointer; }
.starter:hover { background: var(--ee-wash); }
.starter .ic { width: 20px; height: 20px; color: var(--ee-muted); }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 92%; padding: 10px 14px; border-radius: 18px; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin: 0; }
.msg.ai .bubble { background: #fff; border: 1px solid var(--ee-line); }
.msg.user .bubble { background: var(--ee-wash); color: var(--ee-text); }
.bubble.loading { color: var(--ee-muted); }
.ee-ai-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ee-ai-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 2px solid var(--ee-line); border-bottom-width: 4px; border-radius: 12px; background: #fff; font-weight: 700; text-decoration: none; color: var(--ee-structure) !important; }
.eco-gate { margin: 0 20px 12px; padding: 16px; background: var(--ee-wash); border-radius: 20px; display: grid; gap: 8px; }
.eco-gate-title { font: 700 22px/1.2 var(--ee-display); color: var(--ee-ecoai); }
.eco-gate-actions { display: grid; gap: 10px; margin-top: 4px; }
.composer-form { display: block; margin: 0; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ee-line); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border: 2px solid var(--ee-line); border-radius: 24px; background: #fff; }
.composer:focus-within { border-color: var(--ee-ecoai); }
.composer textarea { flex: 1 1 auto; min-width: 0; width: 100%; max-height: 120px; min-height: 40px; padding: 8px 0; border: 0; outline: none; resize: none; background: transparent; font: 400 17px/1.4 var(--ee-body); color: var(--ee-text); }
.composer textarea:focus-visible { outline: none; }
.composer .send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-bottom: 3px solid var(--ee-primary-press); border-radius: 16px; background: var(--ee-ecoai); color: #fff; cursor: pointer; }
.composer .send .ic { width: 22px; height: 22px; }
.composer .send[disabled] { opacity: .5; cursor: not-allowed; }
.composer-form .ee-form-consent { margin: 8px 6px 0 !important; font: 400 13px/1.4 var(--ee-body) !important; color: var(--ee-muted) !important; }
.composer-form .ee-form-consent a { color: var(--ee-link) !important; font-weight: 600 !important; }
.noscript { padding: 16px; color: var(--ee-muted); }

/* ---------- Wide screens: a centered app frame with a side rail ---------- */
@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); width: min(1160px, calc(100% - 48px)); margin: 24px auto 40px; min-height: 760px; padding-bottom: 0; background: var(--ee-shell); border: 1px solid var(--ee-line); border-radius: 32px; overflow: clip; }
  .rail { position: static; display: flex; flex-direction: column; gap: 6px; height: auto; padding: 24px 16px; background: var(--ee-wash); border-top: 0; border-right: 1px solid var(--ee-line); }
  .rail-title { display: block; padding: 0 12px 12px; font: 700 28px/1 var(--ee-display); color: var(--ee-structure); }
  .rail-item { flex-direction: row; justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; border-radius: 16px; font-size: 18px; text-align: left; color: var(--ee-structure) !important; }
  .rail-item:hover { background: rgba(255,255,255,.7); }
  .rail-item[aria-current="page"], .rail-item[aria-expanded="true"] { background: #fff; color: var(--ee-primary) !important; box-shadow: inset 0 0 0 2px var(--ee-primary); }
  .app[data-view="lesson"] .rail { display: flex; }
  .rail-foot { display: grid; gap: 8px; margin-top: auto; padding: 14px 12px 0; }
  .rail-count { font-size: 15px; font-weight: 600; color: var(--ee-structure); }
  .view { padding: 28px 40px 40px; }
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 16px; padding: 24px; border-radius: 32px; }
  .hero-copy { order: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 16px 16px 24px; }
  .hero-art { order: 2; height: auto; aspect-ratio: 4 / 3; border-radius: 24px; }
  .hero-art img { object-position: 50% 50%; }
  .hero h1 { font-size: 50px; max-width: 13ch; }
  .hero-actions { flex-direction: column; align-items: flex-start; margin-top: 24px; }
  .hero-actions .btn { width: 100%; max-width: 360px; }
  .view.lesson { padding: 0; min-height: 760px; }
  .lesson-top { padding: 20px 28px 4px; }
  .lesson-sub { padding: 0 32px; }
  .card-area { padding: 12px 32px 20px; }
  .step { min-height: 440px; padding: 32px 36px; }
  .step .art { margin: -32px -36px 0; height: 240px; }
  .step .big { font-size: 22px; }
  .gate-card .art { margin: -32px -36px 4px; }
  .lesson-bar { position: static; padding: 16px 32px 24px; background: transparent; border-top: 0; }
  .lesson-bar .btn { flex: 0 0 auto; min-width: 200px; }
  .lesson-bar .btn.back { min-width: 120px; }
  .lesson-bar .grow { flex: 1; }
  .step .videos { grid-template-columns: 1fr; }
  /* 1000px to 1279px: ECO is a right-hand drawer over the app, so the lesson keeps its full width. */
  .eco { top: 0; bottom: 0; left: auto; right: 0; width: min(420px, 100%); height: auto; border-radius: 28px 0 0 28px; border-bottom: 1px solid var(--ee-line); }
  @keyframes sheet { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .stop-label { width: min(230px, 28vw); font-size: 19px; }
  .stop-meta { font-size: 15px; }
  .gate-actions { grid-auto-flow: column; grid-auto-columns: max-content; }
  .eco-gate-actions { grid-auto-flow: row; }
}
@media (min-width: 1280px) {
  .app.eco-open { grid-template-columns: 232px minmax(0, 1fr) 380px; }
  .app.eco-open .view { padding: 28px 24px 40px; }
  .app.eco-open .view.lesson { padding: 0; }
  .eco { position: sticky; top: 8px; bottom: auto; right: auto; z-index: auto; align-self: start; width: auto; height: min(calc(100dvh - 16px), 820px); min-height: 560px; border-radius: 0; border: 0; border-left: 1px solid var(--ee-line); animation: none; background: var(--ee-surface); }
  .scrim { display: none !important; }
  .app.eco-open .stop-label { width: 190px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .step.enter-next, .step.enter-back, .eco, .step.step-done .done-art, .stop.is-current .stop-tile { animation: none !important; }
  .confetti { display: none; }
  .btn, .continue, .stop-tile, .opt, .meter i { transition: none; }
}
