/* ============================================================
   Inkwell · practice page (depends on theme.css)
   Comekey-style integrated dictation, mobile-first.
   ============================================================ */

.practice-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- top bar (compact, course-aware) ---- */
.fx-top {
  display: flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  color: var(--ink-3);
  gap: 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
  min-height: 44px;
  background: rgba(14,16,24,0.6);
  backdrop-filter: saturate(1.4) blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.fx-top .home, .fx-top .icon-btn {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  font: inherit;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.fx-top .home:hover, .fx-top .icon-btn:hover {
  background: var(--bg-2);
  color: var(--ink-1);
}
.fx-top .crumbs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-width: 0;
}
.fx-top .book, .fx-top .unit {
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  font: inherit;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-top .book:hover, .fx-top .unit:hover { background: var(--bg-2); color: var(--ink-1); }
.fx-top .sep { color: var(--ink-faint); }
.fx-top .progress-text {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.fx-top .meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-3);
}
.fx-top #timer { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.fx-top #wpm   { font-variant-numeric: tabular-nums; font-family: var(--mono); color: var(--ok); }
.fx-top .fav.on { color: var(--gold); }

@media (max-width: 720px) {
  .fx-top { font-size: 0.76rem; gap: 0.4rem; padding: 0.45rem 0.7rem; }
  .fx-top .book, .fx-top .unit { max-width: 9rem; }
  .fx-top #timer, .fx-top #wpm { display:none; }
}

/* ---- thin progress strip ---- */
.fx-bar {
  height: 2px;
  background: transparent;
  position: relative;
}
.fx-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--acc-2), var(--acc-1));
  box-shadow: 0 0 12px rgba(185,168,255,0.6);
  transition: width 0.4s ease;
}

/* ---- stage ---- */
.fx-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.2rem 1.5rem 7rem;
  gap: 1.4rem;
  text-align: center;
  position: relative;
}
.fx-cn {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  color: var(--ink-1);
  font-weight: 400;
  max-width: 60rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  margin: 0;
}
.fx-ipa {
  font-family: var(--mono);
  color: var(--ink-3);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  min-height: 1.2em;
  margin: 0;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}
.fx-ipa span { color: var(--ink-3); }

/* integrated sentence line */
.fx-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.2rem 0.85rem;
  max-width: 72rem;
  min-height: 60px;
  margin-top: 0.3rem;
}
.fx-word {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}
.fx-word .typed {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  line-height: 1.1;
  color: var(--ink-1);
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: pre;
  min-height: 1.5em;
  display: inline-flex;
  align-items: baseline;
}
.fx-word .typed .ch { display: inline-block; }
.fx-word .typed .cursor {
  display: inline-block;
  width: 0.5em;
  color: transparent;
}
.fx-word.current .typed .cursor {
  border-bottom: 2px solid var(--acc-1);
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { border-color: transparent; } }
.fx-word .dash {
  height: 2px;
  width: 100%;
  min-width: 1.4em;
  background: var(--rule);
  border-radius: 1px;
  transition: background 0.15s, width 0.2s, box-shadow 0.18s;
}
.fx-word.current .dash {
  background: var(--acc-1);
  box-shadow: 0 0 6px rgba(185,168,255,0.4);
}
.fx-word.done .dash { background: rgba(185,168,255,0.45); }
.fx-word.flash { animation: shake 0.32s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-5px); }
  75%     { transform: translateX(5px); }
}

/* big Good! banner */
.fx-good {
  position: absolute;
  top: 64%;
  left: 50%;
  transform: translate(-50%, 1.4rem);
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--ok);
  letter-spacing: 0.02em;
  opacity: 0;
  text-shadow: 0 0 24px rgba(111,211,155,0.45);
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.fx-good.on { opacity: 1; animation: pop 0.6s ease-out; }
@keyframes pop {
  0%   { transform: translate(-50%, 2.6rem) scale(0.6); opacity: 0; }
  60%  { transform: translate(-50%, 1.2rem) scale(1.06); opacity: 1; }
  100% { transform: translate(-50%, 1.4rem) scale(1); opacity: 1; }
}

/* combo badge */
.fx-combo {
  position: absolute;
  bottom: 8rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.fx-combo[hidden] { display: none !important; }
.fx-combo.on { opacity: 1; }
.fx-combo .label {
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  opacity: 0.85;
}
.fx-combo .num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1;
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 60%, #c89a30 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(236,193,92,0.4));
}
.fx-combo.pop .num { animation: combo-pop 0.45s ease-out; }
@keyframes combo-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

/* sound dot — tiny visual feedback so users know keys register even if audio is off */
.fx-sound-dot {
  position: fixed;
  right: 18px;
  bottom: 64px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acc-1);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(185,168,255,0.6);
  transition: opacity 0.18s;
}
.fx-sound-dot.on { opacity: 0.9; animation: dot-pop 0.18s; }
@keyframes dot-pop {
  0% { transform: scale(0.5); }
  100% { transform: scale(1); }
}

/* hidden input for mobile keyboard */
.fx-input { position: absolute; opacity: 0; pointer-events: none; }

/* round done */
.fx-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  padding: 3rem 1rem;
  text-align: center;
}
.fx-done h2 { font-family: var(--serif); font-weight: 400; font-size: 2rem; margin: 0; }
.fx-done p { color: var(--ink-3); margin: 0; }
.fx-done .row { display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center; }

