/* ---------- the new lesson screens (learn.js and the lp-*.js files): tokens of pop.css only, they flip for dark ---------- */

/* the stars of a part over the title of the end screen: the middle one bigger and higher, those got lit in turn */
.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 6px 0 0; height: 76px; }
.win-stars i { display: block; width: 52px; height: 52px; animation: lp-star .45s cubic-bezier(.3, 1.7, .5, 1) backwards; }
.win-stars i:nth-child(2) { width: 70px; height: 70px; margin-bottom: 14px; animation-delay: .12s; }
.win-stars i:nth-child(3) { animation-delay: .24s; }
.win-stars svg { display: block; width: 100%; height: 100%; fill: var(--fill, #EFECE4); stroke: var(--line, #E7E2D6); stroke-width: 1.4; stroke-linejoin: round; }
/* a gold of their own, the same in light and dark */
.win-stars i.on svg { fill: #FFC53D; stroke: #E0961A; filter: drop-shadow(0 2px 0 #C9820F); }
@keyframes lp-star { from { opacity: 0; transform: scale(.3) rotate(-25deg); } }
@media (prefers-reduced-motion: reduce) { .win-stars i { animation: none; } }

/* "+ Lưu" / "Đã lưu": a small pill wherever a word can go into the book */
.sv { flex: none; min-width: 78px; min-height: 36px; padding: 6px 14px; border: 2px solid var(--acc-btn, #14884F); border-radius: 999px;
  background: transparent; color: var(--acc-ink, #0E7A43); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: transform var(--t-press, 90ms), background-color var(--t-press, 90ms); -webkit-tap-highlight-color: transparent; }
.sv:active { transform: scale(.95); }
.sv.on { background: var(--acc-btn, #14884F); color: #fff; }

/* the "Lưu từ nào?" screen: a title, the words on one white card, Xong at the foot */
.svl { padding-top: 8px; }
.svl-title { margin: 6px 4px 14px; font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; color: var(--ink, #1B201C); }
.svl-card { background: var(--card, #fff); border-radius: var(--r-card, 24px); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); padding: 4px 16px; }
.svl-list { display: grid; }
.svl-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 0; border-top: 1px solid var(--line, #E7E2D6); }
.svl-row:first-child { border-top: 0; }
.svl-row .lp-say { width: 36px; height: 36px; }
/* "Từ sai" on the end screen of a game: a short card, scrolls past 8 lines */
.svm { margin: 14px 0 0; padding: 10px 16px 4px; text-align: left; background: var(--card, #fff); border-radius: var(--r-card, 24px); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); }
.svm-title { margin: 0 0 2px; font-size: 15px; font-weight: 800; color: var(--ink2, #4F5751); }
.svm .svl-list { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.svm .svl-row { padding: 9px 0; }
.svl-w { flex: 1; min-width: 0; }
.svl-w b { display: block; font-family: var(--kr-sans, inherit); font-size: 18px; line-height: 1.35; font-weight: 700; color: var(--ink, #1B201C); overflow-wrap: anywhere; }
.svl-w small { display: block; margin-top: 2px; font-size: 14px; line-height: 1.4; color: var(--ink2, #4F5751); overflow-wrap: anywhere; }

/* a part played round by round (lpRounds) */
.lpr { padding-top: 8px; }

@media (min-width: 1000px) {
  .svl-title { font-size: 34px; margin-bottom: 20px; }
  .svl-card { padding: 8px 28px; }
  .svl-w b { font-size: 20px; }
  .win-stars { height: 86px; }
  .win-stars i { width: 58px; height: 58px; }
  .win-stars i:nth-child(2) { width: 78px; height: 78px; margin-bottom: 16px; }
}

/* listening and reading paragraph by paragraph (lp-listen.js): a card to hear or read, the questions one by one under
   it, then Nếp's word and the lines with their meaning. Answered, Nếp's word comes first and, in listening, the
   answers before the lines */
.lps { display: flex; flex-direction: column; gap: 14px; }
.lps-card { min-width: 0; background: var(--card, #fff); border-radius: var(--r-card, 24px); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); padding: 18px; }
.lps-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.lps-pill { padding: 5px 12px; border-radius: 999px; background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); font-size: 14px; font-weight: 800; white-space: nowrap; }
.lps-meta { color: var(--ink2, #4F5751); font-size: 14px; font-weight: 700; }
.lps-note { margin: 10px 0 0; color: var(--ink2, #4F5751); font-size: 14px; line-height: 1.5; }
.lps-top .lp-say { width: 36px; height: 36px; }

.lps-media { text-align: center; }
.lps-media .lps-note { text-align: left; }
.lps-play { display: grid; place-items: center; width: 88px; height: 88px; margin: 22px auto 16px; padding: 0; border: 0; border-radius: 50%;
  background: var(--acc-btn, #14884F); color: #fff; box-shadow: 0 0 0 12px var(--acc-soft, #E2F3E8), var(--sh-btn, none); cursor: pointer;
  transition: transform var(--t-press, 90ms); -webkit-tap-highlight-color: transparent; }
.lps-play:active { transform: scale(.95); }
.lps-play svg { width: 40px; height: 40px; }
.lps-media.playing .lps-play { animation: lps-pulse 1.4s ease-in-out infinite; }
@keyframes lps-pulse { 50% { box-shadow: 0 0 0 18px var(--acc-soft, #E2F3E8), var(--sh-btn, none); } }
.lps-wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 44px; }
.lps-wave i { flex: none; width: 4px; border-radius: 2px; background: var(--line, #E7E2D6); transition: background-color .3s; }
.lps-wave i.on { background: var(--acc-btn, #14884F); }
.lps-media.playing .lps-wave i:not(.on) { animation: lps-bar 1s ease-in-out infinite alternate; }
.lps-media.playing .lps-wave i:nth-child(3n) { animation-delay: -.3s; }
.lps-media.playing .lps-wave i:nth-child(3n+1) { animation-delay: -.6s; }
@keyframes lps-bar { to { transform: scaleY(.55); } }
/* the hidden words, as grey lines */
.lps-ghost { display: grid; gap: 10px; margin-top: 18px; }
.lps-ghost i { display: block; height: 12px; border-radius: 6px; background: var(--fill, #EFECE4); }
.lps-ghost i:nth-child(1) { width: 92%; }
.lps-ghost i:nth-child(2) { width: 64%; }
.lps-ghost i:nth-child(3) { width: 78%; }

.lps-text { margin-top: 12px; font-family: var(--kr-sans, inherit); font-size: 18px; line-height: 1.75; color: var(--ink, #1B201C); overflow-wrap: anywhere; }
.lps-vi { margin: 10px 0 0; line-height: 1.55; }

/* a question */
.lps-qn { display: block; margin-bottom: 4px; color: var(--ink2, #4F5751); font-size: 13px; font-weight: 700; }
.lps-ask { margin: 0 0 14px; font-size: 18px; font-weight: 800; line-height: 1.4; color: var(--ink, #1B201C); white-space: pre-line; overflow-wrap: anywhere; }
.lps-opts { display: grid; gap: 10px; }
.lps-opts.pics { grid-template-columns: 1fr 1fr; }
.lps-opt { min-height: 52px; padding: 12px 16px; border: 2px solid var(--line, #E7E2D6); border-radius: var(--r-sm, 14px); background: var(--card, #fff); color: var(--ink, #1B201C);
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.35; text-align: left; overflow-wrap: anywhere; cursor: pointer;
  transition: transform var(--t-press, 90ms), border-color .15s, background-color .15s; -webkit-tap-highlight-color: transparent; }
.lps-opt.ko { font-family: var(--kr-sans, inherit); font-size: 18px; }
.lps-opt.pic { display: grid; place-items: center; padding: 8px; }
.lps-opt.pic img { display: block; width: 100%; max-width: 120px; aspect-ratio: 1; object-fit: contain; }
.lps-opt:active:not(:disabled) { transform: scale(.98); }
.lps-opt:disabled { cursor: default; }
.lps-opt.ok, .lps-in.ok { border-color: var(--acc-btn, #14884F); background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); }
.lps-opt.no, .lps-in.no { border-color: var(--red-btn, #CC3D2C); background: var(--red-soft, #FCE9E4); color: var(--red-ink, #B8321F); }
.lps-type { display: flex; gap: 10px; }
.lps-in { flex: 1; min-width: 0; min-height: 52px; padding: 10px 14px; border: 2px solid var(--line, #E7E2D6); border-radius: var(--r-sm, 14px); background: var(--card, #fff);
  color: var(--ink, #1B201C); font: inherit; font-family: var(--kr-sans, inherit); font-size: 18px; }
.lps-type .btn { flex: none; }

/* a question answered: one line, green and ticked, or red with the answer */
.lps-done { padding: 10px 16px 12px; border: 2px solid var(--acc-btn, #14884F); border-radius: 18px; background: var(--acc-soft, #E2F3E8); }
.lps-done.no { border-color: var(--red-btn, #CC3D2C); background: var(--red-soft, #FCE9E4); }
.lps-done small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink2, #4F5751); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.lps-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--acc-ink, #0E7A43); overflow-wrap: anywhere; }
.lps-done.no .lps-pick { color: var(--red-ink, #B8321F); }
.lps-pick i { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--acc-btn, #14884F); color: #fff; }
.lps-pick i svg { width: 16px; height: 16px; }
.lps-said { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.lps-said .lp-say { width: 34px; height: 34px; }
.lps-said b { min-width: 0; font-family: var(--kr-sans, inherit); font-size: 17px; font-weight: 600; line-height: 1.5; color: var(--ink, #1B201C); overflow-wrap: anywhere; }

/* Nếp's word when a round is answered */
.lps-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lps-nep { flex: none; width: 64px; height: 64px; }
.lps-nep canvas, .lps-nep img { display: block; width: 100%; height: 100%; }
.lps-bub { min-width: 0; padding: 10px 16px; border-radius: 18px; background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent);
  font-size: 17px; font-weight: 800; color: var(--ink, #1B201C); }
.lps-gr { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--honey-soft, #FCEFD2); color: var(--honey-ink, #8A5A00); font-size: 16px; font-weight: 800; }
.lps-gr svg { width: 20px; height: 20px; }
.lps.end .lps-head { order: -2; }
.lps.end[data-kind="talk"] .lps-qs { order: -1; }
.lps-qs { display: grid; gap: 12px; min-width: 0; }
.lps-qs:empty { display: none; }

/* the lines of a bit of dialogue, shown once it is answered */
.lps-script .lps-top .btn { flex: none; }
.lps-talk { display: grid; gap: 10px; margin-top: 12px; }
.lps-talk .lp-bub { max-width: 94%; padding: 8px 12px 10px 52px; }
.lps-talk .lp-bub .lp-say { left: 8px; top: 10px; width: 36px; height: 36px; }
.lps-talk .lp-bub b { line-height: 1.45; overflow-wrap: anywhere; }
.lps-talk .lp-bub small { margin-top: 2px; line-height: 1.4; }
/* a third speaker on the left again, in a tint of its own */
.lps-talk .lp-bub.w3, html.pop .lps-talk .lp-bub.w3 { background: var(--fill, #EFECE4); }
/* a new paragraph of a text to read */
.lps-gap { display: block; height: 12px; }
.lps .lp-rep { margin: 0; }

@media (prefers-reduced-motion: reduce) { .lps-media.playing .lps-play, .lps-media.playing .lps-wave i { animation: none; } }
@media (min-width: 1000px) {
  .lps-card { padding: 24px 28px; }
  .lps-ask { font-size: 20px; }
  .lps-text { font-size: 20px; }
}

/* speaking as a role play (lp-speak.js): a speaker picked on cards, then a chat where Nếp reads on the left and the
   learner's lines come on the right, the mic in the dock at the foot; the words Azure did not like in orange */
.lpk { --lpk-bad: #D9480F; --lpk-bad-line: #F59F00; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
html[data-theme="dark"] .lpk { --lpk-bad: #FFA94D; --lpk-bad-line: #FFC078; }
.lpk-h { margin: 6px 4px 0; font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; color: var(--ink, #1B201C); }
.lpk-h3 { margin: 6px 4px -4px; font-size: 18px; font-weight: 800; color: var(--ink, #1B201C); }
.lpk-sub { margin: -6px 4px 0; color: var(--ink2, #4F5751); font-size: 15px; line-height: 1.5; }
.lpk-card { min-width: 0; background: var(--card, #fff); border-radius: var(--r-card, 24px); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); padding: 6px 16px; }
.lpk-card .lp-line b, .lpk-card .lp-rec b { overflow-wrap: anywhere; }
.lpk .lp-task { overflow-wrap: anywhere; }

/* the roles */
.lpk-roles { display: grid; gap: 10px; }
.lpk-role { position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 76px; padding: 10px 16px; border: 2px solid var(--line, #E7E2D6); border-radius: 20px;
  background: var(--card, #fff); color: var(--ink, #1B201C); font: inherit; text-align: left; cursor: pointer; transition: transform var(--t-press, 90ms), border-color .15s; -webkit-tap-highlight-color: transparent; }
.lpk-role:active { transform: scale(.98); }
.lpk-role.on { border-color: var(--acc-btn, #14884F); background: color-mix(in srgb, var(--acc-soft, #E2F3E8) 55%, var(--card, #fff)); }
.lpk-rt { flex: 1; min-width: 0; }
.lpk-rt b { display: block; font-size: 18px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.lpk-rt b span { font-family: var(--kr-sans, inherit); }
.lpk-rt small { display: block; margin-top: 2px; color: var(--ink2, #4F5751); font-size: 14px; }
.lpk-role em { position: absolute; top: -11px; right: 14px; max-width: 50%; padding: 2px 10px; border-radius: 999px; background: var(--acc-btn, #14884F); color: #fff;
  font-size: 13px; font-style: normal; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lpk-av { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--honey-soft, #FCEFD2); color: var(--honey-ink, #8A5A00);
  font-family: var(--kr-sans, inherit); font-size: 22px; font-weight: 800; }
.lpk-av.c1 { background: var(--sky-soft, #E3F0FA); color: var(--sky-d, #1F5F8B); }
.lpk-av.c2 { background: var(--purple-soft, #EFE7FA); color: var(--purple-d, #5B3D8F); }
.lpk-av.c3 { background: var(--red-soft, #FCE9E4); color: var(--red-ink, #B8321F); }
.lpk-av.nep { background: var(--card, #fff); box-shadow: 0 0 0 1px var(--line, #E7E2D6); overflow: hidden; }
.lpk-av.nep canvas, .lpk-av.nep img { display: block; width: 100%; height: 100%; }

/* the chat */
.lpk[data-k="play"] { padding-bottom: 130px; }
/* the combo: a pill in the bar by the title (outside .lpk, so its orange is its own) */
.lpk-combo { --lpk-bad: #D9480F; flex: none; display: none; align-items: center; gap: 4px; height: 32px; padding: 0 12px 0 8px; border-radius: 999px; background: var(--honey-soft, #FCEFD2); color: var(--lpk-bad);
  font-size: 15px; font-weight: 800; white-space: nowrap; }
html[data-theme="dark"] .lpk-combo { --lpk-bad: #FFA94D; }
.lpk-combo.on { display: inline-flex; animation: lp-star .4s cubic-bezier(.3, 1.7, .5, 1); }
.lpk-combo svg { width: 18px; height: 18px; }
.lpk-chat { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lpk-msg { display: flex; align-items: flex-start; gap: 10px; min-width: 0; transition: opacity .3s; }
.lpk-msg .lpk-av { width: 44px; height: 44px; font-size: 19px; }
.lpk-msg.me { justify-content: flex-end; }
.lpk-bub { position: relative; min-width: 0; max-width: calc(100% - 54px); padding: 10px 14px 12px; border-radius: 18px 18px 18px 6px; background: var(--acc-soft, #E2F3E8); color: var(--ink, #1B201C); }
.lpk-msg.me .lpk-bub { border-radius: 18px 18px 6px 18px; background: var(--honey-soft, #FCEFD2); }
.lpk-bub i { display: block; font-style: normal; font-size: 13px; font-weight: 700; color: var(--ink2, #4F5751); }
.lpk-msg.me .lpk-bub i { text-align: right; }
.lpk-bub b { display: block; margin-top: 2px; font-family: var(--kr-sans, inherit); font-size: 17px; font-weight: 600; line-height: 1.55; overflow-wrap: anywhere; }
.lpk-msg.me .lpk-bub b { font-size: 18px; color: var(--ink, #1B201C); }
.lpk-bub small { display: block; margin-top: 6px; color: var(--ink2, #4F5751); font-size: 14px; line-height: 1.45; }
.lpk-bub .lp-say { float: right; width: 32px; height: 32px; margin: 0 0 4px 8px; }
.lpk-said .lpk-bub b { font-family: inherit; font-size: 16px; font-weight: 800; }
/* lines gone by: dimmed, two lines high, no meaning */
.lpk-msg.old { opacity: .62; }
.lpk-msg.old .lpk-bub b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; }
.lpk-msg.old .lpk-bub small, .lpk-msg.old .lp-say { display: none; }
/* Nếp reading: three dots under the line */
.lpk-dots { display: none; gap: 4px; margin-top: 6px; }
.lpk-msg.reading .lpk-dots { display: flex; }
.lpk-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--acc-btn, #14884F); animation: lpk-dot 1s ease-in-out infinite; }
.lpk-dots i:nth-child(2) { animation-delay: .15s; }
.lpk-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes lpk-dot { 50% { opacity: .25; transform: translateY(-3px); } }
.lpk-turn { align-self: center; padding: 5px 14px; border-radius: 999px; background: var(--honey-soft, #FCEFD2); color: var(--honey-ink, #8A5A00); font-size: 14px; font-weight: 800; }
.lpk-swap { margin: 4px 2px 0; line-height: 2; }

/* a word Azure did not like */
.lpk-bad { color: var(--lpk-bad); text-decoration: underline wavy var(--lpk-bad-line); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.lpk-score { display: flex; align-items: center; gap: 14px; min-width: 0; margin-left: 54px; padding: 12px 16px; border-radius: 20px; background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); }
.lpk-ring { --c: var(--acc-btn, #14884F); flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--card, #fff) 76%, transparent 78%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--fill, #EFECE4) 0); }
.lpk-ring.ok { --c: #E8A317; }
.lpk-ring.bad { --c: var(--lpk-bad); }
.lpk-ring b { font-size: 24px; font-weight: 800; color: var(--c); }
.lpk-sw { display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; font-family: var(--kr-sans, inherit); font-size: 17px; font-weight: 700; }
.lpk-sw small { font-family: var(--font, inherit); font-size: 15px; font-weight: 700; color: var(--acc-ink, #0E7A43); }
.lp-sc-w { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-family: var(--kr-sans, inherit); font-size: 15px; font-weight: 700; }
.lp-sc-w .lp-sc { margin-top: 0; }

/* the dock: the sample, the mic, the way on */
.lpk-dock:empty { display: none; }
.lpk-dock { flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 8px; padding-top: 18px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.lpk-dk { display: grid; grid-template-columns: 56px auto 56px; align-items: center; justify-items: center; gap: 28px; }
.lpk-dk.solo { display: flex; justify-content: center; }
.lpk-dk.solo .lpk-gap { display: none; }
.lpk-dk.two { display: flex; width: 100%; max-width: 520px; gap: 10px; }
.lpk-dk.two .btn { flex: 1; max-width: none; }
.lpk-dk.two .btn:first-child { flex: 0 0 38%; }
.lpk-hear { display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--card, #fff); color: var(--acc-btn, #14884F);
  box-shadow: var(--sh-card, none), 0 0 0 1px var(--line, #E7E2D6); cursor: pointer; }
.lpk-hear svg { width: 24px; height: 24px; }
/* (html .lpk-dock .lpk-dk: over the dark theme's outlined mic of pop.css) */
html .lpk-dock .lpk-dk .lp-mic.lpk-mic { width: 76px; height: 76px; border: 0; background: var(--red-btn, #CC3D2C); color: #fff; box-shadow: 0 0 0 10px color-mix(in srgb, var(--red-btn, #CC3D2C) 16%, transparent); }
.lpk .lpk-mic svg { width: 34px; height: 34px; }
html .lpk-dock .lpk-dk .lp-mic.lpk-mic.on { animation: lpk-live 1.2s ease-in-out infinite; }
@keyframes lpk-live { 50% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--red-btn, #CC3D2C) 22%, transparent); } }
.lpk-st { margin: 0; min-height: 20px; color: var(--ink2, #4F5751); font-size: 14px; font-weight: 700; text-align: center; }
.lpk-st.live { color: var(--red-ink, #B8321F); }
.lpk-st:empty { display: none; }
.lpk-dock > .btn { flex: none; width: 100%; max-width: 320px; }

@media (prefers-reduced-motion: reduce) { .lpk-dots i, html .lpk-dock .lpk-dk .lp-mic.lpk-mic.on, .lpk-combo.on { animation: none; } }
@media (min-width: 1000px) {
  .lpk-h { font-size: 34px; }
  .lpk-card { padding: 8px 28px; }
  .lpk-bub { max-width: 78%; }
  .lpk-bub b { font-size: 19px; }
  .lpk-msg.me .lpk-bub b { font-size: 20px; }
}

/* writing in a frame (lp-write.js): a box a line of the frame, a label over each, ticked when filled; then Nếp reading
   the lines one by one; then the stars, Nếp's word and the lines, a line with a fix in orange with its reason */
.lpw-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lpw-head .lpk-h { flex: 1; min-width: 0; }
.lpw-n { flex: none; margin-top: 6px; padding: 4px 12px; border-radius: 999px; background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); font-size: 15px; font-weight: 800; }
.lpw-boxes { display: grid; gap: 10px; }
.lpw-box { display: block; min-width: 0; padding: 10px 16px 8px; border: 2px solid var(--line, #E7E2D6); border-radius: 18px; background: var(--card, #fff); cursor: text;
  transition: border-color .15s, box-shadow .15s; }
.lpw-box.done { border-color: color-mix(in srgb, var(--acc-btn, #14884F) 45%, var(--line, #E7E2D6)); }
.lpw-box:focus-within { border-color: var(--acc-btn, #14884F); box-shadow: 0 0 0 4px var(--acc-soft, #E2F3E8); }
.lpw-lab { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; }
.lpw-lab b { font-family: var(--kr-sans, inherit); font-size: 15px; font-weight: 800; line-height: 1.35; color: var(--acc-ink, #0E7A43); overflow-wrap: anywhere; }
.lpw-lab small { color: var(--ink2, #4F5751); font-size: 14px; line-height: 1.35; }
.lpw-ok { display: grid; place-items: center; width: 16px; height: 16px; margin-left: -4px; color: var(--acc-btn, #14884F); }
.lpw-ok svg { width: 16px; height: 16px; }
.lpw-box:not(.done) .lpw-ok { display: none; }
.lpw-in { display: block; width: 100%; min-height: 34px; margin: 2px 0 0; padding: 4px 0; border: 0; outline: 0; background: transparent; color: var(--ink, #1B201C); resize: none; overflow: hidden;
  font: inherit; font-family: var(--kr-sans, inherit); font-size: 18px; line-height: 1.45; }
.lpw-in::placeholder { color: var(--ink3, #5C625C); opacity: .75; }
.lpw-why { margin: 0 4px; color: var(--red-ink, #B8321F); font-size: 15px; font-weight: 700; line-height: 1.45; }

/* Nếp reading */
.lpw-read { display: flex; flex-direction: column; align-items: center; padding-top: 12px; text-align: center; }
.lpw-nep { position: relative; width: 170px; height: 170px; }
.lpw-nep canvas, .lpw-nep img { display: block; width: 100%; height: 100%; }
.lpw-dots { position: absolute; top: 4px; right: -46px; display: flex; gap: 6px; padding: 10px 14px; border-radius: 999px; background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); }
.lpw-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--acc-btn, #14884F); animation: lpk-dot 1s ease-in-out infinite; }
.lpw-dots i:nth-child(2) { animation-delay: .15s; }
.lpw-dots i:nth-child(3) { animation-delay: .3s; }
.lpw-paper { width: 100%; max-width: 440px; margin-top: 6px; padding: 14px 16px; border-radius: 20px; background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent);
  text-align: left; transform: rotate(-1.2deg); }
.lpw-paper p { margin: 0; padding: 6px 8px; border-radius: 10px; font-family: var(--kr-sans, inherit); font-size: 15px; line-height: 1.5; color: var(--ink2, #4F5751); overflow-wrap: anywhere;
  animation: lpw-scan 4.2s ease-in-out infinite; animation-delay: calc(var(--d) * .7s); }
@keyframes lpw-scan { 0%, 22% { background: var(--acc-soft, #E2F3E8); color: var(--ink, #1B201C); } 32%, 100% { background: transparent; } }
.lpw-rh { margin: 24px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink, #1B201C); }
.lpw-rs { margin: 6px 0 0; color: var(--ink2, #4F5751); font-size: 16px; font-weight: 600; }

/* the stars and the lines */
.lpw-res { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lpw-top { display: flex; align-items: center; justify-content: center; gap: 14px; }
.lpw-top .win-stars { height: 62px; margin: 0; }
.lpw-top .lps-gr { margin-left: 0; }
.lpw-top .win-stars i { width: 42px; height: 42px; }
.lpw-top .win-stars i:nth-child(2) { width: 56px; height: 56px; margin-bottom: 10px; }
.lpw-card { min-width: 0; padding: 4px 16px; border-radius: var(--r-card, 24px); background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); }
.lpw-row { display: grid; grid-template-columns: minmax(84px, min(32%, 190px)) minmax(0, 1fr); align-items: baseline; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line, #E7E2D6); }
.lpw-row:first-child { border-top: 0; }
.lpw-row .lpw-ok { display: inline-grid; margin-left: 0; }
.lpw-row p { margin: 0; min-width: 0; font-family: var(--kr-sans, inherit); font-size: 17px; line-height: 1.55; color: var(--ink, #1B201C); overflow-wrap: anywhere; }
.lpw-row.fix { display: block; margin: 6px -8px; padding: 12px 14px; border: 0; border-radius: 18px; background: var(--honey-soft, #FCEFD2); }
.lpw-row.fix + .lpw-row { border-top: 0; }
.lpw-row.fix .lpw-lab b { color: var(--honey-ink, #8A5A00); }
.lpw-row.fix p { margin-top: 4px; }
.lpw-row.fix s { color: var(--red-ink, #B8321F); text-decoration-thickness: 2px; }
.lpw-row.fix p b { padding: 1px 6px; border-radius: 6px; background: var(--acc-btn, #14884F); color: #fff; font-weight: 700; }
.lpw-row.fix small { display: block; margin-top: 6px; color: var(--honey-ink, #8A5A00); font-size: 15px; font-weight: 700; line-height: 1.4; }
.lpw-sample { overflow-wrap: anywhere; }
.lpw .lp-rep { margin: 0; }

@media (prefers-reduced-motion: reduce) { .lpw-dots i, .lpw-paper p { animation: none; } }
@media (min-width: 1000px) {
  .lpw-nep { width: 200px; height: 200px; }
  .lpw-paper p { font-size: 16px; }
  .lpw-row p { font-size: 18px; }
}

/* the weak-word hunt (lp-hunt.js): the culture, then a start card, then the clock in an orange ring between the combo
   and the words caught, a big word on a white card and four answers; time up: Nếp, the words caught, grains and
   points, the words left over with "+ Lưu". The orange is its own, a little lighter in dark */
.hn { --hn-hot: #E8590C; --hn-hot-soft: #FFF0E6; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
html[data-theme="dark"] .hn { --hn-hot: #FF922B; --hn-hot-soft: color-mix(in srgb, #FF922B 16%, var(--card, #222)); }
.hn-cult p { line-height: 1.6; overflow-wrap: anywhere; }
.hn-topic { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink, #1B201C); }
.hn-score { flex: none; min-width: 52px; padding: 4px 14px; border-radius: 999px; background: var(--card, #fff); box-shadow: 0 0 0 2px var(--line, #E7E2D6);
  color: var(--ink, #1B201C); font-size: 20px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.hn-score.bump { animation: lp-star .35s cubic-bezier(.3, 1.7, .5, 1); }

.hn-start, .hn-end { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 8px; text-align: center; }
.hn-h { margin: 6px 0 0; font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; color: var(--ink, #1B201C); }
.hn-h em { font-style: normal; color: var(--acc-ink, #0E7A43); }
.hn-sub { margin: 0; color: var(--ink2, #4F5751); font-size: 16px; font-weight: 600; line-height: 1.45; }
.hn-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.hn-chip { padding: 6px 12px; border-radius: 12px; background: var(--hn-hot-soft); color: var(--hn-hot); font-family: var(--kr-sans, inherit); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.hn-chip.ok { background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); }
.hn-nep { position: relative; width: 150px; height: 150px; }
.hn-nep canvas, .hn-nep img { display: block; width: 100%; height: 100%; }
.hn-over { position: absolute; top: -6px; left: 50%; z-index: 1; transform: translate(-50%, -50%); padding: 6px 16px; border-radius: 999px; background: var(--card, #fff);
  box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); color: var(--ink2, #4F5751); font-size: 15px; font-weight: 800; white-space: nowrap; }
.hn-end .hn-nep { margin-top: 18px; }
.hn-end .win-stars { margin: 0; height: 60px; }
.hn-end .win-stars i { width: 40px; height: 40px; }
.hn-end .win-stars i:nth-child(2) { width: 54px; height: 54px; margin-bottom: 10px; }

/* the clock */
.hn-ring { --c: var(--hn-hot); flex: none; display: grid; place-content: center; justify-items: center; width: 112px; height: 112px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--card, #fff) 82%, transparent 84%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--fill, #EFECE4) 0); }
.hn-ring b { font-size: 40px; line-height: 1; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; }
.hn-ring small { margin-top: 2px; color: var(--ink2, #4F5751); font-size: 13px; font-weight: 700; }
.hn-ring.low { --c: var(--red-btn, #CC3D2C); }
.hn-ring.low b { animation: hn-beat 1s ease-in-out infinite; }
@keyframes hn-beat { 50% { transform: scale(1.12); } }

.hn-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.hn-combo { justify-self: start; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px; background: var(--hn-hot-soft);
  color: var(--hn-hot); font-size: 15px; font-weight: 800; white-space: nowrap; visibility: hidden; }
.hn-combo.on { visibility: visible; animation: lp-star .4s cubic-bezier(.3, 1.7, .5, 1); }
.hn-combo svg { width: 18px; height: 18px; }
.hn-got { justify-self: end; display: grid; justify-items: center; }
.hn-got b { font-size: 28px; line-height: 1.1; font-weight: 800; color: var(--ink, #1B201C); font-variant-numeric: tabular-nums; }
.hn-got small { color: var(--ink2, #4F5751); font-size: 13px; font-weight: 700; }

/* a question */
.hn-q { display: flex; flex-direction: column; gap: 12px; }
.hn-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 200px; padding: 22px 18px;
  border-radius: var(--r-card, 24px); background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 2px var(--acc-soft, #E2F3E8); text-align: center; }
.hn-pic { display: block; width: 104px; height: 104px; object-fit: contain; }
.hn-word { font-family: var(--kr-sans, inherit); font-size: 34px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; color: var(--ink, #1B201C); overflow-wrap: anywhere; }
.hn-miss { padding: 3px 10px; border-radius: 999px; background: var(--red-soft, #FCE9E4); color: var(--red-ink, #B8321F); font-size: 13px; font-weight: 800; }
.hn-lab { color: var(--ink2, #4F5751); font-size: 15px; font-weight: 700; }
.hn-hear { display: grid; place-items: center; width: 92px; height: 92px; padding: 0; border: 0; border-radius: 50%; background: var(--acc-btn, #14884F); color: #fff;
  box-shadow: 0 0 0 12px var(--acc-soft, #E2F3E8); cursor: pointer; transition: transform var(--t-press, 90ms); -webkit-tap-highlight-color: transparent; }
.hn-hear:active { transform: scale(.95); }
.hn-hear svg { width: 42px; height: 42px; }
.hn-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hn-opts.one { grid-template-columns: 1fr; }
.hn-opt { min-height: 64px; padding: 10px 12px; border: 2px solid var(--line, #E7E2D6); border-radius: 18px; background: var(--card, #fff); box-shadow: 0 3px 0 var(--line, #E7E2D6);
  color: var(--ink, #1B201C); font: inherit; font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; cursor: pointer;
  transition: transform var(--t-press, 90ms), border-color .15s, background-color .15s; -webkit-tap-highlight-color: transparent; }
.hn-opt.ko { font-family: var(--kr-sans, inherit); font-size: 18px; }
.hn-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line, #E7E2D6); }
.hn-opt:disabled { cursor: default; }
.hn-opt.ok { border-color: var(--acc-btn, #14884F); background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); box-shadow: 0 3px 0 var(--acc-btn, #14884F); }
.hn-opt.no { border-color: var(--red-btn, #CC3D2C); background: var(--red-soft, #FCE9E4); color: var(--red-ink, #B8321F); box-shadow: 0 3px 0 var(--red-btn, #CC3D2C); animation: hn-shake .3s; }
@keyframes hn-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* time up */
.hn-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hn-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px 8px 10px; border-radius: 999px; background: var(--card, #fff);
  box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); color: var(--ink, #1B201C); font-size: 18px; font-weight: 800; }
.hn-pill svg { width: 22px; height: 22px; }
.hn-pill.pt svg { color: var(--hn-hot); }
.hn-left { align-self: stretch; margin-top: 6px; padding: 14px 16px; border-radius: var(--r-card, 24px); background: var(--card, #fff); box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); text-align: left; }
.hn-left h4 { margin: 0; color: var(--ink2, #4F5751); font-size: 15px; font-weight: 800; }
.hn-left .svl-row:first-child { border-top: 0; }
.hn-left .hn-chips { justify-content: flex-start; }

@media (prefers-reduced-motion: reduce) { .hn-ring.low b, .hn-opt.no, .hn-combo.on, .hn-score.bump { animation: none; } }
@media (min-width: 1000px) {
  .hn-h { font-size: 32px; }
  .hn-card { min-height: 230px; }
  .hn-word { font-size: 42px; }
  .hn-opt { font-size: 17px; min-height: 70px; }
  .hn-left { padding: 18px 28px; }
}

/* ---------- rewards (Task 13) ---------- */
/* a combo of a lesson's game paying grains (game.js), on the badge */
.st-cgr { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; padding: 0 8px 0 4px; border-radius: 999px; background: #FFF4D6; color: #8A5A00; }
.st-cgr svg { width: 16px; height: 16px; }

/* a chest with a shop item (chest.js chestReveal): the card rises out of the chest, the buttons at the foot */
.cr { --cr-rare: #8B5CF6; --cr-rare-d: #6D3FD8; }
.cr.gift .cr-stage { margin-top: 120px; }
/* the screen waits on a choice: the map behind goes darker than for grains, so the card and its price read alone */
.cr.gift::before { background: radial-gradient(circle at 50% 46%, rgba(120, 70, 10, .62), rgba(22, 13, 3, .94) 66%); }
html[data-theme="dark"] .cr.gift::before { background: radial-gradient(circle at 50% 46%, rgba(110, 66, 8, .55), rgba(0, 0, 0, .94) 66%); }
.cr-gift { position: absolute; left: 50%; bottom: 50%; z-index: 3; width: 196px; margin-left: -98px; opacity: 0; transform: translateY(40%) scale(.3); transform-origin: 50% 100%; pointer-events: none; }
.cr.item .cr-gift { animation: cr-gift .7s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes cr-gift { 0% { opacity: 0; transform: translateY(40%) scale(.3); } 35% { opacity: 1; } 100% { opacity: 1; transform: none; } }
.cr-card { position: relative; padding: 24px 12px 14px; border: 4px solid var(--line, #E7E2D6); border-radius: 28px; background: var(--card, #fff); text-align: center;
  box-shadow: 0 22px 40px -14px rgba(0, 0, 0, .55); }
.cr-card.rare { border-color: var(--cr-rare); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cr-rare) 26%, transparent), 0 22px 40px -14px rgba(0, 0, 0, .55); }
.cr-tag { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); padding: 4px 16px; border-radius: 999px; background: var(--cr-rare-d); color: #fff;
  font-size: 15px; font-weight: 800; white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.cr-dress .nd { width: 150px; margin: 0 auto; }
.cr-name { display: block; margin-top: 6px; color: var(--ink, #1B201C); font-size: 20px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.cr-acts { position: absolute; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 3; display: grid; gap: 10px; max-width: 420px; margin: 0 auto;
  opacity: 0; transform: translateY(24px); pointer-events: none; transition: opacity .3s .3s, transform .45s .3s cubic-bezier(.3, 1.4, .5, 1); cursor: default; }
.cr.item .cr-acts { opacity: 1; transform: none; pointer-events: auto; }
.cr.exit .cr-gift, .cr.exit .cr-acts { opacity: 0; transition: opacity .2s; animation: none; }
.cr-price { margin: 0 0 6px; color: #FFF3D6; font-size: 15px; font-weight: 700; text-align: center; }
.cr-acts .btn { width: 100%; }
@media (min-width: 1000px) { .cr-gift { width: 220px; margin-left: -110px; } .cr-dress .nd { width: 170px; } }
@media (prefers-reduced-motion: reduce) { .cr.item .cr-gift { animation: none; opacity: 1; transform: none; } .cr-acts { transition: none; } }

/* a lesson finished (learn.js lessonSummary): one white card, the lesson's pill, its stars, what was done in it */
.lsum { --lsum-tint: #7C4DDB; padding-top: 18px; }
.lsum-card { display: flex; flex-direction: column; align-items: center; padding: 22px 18px 6px; border-radius: var(--r-card, 24px); background: var(--card, #fff);
  box-shadow: var(--sh-card, none), 0 0 0 1px var(--rim, transparent); text-align: center; }
.lsum-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 14px 3px 3px; border: 2px solid var(--lsum-tint); border-radius: 999px;
  color: var(--ink, #1B201C); font-size: 17px; font-weight: 800; }
.lsum-pill em { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--lsum-tint); color: #fff; font-style: normal; font-size: 15px; }
.lsum-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--kr-sans, inherit); }
.lsum-h { margin: 14px 0 0; color: var(--ink, #1B201C); font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.lsum-nep { width: 150px; margin: 6px 0 0; }
.lsum-nep .nd { width: 100%; }
.lsum-stars { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.lsum-stars i { display: block; width: 32px; height: 32px; animation: lp-star .45s cubic-bezier(.3, 1.7, .5, 1) backwards; }
.lsum-stars svg { display: block; width: 100%; height: 100%; fill: #FFC53D; stroke: #E0961A; stroke-width: 1.4; stroke-linejoin: round; }
.lsum-stars b { color: var(--ink, #1B201C); font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lsum-stars small { color: var(--ink2, #4F5751); font-size: 15px; font-weight: 700; }
.lsum-rows { align-self: stretch; display: grid; }
.lsum-row { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 4px; border-top: 1px solid var(--line, #E7E2D6); text-align: left; }
.lsum-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; }
.lsum-ic svg { width: 22px; height: 22px; }
.lsum-ic.say { background: var(--acc-soft, #E2F3E8); color: var(--acc-ink, #0E7A43); }
.lsum-ic.write { background: var(--honey-soft, #FCEFD2); color: var(--honey-ink, #8A5A00); }
.lsum-ic.word { background: color-mix(in srgb, var(--lsum-tint) 16%, transparent); color: var(--lsum-tint); }
.lsum-row b { min-width: 2.2ch; color: var(--ink, #1B201C); font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lsum-row span { min-width: 0; color: var(--ink2, #4F5751); font-size: 16px; font-weight: 700; }
html[data-theme="dark"] .lsum { --lsum-tint: #A98BF0; }
@media (min-width: 1000px) { .lsum-card { max-width: 520px; margin: 0 auto; padding: 28px 32px 10px; } .lsum-h { font-size: 34px; } }
@media (prefers-reduced-motion: reduce) { .lsum-stars i { animation: none; } }
