/* Practice and lesson player: shared by the student app and the admin preview. */
/* ---------- practice ---------- */
.px { position: fixed; inset: 0; top: var(--vvt, 0); bottom: auto; height: var(--vvh, 100%); z-index: 40; background: var(--paper); display: flex; flex-direction: column; }
.px-head { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.px-bar { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.px-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }
.px-count { font-size: 13.5px; font-weight: 700; color: var(--muted); min-width: 44px; text-align: right; }
.px-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; width: 100%; max-width: 640px; margin: 0 auto; padding: 14px 20px 20px; display: flex; flex-direction: column; }
.px-step { display: flex; flex-direction: column; gap: 18px; flex: 1; animation: stepIn .45s var(--ease-out); }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } }
.px-q { font-size: 21px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.px-prompt { display: grid; place-items: center; gap: 10px; padding: 6px 0 4px; text-align: center; }
.px-prompt .pic { width: min(44vw, 30vh, 200px); height: min(44vw, 30vh, 200px); font-size: min(26vw, 17vh, 118px); border-radius: 30px; background: var(--card); border: 1px solid var(--line); }
.px-word { font-family: var(--f-display); font-size: clamp(42px, 11vw, 60px); font-weight: 600; line-height: 1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.px-ex { color: var(--graphite); font-style: italic; }
.say { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; padding: 8px 14px; border-radius: 999px; background: var(--accent-soft); }
.say.big { width: 96px; height: 96px; padding: 0; justify-content: center; border-radius: 50%; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 12px 16px; width: 100%;
  border-radius: 14px; border: 1.5px solid var(--line); border-bottom-width: 3.5px; background: var(--card);
  font-weight: 700; font-size: 17px; text-align: left; line-height: 1.3;
  transition: border-color .15s, background-color .15s, color .15s, opacity .2s, transform .1s;
}
.opt:hover { border-color: var(--line-2); }
.opt:active { transform: translateY(1.5px); }
.opt kbd { font-family: var(--f-ui); font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin-left: auto; display: none; }
@media (hover: hover) and (pointer: fine) { .opt kbd { display: inline-block; } }
.opt.ok { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.opt.bad { border-color: var(--wrong); background: var(--wrong-soft); color: var(--wrong); animation: shake .35s; }
.opt.sel { border-color: var(--accent); color: var(--accent); }
.opt.done { opacity: 0; pointer-events: none; transform: scale(.96); transition: opacity .35s, transform .35s; }
.opt.dim { opacity: .45; }
.opt[disabled] { cursor: default; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .opt { justify-content: center; text-align: center; font-size: 16px; min-height: 60px; padding: 10px; }
.type-in .input { min-height: 60px; font-size: 19px; }
.type-in .input.is-ok { border-color: var(--accent); color: var(--accent); }
.type-in .input.is-bad { border-color: var(--wrong); color: var(--wrong); animation: shake .35s; }
.hint { font-size: 14px; color: var(--muted); }
.px-foot { padding: 10px 20px calc(16px + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
  transform: translateY(105%); transition: transform .38s var(--ease-out);
}
.sheet.show { transform: none; }
.sheet.ok { background: var(--accent-soft); border-color: transparent; }
.sheet.bad { background: var(--wrong-soft); border-color: transparent; }
.sheet-in { max-width: 600px; margin: 0 auto; display: grid; gap: 10px; }
.sheet h3 { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; }
.sheet.ok h3 { color: var(--accent); }
.sheet.bad h3 { color: var(--wrong); }
.sheet .ans { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet .ans .icon-btn { width: 36px; height: 36px; color: var(--accent); }
.sheet .note { font-size: 14.5px; color: var(--graphite); }
.sheet.ok .btn { background: var(--accent); color: var(--on-accent); }
.sheet.bad .btn { background: var(--wrong); color: var(--on-wrong); }

.px-done { flex: 1; display: grid; place-items: center; align-content: center; text-align: center; gap: 18px; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; }
.px-done h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(48px, 13vw, 72px); line-height: .95; }
.done-mark { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); animation: pop .6s var(--ease-out); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: min(100%, 420px); border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.done-stat { padding: 14px 6px 12px; display: grid; gap: 2px; }
.done-stat + .done-stat { border-left: 1px solid var(--line); }
.done-stat b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.done-stat span { font-size: 12.5px; color: var(--graphite); font-weight: 600; }
.done-actions { display: grid; gap: 8px; width: min(100%, 420px); }

.px .center-msg { min-height: 60vh; display: grid; place-items: center; text-align: center; gap: 16px; align-content: center; }

/* ---------- lesson tasks ---------- */
.retry-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; font-weight: 800; color: var(--wrong); background: var(--wrong-soft); padding: 4px 10px; border-radius: 999px; }
.px-sent { font-size: clamp(22px, 5.4vw, 27px); font-weight: 700; line-height: 1.38; letter-spacing: -.01em; overflow-wrap: anywhere; }
.px-prompt .px-sent { text-align: center; }
.q-text { font-size: clamp(21px, 5.2vw, 25px); font-weight: 700; line-height: 1.45; letter-spacing: -.01em; overflow-wrap: anywhere; }
.blank { display: inline-block; min-width: 3.4em; height: 1.15em; vertical-align: -.2em; margin: 0 .12em; border-bottom: 2.5px solid var(--line-2); }
.blank.filled { height: auto; min-width: 0; vertical-align: baseline; color: var(--accent); border-color: var(--accent); padding: 0 .15em; animation: riseIn .3s var(--ease-out); }

.theory { gap: 16px; }
.theory h2 { font-family: var(--f-display); font-size: clamp(40px, 10.5vw, 54px); font-weight: 600; line-height: 1; letter-spacing: -.01em; }
.theory > .pic { width: 112px; height: 112px; font-size: 66px; border-radius: 26px; background: var(--card); border: 1px solid var(--line); }
.rich { display: grid; gap: 12px; font-size: 17px; line-height: 1.6; }
.rich ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.rich li { position: relative; padding-left: 20px; }
.rich li::before { content: ""; position: absolute; left: 3px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.rich b { font-weight: 800; color: var(--accent); }
.examples { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 14px 6px 4px 16px; display: grid; }
.examples h3 { font-size: 14.5px; font-weight: 700; color: var(--graphite); padding-bottom: 4px; }
.ex-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.ex-row + .ex-row { border-top: 1px solid var(--line); }
.ex-row b { display: block; font-weight: 700; font-size: 16.5px; line-height: 1.4; }
.ex-row small { display: block; color: var(--graphite); font-size: 14px; }

.gap-text { font-size: clamp(20px, 5vw, 23px); font-weight: 600; line-height: 2.25; overflow-wrap: anywhere; }
.gap-in {
  font: inherit; font-weight: 700; line-height: 1.3; color: var(--ink); text-align: center; max-width: 100%;
  background: var(--paper-2); border: 0; border-bottom: 2.5px solid var(--line-2); border-radius: 8px 8px 3px 3px;
  padding: 2px 6px; margin: 0 2px; outline: 2px solid transparent; transition: border-color .15s, background-color .15s;
}
.gap-in:focus { border-color: var(--accent); background: var(--accent-soft); }
.gap-in.is-ok { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.gap-in.is-bad { color: var(--wrong); border-color: var(--wrong); background: var(--wrong-soft); animation: shake .35s; }

.tiles-ans {
  min-height: 124px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 6px 0 10px;
  background: repeating-linear-gradient(to bottom, transparent 0 54px, var(--line) 54px 55.5px, transparent 55.5px 56px);
}
.tiles-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 6px; }
.tile {
  min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); border-bottom-width: 3.5px;
  background: var(--card); font-weight: 700; font-size: 17px; line-height: 1.2; transition: border-color .15s, color .15s, background-color .15s;
}
.tile:hover { border-color: var(--line-2); }
.tile.used { color: transparent; background: var(--paper-2); border-color: var(--paper-2); pointer-events: none; box-shadow: none; }
.tiles-ans.is-ok .tile { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tiles-ans.is-bad .tile { border-color: var(--wrong); color: var(--wrong); background: var(--wrong-soft); }
.tiles-ans.is-bad { animation: shake .35s; }

.ta-in { min-height: 112px !important; resize: none !important; font-size: 18px; }
.type-in .ta-in.is-ok { border-color: var(--accent); color: var(--accent); }
.type-in .ta-in.is-bad { border-color: var(--wrong); color: var(--wrong); animation: shake .35s; }
.listen-pad { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 0; }

.stars { display: flex; gap: 6px; justify-content: center; align-items: flex-start; padding-top: 14px; }
.star { color: var(--line-2); animation: starIn .55s var(--ease-out) backwards; }
.star .ic { stroke-width: 1.4; }
.star.on { color: var(--accent); }
.star.on .ic { fill: currentColor; }
.star:nth-child(2) { margin-top: -14px; }
.star:nth-child(2) .ic { width: 56px; height: 56px; }
@keyframes starIn { 0% { opacity: 0; transform: scale(.3) rotate(-25deg); } 70% { opacity: 1; } }
.ex-row .grow { flex: 1; min-width: 0; }

@media (any-pointer: coarse) {
  .sheet .ans .icon-btn { width: 44px; height: 44px; }
}
