/* Lesson player styles. Uses only the shared design tokens from css/app.css. */

/* the host (.player-host) is fixed full-screen and already pads the top safe area, so fill it and add nothing */
.pl { display: flex; flex-direction: column; height: 100%; min-height: 0; width: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: var(--fs-m); line-height: 1.5; overscroll-behavior: none; position: relative; }
.pl *, .pl *::before, .pl *::after { box-sizing: border-box; }
.pl [hidden] { display: none !important; }
.pl button { font-family: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.pl p, .pl h2, .pl h3, .pl h4, .pl ul { margin: 0; }
.pl ul { padding: 0; list-style: none; }
.pl-ico { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.pl-ico svg { width: 100%; height: 100%; }

/* ---------- header ---------- */
.pl-head { flex: none; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.pl-x { flex: none; width: var(--tap); height: var(--tap); border-radius: var(--r-m); border: 0; background: transparent; color: var(--ink-2); font-size: 1.25rem; display: inline-flex; align-items: center; justify-content: center; margin-left: calc(var(--sp-2) * -1); transition: background 0.18s; }
.pl-x:hover, .pl-x:focus-visible { background: var(--surface-2); }
.pl-headmid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-progress { height: 8px; border-radius: var(--r-s); background: var(--line); overflow: hidden; }
.pl-progress .bar { height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width 0.25s ease; }
.pl-phases { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pl-pill { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-s); font-weight: 600; color: var(--ink-3); padding: 2px var(--sp-3); border-radius: 999px; background: var(--surface-2); transition: background 0.18s, color 0.18s; }
.pl-pill.is-on { background: var(--brand-soft); color: var(--brand); }
.pl-pill.is-done { color: var(--ok); }
.pl-pill.is-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- main stage ---------- */
.pl-main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pl-inner { width: 100%; max-width: 760px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-6); }
.pl-stage { min-width: 0; outline: none; display: flex; flex-direction: column; gap: var(--sp-4); animation: pl-in 0.22s ease both; }
@keyframes pl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pl-hintbox { margin-top: var(--sp-4); }
.pl-hint-in { display: flex; gap: var(--sp-3); align-items: flex-start; background: var(--warn-soft); color: var(--ink); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); }
.pl-hint-in .pl-ico { color: var(--warn); font-size: 1.3rem; margin-top: 2px; }

.pl-instr { font-size: var(--fs-s); font-weight: 700; letter-spacing: 0.02em; color: var(--ink-2); }
.pl-bodytext { font-size: var(--fs-m); color: var(--ink); }
.pl-small { font-size: var(--fs-s); color: var(--ink-2); }
.pl-prompt { font-size: var(--fs-l); font-weight: 600; line-height: 1.4; }
.pl-prompt-word { font-size: var(--fs-xl); font-weight: 700; }
.pl-prompt-bad { color: var(--bad); }
.pl-prompt-zh { font-weight: 600; }
.pl-promptrow { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.pl-pic { font-size: 5rem; line-height: 1.1; text-align: center; padding: var(--sp-3) 0; }
.pl-pic-learn { font-size: 6rem; }
.pl-blank { display: inline-block; min-width: 3.5em; border-bottom: 3px solid var(--brand); text-align: center; font-weight: 700; margin: 0 2px; }
.pl-blank.is-right { color: var(--ok); border-color: var(--ok); }
.pl-blank.is-wrong { color: var(--bad); border-color: var(--bad); }
.pl-hi { background: var(--warn-soft); color: inherit; border-radius: 4px; padding: 0 3px; font-weight: 700; }
.pl-counter-small { font-size: var(--fs-s); color: var(--ink-3); font-weight: 600; }

/* ---------- Chinese help ---------- */
.pl .zh { color: var(--ink-2); font-size: var(--fs-s); line-height: 1.5; }
.pl .pl-zh-big { font-size: var(--fs-l); color: var(--ink); font-weight: 600; }
.pl-zhwrap { display: flex; align-items: flex-start; gap: var(--sp-2); flex-wrap: wrap; }
.pl-zhbtn { flex: none; min-width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: var(--fs-s); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pl-zhbtn.is-open { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }
.pl-zhwrap .zh { flex: 1; min-width: 60%; padding-top: 6px; }

/* ---------- speaker buttons ---------- */
.pl-say { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-width: var(--tap); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: 999px; border: 0; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: var(--fs-s); transition: transform 0.15s, background 0.18s; }
.pl-say:active { transform: scale(0.96); }
.pl-say .pl-ico { font-size: 1.4rem; }
.pl-say.is-playing { background: var(--brand); color: var(--brand-ink); }
.pl-say-big { min-width: calc(var(--tap) * 1.4); min-height: calc(var(--tap) * 1.4); }
.pl-say-big .pl-ico { font-size: 2rem; }
.pl-say-small { min-width: 40px; min-height: 40px; }
.pl-say-slow { background: var(--surface-2); color: var(--ink-2); }
.pl-say-text { font-size: var(--fs-xl); font-weight: 700; }

/* ---------- choice ---------- */
.pl-opts { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
.pl-opt { display: flex; align-items: center; gap: var(--sp-3); min-height: calc(var(--tap) * 1.15); padding: var(--sp-3) var(--sp-4); border: 2px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--ink); font-size: var(--fs-l); text-align: left; box-shadow: var(--sh-1); transition: border-color 0.15s, background 0.15s, transform 0.12s, opacity 0.2s; }
.pl-opt:active { transform: scale(0.985); }
.pl-opt.is-sel { border-color: var(--brand); background: var(--brand-soft); }
.pl-opt.is-right { border-color: var(--ok); background: var(--ok-soft); }
.pl-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.pl-opt.is-dim { opacity: 0.4; }
.pl-opt:disabled { cursor: default; }
.pl-opt-pic { font-size: 3.4rem; line-height: 1; }
.pl-opts-pic { grid-template-columns: repeat(2, 1fr); }
.pl-opts-pic.pl-opts-n3 { grid-template-columns: repeat(3, 1fr); }
.pl-opts-pic .pl-opt { flex-direction: column; justify-content: center; min-height: 112px; padding: var(--sp-3); }
.pl-opts-pic .pl-opt-pic { font-size: 3.2rem; }
.pl-opts-big { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.pl-opts-big .pl-opt { justify-content: center; font-size: var(--fs-xxl); font-weight: 700; font-family: "Andika", var(--font-learn); min-height: 84px; }
.pl-opts-zh .pl-opt { font-size: var(--fs-l); }
.pl-opts-text .pl-opt { font-size: var(--fs-l); }

.pl-passage { display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-passage-btn { align-self: flex-start; }
.pl-passage-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--sp-4); }
.pl-passage-title { font-size: var(--fs-m); margin-bottom: var(--sp-2); }
.pl-passage-text { font-size: var(--fs-m); line-height: 1.7; }

/* ---------- tiles ---------- */
.pl-slots { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-content: flex-start; min-height: calc(var(--tap) * 1.9); padding: var(--sp-3); background: var(--surface); border: 2px dashed var(--line); border-radius: var(--r-m); }
.pl-slots.is-right { border-color: var(--ok); background: var(--ok-soft); border-style: solid; }
.pl-slots.is-wrong { border-color: var(--bad); background: var(--bad-soft); border-style: solid; }
.pl-bank { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; padding: var(--sp-2) 0; }
.pl-tile { min-height: var(--tap); min-width: var(--tap); padding: var(--sp-2) var(--sp-4); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--r-m); background: var(--surface); color: var(--ink); font-size: var(--fs-l); font-weight: 600; box-shadow: var(--sh-1); transition: transform 0.12s, opacity 0.2s, border-color 0.15s; }
.pl-tile:active { transform: translateY(2px); }
.pl-tile-placed { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.pl-tile.is-used { opacity: 0.22; box-shadow: none; pointer-events: none; }
.pl-slots.is-right .pl-tile-placed { border-color: var(--ok); }
.pl-slots.is-wrong .pl-tile-placed { border-color: var(--bad); }
.pl-slots-letters, .pl-bank-letters { justify-content: center; }
.pl-slots-letters { min-height: calc(var(--tap) * 1.5); align-items: center; }
.pl-slots-letters .pl-tile, .pl-bank-letters .pl-tile { width: 56px; min-width: 56px; padding: 0; font-family: "Andika", var(--font-learn); font-size: var(--fs-xl); text-align: center; }
.pl-slot-empty { width: 56px; height: 56px; border-bottom: 4px solid var(--line); border-radius: 2px; }

/* ---------- type / writing inputs ---------- */
.pl-input { width: 100%; font-family: inherit; font-size: 17px; line-height: 1.5; padding: var(--sp-3) var(--sp-4); border: 2px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--ink); min-height: calc(var(--tap) * 1.1); outline: none; transition: border-color 0.15s; -webkit-appearance: none; appearance: none; }
.pl-input:focus { border-color: var(--brand); }
.pl-input.is-right { border-color: var(--ok); background: var(--ok-soft); }
.pl-input.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.pl-input-learn { font-family: "Andika", var(--font-learn); font-size: 1.25rem; }
.pl-textarea { resize: vertical; min-height: 150px; }
.pl-typearea, .pl-writearea { display: flex; flex-direction: column; gap: var(--sp-3); }
.pl-switch { align-self: flex-start; }
.pl-counter { font-size: var(--fs-s); color: var(--ink-2); font-weight: 600; text-align: right; }
.pl-counter.is-ok { color: var(--ok); }
.pl-counter.is-over { color: var(--bad); }
.pl-pencil-tip { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--ink-3); }
.pl-answer-big { font-size: var(--fs-xl); font-weight: 700; color: var(--ok); }
.pl-reveal { display: flex; flex-direction: column; gap: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--sp-4); }
.pl-rate { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

.pl-padbox { display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-padwrap { position: relative; width: 100%; min-height: 150px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-m); overflow: hidden; touch-action: none; }
.pl-padwrap canvas { touch-action: none; display: block; }
.pl-pad-trace { min-height: 220px; }
.pl-pad-copy { min-height: 190px; }
.pl-padwrap.is-locked { pointer-events: none; opacity: 0.85; }
.pl-padtools { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.pl-tool { min-height: 40px; }
.pl-model-word { font-family: "Andika", var(--font-learn); font-size: var(--fs-xxl); font-weight: 700; letter-spacing: 0.04em; color: var(--ink); }
.pl-model-trace { text-align: center; padding: var(--sp-4); background: var(--surface); border-radius: var(--r-m); border: 1px solid var(--line); font-size: 4rem; }
.pl-padres { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; }
.pl-perchar { display: flex; gap: var(--sp-2); }
.pl-pc { min-width: 36px; text-align: center; padding: 2px var(--sp-2); border-radius: var(--r-s); font-family: "Andika", var(--font-learn); font-weight: 700; }
.pl-pc.is-ok { background: var(--ok-soft); color: var(--ok); }
.pl-pc.is-low { background: var(--warn-soft); color: var(--ink); }
.pl-diff-exp { color: var(--ok); font-weight: 700; }
.pl-diff-got { color: var(--bad); text-decoration: line-through; }
.pl-actions-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }

/* ---------- speaking ---------- */
.pl-readtext { font-size: var(--fs-xl); line-height: 1.6; font-weight: 600; padding: var(--sp-4); background: var(--surface); border-radius: var(--r-m); border: 1px solid var(--line); }
.pl-readtext-big { font-size: 2.6rem; text-align: center; font-family: "Andika", var(--font-learn); padding: var(--sp-5) var(--sp-4); }
.pl-readtext-long { font-size: var(--fs-l); font-weight: 500; }
.pl-w { border-radius: 4px; padding: 0 2px; }
.pl-scored .pl-w.is-ok { color: var(--ok); background: var(--ok-soft); }
.pl-scored .pl-w.is-near { color: var(--ink); background: var(--warn-soft); text-decoration: underline dashed; text-underline-offset: 4px; }
.pl-scored .pl-w.is-miss { color: var(--bad); background: var(--bad-soft); text-decoration: underline wavy; text-underline-offset: 4px; }
.pl-legend { font-size: var(--fs-s); color: var(--ink-3); }
.pl-modelrow { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.pl-replay { gap: var(--sp-2); }
.pl-recwrap { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-3) 0; }
.pl-mic { position: relative; width: 96px; height: 96px; border-radius: 999px; border: 0; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 2.4rem; box-shadow: var(--sh-2), 0 0 0 calc(var(--lvl, 0) * 26px) var(--brand-soft); transition: transform 0.15s, background 0.2s, box-shadow 0.08s; }
.pl-mic:active { transform: scale(0.96); }
.pl-mic:disabled { opacity: 0.5; }
.pl-mic .pl-stop-ico { display: none; }
.pl-mic.is-rec { background: var(--bad); }
.pl-mic.is-rec .pl-mic-ico { display: none; }
.pl-mic.is-rec .pl-stop-ico { display: inline-flex; }
.pl-mic.is-rec::after { content: ""; position: absolute; inset: -8px; border-radius: 999px; border: 3px solid var(--bad); opacity: 0.5; animation: pl-pulse 1.2s ease-out infinite; }
@keyframes pl-pulse { from { transform: scale(0.92); opacity: 0.6; } to { transform: scale(1.25); opacity: 0; } }
.pl-reclabel { font-size: var(--fs-s); font-weight: 600; color: var(--ink-2); }
.pl-interim { font-size: var(--fs-s); color: var(--ink-3); min-height: 1.4em; text-align: center; }
.pl-readres { display: flex; flex-direction: column; gap: var(--sp-3); }
.pl-msg { color: var(--ink-2); }
.pl-bigscore { display: inline-flex; align-items: baseline; gap: var(--sp-2); }
.pl-bigscore-n { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--ink); }
.pl-bigscore.is-good .pl-bigscore-n { color: var(--ok); }
.pl-bigscore-l { font-size: var(--fs-s); color: var(--ink-2); font-weight: 600; }
.pl-meters { display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-meter { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-s); }
.pl-meter-l { flex: none; width: 7.5em; color: var(--ink-2); font-weight: 600; }
.pl-meter-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pl-meter-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.4s ease; }
.pl-meter-v { flex: none; width: 2.6em; text-align: right; font-weight: 700; color: var(--ink); }
.pl-pace { font-weight: 700; padding: 1px var(--sp-3); border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.pl-pace.is-slow, .pl-pace.is-fast { background: var(--warn-soft); color: var(--ink); }
.pl-faces { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.pl-face { flex: 1; min-width: 96px; min-height: calc(var(--tap) * 1.4); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); border: 2px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--ink-2); font-size: var(--fs-s); font-weight: 600; transition: border-color 0.15s, background 0.15s; }
.pl-face .pl-ico { font-size: 2rem; }
.pl-face.is-sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pl-keys { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.pl-key { font-size: var(--fs-s); }
.pl-key.is-miss { background: var(--bad-soft); color: var(--bad); }
.pl-key.is-ok { background: var(--ok-soft); color: var(--ok); }
.pl-heard { font-size: var(--fs-l); font-style: italic; color: var(--ink); }
.pl-sample { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.pl-sample h4, .pl-gradeview h4, .pl-res-sec h3, .pl-modelcard h4 { font-size: var(--fs-m); font-weight: 700; color: var(--ink-2); }
.pl-sample-text { font-size: var(--fs-m); line-height: 1.6; }
.pl-issues { display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-issues li { font-size: var(--fs-s); padding: var(--sp-2) var(--sp-3); background: var(--surface); border-radius: var(--r-s); border: 1px solid var(--line); }

/* ---------- free writing ---------- */
.pl-tips { display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-tips li { font-size: var(--fs-s); color: var(--ink-2); padding-left: var(--sp-4); position: relative; }
.pl-tips li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 6px; height: 6px; border-radius: 999px; background: var(--brand); }
.pl-gradeview { display: flex; flex-direction: column; gap: var(--sp-3); }
.pl-gradehead { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.pl-stars { display: inline-flex; gap: var(--sp-1); }
.pl-star { font-size: 1.6rem; color: var(--line); display: inline-flex; }
.pl-star svg { fill: none; stroke: currentColor; }
.pl-star.is-on { color: var(--gold); }
.pl-star.is-on svg { fill: var(--gold); }
.pl-stars-big .pl-star { font-size: 2.6rem; }
.pl-stars-big .pl-star.is-on { animation: pl-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes pl-pop { from { transform: scale(0); } to { transform: scale(1); } }
.pl-writtentext { white-space: pre-wrap; font-size: var(--fs-l); line-height: 1.8; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.pl-issue { font: inherit; color: inherit; background: transparent; border: 0; padding: 0 1px; margin: 0; cursor: pointer; text-decoration: underline wavy; text-underline-offset: 4px; text-decoration-thickness: 2px; min-height: 0; }
.pl-issue.is-spelling { text-decoration-color: var(--bad); }
.pl-issue.is-grammar { text-decoration-color: var(--warn); }
.pl-issue.is-capital, .pl-issue.is-punct { text-decoration-color: var(--brand); }
.pl-issue.is-word, .pl-issue.is-style { text-decoration-color: var(--ink-3); }
.pl-issue.is-open { background: var(--warn-soft); border-radius: 3px; }
.pl-issue-info { padding: var(--sp-3) var(--sp-4); background: var(--warn-soft); border-radius: var(--r-m); display: flex; flex-direction: column; gap: var(--sp-1); }
.pl-fix { font-weight: 700; color: var(--ok); }
.pl-good { color: var(--ok); font-weight: 600; }

/* ---------- learn cards ---------- */
.pl .card.pl-wordcard, .pl .card.pl-soundcard, .pl .card.pl-teachcard, .pl .card.pl-sentcard, .pl .card.pl-readingcard, .pl .card.pl-modelcard, .pl .card.pl-introcard, .pl .card.pl-intro { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-1); border: 1px solid var(--line); }
.pl-wordcard { align-items: center; text-align: center; }
.pl-wordrow { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); flex-wrap: wrap; }
.pl-bigword { font-family: "Andika", var(--font-learn); font-size: 2.6rem; font-weight: 700; line-height: 1.15; }
.pl-pos { align-self: center; font-size: var(--fs-s); color: var(--ink-3); }
.pl-exbox { align-self: stretch; text-align: left; background: var(--surface-2); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.pl-exlabel { font-size: var(--fs-s); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.pl-exrow { display: flex; align-items: center; gap: var(--sp-3); }
.pl-exline { font-size: var(--fs-l); flex: 1; }
.pl-pattern { font-family: "Andika", var(--font-learn); font-size: 3rem; font-weight: 700; color: var(--brand); text-align: center; padding: var(--sp-2) 0; }
.pl-wordchips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pl-wchip { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--fs-l); font-weight: 600; transition: background 0.15s, border-color 0.15s; }
.pl-wchip .pl-ico { color: var(--brand); }
.pl-wchip.is-playing { background: var(--brand-soft); border-color: var(--brand); }
.pl-listenall { align-self: flex-start; }
.pl-teachtop { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.pl-teachh { font-size: var(--fs-xl); font-weight: 800; line-height: 1.25; }
.pl-teachcard.is-watch { border-color: var(--warn); }
.pl-teachcard.is-watch .pl-teachh { color: var(--ink); }
.pl-teachcard.is-watch .pl-teachh .pl-ico { color: var(--warn); }
.pl-compare { display: flex; flex-direction: column; gap: var(--sp-3); }
.pl-cmp { border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.pl-cmp.is-bad { background: var(--bad-soft); }
.pl-cmp.is-good { background: var(--ok-soft); }
.pl-cmp-l { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-s); font-weight: 700; }
.pl-cmp.is-bad .pl-cmp-l { color: var(--bad); }
.pl-cmp.is-good .pl-cmp-l { color: var(--ok); }
.pl-cmp-t { font-size: var(--fs-l); font-weight: 600; flex: 1; }
.pl-cmp.is-bad .pl-cmp-t { text-decoration: line-through; text-decoration-color: var(--bad); }
.pl-examples { display: flex; flex-direction: column; gap: var(--sp-3); }
.pl-exitem { padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: var(--r-m); display: flex; flex-direction: column; gap: var(--sp-1); }
.pl-sentcard { align-items: center; text-align: center; }
.pl-bigsentence { font-size: var(--fs-xl); font-weight: 700; line-height: 1.5; font-family: "Andika", var(--font-learn); }
.pl-tapword { font: inherit; color: inherit; background: transparent; border: 0; padding: 2px 3px; border-radius: 6px; min-height: 0; }
.pl-tapword:active { background: var(--brand-soft); }
.pl-reading-text { font-size: var(--fs-l); line-height: 2; }
.pl-rw { font: inherit; color: inherit; background: transparent; border: 0; padding: 0 1px; margin: 0; border-radius: 4px; min-height: 0; text-align: inherit; transition: background 0.12s; }
.pl-rw.has-gloss { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.pl-rw.is-picked { background: var(--brand-soft); }
.pl-rw.is-reading { background: var(--warn-soft); box-shadow: 0 0 0 2px var(--warn-soft); }
.pl-bubble { position: sticky; bottom: 0; background: var(--ink); color: var(--surface); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); box-shadow: var(--sh-2); }
.pl-bubble .zh { color: var(--surface); font-size: var(--fs-m); }
.pl-bubble .pl-say { background: var(--surface); }
.pl-listenalong { align-self: flex-start; }
.pl-listenalong.is-on { background: var(--bad); }

/* ---------- phase intro ---------- */
.pl-intro, .pl-introcard { align-items: center; text-align: center; padding: var(--sp-6) var(--sp-5); }
.pl-intro-badge { width: 72px; height: 72px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.pl-introt { font-size: var(--fs-xl); font-weight: 800; line-height: 1.25; }
.pl-introbtns { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; max-width: 360px; }

/* ---------- footer, feedback ---------- */
.pl-foot { flex: none; background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--sh-2); padding-bottom: env(safe-area-inset-bottom); }
.pl-footrow { display: flex; align-items: center; gap: var(--sp-3); width: 100%; max-width: 760px; margin: 0 auto; padding: var(--sp-3) var(--sp-4); }
.pl-footleft { display: flex; gap: var(--sp-2); }
.pl-primary { flex: 1; max-width: 360px; margin-left: auto; min-height: calc(var(--tap) * 1.15); font-weight: 700; transition: opacity 0.18s, transform 0.12s; }
.pl-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.pl-hintbtn { gap: var(--sp-1); }
.pl-feedback { width: 100%; padding: var(--sp-3) var(--sp-4); max-height: 42vh; overflow-y: auto; animation: pl-up 0.2s ease both; border-bottom: 1px solid var(--line); }
@keyframes pl-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.pl-feedback > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.pl-feedback.is-ok { background: var(--ok-soft); }
.pl-feedback.is-bad { background: var(--bad-soft); }
.pl-feedback.is-info { background: var(--brand-soft); }
.pl-fb-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-l); font-weight: 800; }
.pl-feedback.is-ok .pl-fb-title { color: var(--ok); }
.pl-feedback.is-bad .pl-fb-title { color: var(--bad); }
.pl-feedback.is-info .pl-fb-title { color: var(--brand); }
.pl-fb-title .pl-ico { font-size: 1.4rem; }
.pl-fb-score { margin-left: auto; font-size: var(--fs-m); }
.pl-fb-body { display: flex; flex-direction: column; gap: var(--sp-1); margin-top: var(--sp-2); color: var(--ink); }
.pl-fb-answer { font-size: var(--fs-m); }
.pl-fb-l { color: var(--ink-2); font-weight: 600; }
.pl-fb-why { font-size: var(--fs-s); color: var(--ink); }
.pl-fb-note { font-size: var(--fs-s); color: var(--ink-2); }

/* ---------- results ---------- */
.pl-res { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); text-align: center; position: relative; }
.pl-res-title { font-size: var(--fs-xl); font-weight: 800; }
.pl-ring-wrap { position: relative; width: 150px; height: 150px; }
.pl-ring { width: 100%; height: 100%; }
.pl-ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.pl-ring-fg { fill: none; stroke: var(--brand); stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 0.9s ease; }
.pl-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pl-ring-n { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.pl-ring-l { font-size: var(--fs-s); color: var(--ink-2); font-weight: 600; }
.pl-res-sub { color: var(--ink-2); font-weight: 600; }
.pl-res-pass { font-weight: 700; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-m); }
.pl-res-pass.is-ok { background: var(--ok-soft); color: var(--ok); }
.pl-res-pass.is-bad { background: var(--warn-soft); color: var(--ink); }
.pl-res-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.pl-res .chip.is-ok { background: var(--ok-soft); color: var(--ok); }
.pl-xp { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.pl-res-sec { width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); align-items: center; }
.pl-res-level { font-size: var(--fs-xxl); font-weight: 800; color: var(--brand); }
.pl-review { width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); text-align: left; }
.pl-review-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.pl-review-q { font-weight: 600; }
.pl-review-a { font-size: var(--fs-s); }
.pl-confetti { position: absolute; left: 0; right: 0; top: -20px; height: 240px; overflow: hidden; pointer-events: none; }
.pl-conf { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: pl-fall 2.2s ease-in both; }
.pl-conf-0 { background: var(--brand); }
.pl-conf-1 { background: var(--gold); }
.pl-conf-2 { background: var(--ok); }
.pl-conf-3 { background: var(--warn); }
@keyframes pl-fall { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(230px) rotate(420deg); opacity: 0; } }

/* ---------- age styles ---------- */
.pl[data-band="K2"] .pl-opt, .pl[data-band="K2"] .pl-tile, .pl[data-band="K2"] .pl-face, .pl[data-band="K2"] .pl-wchip { border-radius: var(--r-l); }
.pl[data-band="K2"] .pl-opts-pic .pl-opt { min-height: 140px; }
.pl[data-band="K2"] .pl-opts-pic .pl-opt-pic { font-size: 4.2rem; }
.pl[data-band="K2"] .pl-pic { font-size: 6.5rem; }
.pl[data-band="K2"] .pl-bigword { font-size: 3.2rem; }
.pl[data-band="K2"] .pl-mic { width: 112px; height: 112px; }
.pl[data-band="K2"] .pl-primary { min-height: calc(var(--tap) * 1.25); font-size: var(--fs-l); border-radius: var(--r-l); }
.pl[data-band="K2"] .pl-progress { height: 12px; }
.pl[data-band="K2"] .pl-slots-letters .pl-tile, .pl[data-band="K2"] .pl-bank-letters .pl-tile { width: 64px; min-width: 64px; height: 64px; }
.pl[data-band="K2"] .pl-slot-empty { width: 64px; height: 64px; }
.pl[data-band="K2"] .pl-stage { gap: var(--sp-5); }
.pl[data-band="912"] .pl-stage { gap: var(--sp-3); }
.pl[data-band="912"] .pl .card, .pl[data-band="912"] .card.pl-wordcard, .pl[data-band="912"] .card.pl-teachcard { box-shadow: none; }
.pl[data-band="912"] .pl-opt, .pl[data-band="912"] .pl-tile { box-shadow: none; }
.pl[data-band="912"] .pl-confetti, .pl[data-band="68"] .pl-confetti { display: none; }
.pl[data-band="912"] .pl-pic { font-size: 3.5rem; }
.pl[data-band="912"] .pl-bigword { font-size: 2rem; }
.pl[data-band="68"] .pl-pic { font-size: 4rem; }
.pl[data-band="68"] .pl-bigword { font-size: 2.2rem; }

/* ---------- larger screens ---------- */
@media (min-width: 600px) {
  .pl-inner { padding: var(--sp-6) var(--sp-5) var(--sp-6); }
  .pl-opts-text, .pl-opts-zh { grid-template-columns: repeat(2, 1fr); }
  .pl-opts-text.pl-opts-n2, .pl-opts-zh.pl-opts-n2 { grid-template-columns: repeat(2, 1fr); }
  .pl-footrow { padding: var(--sp-3) var(--sp-5); }
  .pl-head { padding: var(--sp-2) var(--sp-5); }
}
@media (min-width: 1000px) {
  .pl-inner { max-width: 820px; }
  .pl-opts-pic { grid-template-columns: repeat(4, 1fr); }
  .pl-opts-pic.pl-opts-n3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 400px) {
  .pl-inner { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .pl-bigword { font-size: 2.2rem; }
  .pl-meter-l { width: 6em; }
  .pl .card.pl-wordcard, .pl .card.pl-soundcard, .pl .card.pl-teachcard, .pl .card.pl-sentcard, .pl .card.pl-readingcard, .pl .card.pl-modelcard { padding: var(--sp-4); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .pl-pic { font-size: 3.2rem; padding: 0; }
  .pl-pic-learn { font-size: 3.6rem; }
  .pl-feedback { max-height: 34vh; }
}

@media (prefers-reduced-motion: reduce) {
  .pl *, .pl *::before, .pl *::after { animation: none !important; transition: none !important; }
}

.pl-introbtns .btn { flex-direction: column; gap: 2px; line-height: 1.3; }
.pl-btn-zh { font-size: var(--fs-s); font-weight: 500; opacity: 0.85; }

/* ---------- spoken instructions, K2 results, plain results ---------- */
.pl-instrbar { display: flex; align-items: center; gap: var(--sp-3); }
.pl-instrbar .pl-instr { flex: 1; min-width: 0; }
.pl-ear { flex: none; width: var(--tap); height: var(--tap); border-radius: 999px; border: 0; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; transition: transform 0.15s; }
.pl-ear:active { transform: scale(0.94); }
.pl-intro .pl-ear { width: calc(var(--tap) * 1.2); height: calc(var(--tap) * 1.2); }
.pl[data-band="K2"] .pl-instr { font-size: var(--fs-m); }
.pl-res-cheer { font-size: var(--fs-xxl); font-weight: 800; line-height: 1.2; color: var(--brand); }
.pl-res-plain { font-size: var(--fs-l); font-weight: 700; color: var(--ink); }
.pl[data-band="K2"] .pl-res .pl-stars-big .pl-star { font-size: 3.6rem; }
.pl-wordcard, .pl-exbox, .pl-exline, .pl-bigsentence, .pl-readtext, .pl-writtentext, .pl-review-q, .pl-fb-body, .pl-prompt { overflow-wrap: anywhere; }
.pl-reading-text, .pl-sample-text, .pl-bodytext { overflow-wrap: break-word; }
.pl-padwrap, .pl-padwrap canvas, .pl-input { max-width: 100%; }
.pl-meter-l { max-width: 40%; }

@media (max-width: 400px) {
  .pl-bigword { font-size: 2rem; }
  .pl-readtext-big { font-size: 2.1rem; }
  .pl-pattern { font-size: 2.4rem; }
  .pl-model-trace { font-size: 3rem; }
  .pl-footrow { gap: var(--sp-2); padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .pl-primary { min-width: 0; }
  .pl-hintbtn span { display: none; }
  .pl-faces { gap: var(--sp-2); }
  .pl-face { min-width: 80px; }
  .pl[data-band="K2"] .pl-slots-letters .pl-tile, .pl[data-band="K2"] .pl-bank-letters .pl-tile, .pl[data-band="K2"] .pl-slot-empty { width: 52px; min-width: 52px; height: 56px; }
}

/* iPad portrait and up: use the width, larger type targets */
@media (min-width: 700px) {
  .pl-inner { max-width: 900px; }
  .pl-opts-pic { grid-template-columns: repeat(4, 1fr); }
  .pl-opts-pic.pl-opts-n3 { grid-template-columns: repeat(3, 1fr); }
  .pl-opts-pic.pl-opts-n2 { grid-template-columns: repeat(2, minmax(0, 260px)); justify-content: center; }
  .pl-compare { flex-direction: row; }
  .pl-compare .pl-cmp { flex: 1; }
  .pl-examples { display: grid; grid-template-columns: repeat(2, 1fr); }
  .pl-footrow, .pl-feedback > * { max-width: 900px; }
}
@media (min-width: 1000px) {
  .pl-inner { max-width: 1040px; padding-top: var(--sp-6); }
  .pl-opts-text, .pl-opts-zh { grid-template-columns: repeat(2, 1fr); }
  .pl-opts-text.pl-opts-n4, .pl-opts-zh.pl-opts-n4 { grid-template-columns: repeat(2, 1fr); }
  .pl-footrow, .pl-feedback > * { max-width: 1040px; }
  .pl[data-band="K2"] .pl-opts-pic .pl-opt { min-height: 170px; }
  .pl-pad-trace { min-height: 280px; }
  .pl-review { display: grid; grid-template-columns: repeat(2, 1fr); }
}

/* quick checks inside Learn, labelled model parts */
.pl-quickbadge{align-self:flex-start;margin-bottom:var(--sp-2);background:var(--brand-soft);color:var(--brand-ink)}
.pl-parts{display:flex;flex-direction:column;gap:var(--sp-2)}
.pl-part{background:var(--surface-2);border-radius:var(--r-m);padding:var(--sp-2) var(--sp-3);border-left:4px solid var(--brand)}
.pl-part-l{display:block;font-size:var(--fs-s);font-weight:700;color:var(--brand-ink);text-transform:uppercase;letter-spacing:.04em;margin-bottom:var(--sp-1)}
