/* Habit lesson. All rules scoped under .hab-* */
.hab-sc { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hab-hero img { width: 300px; max-width: 100%; max-height: 34vh; object-fit: contain; display: block; filter: drop-shadow(0 18px 30px rgba(123,92,253,.35)); }
.hab-note { font-size: 13px; color: var(--dim); text-align: center; }

/* ---------- the game ---------- */
.hab-game { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hab-rule { display: flex; gap: 8px; width: 100%; }
.hab-rule span { flex: 1; padding: 8px 10px; border-radius: 10px; background: var(--raised); font-size: 13px; font-weight: 700; text-align: center; line-height: 1.25; }
.hab-rule .hab-ok { box-shadow: inset 0 0 0 2px var(--mint); }
.hab-rule .hab-no { box-shadow: inset 0 0 0 2px rgba(216,85,85,.7); }
.hab-pit { width: 100%; height: 150px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; transition: background .15s, box-shadow .15s; }
.hab-pit.hab-hit { box-shadow: inset 0 0 0 3px var(--mint); }
.hab-pit.hab-bad { box-shadow: inset 0 0 0 3px var(--red); background: #2a1520; }
.hab-cue { width: 96px; height: 96px; opacity: 0; transform: scale(.6); }
.hab-cue.in { opacity: 1; transform: none; transition: transform .08s ease-out, opacity .05s; }
.hab-cue.gone { opacity: .25; transform: scale(.85); }
.hab-cue svg { width: 100%; height: 100%; display: block; }
.hab-star path { fill: var(--gold); stroke: #fff4d6; stroke-width: 3; stroke-linejoin: round; }
.hab-ring circle { fill: none; stroke: var(--violet-bright); stroke-width: 12; }
.hab-coins { font-size: 14px; font-weight: 700; color: var(--dim); }
.hab-coins b { font: 600 20px var(--mono); color: var(--gold); margin-left: 4px; }
.btn.hab-pad { min-height: 72px; font-size: 20px; letter-spacing: .06em; }

/* ---------- cue to action ---------- */
.hab-link { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 12px 0; }
.hab-node { width: 104px; height: 104px; border-radius: 20px; background: var(--raised); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.hab-node svg { width: 52px; height: 52px; }
.hab-node b { font-size: 22px; color: var(--gold); }
.hab-node span { font-size: 13px; font-weight: 700; color: var(--dim); }
.hab-arrow { display: block; width: 36px; height: 4px; background: var(--gold); position: relative; border-radius: 2px; flex: none; }
.hab-arrow::after { content: ""; position: absolute; right: -2px; top: -6px; border: 8px solid transparent; border-left: 10px solid var(--gold); border-right: 0; }

.hab-race { width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 8px 4px; }
.hab-lane { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.hab-lane b { font-size: 14px; grid-row: span 2; }
.hab-lane div { height: 16px; border-radius: 8px; background: var(--surface); overflow: hidden; }
.hab-lane i { display: block; height: 100%; width: 0; border-radius: 8px; transition: width .9s cubic-bezier(.3,.7,.3,1); }
.hab-bar1 { background: var(--gold); }
.hab-bar2 { background: var(--mint); transition-delay: .25s !important; }
.hab-lane span { font-size: 13px; color: var(--dim); opacity: 0; transition: opacity .3s .9s; }
.hab-race.on .hab-bar1 { width: 38%; }
.hab-race.on .hab-bar2 { width: 72%; }
.hab-race.on .hab-lane span { opacity: 1; }
.hab-tick { display: flex; justify-content: space-between; padding-left: 106px; font-size: 12px; color: var(--faint); }

/* ---------- popcorn ---------- */
.hab-pop { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hab-pop img { width: 100%; max-width: 330px; max-height: 30vh; object-fit: contain; }
.hab-pop.small img { max-height: 90px; }
.hab-poplab { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 330px; text-align: center; font-size: 14px; font-weight: 700; }
.hab-poplab span:last-child { color: #c9c3b6; }
.hab-who { font-size: 14px; font-weight: 700; text-align: center; }
.hab-bars { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.hab-brow { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; font-size: 14px; font-weight: 700; }
.hab-brow div { height: 22px; border-radius: 8px; background: var(--surface); overflow: hidden; }
.hab-brow i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 8px; transition: width .8s cubic-bezier(.3,.7,.3,1); }
.hab-brow.hab-stale i { background: #9c968a; }
.hab-room { width: 100%; padding: 22px 12px; border-radius: 16px; background: linear-gradient(180deg, #232b44, #1a2136); display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.hab-room b { font-size: 17px; }
.hab-room span { font-size: 13px; color: var(--dim); }

/* ---------- step back ---------- */
.hab-loop { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0; }
.hab-cell { flex: 1; min-width: 0; padding: 14px 6px; border-radius: 14px; background: var(--raised); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.hab-cell b { font-size: 16px; }
.hab-cell span { font-size: 12px; color: var(--dim); line-height: 1.25; }
.hab-c1 { box-shadow: inset 0 0 0 2px var(--gold); }
.hab-c3 { opacity: .45; }
.hab-loop .hab-arrow { width: 18px; }

/* ---------- how long ---------- */
.hab-claim { margin: 14px auto 0; padding: 14px 20px; border-radius: 14px; background: var(--raised); display: flex; flex-direction: column; align-items: center; gap: 2px; animation: habPop .3s cubic-bezier(.34,1.56,.64,1) both; }
.hab-claim b { font: 600 26px var(--mono); color: var(--gold); }
.hab-claim span { font-size: 13px; color: var(--dim); }
@keyframes habPop { from { transform: scale(.6); opacity: 0; } }
.hab-curve { width: 100%; max-width: 360px; display: block; }
.hab-ax { stroke: var(--line-strong); stroke-width: 1.5; }
.hab-tx { fill: var(--dim); font: 600 12px var(--sans); }
.hab-mark21 { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 4; }
.hab-t21 { fill: var(--faint); }
.hab-line { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.hab-dot { fill: var(--gold); }
.hab-miss { fill: none; stroke: var(--red); stroke-width: 2.5; }
.hab-tm { fill: #ff9a9a; }
.hab-missg.on .hab-miss { stroke: var(--mint); }
.hab-missg.on .hab-tm { fill: var(--mint); }

/* ---------- puzzles ---------- */
.hab-plans { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.hab-plan { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; line-height: 1.3; transition: box-shadow .3s; }
.hab-plan b { font: 600 15px var(--mono); color: var(--gold); flex: none; width: 18px; }
.hab-plan.on { box-shadow: inset 0 0 0 2.5px var(--mint); }

@media (max-height: 700px) {
  .hab-pit { height: 120px; }
  .hab-cue { width: 80px; height: 80px; }
  .hab-hero img { max-height: 28vh; }
  .hab-curve { max-width: 320px; }
  .hab-pop.small img { max-height: 64px; }
  .btn.hab-pad { min-height: 60px; }
}
