/* ============================================================
   Winny Math Learn — practice platform styles
   Loads AFTER /css/styles.css and reuses its :root tokens,
   header, footer, .container and .btn classes.
   ============================================================ */

.learn-main { padding: 26px 0 60px; }

/* ---------- shared bits ---------- */
.learn-crumbs { font-size: .85rem; color: var(--muted); margin: 6px 0 14px; }
.learn-crumbs a { color: var(--muted); }
.learn-crumbs a:hover { color: var(--green-600); }

.learn-kicker { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head);
  font-weight: 700; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--green-600); }
.learn-kicker::before { content: ""; width: 22px; height: 2px; background: var(--grad); border-radius: 2px; }

/* ---------- landing hero ---------- */
.learn-hero { position: relative; text-align: center; padding: 54px 0 34px; overflow: hidden; }
.learn-hero h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.08; margin: 14px 0 14px; }
.learn-hero h1 .accent { color: var(--green-600); }
.learn-hero .lede { max-width: 62ch; margin: 0 auto 22px; color: var(--slate); font-size: 1.12rem; }
.learn-hero .lede b { color: var(--ink); }
.learn-stats { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin: 20px 0 4px; }
.learn-stat { text-align: center; }
.learn-stat .num { display: block; font-family: var(--font-head); font-weight: 800; font-size: 1.7rem; color: var(--green-600); }
.learn-stat .lab { font-size: .84rem; color: var(--muted); }

/* ---------- grade grid ---------- */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 26px 0 8px; }
.grade-card { position: relative; display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px 16px 16px; text-align: center; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.grade-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--green); }
.grade-card .g-num { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 10px;
  border-radius: 16px; background: var(--grad-soft); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; }
.grade-card.hs .g-num { font-size: .95rem; letter-spacing: .02em; }
.grade-card h3 { font-size: 1.02rem; margin: 0 0 3px; }
.grade-card .g-skills { font-size: .8rem; color: var(--muted); }
.grade-card .g-progress { margin-top: 10px; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.grade-card .g-progress i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 3px; transition: width .4s ease; }

/* ---------- feature trio + comparison ---------- */
.learn-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 34px 0; }
.learn-feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.learn-feature .ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: var(--green-50); color: var(--green-600); font-size: 1.3rem; margin-bottom: 12px; }
.learn-feature h3 { font-size: 1.08rem; margin: 0 0 6px; }
.learn-feature p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- course/grade page ---------- */
.course-head { padding: 40px 0 8px; }
.course-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 12px 0 8px; }
.course-head .lede { color: var(--slate); max-width: 68ch; }
.course-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.course-chip { font-size: .8rem; font-weight: 600; color: var(--green-600); background: var(--green-50);
  border: 1px solid rgba(22,160,23,.18); border-radius: 999px; padding: 4px 12px; }

.strand-block { margin: 30px 0 4px; }
.strand-block > h2 { font-size: 1.28rem; margin: 0 0 4px; }
.strand-block > .strand-sub { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.skill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.skill-card { position: relative; display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 14px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.skill-card:hover { transform: translateY(-2px); border-color: var(--green); box-shadow: var(--shadow); }
.skill-ring { flex: 0 0 auto; width: 46px; height: 46px; }
.skill-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.skill-ring .ring-bg { fill: none; stroke: var(--line-soft); stroke-width: 4; }
.skill-ring .ring-val { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.skill-ring .ring-num { font: 700 11px var(--font-head, sans-serif); fill: var(--ink); transform: rotate(90deg); transform-origin: center; text-anchor: middle; dominant-baseline: central; }
.skill-card.mastered .ring-val { stroke: var(--amber); }
.skill-card h3 { font-size: .99rem; line-height: 1.3; margin: 1px 0 3px; }
.skill-card p { font-size: .84rem; color: var(--muted); margin: 0; }
.skill-card .badges { position: absolute; top: 10px; right: 12px; display: flex; gap: 5px; font-size: .82rem; }

/* ---------- practice page layout ---------- */
.practice-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; margin-top: 8px; }
@media (max-width: 900px) {
  .practice-wrap { grid-template-columns: 1fr; }
  /* phone: question first, sidebar below it, and sticky OFF so cards never overlap */
  .practice-side { order: 2; position: static; }
}

.qcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.qcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 22px; border-bottom: 1px solid var(--line-soft); }
.qcard-head .skill-name { font-family: var(--font-head); font-weight: 700; font-size: .98rem; }
.diff-dots { display: inline-flex; gap: 4px; align-items: center; }
.diff-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.diff-dots i.on { background: var(--green); }
.diff-dots .diff-label { font-size: .75rem; color: var(--muted); margin-left: 6px; }

.qbody { padding: 30px 26px 26px; }
.qprompt { font-size: 1.14rem; color: var(--ink); margin: 0 0 14px; max-width: 62ch; }
.qmath { font-family: var(--font-mono, "Space Mono", monospace); font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  color: var(--ink); margin: 8px 0 4px; line-height: 1.5; overflow-x: auto; padding-bottom: 4px; }
.qmath .frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin: 0 2px; line-height: 1.05; font-size: .82em; }
.qmath .frac > .fr-top { border-bottom: 2px solid currentColor; padding: 0 4px 1px; }
.qmath .frac > .fr-bot { padding: 1px 4px 0; }
sup.exp { font-size: .62em; }

/* answer input */
.answer-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.answer-input { flex: 0 1 260px; font: 600 1.15rem var(--font-mono, monospace); color: var(--ink);
  padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px; outline: none; min-width: 140px;
  transition: border-color .15s ease, box-shadow .15s ease; }
.answer-input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(22,160,23,.12); }
.answer-unit { font-size: 1rem; color: var(--muted); font-weight: 600; }

/* multiple choice */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 22px; }
.mc-btn { position: relative; font: 600 1.05rem var(--font-mono, monospace); color: var(--ink); text-align: left;
  background: var(--bg-soft); border: 2px solid var(--line); border-radius: 12px; padding: 14px 14px 14px 44px;
  min-height: 48px; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .12s ease; }
@media (hover: hover) { .mc-btn:hover { border-color: var(--green); transform: translateY(-1px); } }
.mc-btn:active { transform: scale(.985); }
.mc-btn .key { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px;
  display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.mc-btn.selected { border-color: var(--green-600); background: var(--green-50); }
.mc-btn.correct { border-color: var(--green-600); background: var(--green-50); }
.mc-btn.wrong { border-color: #e11d48; background: #fef2f2; }

/* action row */
.action-row { display: flex; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.action-row button, .answer-row button { touch-action: manipulation; min-height: 44px; }
.btn-submit { min-width: 130px; }
.btn-ghost { background: none; border: 2px solid var(--line); color: var(--slate); border-radius: 12px;
  padding: 10px 18px; font: 600 .95rem var(--font-head, sans-serif); cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.btn-ghost:hover { border-color: var(--green); color: var(--green-600); }
.kbd-hint { margin-left: auto; font-size: .78rem; color: var(--muted); }
.kbd-hint kbd { font-family: var(--font-mono, monospace); background: var(--bg-soft); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: .74rem; }

/* hint + feedback */
.hint-box { display: none; margin-top: 18px; border-left: 4px solid var(--amber); background: #fffbeb;
  border-radius: 0 12px 12px 0; padding: 12px 16px; color: var(--ink); font-size: .97rem; }
.hint-box.show { display: block; }

.feedback { display: none; margin-top: 22px; border-radius: 14px; padding: 16px 18px; font-size: 1rem; }
.feedback.show { display: block; }
.feedback.good { background: var(--green-50); border: 1px solid rgba(22,160,23,.25); color: var(--green-700); }
.feedback.bad { background: #fef2f2; border: 1px solid #fecdd3; color: #9f1239; }
.feedback .fb-title { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; display: flex; gap: 8px; align-items: center; }
.feedback .fb-answer { margin-top: 4px; }
.feedback .fb-answer b { font-family: var(--font-mono, monospace); }

/* worked solution */
.solution { display: none; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.solution.show { display: block; }
.solution-head { display: flex; align-items: center; gap: 8px; background: var(--bg-soft); padding: 10px 16px;
  font-family: var(--font-head); font-weight: 700; font-size: .92rem; color: var(--ink); }
.sol-step { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.sol-step .n { width: 26px; height: 26px; display: grid; place-items: center; background: var(--green-50);
  color: var(--green-700); font: 700 .8rem var(--font-head, sans-serif); border-radius: 50%; }
.sol-step .m { font-family: var(--font-mono, monospace); font-size: 1.06rem; color: var(--ink); overflow-x: auto; }
.sol-step .w { grid-column: 2; color: var(--muted); font-size: .9rem; }

/* video solution */
.video-slot { margin-top: 16px; }
.video-slot video { width: 100%; border-radius: 14px; background: #000; }
.video-cap { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ---------- practice sidebar ---------- */
.practice-side { display: grid; gap: 16px; position: sticky; top: 86px; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.side-card h3 { font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; font-weight: 700; }

.score-ring-wrap { display: grid; place-items: center; position: relative; }
.score-ring-wrap svg { width: 168px; height: 168px; }
.score-ring-bg { fill: none; stroke: var(--line-soft); stroke-width: 11; }
.score-ring-val { fill: none; stroke: url(#scoreGrad); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset .5s cubic-bezier(.22,1,.36,1); }
.score-tick { stroke: #fff; stroke-width: 3; }
.score-center { position: absolute; text-align: center; }
.score-center .val { font: 800 2.3rem var(--font-head, sans-serif); color: var(--ink); line-height: 1; }
.score-center .of { font-size: .78rem; color: var(--muted); }
.score-delta { position: absolute; top: 8px; right: 4px; font: 700 .95rem var(--font-head, sans-serif); color: var(--green-600);
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
.score-delta.pop { opacity: 1; transform: translateY(0); }
.score-delta.neg { color: #e11d48; }
.score-medal { text-align: center; margin-top: 8px; font-size: .86rem; color: var(--muted); }
.score-medal b { color: var(--ink); }
.checkpoint-note { text-align: center; font-size: .76rem; color: var(--muted); margin-top: 6px; }
.checkpoint-note b { color: var(--green-600); }

.session-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; gap: 8px; }
.session-stats .num { display: block; font: 800 1.3rem var(--font-head, sans-serif); color: var(--ink); }
.session-stats .lab { font-size: .72rem; color: var(--muted); }
.streak-flame { color: #f97316; font-weight: 800; }

.side-cta { background: var(--grad-vivid); color: #fff; border: none; }
.side-cta h4 { color: #fff; font-size: 1.05rem; margin: 0 0 6px; }
.side-cta p { color: rgba(255,255,255,.92); font-size: .88rem; margin: 0 0 12px; }
.side-cta .btn-white { background: #fff; color: var(--green-600); box-shadow: 0 8px 20px rgba(0,0,0,.15); }

.report-link { font-size: .78rem; color: var(--muted); text-align: center; }
.report-link a { color: var(--muted); text-decoration: underline; }
.report-link a:hover { color: var(--green-600); }

/* ---------- grade-aware type scale (little kids get big friendly text) ---------- */
body[data-grade="1"] .qprompt, body[data-grade="2"] .qprompt, body[data-grade="3"] .qprompt { font-size: 1.45rem; line-height: 1.5; }
body[data-grade="1"] .qmath, body[data-grade="2"] .qmath, body[data-grade="3"] .qmath { font-size: clamp(1.8rem, 4.5vw, 2.5rem); }
body[data-grade="1"] .mc-btn, body[data-grade="2"] .mc-btn, body[data-grade="3"] .mc-btn { font-size: 1.35rem; padding: 18px 16px 18px 48px; }
body[data-grade="1"] .answer-input, body[data-grade="2"] .answer-input, body[data-grade="3"] .answer-input { font-size: 1.5rem; }
body[data-grade="1"] .sol-step .m, body[data-grade="2"] .sol-step .m, body[data-grade="3"] .sol-step .m { font-size: 1.3rem; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .95;
  animation: confetti-fall 1.6s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0); }
  100% { transform: translateY(105vh) rotate(540deg); opacity: .7; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .grade-card, .skill-card, .mc-btn { transition: none; }
}

/* ---------- touch devices (iOS Safari & co.) ---------- */
@media (hover: none) {
  .kbd-hint { display: none; }               /* hardware-keyboard hints are noise on touch */
  .grade-card:hover, .skill-card:hover { transform: none; }
}
.sol-step .m, .vs-table-wrap { -webkit-overflow-scrolling: touch; }

/* correct-answer pulse on the card */
@keyframes goodpulse { 0% { box-shadow: 0 0 0 0 rgba(22,160,23,.35); } 100% { box-shadow: 0 0 0 22px rgba(22,160,23,0); } }
.qcard.good-pulse { animation: goodpulse .7s ease-out 1; }

/* mastered celebration */
.mastered-banner { display: none; margin: 0 0 18px; text-align: center; background: var(--grad-vivid); color: #fff;
  border-radius: var(--radius-lg); padding: 22px; }
.mastered-banner.show { display: block; }
.mastered-banner h2 { color: #fff; margin: 0 0 6px; }
.mastered-banner p { color: rgba(255,255,255,.93); margin: 0 0 12px; }

/* comparison table on landing */
.vs-table-wrap { overflow-x: auto; margin: 12px 0 30px; }
.vs-table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 560px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.vs-table th, .vs-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.vs-table thead th { font-family: var(--font-head); background: var(--bg-soft); }
.vs-table td.yes { color: var(--green-700); font-weight: 700; }
.vs-table td.no { color: var(--muted); }