/* bottom hints */
.fx-keys {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 1.2rem;
  padding: 0.85rem 1.5rem 1.05rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-soft);
  background: rgba(14,16,24,0.85);
  backdrop-filter: blur(10px);
}
.fx-keys .grp { display: inline-flex; align-items: center; gap: 0.4rem; }
.fx-key {
  display: inline-flex;
  align-items: center; justify-content: center;
  padding: 2px 7px;
  min-width: 1.5em;
  border: 1px solid var(--rule);
  background: var(--bg-2);
  color: var(--ink-2);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.74rem;
}
.fx-keys .plus { color: var(--ink-faint); padding: 0 1px; }
@media (max-width: 720px) {
  .fx-keys { font-size: 0.7rem; gap: 0.5rem; padding: 0.6rem 0.8rem 0.7rem; }
  .fx-keys .grp:nth-child(n+4) { display: none; }
}

/* modal */
.fx-modal-back {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
  padding: 1rem;
}
.fx-modal-back[hidden] { display: none !important; }
.fx-modal {
  background: var(--bg-1-solid);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 1.4rem 1.6rem;
  width: 100%;
  max-width: 580px;
  color: var(--ink-1);
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--sh-lg);
}
.fx-modal h3 { margin: 0 0 1rem; font-family: var(--serif); font-weight: 400; font-size: 1.1rem; }
.fx-modal .close {
  float: right;
  background: transparent;
  color: var(--ink-3);
  border: 0;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.fx-modal .close:hover { color: var(--ink-1); }

.cat-group { margin-bottom: 0.8rem; }
.cat-title {
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.5rem 0.2rem 0.35rem;
}
.cat-book {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink-1);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  font: inherit;
  transition: all 0.12s;
}
.cat-book:hover, .cat-book.on {
  background: var(--bg-2);
  border-color: var(--acc-1);
}
.cat-book strong { color: var(--ink-1); }
.cat-book small { display: block; color: var(--ink-3); margin-top: 0.25rem; font-size: 0.82rem; }

.unit-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink-1);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  font: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  transition: all 0.12s;
}
.unit-list button:hover, .unit-list button.on {
  background: var(--bg-2);
  border-color: var(--acc-1);
}
.unit-list .count { color: var(--ink-3); font-size: 0.8rem; font-family: var(--mono); }


/* ---- daily goal pill ---- */
.fx-top .goal {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.8rem;
}
.fx-top .goal[hidden] { display: none; }
.fx-top .goal .goal-icon { font-size: 0.85rem; }
.fx-top .goal .goal-text { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.fx-top .goal .goal-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.fx-top .goal .goal-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width 0.4s ease;
}
.fx-top .goal.done .goal-bar > span { background: linear-gradient(90deg, var(--ok-soft), var(--ok)); }
@media (max-width: 880px) {
  .fx-top .goal .goal-bar { width: 50px; }
}
@media (max-width: 720px) {
  .fx-top .goal { display: none; }
}

/* ---- confetti canvas ---- */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

/* ---- light theme override ---- */
body.light-theme {
  background:
    radial-gradient(ellipse 60% 35% at 18% -10%, rgba(138,123,255,0.12), transparent 60%),
    radial-gradient(ellipse 45% 30% at 90% 100%, rgba(77,107,255,0.08), transparent 60%),
    #fbfaf6;
  color: #1a1814;
}
body.light-theme .fx-top { background: rgba(251,250,246,0.85); border-bottom-color: rgba(0,0,0,0.08); }
body.light-theme .fx-top .home, body.light-theme .fx-top .icon-btn { color: #3a362f; }
body.light-theme .fx-top .home:hover, body.light-theme .fx-top .icon-btn:hover { background: rgba(0,0,0,0.05); color: #1a1814; }
body.light-theme .fx-top .book, body.light-theme .fx-top .unit { color: #1a1814; }
body.light-theme .fx-top .book:hover, body.light-theme .fx-top .unit:hover { background: rgba(0,0,0,0.05); }
body.light-theme .fx-top .progress-text, body.light-theme .fx-top .meta { color: #6b6658; }
body.light-theme .fx-top #wpm { color: var(--ok); }
body.light-theme .fx-bar { }
body.light-theme .fx-cn  { color: #1a1814; }
body.light-theme .fx-ipa, body.light-theme .fx-ipa span { color: #6b6658; }
body.light-theme .fx-word .typed { color: #1a1814; }
body.light-theme .fx-word .dash { background: #d4cfbf; }
body.light-theme .fx-word.current .dash { background: var(--acc-2); }
body.light-theme .fx-word.done .dash { background: rgba(138,123,255,0.5); }
body.light-theme .fx-keys { background: rgba(251,250,246,0.92); border-top-color: rgba(0,0,0,0.08); color: #6b6658; }
body.light-theme .fx-key { background: #f0ecdf; border-color: rgba(0,0,0,0.08); color: #3a362f; }
body.light-theme .fx-modal { background: #fffdf7; border-color: rgba(0,0,0,0.1); color: #1a1814; }
body.light-theme .cat-book, body.light-theme .unit-list button { color: #1a1814; border-color: rgba(0,0,0,0.08); }
body.light-theme .cat-book:hover, body.light-theme .cat-book.on,
body.light-theme .unit-list button:hover, body.light-theme .unit-list button.on { background: #f0ecdf; border-color: var(--acc-2); }
body.light-theme .cat-book strong { color: #1a1814; }
body.light-theme .cat-book small, body.light-theme .unit-list .count { color: #6b6658; }
body.light-theme .fx-good { color: var(--ok); }
body.light-theme .fx-top .goal { background: #fffdf7; border-color: rgba(0,0,0,0.08); color: #3a362f; }

/* ---- mistake-bank single-word play helper for profile page (used by profile.js to inject a small replay button) ---- */
