/* AI Fluency Lab components. Every color comes from tokens.css. */
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
.fl-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 16px; }
.fl-stack { display: flex; flex-direction: column; gap: 16px; padding: 16px; max-width: 420px; }
.fl-ico { width: 1em; height: 1em; flex: none; }
:where(.fl-btn, .fl-opt, .fl-rail-btn, .fl-line, .fl-tab, .fl-feed-nav button):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Button */
.fl-btn { font: 700 15px/1 var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border: 2px solid var(--ink); border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; -webkit-tap-highlight-color: transparent; }
.fl-btn:active { transform: translateY(3px); box-shadow: var(--shadow-pop-pressed); }
.fl-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.fl-btn-primary { background: var(--volt); color: var(--on-volt); }
.fl-btn-secondary { background: var(--surface); color: var(--ink); }
.fl-btn-zap { background: var(--lemon); color: var(--on-lemon); }
.fl-btn-ghost { background: transparent; color: var(--ink); border-color: transparent; box-shadow: none; }
.fl-btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.fl-btn-lg { height: 56px; padding: 0 28px; font-size: 17px; }
.fl-btn-block { width: 100%; }
.fl-btn-icon { display: inline-flex; font-size: 18px; }

/* Habit chip */
.fl-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding-block: 0; padding-inline: 6px 12px; border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); border: 2px solid var(--ink); font: 600 13px/1 var(--font-body); white-space: nowrap; }
.fl-chip-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--hc); border: 2px solid var(--ink); box-sizing: border-box; }
.fl-chip-score { font: 700 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.fl-h-context { --hc: var(--habit-context); } .fl-h-iteration { --hc: var(--habit-iteration); } .fl-h-verification { --hc: var(--habit-verification); } .fl-h-judgment { --hc: var(--habit-judgment); } .fl-h-ownership { --hc: var(--habit-ownership); }

/* Story progress */
.fl-story { display: flex; gap: 4px; width: 100%; }
.fl-story-seg { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .32); overflow: hidden; }
.fl-story-fill { height: 100%; width: 0; background: var(--on-scrim); border-radius: 2px; }
.fl-story-seg.is-done .fl-story-fill { width: 100%; }
.fl-story-seg.is-active .fl-story-fill { animation: fl-fill var(--dur, 9s) linear forwards; }
@keyframes fl-fill { to { width: 100%; } }

