/* Focused practice player + typing surface. */
.layout-focus { min-height: 100dvh; }
.player { min-height: 100dvh; display: flex; flex-direction: column; }
.player-top {
  position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto;
  align-items: center; gap: 8px 14px; padding: 12px 20px 10px; background: var(--bg);
}
.player-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.player-title .en { color: var(--text); font-weight: 600; }
.player-count { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.player-progress { grid-column: 1 / -1; height: 4px; }
.player-mode { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--accent); padding: 0 16px 6px; }
.player-mode .icon { width: 16px; height: 16px; }

.player-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px 20px 48px; gap: 32px; }
.player.with-art .player-body { grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.4fr); }
.player-art { align-self: stretch; display: flex; align-items: center; }
.player-cover { width: 100%; aspect-ratio: 3 / 4; max-height: 70dvh; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.player-cover img, .player-cover .cover-gen { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .player.with-art .player-body { grid-template-columns: 1fr; gap: 16px; align-items: start; }
  /* Tablets and phones: the story picture sits above the sentence as a short banner. */
  .player.with-art .player-body { align-content: start; }
  .player-art { display: block; align-self: start; }
  .player-cover { aspect-ratio: 16 / 9; max-height: 30dvh; }
}
@media (max-width: 520px) {
  .player-cover { max-height: 20dvh; border-radius: var(--r-lg); }
}

.player-stage { min-width: 0; }
.player-stage.enter > * { animation: rise-in 420ms var(--ease) both; }
.player-hint { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 18px; }

/* ---------- Line card ---------- */
.line-card { position: relative; padding: 40px 32px 28px; border-radius: var(--r-xl); background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow); cursor: text; transition: border-color var(--normal), box-shadow var(--normal); }
.line-card.done { border-color: color-mix(in srgb, var(--success) 55%, transparent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 12%, transparent), var(--shadow); }
.board-host { position: relative; }

.typing { position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; row-gap: 14px; font-family: var(--font-en); font-weight: 600; letter-spacing: -0.01em; text-align: center; }
.typing-lg { font-size: clamp(26px, 4.2vw, 40px); line-height: 1.2; }
.typing-md { font-size: clamp(20px, 3vw, 28px); line-height: 1.25; }
.tw { position: relative; display: inline-flex; white-space: nowrap; }
.tw.has-gloss::after { content: ''; position: absolute; inset-inline: 0; bottom: -6px; border-bottom: 2px dotted color-mix(in srgb, var(--accent) 70%, transparent); }
.sp { width: 0.3em; }
.ch { position: relative; color: var(--untyped); transition: color 120ms; }
.ch.on { color: var(--typed); }
.ch.punct { color: var(--untyped); }
.ch.punct.on { color: var(--typed); }
.ch.hinted { color: var(--accent); }
.ch.cur::after { content: ''; position: absolute; inset-inline: 0.04em; bottom: -0.12em; height: 3px; border-radius: 2px; background: var(--accent); animation: caret 1.05s ease-in-out infinite; }
.ch.bad { color: var(--wrong) !important; animation: shake 280ms; }
.typing.is-hidden .ch:not(.on):not(.punct) { color: var(--untyped); }
.typing.is-done .ch { color: var(--success); }
.typing-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; background: transparent; color: transparent; caret-color: transparent; cursor: text; }

.gloss {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px); z-index: 3; pointer-events: none;
  padding: 4px 10px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-ar); font-size: 14px; font-weight: 700; letter-spacing: 0; white-space: nowrap;
  opacity: 0; transition: opacity var(--fast), transform var(--fast) var(--ease);
}
.gloss::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--accent); }
.tw.has-gloss:hover .gloss, .typing.show-gloss .gloss { opacity: 1; transform: translate(-50%, 0); }

.translation { text-align: center; color: var(--translation); font-size: 19px; margin-top: 22px; transition: filter var(--normal); }
.translation.veiled { filter: blur(7px); cursor: pointer; user-select: none; }

.line-tools { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 28px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 14px; transition: background-color var(--fast), color var(--fast); }
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip .icon { width: 16px; height: 16px; }

.play-btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.play-btn > .icon { width: 32px; height: 32px; padding: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 20px; }
.wave i { width: 3px; height: 40%; border-radius: 2px; background: currentColor; }
.wave i:nth-child(2) { height: 80%; } .wave i:nth-child(3) { height: 55%; } .wave i:nth-child(4) { height: 95%; } .wave i:nth-child(5) { height: 45%; }
.play-btn.playing .wave i { animation: eq 0.9s ease-in-out infinite; }
.play-btn.playing .wave i:nth-child(2) { animation-delay: -0.2s; } .play-btn.playing .wave i:nth-child(3) { animation-delay: -0.45s; }
.play-btn.playing .wave i:nth-child(4) { animation-delay: -0.1s; } .play-btn.playing .wave i:nth-child(5) { animation-delay: -0.6s; }

.acc-pill { display: flex; width: max-content; margin: 18px auto 0; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: 13px; }
.acc-pill b { color: var(--text); font-size: 14px; }
.acc-label { font-size: 11px; letter-spacing: 0.08em; }
.acc-errs { color: var(--error); }
.acc-errs:empty { display: none; }

/* ---------- Word card ---------- */
.quiz-card { text-align: center; padding: 36px 28px; border-radius: var(--r-xl); background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow); }
.quiz-word { display: inline-flex; align-items: center; gap: 12px; margin-top: 18px; font-family: var(--font-en); font-size: clamp(34px, 6vw, 52px); font-weight: 700; letter-spacing: -0.02em; }
.quiz-word .icon { width: 26px; height: 26px; color: var(--accent); }
.quiz-say { color: var(--text-muted); margin-top: 4px; }
.quiz-context { color: var(--text-faint); font-size: 15px; margin-top: 10px; }
.quiz-q { margin: 22px 0 12px; font-weight: 700; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid transparent; font-size: 18px; font-weight: 500; transition: background-color var(--fast), border-color var(--fast), transform var(--fast); }
.option:hover { background: var(--surface-hover); }
.option:active { transform: scale(0.98); }
.option .kbd { opacity: 0.6; }
.option.right { background: color-mix(in srgb, var(--success) 18%, var(--surface)); border-color: var(--success); }
.option.wrong { background: var(--error-soft); border-color: var(--error); }
@media (max-width: 520px) { .options { grid-template-columns: 1fr; } .line-card { padding: 32px 18px 22px; } }

/* ---------- Summary ---------- */
.summary { max-width: 640px; margin: 0 auto; padding: 56px 20px; text-align: center; }
.summary-badge { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.summary-badge .icon { width: 40px; height: 40px; }
.summary h1 { font-family: var(--font-display); font-size: 34px; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.summary-stats div { padding: 16px 8px; border-radius: var(--r-lg); background: var(--bg-elev); border: 1px solid var(--border); }
.summary-stats b { display: block; font-family: var(--font-en); font-size: 26px; }
.summary-stats span { font-size: 13px; color: var(--text-muted); }
.summary .note { color: var(--text-muted); }
.summary-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }
.mini-list { text-align: start; margin-top: 20px; display: flex; flex-direction: column; gap: 6px; }
.mini-list li { list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--bg-elev); border: 1px solid var(--border); font-size: 15px; }

@keyframes caret { 50% { opacity: 0.25; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes eq { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }
