/* Sovi Learn sheet (web) — mirrors the Sovi Learn H5 design: white cards, purple progress,
   pill options #f4f5f9, black pill CTAs, flip study cards, ring + dot results. */
html.sl-locked, html.sl-locked body { overflow: hidden; }
.sl-root { position: fixed; inset: 0; z-index: 1100; --sl-brand: #8c55f2; --sl-ink: #1d1b26; --sl-muted: #8a8796; --sl-line: #ececf2;
  --sl-bg: #ffffff; --sl-soft: #f4f5f9; --sl-panel: #fbfbfd; --sl-good: #3fbf9b; --sl-bad: #f2777a; font-family: Inter, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.sl-backdrop { position: absolute; inset: 0; background: rgba(20,16,32,.38); opacity: 0; transition: opacity .25s ease; }
.sl-root.is-open .sl-backdrop { opacity: 1; }
.sl-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column; outline: none;
  background: var(--sl-panel); color: var(--sl-ink); box-shadow: -12px 0 40px rgba(30,20,60,.18); transform: translateX(100%);
  transition: transform .32s cubic-bezier(.22,.9,.3,1), width .3s ease; }
.sl-root.is-open .sl-panel { transform: none; }
.sl-root.is-wide .sl-panel { width: min(920px, 100vw); }
.sl-root.is-lab-view .sl-head { padding: 8px 14px; border-bottom: 1px solid var(--sl-line); }
.sl-root.is-lab-view .sl-body { display: flex; flex-direction: column; overflow: hidden; padding: 10px 14px 8px; }
.sl-root.is-lab-view .sl-foot { padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sl-line); }
.sl-root.is-lab-view .sl-cta { padding: 11px 16px; font-size: 14.5px; }
.sl-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.sl-head-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sl-soft); color: var(--sl-brand); text-decoration: none; font-size: 14px; font-weight: 700; }
.sl-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; padding: 12px 14px; background: var(--sl-bg); }
.sl-title { margin: 0; text-align: center; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-icon { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--sl-soft); color: var(--sl-ink); cursor: pointer; display: grid; place-items: center; font-size: 14px; }
.sl-icon svg { width: 18px; height: 18px; }
.sl-progress { display: flex; align-items: center; gap: 12px; padding: 8px 20px 4px; background: var(--sl-bg); }
.sl-bar { flex: 1; height: 8px; border-radius: 99px; background: #e4e4ea; overflow: hidden; }
.sl-bar i { display: block; height: 100%; border-radius: 99px; background: var(--sl-brand); transition: width .35s ease; }
.sl-progress span { font-size: 14px; color: var(--sl-ink); } .sl-progress b { color: var(--sl-brand); }
.sl-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 20px; }
.sl-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--sl-panel); }
.sl-cta { width: 100%; border: 0; border-radius: 999px; padding: 15px 18px; background: #000; color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.18); transition: transform .12s ease; }
.sl-cta:active { transform: scale(.98); }
.sl-pill { border: 0; border-radius: 999px; padding: 10px 20px; background: #000; color: #fff; font-weight: 700; cursor: pointer; margin-top: 12px; }
.sl-card { background: var(--sl-bg); border-radius: 26px; padding: 22px 20px; box-shadow: 0 4px 22px rgba(40,30,90,.07); position: relative; }
.sl-center { text-align: center; } .sl-center h3 { margin: 10px 0 4px; font-size: 21px; }
.sl-muted { color: var(--sl-muted); font-size: 13px; margin: 4px 0; }
.sl-accent { color: var(--sl-brand); }
.sl-busy { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 0; color: var(--sl-muted); font-size: 13.5px; }
.sl-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #e6dcff; border-top-color: var(--sl-brand); animation: sl-spin .8s linear infinite; }
@keyframes sl-spin { to { transform: rotate(360deg); } }
.sl-empty { text-align: center; padding: 40px 16px; color: var(--sl-muted); }
button:focus-visible, .sl-flip:focus-visible { outline: 2px solid var(--sl-brand); outline-offset: 2px; }

/* overview */
.sl-hero { text-align: center; padding: 6px 0 14px; }
.sl-hero h3 { margin: 14px 0 2px; font-size: 20px; } .sl-hero p { margin: 0; color: var(--sl-muted); font-size: 13px; }
.sl-fan { position: relative; height: 206px; margin-bottom: 6px; display: flex; justify-content: center; }
.sl-fan-card { position: absolute; top: 6px; width: 112px; transform: translateX(calc(var(--i) * 74px)) rotate(calc(var(--i) * 8deg)); transform-origin: 50% 120%;
  animation: sl-fan-in .55s cubic-bezier(.2,1.2,.4,1) both; animation-delay: calc((var(--i) + 1) * 70ms); }
@keyframes sl-fan-in { from { opacity: 0; transform: translateY(30px) rotate(0); } }
.sl-steps { display: flex; flex-direction: column; gap: 10px; }
.sl-step { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%; border: 1px solid var(--sl-line);
  border-radius: 18px; background: var(--sl-bg); padding: 13px 14px; cursor: pointer; color: inherit; transition: border-color .2s ease, transform .15s ease; }
.sl-step:hover { border-color: #cdb6fb; transform: translateY(-1px); }
.sl-step-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #f1eafe; color: var(--sl-brand); }
.sl-step-finished .sl-step-n { background: var(--sl-brand); color: #fff; }
.sl-step-t b { display: block; font-size: 14.5px; } .sl-step-t small { color: var(--sl-muted); font-size: 12px; }
.sl-step-s { font-size: 11.5px; color: var(--sl-muted); background: var(--sl-soft); border-radius: 99px; padding: 3px 9px; }
.sl-step-doing .sl-step-s { color: #b4791d; background: #fff4df; } .sl-step-finished .sl-step-s { color: #2c9a7b; background: #e3f7f0; }

/* study flip card */
.sl-flip { position: relative; perspective: 1400px; cursor: pointer; max-width: 330px; margin: 0 auto; }
.sl-flip-inner { position: relative; width: 100%; transition: transform .6s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; aspect-ratio: 630 / 1080; }
.sl-flip.is-flipped .sl-flip-inner { transform: rotateY(180deg); }
.sl-flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; overflow: hidden; }
.sl-front { transform: rotateY(0deg) translateZ(1px); -webkit-transform: rotateY(0deg) translateZ(1px); z-index: 2; }
.sl-flip-face .sc-card { height: 100%; border-radius: 14px; }
.sl-backface { transform: rotateY(180deg) translateZ(1px); -webkit-transform: rotateY(180deg) translateZ(1px); z-index: 1; border: 8px solid #cfd2e6; box-sizing: border-box;
  background: radial-gradient(120% 80% at 20% 30%, #e7defd 0%, #f3f0fd 45%, #eef3fe 100%); }
.sl-flip:not(.is-flipped) .sl-backface { pointer-events: none; visibility: hidden; transition: visibility 0s linear .3s; }
.sl-flip.is-flipped .sl-front { pointer-events: none; visibility: hidden; transition: visibility 0s linear .3s; }
.sl-flip.is-flipped .sl-backface { visibility: visible; z-index: 2; transition: visibility 0s linear 0s; }
.sl-back { height: 100%; overflow-y: auto; padding: 22px 18px; box-sizing: border-box; color: #4a3f6b; }
.sl-back-name { font: 700 19px/1.3 "Playfair Display", Georgia, serif; color: #1d1b26; margin-bottom: 10px; }
.sl-back-sec { margin: 12px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--sl-brand); text-transform: uppercase; }
.sl-back-text { font-size: 14.5px; line-height: 1.55; } .sl-back ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.55; }
.sl-back-img { width: 100%; border-radius: 10px; margin-top: 12px; }
.sl-flip-hint { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: -2px; padding: 9px; border-radius: 0 0 14px 14px;
  background: var(--sl-brand); color: #fff; font-style: italic; font-weight: 700; font-size: 14px; position: relative; z-index: 2; }
.sl-flip-hint img { width: 16px; height: 16px; filter: brightness(10); }
.sl-judge { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sl-judge button { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 15px; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(40,30,90,.08); }
.sl-judge img { width: 18px; height: 18px; }
.sl-judge-bad { background: #fff6f5; color: var(--sl-bad); } .sl-judge-good { background: #eefcf7; color: var(--sl-good); }
.sl-bars { margin: 18px 0 6px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.sl-bars > div { display: grid; grid-template-columns: 92px 1fr 22px; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.sl-meter { height: 8px; border-radius: 99px; background: #eeeef3; overflow: hidden; } .sl-meter i { display: block; height: 100%; border-radius: 99px; }
.sl-good i { background: var(--sl-good); } .sl-bad i { background: var(--sl-bad); }
.sl-good + b { color: var(--sl-good); } .sl-bad + b { color: var(--sl-bad); }
.sl-check { width: 56px; height: 56px; }

/* practice */
.sl-q { min-height: 320px; }
.sl-q-text { font-size: 18px; line-height: 1.5; font-weight: 600; margin-bottom: 18px; }
.sl-q-text p { margin: 0 0 6px; }
.sl-opts { display: flex; flex-direction: column; gap: 12px; }
.sl-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 2px solid transparent; border-radius: 999px; padding: 15px 20px;
  background: var(--sl-soft); color: inherit; font-size: 15.5px; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .12s ease; }
.sl-opt:not(:disabled):hover { background: #ece8f9; }
.sl-opt:not(:disabled):active { transform: scale(.985); }
.sl-opt-k { color: var(--sl-muted); font-size: 13px; min-width: 18px; }
.sl-opt img { width: 20px; height: 20px; margin-left: auto; }
.sl-opt.is-picked { border-color: #cdb6fb; }
.sl-opt.is-right { background: #e9fbf4; border-color: #7fdcbf; } .sl-opt.is-wrong { background: #fff1f1; border-color: #f6a5a7; }
.sl-opt.is-dim { opacity: .55; }
.sl-opt.is-right { animation: sl-pop .4s cubic-bezier(.2,1.5,.4,1); } .sl-opt.is-wrong { animation: sl-shake .35s ease; }
@keyframes sl-pop { 50% { transform: scale(1.03); } } @keyframes sl-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.sl-feedback { margin-top: 16px; border-radius: 18px; padding: 14px 16px; font-size: 14px; line-height: 1.55; animation: sl-rise .3s ease; }
@keyframes sl-rise { from { opacity: 0; transform: translateY(6px); } }
.sl-feedback b { display: block; font-size: 15px; margin-bottom: 2px; }
.sl-feedback.is-right { background: #eefcf7; } .sl-feedback.is-right b { color: #2c9a7b; }
.sl-feedback.is-wrong { background: #fff6f5; } .sl-feedback.is-wrong b { color: #d9534f; }
.sl-rationale { margin-top: 6px; color: #4a4659; } .sl-rationale p { margin: 0; }
.sl-q-skeleton i { display: block; height: 52px; border-radius: 999px; background: var(--sl-soft); margin-top: 12px; animation: sl-pulse 1.2s ease-in-out infinite; }
@keyframes sl-pulse { 50% { opacity: .5; } }
.sl-nav { display: grid; grid-template-columns: 56px 1fr 56px; gap: 16px; align-items: center; }
.sl-round { width: 56px; height: 56px; border: 0; border-radius: 50%; background: #000; color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.sl-round svg { width: 22px; height: 22px; } .sl-round:disabled { opacity: .25; cursor: default; }
.sl-cta-mid { padding: 15px 10px; }

/* results */
.sl-ring { width: 112px; height: 112px; transform: rotate(-90deg); display: block; margin: 4px auto 0; }
.sl-ring circle { fill: none; stroke: #ececf2; stroke-width: 9; } .sl-ring .sl-ring-v { stroke: var(--sl-brand); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.sl-ring-label { margin-top: -74px; height: 74px; font-size: 22px; font-weight: 700; color: var(--sl-brand); }
.sl-dots { display: grid; grid-template-columns: repeat(5, 44px); gap: 12px; justify-content: center; margin: 14px 0 6px; }
.sl-dot { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f1f1f4; color: var(--sl-ink); font-weight: 600; font-size: 15px; cursor: pointer; }
.sl-dot.is-right { background: #ddf8ee; color: #2c9a7b; } .sl-dot.is-wrong { background: #fde6e6; color: #d9534f; }
.sl-challenge { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--sl-line); text-align: center; }
.sl-challenge b { display: block; font-size: 14px; } .sl-challenge small { color: var(--sl-muted); font-size: 12px; }
.sl-challenge-cover { position: relative; margin-top: 10px; aspect-ratio: 16 / 9; border-radius: 14px; background: #ddd center / cover no-repeat; }
.sl-try { position: absolute; right: 12px; bottom: 12px; border: 0; border-radius: 999px; padding: 8px 16px; background: #000; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.sl-done h3 { font-size: 20px; } .sl-hero-img { width: 200px; max-width: 70%; margin: 6px auto 4px; display: block; animation: sl-float 3s ease-in-out infinite; }
@keyframes sl-float { 50% { transform: translateY(-6px); } }
.sl-levels { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; flex-wrap: wrap; }
.sl-level { width: 92px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sl-level-card { width: 100%; }
.sl-next { margin-top: 18px; text-align: left; } .sl-next-t { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sl-brand); margin-bottom: 8px; }
.sl-next-btn { display: flex; width: 100%; margin-bottom: 8px; }

/* application lab */
.sl-lab { position: relative; flex: 1 1 auto; min-height: 0; height: calc(100dvh - 140px); border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 4px 22px rgba(40,30,90,.08); }
.sl-lab iframe { width: 100%; height: 100%; border: 0; display: block; }
.sl-lab-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; }
.sl-lab-out { display: inline-flex; align-items: center; gap: 4px; align-self: flex-end; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--sl-brand); text-decoration: none; flex-shrink: 0; }

/* home */
.sl-sec { margin-bottom: 22px; } .sl-sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.sl-sec-h b { font-size: 16px; } .sl-sec-h small { color: var(--sl-muted); font-size: 12px; }
.sl-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.sl-col-card { border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s ease; }
.sl-col-card:hover { transform: translateY(-3px); }
.sl-plan-row { display: grid; grid-template-columns: 1fr 70px; gap: 12px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--sl-line); border-radius: 16px;
  background: var(--sl-bg); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; color: inherit; }
.sl-plan-t b { display: block; font-size: 14px; } .sl-plan-t small { color: var(--sl-muted); font-size: 12px; }
.sl-plan-bar { height: 6px; border-radius: 99px; background: #eeeef3; overflow: hidden; } .sl-plan-bar i { display: block; height: 100%; background: var(--sl-brand); }

@media (max-width: 640px) { .sl-panel, .sl-root.is-wide .sl-panel { width: 100vw; } .sl-lab { height: calc(100dvh - 148px); } }

html.night .sl-root { --sl-ink: #ece9f5; --sl-muted: #a29fb0; --sl-line: #34313d; --sl-bg: #24222b; --sl-soft: #302d38; --sl-panel: #1b1a20; }
html.night .sl-cta, html.night .sl-round, html.night .sl-pill, html.night .sl-try { background: #fff; color: #000; }
html.night .sl-opt.is-right, html.night .sl-feedback.is-right, html.night .sl-judge-good { background: #173a31; }
html.night .sl-opt.is-wrong, html.night .sl-feedback.is-wrong, html.night .sl-judge-bad { background: #3d2224; }
html.night .sl-rationale { color: #cfcbe0; } html.night .sl-step-n { background: #3a2f55; }
html.night .sl-dot { background: #302d38; } html.night .sl-dot.is-right { background: #173a31; } html.night .sl-dot.is-wrong { background: #3d2224; }
html.night .sl-bar, html.night .sl-meter, html.night .sl-plan-bar { background: #3a3744; }

@media (prefers-reduced-motion: reduce) {
  .sl-panel, .sl-flip-inner, .sl-fan-card, .sl-opt, .sl-feedback, .sl-hero-img { transition: none !important; animation: none !important; }
}

/* The visible viewport and flex layout own the height; headers/footers size to their content. */
.sl-panel { max-width: 100%; min-height: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.sl-head, .sl-progress, .sl-foot { flex: none; }
.sl-lab, .sl-root.is-lab-view .sl-lab { height: auto; flex: 1 1 0; min-height: 0; }
.sl-root.is-lab-view .sl-body { min-height: 0; }
.sl-root.is-lab-view .sl-foot:empty { display: none; }
.sl-root button, .sl-root a { min-height: 44px; }
.sl-head { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.sl-icon, .sl-head-link { width: 44px; height: 44px; }
.living-textbook-stage.is-playing { min-height: 0 !important; }
/* If even essential controls cannot fit (keyboard/landscape), the measured frame can scroll. */
.sl-root.is-lab-view .sl-body { overflow-y: auto; }
.sl-root.is-lab-view .sl-lab { flex-shrink: 0; }
.sl-progress[hidden], .sl-foot[hidden] { display: none; }
html.sovi-app-shell .sl-panel { padding: 0; }
html.sovi-app-shell .sl-foot, html.sovi-app-shell .sl-root.is-lab-view .sl-foot { padding-bottom: 10px; }

/* My learning: the real page used by both the app and browser. */
.sl-root[data-view="home"] .sl-body { max-width:1120px; width:100%; box-sizing:border-box; margin-inline:auto; padding:20px 20px 36px; }
.sl-learning-summary { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:24px; }
.sl-learning-summary button { display:flex; flex-direction:column; gap:6px; padding:18px; border:1px solid var(--sl-line); border-radius:18px; background:var(--sl-bg); color:var(--sl-ink); text-decoration:none; }
.sl-learning-summary strong { font-size:28px; line-height:1.15; font-weight:650; color:var(--sl-brand); }
.sl-learning-summary span { font-size:13px; color:var(--sl-muted); }
.sl-root[data-view="home"] .sl-sec { padding:20px; border:1px solid var(--sl-line); border-radius:20px; background:var(--sl-bg); margin:20px 0; }
.sl-root[data-view="home"] .sl-sec-h { flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.sl-root[data-view="home"] .sl-col { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.sl-root[data-view="home"] .sl-col-card { min-width:0; width:100%; align-self:start; }
.sl-root[data-view="home"] .sl-plan-row { grid-template-columns:minmax(0,1fr) 64px; min-height:72px; background:var(--sl-soft); border:0; margin-top:10px; }
.sl-root[data-view="home"] .sl-plan-t { min-width:0; }
.sl-root[data-view="home"] .sl-plan-t b { overflow-wrap:anywhere; }
.sl-root[data-view="home"] .sf-home-host { padding:20px; border:1px solid var(--sl-line); border-radius:20px; background:var(--sl-bg); }
.sl-root[data-view="home"] .sf-cta-inline { border-radius:14px; box-shadow:none; }
.sl-root[data-view="home"] .sf-strip { margin-inline:0; padding-inline:0; }
@media(min-width:700px) {
 .sl-root[data-view="home"] .sl-body { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:20px; align-content:start; }
 .sl-learning-summary { grid-column:1/-1; margin-bottom:0; }
 .sl-root[data-view="home"] .sf-home-host { grid-row:span 2; }
 .sl-root[data-view="home"] .sl-sec { margin:0; }
 .sl-root[data-view="home"] .sl-col { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(prefers-reduced-motion:reduce) { .sl-col-card:hover { transform:none; } }
.sl-home-ask { display:inline-flex; align-items:center; gap:10px; min-height:44px; margin-top:12px; padding:10px 14px; border:0; border-radius:12px; color:var(--sl-brand); background:var(--sl-soft); font-weight:600; }
.sl-home-ask svg { width:18px; height:18px; }
@media(min-width:700px) {
 .sl-root[data-view="home"] .sf-home-host { grid-column:1/-1; grid-row:auto; }
 .sl-root[data-view="home"] .sl-learning-cards { grid-row:2; }
 .sl-root[data-view="home"] .sl-learning-plans { grid-row:2; }
}

.sl-learning-summary button { text-align:left; cursor:pointer; }
.sl-card-name { font-family:inherit; font-size:14px; line-height:1.4; font-weight:600; color:var(--sl-ink); text-align:left; align-self:stretch; overflow-wrap:anywhere; }