/* XP bar */
.fl-xp { display: flex; align-items: center; gap: 10px; font: 700 13px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--on-scrim); }
.fl-xp-streak { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--volt); color: var(--on-volt); }
.fl-xp-track { flex: 1; min-width: 60px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.fl-xp-fill { height: 100%; background: var(--lemon); border-radius: 5px; transition: width .5s cubic-bezier(.2, .9, .3, 1.3); }
.fl-xp-num { min-width: 64px; text-align: end; }
.fl-xp-solo { background: var(--scrim); padding: 10px 12px; border-radius: var(--radius-md); }

/* Action rail */
.fl-rail { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.fl-rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; padding: 10px 0 8px; border: 0; border-radius: var(--radius-pill); background: var(--scrim); color: var(--on-scrim); font: 700 11px/1 var(--font-mono); cursor: pointer; transition: transform .12s ease; -webkit-tap-highlight-color: transparent; }
.fl-rail-btn .fl-ico { font-size: 24px; }
.fl-rail-btn:active { transform: scale(.9); }
.fl-rail-btn.is-on { background: var(--pop); color: var(--on-pop); }
.fl-rail-btn.is-on .fl-ico { animation: fl-pop .35s ease; }
@keyframes fl-pop { 40% { transform: scale(1.35); } }

/* Prompt pick */
.fl-pick { display: flex; flex-direction: column; gap: 12px; }
.fl-opt { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; text-align: start; width: 100%; padding: 14px; border: 2px solid var(--ink); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); font: 500 15px/22px var(--font-body); cursor: pointer; transition: transform .08s ease, box-shadow .08s ease, background .2s; }
.fl-opt:active:not(:disabled) { transform: translateY(3px); box-shadow: var(--shadow-pop-pressed); }
.fl-opt:disabled { cursor: default; }
.fl-opt-tag { font: 700 11px/14px var(--font-mono); letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; background: var(--surface-raised); border: 1.5px solid var(--ink); }
.fl-opt-text { font-family: var(--font-mono); font-size: 13px; line-height: 19px; font-weight: 500; min-width: 0; }
.fl-opt.is-right { background: var(--mint); color: var(--on-mint); border-color: var(--on-mint); animation: fl-bounce .4s ease; }
.fl-opt.is-wrong { background: var(--surface-raised); color: var(--ink-muted); opacity: .9; }
.fl-opt.is-picked-wrong { background: var(--danger); color: var(--on-danger); animation: fl-shake .35s ease; }
.fl-opt.is-right .fl-opt-tag, .fl-opt.is-picked-wrong .fl-opt-tag { background: transparent; border-color: currentColor; }
.fl-why { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink); font: 500 14px/20px var(--font-body); }
.fl-why b { font-weight: 800; }
@keyframes fl-bounce { 30% { transform: scale(1.03); } 60% { transform: scale(.99); } }
@keyframes fl-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* Spot the line */
.fl-lines { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius-md); background: var(--surface); color: var(--ink); border: 2px solid var(--ink); box-shadow: var(--shadow-pop); }
.fl-lines-head { display: flex; justify-content: space-between; font: 700 11px/14px var(--font-mono); letter-spacing: .08em; color: var(--ink-muted); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.fl-line { text-align: start; border: 0; background: transparent; color: inherit; font: 500 15px/21px var(--font-body); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.fl-line:hover:not(:disabled) { background: var(--surface-raised); }
.fl-line:disabled { cursor: default; }
.fl-line.is-caught { background: var(--mint); color: var(--on-mint); text-decoration: line-through; text-decoration-thickness: 2px; }
.fl-line.is-miss { background: var(--danger); color: var(--on-danger); animation: fl-shake .35s ease; }

/* Habit meter */
.fl-meter { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); border: 2px solid var(--ink); }
.fl-meter-row { display: grid; grid-template-columns: 96px 1fr 34px; gap: 10px; align-items: center; font: 600 13px/1 var(--font-body); }
.fl-meter-track { height: 14px; border-radius: 7px; background: var(--surface-raised); overflow: hidden; border: 1.5px solid var(--ink); }
.fl-meter-bar { height: 100%; background: var(--hc); border-inline-end: 1.5px solid var(--ink); transform-origin: left; animation: fl-grow .8s cubic-bezier(.2, .9, .3, 1.2) both; }
.fl-meter-val { font: 700 13px/1 var(--font-mono); font-variant-numeric: tabular-nums; text-align: end; }
.fl-meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.fl-meter-total { font: 700 22px/1 var(--font-mono); }
.fl-meter-low { font: 600 12px/16px var(--font-body); color: var(--ink-muted); }
@keyframes fl-grow { from { transform: scaleX(0); } }

/* Reel card */
.fl-reel { --tone: var(--surface); --on-tone: var(--ink); position: relative; box-sizing: border-box; height: 100%; min-height: 520px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; padding-block: 120px 96px; padding-inline: 18px 76px; background: var(--tone); color: var(--on-tone); scroll-snap-align: start; scroll-snap-stop: always; }
.fl-reel.no-rail { padding-inline-end: 18px; }
.fl-reel.is-solo {border-radius: var(--radius-lg); border: 2px solid var(--ink); padding-top: 64px; padding-bottom: 28px; }
.fl-tone-volt { --tone: var(--volt); --on-tone: var(--on-volt); }
.fl-tone-cobalt { --tone: var(--cobalt); --on-tone: var(--on-cobalt); }
.fl-tone-pop { --tone: var(--pop); --on-tone: var(--on-pop); }
.fl-tone-lemon { --tone: var(--lemon); --on-tone: var(--on-lemon); }
.fl-tone-mint { --tone: var(--mint); --on-tone: var(--on-mint); }
.fl-tone-surface { --tone: var(--ground); --on-tone: var(--ink); }
.fl-reel-eyebrow { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-pill); border: 2px solid currentColor; font: 700 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.fl-reel-title { margin: 0; font: 800 30px/1.08 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.fl-reel-body { margin: 0; font: 500 17px/24px var(--font-body); opacity: .86; max-width: 34ch; }
.fl-reel-big { position: absolute; top: 96px; left: 10px; font: 800 150px/.85 var(--font-display); letter-spacing: -.05em; opacity: .16; pointer-events: none; user-select: none; }
.fl-reel-rail { position: absolute; right: 12px; bottom: 104px; }
.fl-reel.is-solo .fl-reel-rail { bottom: 28px; }
.fl-reel-anim > * { animation: fl-rise .5s cubic-bezier(.2, .9, .3, 1) both; }
.fl-reel-anim > *:nth-child(2) { animation-delay: .06s; } .fl-reel-anim > *:nth-child(3) { animation-delay: .12s; } .fl-reel-anim > *:nth-child(4) { animation-delay: .18s; }
@keyframes fl-rise { from { transform: translateY(18px); } }
.fl-ingredients { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fl-ing { padding: 10px 12px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .14); border: 2px solid currentColor; min-width: 0; }
.fl-ing b { display: block; font: 700 11px/14px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.fl-ing span { font: 600 14px/19px var(--font-body); }

/* Reel feed (phone prototype) */
.fl-phone { position: relative; width: 100%; max-width: 390px; height: 800px; margin: 0 auto; border-radius: 40px; border: 3px solid var(--ink); overflow: hidden; background: var(--ground); box-shadow: 0 8px 0 0 var(--ink); }
.fl-feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.fl-feed::-webkit-scrollbar { display: none; }
.fl-feed > .fl-reel { height: 100%; min-height: 0; }
.fl-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; background: linear-gradient(var(--scrim), rgba(0, 0, 0, 0)); }
.fl-top-row { display: flex; align-items: center; gap: 10px; }
.fl-brand { font: 800 13px/1 var(--font-display); color: var(--on-scrim); letter-spacing: .02em; white-space: nowrap; }
.fl-tabs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 8px 14px; background: var(--ground); border-top: 2px solid var(--ink); }
.fl-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--ink-muted); font: 700 11px/1 var(--font-body); padding: 6px 0; cursor: pointer; border-radius: 12px; }
.fl-tab .fl-ico { font-size: 22px; }
.fl-tab.is-on { color: var(--ink); }
.fl-tab.is-on .fl-ico { color: var(--volt-text); }
.fl-feed-nav { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 3; display: none; flex-direction: column; gap: 8px; }
.fl-feed-nav button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--scrim); color: var(--on-scrim); font-size: 18px; display: grid; place-items: center; cursor: pointer; }
.fl-feed-nav button:disabled { opacity: .3; }
@media (hover: hover) { .fl-feed-nav { display: flex; top: 34%; } }
.fl-burst { position: absolute; left: 50%; top: 42%; z-index: 4; transform: translateX(-50%); padding: 10px 18px; border-radius: var(--radius-pill); background: var(--lemon); color: var(--on-lemon); border: 2px solid var(--ink); font: 800 22px/1 var(--font-display); box-shadow: var(--shadow-pop); pointer-events: none; animation: fl-burst 1.1s ease forwards; }
@keyframes fl-burst { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.6) rotate(-6deg); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.08) rotate(-3deg); } 70% { opacity: 1; transform: translate(-50%, -14px) scale(1) rotate(-3deg); } 100% { opacity: 0; transform: translate(-50%, -48px) scale(.9) rotate(-3deg); } }
.fl-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 16px 16px 24px; border-radius: 28px 28px 0 0; background: var(--surface); color: var(--ink); border-top: 2px solid var(--ink); display: flex; flex-direction: column; gap: 14px; animation: fl-up .35s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes fl-up { from { transform: translateY(100%); } }
.fl-sheet-grab { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.fl-wtabs { display: flex; gap: 6px; }
.fl-wtab { flex: 1; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--ink); background: var(--surface-raised); font: 700 12px/1 var(--font-body); color: var(--ink); text-align: center; }
.fl-wtab.is-on { background: var(--cobalt); color: var(--on-cobalt); }
.fl-mail { padding: 12px; border-radius: 12px; background: var(--surface-raised); font: 500 13px/19px var(--font-body); display: flex; flex-direction: column; gap: 6px; }
.fl-mail-meta { font: 700 11px/14px var(--font-mono); color: var(--ink-muted); letter-spacing: .04em; }
.fl-caret { display: inline-block; width: 2px; height: 15px; background: var(--ink); vertical-align: -2px; animation: fl-blink 1s steps(1) infinite; }
@keyframes fl-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .fl-story-seg.is-active .fl-story-fill { width: 100%; }
}
