/* Subha Bihani admin — "सिक्नुहोस्" (Learn) mode: the Learn screen, the ways in, and the lesson
   overlay (spotlight, moving hand, caption panel). Uses the colours of styles.css.
   No inline styles (CSP): tour.js only writes CSS custom properties through the CSSOM:
   --sx --sy --sw --sh (spotlight box), --fx --fy (fingertip), --vvt --vvb (keyboard/visual viewport),
   --p (progress 0–1), --tour-move (how long the hand takes to move). */

/* ---------- way in: header button ---------- */
.learn-btn{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:46px;min-width:56px;padding:3px 9px;border:1px solid #e3c7cb;border-radius:14px;background:var(--accent-soft);color:var(--accent);font-size:.68rem;font-weight:700;line-height:1.15;text-decoration:none;white-space:nowrap}
.learn-btn .icon{width:20px;height:20px}
@media (min-width:420px){.learn-btn{flex-direction:row;gap:6px;min-height:44px;padding:0 12px 0 10px;border-radius:999px;font-size:.9rem}}
.learn-btn:active{background:#f0dcdc}
.learn-btn[aria-current="page"]{background:var(--accent);border-color:var(--accent);color:#fff}

/* ---------- way in: first-time card on the items screen ---------- */
.learn-card{position:relative;display:flex;gap:12px;margin:0 0 16px;padding:16px 48px 16px 14px;border:1px solid #e3c7cb;border-radius:var(--r-lg);background:linear-gradient(135deg,#fff 0%,var(--accent-soft) 100%);box-shadow:var(--sh)}
.learn-card__icon{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;border-radius:12px;background:var(--accent);color:#fff}
.learn-card__body{flex:1;min-width:0}
.learn-card__title{font:600 1.08rem/1.35 var(--serif);color:var(--ink)}
.learn-card__text{margin-top:4px;color:var(--ink-2);font-size:.9rem;line-height:1.45}
.learn-card__go{margin-top:12px;min-height:50px}
.learn-card__x{position:absolute;right:4px;top:4px;display:flex;align-items:center;justify-content:center;width:48px;height:48px;border:0;border-radius:50%;background:none;color:var(--ink-3);cursor:pointer}
.learn-card__x:active{background:var(--tint)}
body.tour-on .learn-card,body.tour-on .learn-btn{display:none}

/* ---------- the Learn screen ---------- */
.learn-head h1{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px}
.learn-head h1 small{font:500 .85rem/1.3 var(--sans);color:var(--ink-3)}
.learn-safe{display:flex;align-items:flex-start;gap:10px;margin:0 0 16px;padding:12px 14px;border-radius:var(--r);background:var(--warn-soft);color:var(--warn);font-size:.92rem;font-weight:600;line-height:1.45}
.learn-safe .icon{margin-top:1px}
.learn-list{display:grid;gap:12px;margin:0;padding:0;list-style:none}
.learn-item{padding:16px 14px 14px;border:1px solid var(--line);border-radius:var(--r-lg);background:#fff;box-shadow:var(--sh)}
.learn-item__top{display:flex;gap:12px;align-items:flex-start}
.learn-item__num{display:flex;align-items:center;justify-content:center;flex:none;width:40px;height:40px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font:700 1.1rem/1 var(--serif)}
.learn-item__body{flex:1;min-width:0}
.learn-item__title{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px;font:600 1.12rem/1.35 var(--serif)}
.learn-item__title small{font:500 .78rem/1.4 var(--sans);color:var(--ink-3)}
.learn-item__about{margin-top:4px;color:var(--ink-2);font-size:.9rem;line-height:1.45}
.learn-item__btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.learn-item__btns .btn{padding:0 10px;font-size:.95rem;gap:8px}
.learn-video{display:flex;align-items:center;gap:12px;margin-top:18px;min-height:72px;padding:12px 14px;border:1px dashed var(--line-2);border-radius:var(--r-lg);background:var(--tint);color:var(--ink);text-decoration:none}
.learn-video:active{background:var(--tint-2)}
.learn-video__icon{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;border-radius:12px;background:#fff;color:var(--accent)}
.learn-video__body{flex:1;min-width:0}
.learn-video__title{display:block;font-weight:700;color:var(--accent)}
.learn-video__sub{display:block;font-size:.8rem;color:var(--ink-3);line-height:1.35}
.learn-video > .icon{color:var(--ink-3)}

/* ---------- practice status ---------- */
.status--practice{background:#e8eefb;color:#1e3a8a}

/* ---------- the lesson overlay ---------- */
.tour{position:fixed;inset:0;z-index:80;pointer-events:none;--sx:50vw;--sy:50vh;--sw:0px;--sh:0px;--fx:50vw;--fy:110vh;--vvt:0px;--vvb:0px;--p:0;--tour-move:750ms}

/* dim everything except a rounded window around the target */
.tour-spot{position:fixed;left:0;top:0;z-index:1;width:var(--sw);height:var(--sh);border-radius:14px;transform:translate(var(--sx),var(--sy));box-shadow:0 0 0 3px #fff,0 0 0 9px rgba(233,196,106,.55),0 0 0 200vmax rgba(24,16,12,.6);transition:transform .4s cubic-bezier(.4,.1,.2,1),width .4s cubic-bezier(.4,.1,.2,1),height .4s cubic-bezier(.4,.1,.2,1)}
.tour-spot::after{content:"";position:absolute;inset:-3px;border-radius:16px;border:3px solid #e9c46a;animation:tourGlow 1.6s ease-in-out infinite}
.tour--nospot .tour-spot{box-shadow:0 0 0 200vmax rgba(24,16,12,.6)}
.tour--nospot .tour-spot::after{display:none}
@keyframes tourGlow{0%,100%{opacity:.15;transform:scale(1)}50%{opacity:1;transform:scale(1.03)}}

/* taps outside the target go nowhere (watching: nothing gets through at all) */
.tour-block{position:fixed;z-index:2;pointer-events:auto;touch-action:none;background:transparent}
.tour-block--all{inset:0}
.tour-block--top{left:0;right:0;top:0;height:max(0px,var(--sy))}
.tour-block--bottom{left:0;right:0;bottom:0;top:calc(var(--sy) + var(--sh))}
.tour-block--left{left:0;top:var(--sy);height:var(--sh);width:max(0px,var(--sx))}
.tour-block--right{right:0;top:var(--sy);height:var(--sh);left:calc(var(--sx) + var(--sw))}
.tour--do .tour-block--all{display:none}
.tour--nospot .tour-block--all,.tour--busy .tour-block--all{display:block}

/* the hand: fingertip at (--fx, --fy) */
.tour-finger{position:fixed;left:0;top:0;z-index:3;width:56px;height:56px;opacity:0;transform:translate(calc(var(--fx) - 21px),calc(var(--fy) - 2px));transition:transform var(--tour-move) cubic-bezier(.45,.05,.25,1),opacity .3s ease;filter:drop-shadow(0 6px 8px rgba(0,0,0,.4))}
.tour-finger--on{opacity:1}
.tour-finger--drag{transition:opacity .3s ease}
.tour-finger svg{display:block;width:56px;height:56px;transform-origin:21px 2px}
.tour-hand__fill{fill:#fffaf2;stroke:#3b2a20;stroke-width:2.2;stroke-linejoin:round}
.tour-hand__line{fill:none;stroke:#3b2a20;stroke-width:1.6;stroke-linecap:round;opacity:.55}
.tour-finger__dot{position:absolute;left:21px;top:2px;width:0;height:0}
.tour-finger__dot::before{content:"";position:absolute;left:-20px;top:-20px;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.55);border:3px solid #fff;box-shadow:0 0 0 2px rgba(122,31,43,.5);opacity:0;transform:scale(.3)}
.tour-finger--tap svg{animation:tourPress .38s ease}
.tour-finger--tap .tour-finger__dot::before{animation:tourRipple .6s ease-out}
.tour-finger--hint svg{animation:tourNudge 1.4s ease-in-out infinite}
.tour-finger--hint .tour-finger__dot::before{animation:tourRipple 1.4s ease-out infinite}
@keyframes tourPress{40%{transform:scale(.86) translateY(3px)}}
@keyframes tourRipple{0%{opacity:.95;transform:scale(.3)}100%{opacity:0;transform:scale(1.6)}}
@keyframes tourNudge{0%,100%{transform:translate(4px,8px)}50%{transform:translate(0,0)}}

/* the caption + controls panel: at the bottom, or at the top while typing (above the keyboard) */
.tour-panel{position:fixed;left:8px;right:8px;z-index:4;max-width:560px;margin:0 auto;padding:12px 12px 12px;border-radius:20px;background:#fff;color:var(--ink);box-shadow:0 18px 50px -10px rgba(0,0,0,.55),0 0 0 1px rgba(0,0,0,.06);pointer-events:auto;overflow:hidden}
.tour-panel--bottom{bottom:calc(var(--vvb) + 8px + var(--safe-b))}
.tour-panel--top{top:calc(var(--vvt) + 8px)}
.tour-panel--shake{animation:tourShake .4s ease}
@keyframes tourShake{20%{transform:translateX(-8px)}40%{transform:translateX(7px)}60%{transform:translateX(-5px)}80%{transform:translateX(3px)}}
.tour-progress{position:absolute;left:0;right:0;top:0;height:4px;background:var(--tint-2)}
.tour-progress__fill{display:block;height:100%;background:var(--accent);transform-origin:0 50%;transform:scaleX(var(--p));transition:transform .4s ease}
.tour-panel__top{display:flex;align-items:center;gap:8px;margin:2px 0 6px;min-height:40px}
.tour-badge{flex:none;padding:2px 10px;border-radius:999px;background:#e8eefb;color:#1e3a8a;font:700 .74rem/1.6 var(--sans);letter-spacing:.02em}
.tour-panel__flow{flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--ink-2);font-size:.84rem;font-weight:600}
.tour-panel__count{flex:none;color:var(--ink-3);font:600 .84rem/1 var(--sans);font-variant-numeric:tabular-nums}
.tour-x{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;margin:-4px -6px -4px 0;border:0;border-radius:50%;background:var(--tint);color:var(--ink-2);cursor:pointer}
.tour-x:active{background:var(--tint-2)}
.tour-caprow{display:flex;gap:12px;align-items:flex-start}
.tour-cap{flex:1;min-width:0}
.tour-preview{flex:none;width:64px;height:80px;border-radius:10px;border:2px solid #fff;box-shadow:0 0 0 1px var(--line-2),var(--sh);background:var(--tint-2)}
.tour-cap__main{font:600 1.1rem/1.5 var(--serif);color:var(--ink)}
.tour-cap__sub{margin-top:3px;font-size:.84rem;line-height:1.4;color:var(--ink-3)}
.tour-cap--in{animation:tourIn .35s ease}
@keyframes tourIn{from{opacity:0;transform:translateY(6px)}}
.tour-hint{display:flex;align-items:center;gap:8px;margin-top:10px;padding:8px 12px;border-radius:12px;background:var(--accent-soft);color:var(--accent);font-weight:700;font-size:.92rem;line-height:1.35}
.tour-hint--good{background:var(--ok-soft);color:var(--ok)}
.tour-ctrls{display:grid;grid-template-columns:52px 52px minmax(0,1fr) minmax(0,1.35fr);gap:6px;margin-top:12px}
.tour-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:52px;padding:0 10px;border:1px solid var(--line-2);border-radius:14px;background:#fff;color:var(--ink);font:700 .92rem/1.2 var(--sans);text-align:center;cursor:pointer;touch-action:manipulation}
.tour-btn:active{background:var(--tint)}
.tour-btn[disabled]{opacity:.4;cursor:default}
.tour-btn .icon{width:22px;height:22px}
.tour-btn--icon{padding:0}
.tour-btn--next{background:var(--accent);border-color:var(--accent);color:#fff}
.tour-btn--next:active{background:var(--accent-dk)}
.tour-btn--next .icon{width:18px;height:18px;margin-right:-4px}
.tour--do .tour-btn--next{font-size:.84rem;line-height:1.15;padding:0 6px}
.tour--do .tour-btn--next .icon{display:none}
.tour-btn--mine{color:var(--accent);border-color:#d9b3b8;font-size:.86rem;line-height:1.15}
.tour-btn--mine[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.tour-btn--primary{background:var(--accent);border-color:var(--accent);color:#fff}
.tour-btn--wide{width:100%;justify-content:center}
.tour-end__head{display:flex;gap:12px;align-items:flex-start;margin:4px 0 12px}
.tour-end__tick{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;border-radius:50%;background:var(--ok-soft);color:var(--ok)}
.tour-end__tick .icon{width:26px;height:26px;stroke-width:2.6}
.tour-end__title{font:600 1.3rem/1.3 var(--serif)}
.tour-end__text{margin-top:2px;color:var(--ink-2);font-size:.92rem;line-height:1.45}
.tour-end__text--bad{margin:6px 0 12px;color:var(--bad);font-weight:600}
.tour-end__btns{display:grid;gap:8px}

/* the field the hand is "typing" into looks focused (without opening the phone's keyboard) */
.tour-typing{border-color:var(--accent)!important;box-shadow:0 0 0 3px rgba(122,31,43,.18)!important}

@media (prefers-reduced-motion:reduce){
  .tour-finger{display:none}
  .tour-spot,.tour-progress__fill{transition:none}
  .tour-spot::after{animation:none;opacity:1}
}
