/* Daily Build lesson player. See DESIGN.md and docs/lesson-design.md.
   Layout and editor chrome only. Tokens live in tokens.css and shared components
   (.btn .option .feedback .progress .stat .mascot .field) in components.css.
   The page runs in the space theme (<html data-theme="space">).

   The first question comes alone (data-stage="solo"). After it the task docks and the tool slides in
   (data-stage="dock"). Two layouts, one markup:
     >= 900px   task column on the LEFT, AI chat in the middle, your app on the right
                (below ~1060px the chat and the app share one pane and the app becomes a tab)
     < 900px    the tool fills the screen with tabs (Chat, Your app, ...); the task is a bottom drawer
                with two states, open and closed */

/* ==========================================================================
   Page-only values (no token exists for these)
   ========================================================================== */

.pl {
  --pl-col-w: clamp(340px, 29vw, 400px);
  --pl-solo-w: min(640px, calc(100% - 32px));
  --pl-code-fs: 13px;
  --pl-chat-fs: 15px;
  --pl-micro: 12px;
  --pl-top-h: 64px;
  --pl-ease: cubic-bezier(0.3, 0.9, 0.3, 1);

  /* Editor surfaces, all derived from the space tokens */
  --pl-app: var(--space-900);
  --pl-panel: var(--bg);
  --pl-code: var(--space-950);
  --pl-edge: color-mix(in srgb, var(--line) 62%, var(--bg));
  --pl-add: color-mix(in srgb, var(--mint-400) 13%, transparent);
  --pl-del: color-mix(in srgb, var(--pink-400) 14%, transparent);
  --pl-ink-soft: color-mix(in srgb, var(--text) 82%, var(--bg));
  --pl-dock: color-mix(in srgb, var(--surface) 38%, var(--bg));
}

html,
body {
  height: 100%;
}

.pl-diff,
.pl-code,
.pl-term,
.pv-src,
.pl-file,
.pl-mono,
.pl-crow .hs,
.pl-url {
  font-variant-ligatures: none;
}

body {
  overflow: hidden;
  background: var(--pl-app, var(--space-900));
}

.pl-noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  margin: 0;
  padding: var(--sp-5);
  background: var(--bg);
  text-align: center;
}

.pl {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--pl-app);
  color: var(--text);
  animation: pl-enter var(--dur-slow) var(--ease-out) both;
}

@keyframes pl-enter {
  from { opacity: 0; transform: scale(1.012); }
  to { opacity: 1; transform: none; }
}

@keyframes pl-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}


@keyframes pl-dots {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes pl-unlock {
  0% { opacity: 0; transform: scale(0.88) rotate(-2deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes pl-stamp {
  0% { transform: scale(1.8) rotate(-14deg); opacity: 0; }
  100% { transform: scale(1) rotate(-6deg); opacity: 1; }
}

@keyframes pl-drop {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes pl-burst {
  0% { opacity: 0; transform: rotate(45deg) scale(0.2); }
  40% { opacity: 1; transform: rotate(135deg) scale(1.25); }
  100% { opacity: 0; transform: rotate(225deg) scale(0.7); }
}

@keyframes pl-glitch {
  0% { transform: none; }
  8% { transform: translateX(-4px) skewX(-4deg); }
  10% { transform: translateX(3px); }
  12% { transform: none; }
  55% { transform: none; }
  57% { transform: translateX(5px) skewX(5deg); }
  59% { transform: none; }
}

.pl-in {
  animation: pl-in var(--dur-med) var(--ease-out) both;
}

/* ==========================================================================
   Top bar: close, progress, XP (and Words on big screens)
   ========================================================================== */

.pl-top {
  position: relative;
  z-index: 20;
  flex: none;
  display: grid;
  grid-template-columns: 1fr minmax(0, 460px) 1fr;
  align-items: center;
  gap: var(--sp-4);
  height: calc(var(--pl-top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(var(--sp-5), env(safe-area-inset-right, 0px)) 0 max(var(--sp-5), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--pl-edge);
  background: var(--pl-panel);
}

.pl-x {
  justify-self: start;
}

.pl-icon-btn {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) linear, color var(--dur-fast) linear;
}

@media (hover: hover) {
  .pl-icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

/* Progress: one segment per step, filled mint as steps are done. New-word cards do not move it. */
.pl-segs {
  display: flex;
  gap: var(--sp-2);
}

.pl-seg {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  transition: background-color var(--dur-med) linear;
}

.pl-seg.is-cur {
  background: var(--space-500);
}

.pl-seg__f {
  width: 0;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--mint-400);
  transition: width var(--dur-slow) var(--ease-spring);
}

.pl-seg.is-done .pl-seg__f {
  width: 100%;
}

.pl-stats {
  position: relative;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.pl-stats .stat {
  position: relative;
  font-size: 18px;
}

.pl-plus {
  position: absolute;
  left: 50%;
  top: 100%;
  margin-top: 2px;
  color: var(--sun-400);
  font-size: var(--fs-1);
  font-weight: 900;
  pointer-events: none;
  animation: pl-plus 1.1s var(--ease-out) both;
}

@keyframes pl-plus {
  0% { opacity: 0; transform: translate(-50%, -4px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 18px); }
}

/* The Words button: the top bar on big screens, the drawer header on phones */
.pl-words-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) linear;
}

.pl-words-btn svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--violet-300);
}

.pl-words-btn__n {
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .pl-words-btn:hover {
    background: var(--surface-2);
  }
}

.pl-words-btn.is-pop {
  animation: db-pop var(--dur-slow) var(--ease-spring);
}

.pl-words-btn--sheet {
  display: none;
}

/* ==========================================================================
   Stage: the task and the tool
   ========================================================================== */

.pl-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  --pl-drawer-h: 0px;
}

.pl-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.5s linear;
}

.pl-stars i {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.5;
}

.pl[data-stage="dock"] .pl-stars {
  opacity: 0;
}

.pl-body.is-instant *,
.pl-body.is-instant {
  transition: none !important;
}

/* ---- The tool: appears after the first question ---- */

.pl-ws {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: var(--pl-col-w);
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--pl-app);
  opacity: 0;
  visibility: hidden;
  transform: translateX(36px);
  transition:
    opacity 0.5s ease-out 0.2s,
    transform 0.5s var(--ease-out) 0.2s,
    visibility 0s linear 0.7s,
    padding-bottom 0.25s var(--pl-ease) 0s;
}

.pl[data-stage="dock"] .pl-ws {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.5s ease-out 0.2s,
    transform 0.5s var(--ease-out) 0.2s,
    visibility 0s linear 0s,
    padding-bottom 0.25s var(--pl-ease) 0s;
}

.pl-ws[data-split="1"] {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pl-bar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  min-height: 52px;
  padding: var(--sp-1) var(--sp-3);
  border-bottom: 1px solid var(--pl-edge);
}

.pl-split {
  display: contents;
}

.pl-pane {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pl-prev {
  grid-column: 1;
  grid-row: 2;
}

.pl-ws[data-split="1"] .pl-prev {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.pl-ws[data-split="0"][data-tab="preview"] .pl-pane,
.pl-ws[data-split="0"]:not([data-tab="preview"]) .pl-prev {
  display: none;
}

.pl-chatwrap,
.pl-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pl-panel {
  overflow: auto;
}

/* ---- The task: a card at first, then a column on the left ---- */

.pl-coach {
  --pl-pad-x: var(--sp-5);
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 0 solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  transition:
    left 0.5s var(--pl-ease),
    width 0.5s var(--pl-ease),
    top 0.5s var(--pl-ease),
    bottom 0.5s var(--pl-ease),
    border-radius 0.5s var(--pl-ease),
    border-width 0.5s var(--pl-ease),
    background-color 0.5s linear,
    box-shadow 0.5s linear;
}

.pl[data-stage="solo"] .pl-coach {
  --pl-pad-x: 36px;
  left: calc((100% - var(--pl-solo-w)) / 2);
  width: var(--pl-solo-w);
  top: 20px;
  bottom: 20px;
  border-width: var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 0 var(--space-900);
}

.pl[data-stage="dock"] .pl-coach {
  left: 0;
  width: var(--pl-col-w);
  top: 0;
  bottom: 0;
  border-right-width: 1px;
  border-color: var(--pl-edge);
  border-radius: 0;
  background: var(--pl-dock);
  box-shadow: 0 0 0 var(--space-900);
}

.pl-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: 28px var(--pl-pad-x) var(--sp-4);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  transition: opacity 0.25s ease-out;
}

.pl[data-stage="solo"] .pl-scroll {
  padding-top: 32px;
}

.pl[data-stage="solo"] .pl-scroll > :first-child {
  margin-top: auto;
}

.pl[data-stage="solo"] .pl-scroll > :last-child {
  margin-bottom: auto;
}

/* While the card docks, its words fade out and the new ones fade in */
.pl-coach.is-docking .pl-scroll,
.pl-coach.is-docking .pl-foot-slot {
  opacity: 0;
  transition: opacity 0.15s ease-in;
}

.pl-scroll.is-swap-a { animation: pl-swap-a 0.35s ease-out; }
.pl-scroll.is-swap-b { animation: pl-swap-b 0.35s ease-out; }

@keyframes pl-swap-a {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pl-swap-b {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

.pl-foot-slot {
  flex: none;
}

/* The drawer header only exists on phones and small screens */
.pl-hd {
  display: none;
}


/* ==========================================================================
   Tool: tabs, toolbar, toast
   ========================================================================== */

.pl-tabs {
  display: flex;
  gap: var(--sp-1);
}

.pl-tab {
  position: relative;
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--space-faint);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) linear, color var(--dur-fast) linear;
}

@media (hover: hover) {
  .pl-tab:hover {
    color: var(--text);
  }
}

.pl-tab.is-on {
  background: var(--surface);
  color: var(--text);
}

.pl-tab__short {
  display: none;
}

.pl-tab.is-enter {
  animation: pl-tabin 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

@keyframes pl-tabin {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

.pl-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}

.pl-tools__btns {
  display: flex;
  gap: var(--sp-2);
}

.pl-tool-wrap {
  position: relative;
}

.pl-tool {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-med) var(--ease-spring),
    border-color var(--dur-fast) linear,
    color var(--dur-fast) linear;
}

.pl-tool svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.pl-tool:active {
  transform: scale(0.96);
  transition-duration: var(--dur-fast);
}


.pl-tool.is-did {
  border-color: var(--mint-400);
  color: var(--mint-400);
}

.pl-tool__short {
  display: none;
}

.pl-tip {
  position: absolute;
  right: 0;
  top: calc(100% + var(--sp-2));
  z-index: 6;
  padding: 6px var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-1);
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  animation: pl-drop var(--dur-med) var(--ease-out) both;
}

.pl-pop {
  position: absolute;
  right: 0;
  top: calc(100% + var(--sp-2));
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 320px;
  max-width: calc(100vw - 2 * var(--sp-4));
  padding: var(--sp-4);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: pl-drop var(--dur-med) var(--ease-spring) both;
}

.pl-pop__note {
  color: var(--text-muted);
  font-size: var(--fs-1);
  line-height: 1.4;
}

.pl-pop__row {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.pl-pop .field__input {
  min-height: 48px;
  background: var(--pl-app);
}

.pl-toast {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 260px;
  padding: 6px var(--sp-3);
  border: var(--border) solid var(--mint-400);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--mint-400) 14%, var(--pl-app));
  color: var(--mint-400);
  font-size: var(--fs-1);
  font-weight: 800;
  line-height: 1.2;
  animation: pl-drop var(--dur-med) var(--ease-spring) both;
}

.pl-toast svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.pl-toast span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Chat ---- */

/* ---- Chat ---- */

.pl-chat {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  font-size: var(--pl-chat-fs);
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.pl-you {
  align-self: flex-end;
  max-width: 84%;
  padding: 9px var(--sp-4);
  border-radius: var(--r-md) var(--r-md) 4px var(--r-md);
  background: var(--space-500);
  color: var(--paper);
  font-weight: 700;
}

.pl-you.is-bad {
  background: var(--pink-400);
  color: var(--ink);
}

.pl-ai {
  align-self: flex-start;
  display: flex;
  gap: var(--sp-3);
  width: 100%;
  max-width: 96%;
}

.pl-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--sky-400), var(--violet-300));
  color: var(--space-900);
  font-size: var(--pl-micro);
  font-weight: 900;
}

.pl-aitext {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  color: var(--pl-ink-soft);
}

.pl-aitext p {
  margin: 0;
}

.pl-sys {
  align-self: center;
  max-width: 94%;
  padding: 5px var(--sp-3);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--mint-400) 12%, transparent);
  color: var(--mint-400);
  font-size: var(--fs-1);
  font-weight: 800;
  text-align: center;
}

.pl-sys.is-warn {
  background: color-mix(in srgb, var(--sun-400) 12%, transparent);
  color: var(--sun-400);
}

.pl-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: var(--sp-3) 14px;
  border-radius: var(--r-md);
  background: var(--surface);
}

.pl-typing i {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--space-faint);
  animation: pl-dots 1s infinite;
}

.pl-typing i:nth-child(2) { animation-delay: 0.15s; }
.pl-typing i:nth-child(3) { animation-delay: 0.3s; }

.pl-chat code,
.pl-ctx code,
.pl-q code,
.pl-task code,
.pl-warn code,
.feedback code,
.pl-word code,
.pl-pop__note code {
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--violet-300) 18%, transparent);
  font-weight: 700;
}

/* ---- Code blocks: diffs in chat, files in the Files tab ---- */

.pl-diff {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--pl-edge);
  border-radius: var(--r-sm);
  background: var(--pl-code);
  font-family: var(--font-mono);
  font-size: var(--pl-code-fs);
  line-height: 1.7;
}

.pl-diff__hd {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 7px var(--sp-3);
  border-bottom: 1px solid var(--pl-edge);
  color: var(--space-muted);
}

.pl-diff__hd .cnt--add { color: var(--mint-400); }
.pl-diff__hd .cnt--del { color: var(--pink-400); }

.pl-diff__body {
  padding: var(--sp-1) 0;
  overflow-x: auto;
}

.ln {
  display: flex;
  gap: var(--sp-3);
  min-width: max-content;
  padding: 0 var(--sp-3);
  white-space: pre;
}

.ln .no {
  flex: none;
  width: 22px;
  color: var(--space-500);
  text-align: right;
  user-select: none;
}

.ln .sg {
  flex: none;
  width: 8px;
  user-select: none;
}

.ln--add { background: var(--pl-add); color: var(--mint-400); }
.ln--del { background: var(--pl-del); color: var(--pink-400); }
.ln--bad { background: var(--pl-del); color: var(--pink-400); }
.ln--good { background: var(--pl-add); color: var(--mint-400); }

.ln .k { color: var(--violet-300); }
.ln .s { color: var(--sun-400); }
.ln .t { color: var(--sky-400); }
.ln .c { color: var(--space-faint); }
.ln--add .k, .ln--add .s, .ln--add .t, .ln--add .c,
.ln--del .k, .ln--del .s, .ln--del .t, .ln--del .c,
.ln--bad .k, .ln--bad .s, .ln--bad .t, .ln--bad .c,
.ln--good .k, .ln--good .s, .ln--good .t, .ln--good .c {
  color: inherit;
}

.pl-diff.is-reverted .ln {
  opacity: 0.38;
  text-decoration: line-through;
}

.pl-stamp {
  position: absolute;
  right: var(--sp-3);
  top: 38px;
  padding: 2px var(--sp-3);
  border: 3px solid var(--mint-400);
  border-radius: var(--r-sm);
  background: var(--pl-code);
  color: var(--mint-400);
  font-family: var(--font-body);
  font-size: var(--fs-2);
  font-weight: 900;
  letter-spacing: 0.04em;
  transform: rotate(-6deg);
  animation: pl-stamp var(--dur-med) var(--ease-spring) both;
}

/* ---- Composer ---- */

.pl-comp {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 var(--sp-4) var(--sp-4);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border: var(--border) solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-med) linear;
}

.pl-comp.is-live {
  border-color: var(--line-strong);
}

.pl-comp:not(.is-live) {
  opacity: 0.7;
}

.pl-comp__tx {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--pl-chat-fs);
  font-weight: 700;
  text-overflow: ellipsis;
  outline: none;
  cursor: default;
}

.pl-comp__tx::placeholder {
  color: var(--space-faint);
  opacity: 1;
}


.pl-acts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-inline: var(--sp-4);
}

.pl-acts:empty {
  display: none;
}

.pl-acts:not(:empty) {
  padding-bottom: var(--sp-3);
}

/* ---- Task targets: the real controls the learner uses ---- */

.pl-target {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--sun-400);
  color: var(--sun-ink);
  box-shadow: 0 var(--lip-sm) 0 var(--sun-600);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  font-weight: 900;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-med) var(--ease-spring), box-shadow var(--dur-med) var(--ease-spring);
}

.pl-target svg {
  width: 16px;
  height: 16px;
}

.pl-target:active {
  transform: translateY(var(--lip-sm));
  box-shadow: 0 0 0 var(--sun-600);
  transition-duration: var(--dur-fast);
}

.pl-target--inline {
  margin: var(--sp-2) var(--sp-3) var(--sp-1) 50px;
  font-family: var(--font-body);
}

.pl-target--row {
  min-height: 36px;
}

.is-flash {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---- History ---- */

.pl-hist {
  padding: var(--sp-4);
}

.pl-hist__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-2);
}

.pl-hist__head h3 {
  font-family: var(--font-body);
  font-size: var(--fs-3);
  font-weight: 900;
}

.pl-mono {
  color: var(--space-faint);
  font-family: var(--font-mono);
  font-size: var(--pl-micro);
}

.pl-crows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-crow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3) var(--sp-1);
  border-bottom: 1px solid var(--pl-edge);
  font-size: var(--fs-1);
}

.pl-crow .hs {
  width: 7ch;
  color: var(--space-faint);
  font-family: var(--font-mono);
  font-size: var(--pl-micro);
}

.pl-crow .ms {
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  line-height: 1.3;
}

.pl-crow .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.pl-crow .tm {
  min-width: 4ch;
  color: var(--space-faint);
  font-size: var(--pl-micro);
  text-align: right;
}

.pl-crow .act {
  grid-column: 2 / -1;
}

.pl-crow.is-gone .ms {
  color: var(--space-faint);
  text-decoration: line-through;
}

.pl-crow.is-new {
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--sun-400) 8%, transparent);
  animation: pl-drop var(--dur-slow) var(--ease-spring) both;
}

.pl-tag {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--sun-400);
  color: var(--sun-ink);
  font-size: var(--pl-micro);
  font-weight: 900;
  animation: pl-stamp var(--dur-med) var(--ease-spring) both;
}

.pl-tag--head {
  background: var(--mint-400);
  color: var(--mint-ink);
  animation: none;
}

.pl-hist__note {
  margin-top: var(--sp-4);
  color: var(--space-muted);
  font-size: var(--fs-1);
  line-height: 1.5;
}

.pl-hist .pl-target--bar {
  margin-top: var(--sp-3);
}

.pl-files + .pl-target--bar,
.pl-target--bar {
  align-self: flex-start;
}

/* ---- Files ---- */

.pl-files {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Files open like editor tabs, so the code always gets the full width of the panel. */
.pl-tree {
  flex: none;
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border-bottom: 1px solid var(--pl-edge);
  overflow-x: auto;
  scrollbar-width: none;
}

.pl-tree::-webkit-scrollbar {
  display: none;
}

.pl-tree__root {
  display: none;
}

.pl-file {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--space-muted);
  font-family: var(--font-mono);
  font-size: var(--pl-code-fs);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .pl-file:hover {
    background: var(--surface);
    color: var(--text);
  }
}

.pl-file.is-on {
  background: var(--surface);
  color: var(--text);
}

.pl-code {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: var(--sp-3) 0;
  background: var(--pl-code);
  font-family: var(--font-mono);
  font-size: var(--pl-code-fs);
  line-height: 1.9;
}

.pl-code .ln {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pl-code .ln .tx { min-width: 0; }

/* ---- Terminal ---- */

.pl-term {
  flex: 1;
  min-height: 0;
  padding: var(--sp-4);
  background: var(--pl-code);
  font-family: var(--font-mono);
  font-size: var(--pl-code-fs);
  line-height: 1.8;
}

.tl { white-space: pre-wrap; word-break: break-word; color: var(--space-muted); }
.tl--cmd { color: var(--text); }
.tl--ok { color: var(--mint-400); }
.tl--err { color: var(--pink-400); }
.tl--muted { color: var(--space-faint); }

.pl-empty {
  padding: var(--sp-5);
  color: var(--space-faint);
}

/* ---- Your app ---- */

.pl-prev {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--pl-edge);
  background: var(--pl-panel);
}

.pl-ws[data-split="0"] .pl-prev {
  border-left: 0;
}

.pl-prev__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  height: 52px;
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--pl-edge);
}

.pl-prev__head h2 {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 900;
}

.pl-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.pl-live i {
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--mint-400);
}

.pl-live--bad i {
  background: var(--pink-400);
}

.pl-prev__body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: var(--sp-4);
}

.pl-browser {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-float);
}

.pl-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px var(--sp-3);
  background: var(--surface-2);
}

.pl-chrome i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink-2) 35%, var(--paper));
}

.pl-url {
  flex: 1;
  min-width: 0;
  margin-left: var(--sp-2);
  padding: 3px var(--sp-3);
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--pl-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: var(--fs-1);
  line-height: 1.4;
}

.pl-browser--source {
  background: var(--pl-code);
}

.pl-browser--source .pl-screen {
  color: var(--space-text);
}


/* Preview kit: small helpers for the pretend app screens in lesson content. */

.pv-pad { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4); min-height: 100%; }
.pv-pad--bad { background: var(--pink-50); }
.pv-brand { color: var(--orange-400); font-family: var(--font-display); font-size: var(--fs-4); line-height: 1; }
.pv-h { font-size: var(--fs-3); font-weight: 900; line-height: 1.2; }
.pv-p { margin: 0; color: var(--ink-2); }
.pv-note { margin: 0; color: var(--ink-2); font-size: var(--pl-micro); text-align: center; }
.pv-field { padding: 10px var(--sp-3); border: var(--border) solid var(--line); border-radius: var(--r-sm); color: var(--ink-2); }
.pv-btn { position: relative; padding: 11px var(--sp-3); border-radius: var(--r-sm); background: var(--orange-400); color: var(--ink); font-weight: 900; text-align: center; }
.pv-btn--mint { background: var(--mint-400); color: var(--mint-ink); }
.pv-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.pv-card { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); border: var(--border) solid var(--line-strong); border-radius: var(--r-md); background: var(--paper); }
.pv-card--bad { border-color: var(--pink-400); }
.pv-badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--pink-400); color: var(--ink); font-size: var(--fs-4); font-weight: 900; }
.pv-err { padding: var(--sp-2); border-radius: 8px; background: var(--pink-50); color: var(--pink-600); font-family: var(--font-mono); font-size: var(--pl-micro); line-height: 1.5; }
.pv-skel { height: 12px; width: 90%; border-radius: 6px; background: var(--ink); opacity: 0.12; }
.pv-skel--short { width: 60%; }
.pv-tag { margin-left: var(--sp-1); padding: 1px 7px; border-radius: 6px; background: var(--sun-400); color: var(--sun-ink); font-size: var(--pl-micro); font-weight: 900; }
.pv-glitch { animation: pl-glitch 2.2s steps(1) infinite; }
.pv-src { display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3); font-family: var(--font-mono); font-size: var(--pl-micro); line-height: 1.8; color: var(--pl-ink-soft); }
.pv-c { color: var(--space-faint); }
.pv-leak { padding: 2px 6px; border-radius: 6px; background: var(--pl-del); color: var(--pink-400); }
.pv-pin { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 8px; background: var(--pink-400); color: var(--ink); font-family: var(--font-body); font-weight: 900; }
.pv-ok-line { color: var(--mint-400); }
.pv-ok { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); padding: var(--sp-3); border: var(--border) solid var(--mint-400); border-radius: var(--r-sm); background: var(--pl-add); color: var(--mint-400); font-family: var(--font-body); font-size: var(--fs-2); font-weight: 900; }

/* Maya's Bakery screens (lessons 1 and 2). Built in scripts/lessons/bakery-screens.js.
   "gn-" is the generic template, "bk-" is Maya's real app. They use their own warm
   colors on purpose: this is the learner's pretend app, not Daily Build. */
.gn h2, .gn h3, .bk h2 { font-family: var(--font-body); }
.gn { min-height: 100%; background: #FFFFFF; color: #3C4350; font-size: 13px; }
.gn-nav { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid #E3E6EB; color: #7A828F; font-size: 12px; }
.gn-nav b { margin-right: auto; color: #3C4350; font-size: 14px; }
.gn-img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; background: #D5DAE1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M6 30l9-11 6 7 5-5 8 9z' fill='%23B3BAC6'/%3E%3Ccircle cx='28' cy='12' r='4' fill='%23B3BAC6'/%3E%3C/svg%3E") center / 38% no-repeat; }
.gn-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 14px 18px; text-align: center; }
.gn-hero .gn-img { aspect-ratio: 16 / 6; }
.gn-hero h2 { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.gn-hero p { margin: 0; color: #7A828F; }
.gn-btn { display: inline-block; padding: 8px 16px; border-radius: 4px; background: #4A7BD8; color: #FFFFFF; font-size: 12px; font-weight: 700; }
.gn-sec { padding: 12px 14px; border-top: 1px solid #E3E6EB; }
.gn-sec h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.gn-posts, .gn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gn-post, .gn-card { display: flex; flex-direction: column; gap: 4px; }
.gn-post span { color: #4A7BD8; font-size: 12px; }
.gn-card span { color: #7A828F; }
.gn-card .gn-img { aspect-ratio: 16 / 10; }
.gn-news { background: #F2F4F7; }
.gn-form { display: flex; gap: 8px; align-items: center; }
.gn-form > span:first-child { flex: 1; padding: 8px 10px; border: 1px solid #CDD2DA; border-radius: 4px; background: #FFFFFF; color: #9AA1AD; }
.gn-foot { padding: 12px 14px; border-top: 1px solid #E3E6EB; color: #9AA1AD; font-size: 11px; text-align: center; }

.bk { display: flex; flex-direction: column; min-height: 100%; background: #FFF8EE; color: #3A2616; }
.bk-nav { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 16px 4px; }
.bk-brand { color: #C8501F; font-size: 18px; font-weight: 900; letter-spacing: -0.01em; }
.bk-open { color: #8A6D52; font-size: 12px; font-weight: 700; }
.bk-hero { padding: 6px 16px 6px; }
.bk-title { margin: 0; font-size: 25px; font-weight: 900; line-height: 1.1; letter-spacing: -0.01em; }
.bk-lede { margin: 4px 0 0; color: #7A5F46; }
.bk-sec { padding: 8px 16px 0; }
.bk-label { margin: 0 0 2px; font-size: 14px; font-weight: 900; }
.bk-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #F1E0C8; }
.bk-thumb { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #FBE7C6; }
.bk-thumb svg { width: 36px; height: 36px; }
.bk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bk-name { font-weight: 800; }
.bk-sub { color: #8A6D52; font-size: 12px; }
.bk-price { font-weight: 800; }
.bk-add { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #C8501F; color: #FFFFFF; font-size: 20px; font-weight: 700; line-height: 1; }
.bk-add--on { background: #3A2616; font-size: 14px; font-weight: 900; }
.bk-gone { display: inline-block; width: 36px; height: 10px; border-radius: 5px; background: #3A2616; opacity: 0.14; }
.bk-chips { display: flex; gap: 8px; padding-top: 6px; }
.bk-chip { padding: 8px 14px; border: 2px solid #E8D3B3; border-radius: 999px; font-weight: 800; }
.bk-chip--on { border-color: #C8501F; background: #C8501F; color: #FFFFFF; }
.bk-chip--gone { width: 64px; height: 38px; padding: 0; border-style: dashed; opacity: 0.5; }
.bk-bar { position: sticky; bottom: 0; margin-top: auto; padding: 8px 16px; border-top: 1px solid #F1E0C8; background: #FFF8EE; }
.bk-bar .bk-cta { margin: 0; }
.bk-cta { margin: 14px 16px 6px; padding: 11px; border-radius: 14px; background: #C8501F; color: #FFFFFF; font-weight: 900; text-align: center; }
.bk-cta--pay { background: #1F8A5B; }
.bk-cta--alt { margin: 14px 16px 14px; border: 2px solid #C8501F; background: transparent; color: #C8501F; }
.bk-cta--off { background: #D9C7B0; }
.bk-fine { margin: 10px 16px 12px; color: #8A6D52; font-size: 12px; text-align: center; }
.bk-sum { display: flex; justify-content: space-between; padding: 12px 0 0; font-weight: 800; }
.bk-crash { margin: 6px 16px 0; padding: 12px; border: 2px solid #FF5C7A; border-radius: 14px; background: #FFFFFF; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 10px; }
.bk-crash .pv-err { grid-column: 1 / -1; }
.bk-crash .pv-badge { width: 28px; height: 28px; font-size: 16px; }

/* ==========================================================================
   The words list (inside the Words dialog)
   ========================================================================== */

.pl-h {
  margin: 0 0 var(--sp-2);
  padding-inline: var(--sp-1);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  font-weight: 800;
  line-height: 1.3;
}

.pl-h--lesson {
  margin-top: var(--sp-6);
}

.pl-olist {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-ostep {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: var(--fs-1);
  font-weight: 800;
  line-height: 1.3;
}

.pl-ostep__n {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: var(--border) solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--pl-micro);
  line-height: 1;
}

.pl-ostep__n svg {
  width: 14px;
  height: 14px;
}

.pl-ostep.is-cur {
  background: var(--surface);
  color: var(--text);
}

.pl-ostep.is-cur .pl-ostep__n {
  border-color: var(--sun-400);
  color: var(--sun-400);
}

.pl-ostep.is-done {
  color: var(--pl-ink-soft);
}

.pl-ostep.is-done .pl-ostep__n {
  border-color: var(--mint-400);
  background: var(--mint-400);
  color: var(--mint-ink);
}

.pl-word {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-1);
  line-height: 1.35;
}

.pl-word b {
  font-size: var(--fs-2);
  font-weight: 900;
}

.pl-word.is-on {
  border: var(--border) solid var(--line-strong);
  background: var(--surface);
}

.pl-word.is-on b {
  color: var(--sun-400);
}

.pl-word.is-on span {
  color: var(--pl-ink-soft);
}

.pl-word.is-new {
  animation: pl-unlock var(--dur-slow) var(--ease-spring) both;
}

.pl-word.is-off {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-2);
  border: var(--border) dashed var(--line);
  color: var(--text-muted);
}

.pl-word.is-off b {
  font-weight: 800;
}

/* ==========================================================================
   Inside the task panel
   ========================================================================== */

.pl-ask {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.3;
}

.pl[data-stage="solo"] .pl-ask {
  font-size: 26px;
}

.pl-ask:focus {
  outline: none;
}

.pl-ask:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 6px;
}

.pl-ctx {
  margin: 0;
  color: var(--pl-ink-soft);
  font-size: var(--fs-2);
  line-height: 1.5;
}

.pl-chat code,
.pl-ctx code,
.pl-ask code,
.pl-task code,
.pl-warn code,
.pl-band code,
.pl-word code,
.pl-pop__note code,
.pl-wcard code,
.pl-opts code {
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--violet-300) 18%, transparent);
  font-weight: 700;
}

/* ---- Story: the prompt as a chat bubble, then what the AI made ---- */

.pl-story {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.pl-story__you {
  max-width: 90%;
  font-size: 16px;
  line-height: 1.4;
}

.pl-story__made {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-left: 6px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 800;
}

.pl-story__made svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--violet-300);
}

.pl-thumb {
  overflow: hidden;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.pl-thumb .pl-chrome {
  padding: 7px 10px;
}

.pl-thumb__view {
  position: relative;
  height: 150px;
  overflow: hidden;
}

.pl-thumb__inner {
  width: var(--tw, 560px);
  transform: scale(0.62);
  transform-origin: 0 0;
  pointer-events: none;
}

.pl-thumb__inner .gn-hero .gn-img {
  display: none;
}

/* ---- Answers ---- */

.pl-opts {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.pl-coach .option {
  min-height: 56px;
  padding: 9px 14px;
  font-size: var(--fs-2);
}

/* A pick that wasn't it: a soft sun outline, never red */
.pl .pl-opts .option.is-soft,
.pl .pl-opts .option.is-soft[aria-pressed="true"] {
  --opt-border: var(--sun-400);
  --opt-lip: color-mix(in srgb, var(--sun-400) 42%, var(--bg));
  --opt-bg: var(--surface-2);
  --opt-key-bg: transparent;
  --opt-key-border: var(--sun-400);
  --opt-key-fg: var(--sun-400);
}

/* ---- New word cards ---- */

.pl-dots {
  flex: none;
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  height: 10px;
}

.pl-dots i {
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--space-600);
  transition: width var(--dur-med) var(--ease-out), background-color var(--dur-med) linear;
}

.pl-dots i.is-past {
  background: var(--mint-400);
}

.pl-dots i.is-now {
  width: 28px;
  background: var(--sun-400);
}

.pl-wcard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.pl-wcard__lab {
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--violet-300) 18%, transparent);
  color: color-mix(in srgb, var(--violet-300) 70%, #fff);
  font-size: 13px;
  font-weight: 800;
  line-height: 22px;
}

.pl-wcard__term {
  max-width: 100%;
  color: #fff;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  line-height: 48px;
  overflow-wrap: anywhere;
}

.pl-wcard__def {
  min-height: 46px;
  font-size: 17px;
  font-weight: 700;
  line-height: 23px;
  color: color-mix(in srgb, var(--text) 88%, var(--bg));
}

.pl-wcard__ex {
  align-self: stretch;
  min-height: 68px;
  margin-top: 4px;
  padding: 10px 14px;
  border: var(--border) solid var(--space-600);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
}

.pl-wcard__ex b {
  color: var(--sun-400);
  font-weight: 900;
}

/* ---- Match: words on the left, meanings on the right, equal rows ---- */

.pl-mgrid {
  display: grid;
  grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
  grid-auto-rows: minmax(64px, auto);
  gap: 10px;
}

.pl-mc {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 12px;
  border: var(--border) solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 var(--lip-sm) 0 var(--line-strong);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-med) var(--ease-spring),
    box-shadow var(--dur-med) var(--ease-spring),
    border-color var(--dur-fast) linear,
    background-color var(--dur-fast) linear;
}

.pl-mc--t {
  justify-content: center;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.pl-mc--m {
  color: color-mix(in srgb, var(--text) 90%, var(--bg));
  font-weight: 700;
}

.pl-mc:active:not(:disabled) {
  transform: translateY(var(--lip-sm));
  box-shadow: 0 0 0 var(--line-strong);
  transition-duration: var(--dur-fast);
}

.pl-mc.is-sel {
  border-color: var(--violet-300);
  background: color-mix(in srgb, var(--violet-500) 22%, var(--surface));
  box-shadow: 0 var(--lip-sm) 0 var(--violet-300);
}

.pl-mc.is-ok {
  border-color: color-mix(in srgb, var(--mint-400) 50%, transparent);
  background: color-mix(in srgb, var(--mint-400) 12%, var(--surface));
  color: color-mix(in srgb, var(--mint-400) 60%, #fff);
  box-shadow: none;
  cursor: default;
  animation: pl-matched 0.8s var(--ease-out);
}

.pl-mc.is-shake {
  animation: db-shake 0.45s ease-in-out;
}

@keyframes pl-matched {
  from {
    border-color: var(--mint-400);
    background: var(--mint-400);
    color: var(--mint-ink);
    box-shadow: 0 var(--lip-sm) 0 var(--mint-600);
    transform: scale(1.05);
  }
}

.pl-mc__ck {
  position: absolute;
  top: -8px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--mint-400);
  color: var(--mint-ink);
}

.pl-mc__ck svg {
  width: 12px;
  height: 12px;
}

/* ---- Word bank: tiles that fill in a file ---- */

.pl-bank {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 56px;
  gap: 10px;
}

.pl-btile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 4px 10px;
  border: var(--border) solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 var(--lip-sm) 0 var(--line-strong);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-med) var(--ease-spring),
    box-shadow var(--dur-med) var(--ease-spring);
}

.pl-btile:active {
  transform: translateY(var(--lip-sm));
  box-shadow: 0 0 0 var(--line-strong);
  transition-duration: var(--dur-fast);
}

.pl-btile.is-bounce {
  animation: pl-bounce 0.55s ease-out;
}

@keyframes pl-bounce {
  0% { transform: translateY(0); }
  25% { transform: translateY(-14px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

.pl-bnote {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
}

/* The file the tiles fill in */
.pl-doc {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: var(--sp-3);
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--pl-edge);
  border-radius: var(--r-md);
  background: var(--pl-code);
  color: var(--pl-ink-soft);
  font-family: var(--font-mono);
  font-size: var(--pl-code-fs);
  line-height: 20px;
}

.pl-doc__h1 {
  color: #fff;
  font-weight: 600;
}

.pl-doc__h2 {
  margin-top: 6px;
  color: var(--violet-300);
  font-weight: 600;
}

.pl-bslot {
  min-height: calc(var(--n, 1) * 20px + 16px);
  padding: 5px 8px;
  border: var(--border) dashed var(--space-600);
  border-radius: var(--r-sm);
  transition: border-color var(--dur-med) linear, box-shadow var(--dur-med) linear, background-color var(--dur-med) linear;
}

.pl-bslot.is-on {
  border-color: color-mix(in srgb, var(--sun-400) 80%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sun-400) 20%, transparent);
}

.pl-bslot.is-full {
  border-style: solid;
  border-color: color-mix(in srgb, var(--mint-400) 55%, transparent);
  background: color-mix(in srgb, var(--mint-400) 6%, transparent);
}

.pl-doc__ln {
  padding: 0 4px;
  border-radius: 6px;
  color: color-mix(in srgb, var(--mint-400) 25%, var(--space-text));
}

.pl-doc__ln.is-land {
  animation: pl-land 0.5s var(--ease-out) both;
}

@keyframes pl-land {
  from { opacity: 0; transform: translateY(110px) scale(0.8); }
  55% { opacity: 1; }
  to { opacity: 1; transform: none; }
}

/* ---- Tasks: a checklist of real things to do in the tool ---- */

.pl-tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-task {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 48px;
  padding: 6px var(--sp-3);
  border-radius: 14px;
  transition: color var(--dur-med) linear;
}

.pl-task__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: var(--border) solid var(--space-500);
  border-radius: 50%;
  color: var(--mint-ink);
}

.pl-task__box svg {
  width: 14px;
  height: 14px;
}

.pl-task__main {
  flex: 1;
  min-width: 0;
}

.pl-task__main b {
  display: block;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.pl-task.is-done {
  color: var(--text-muted);
}

.pl-task.is-done .pl-task__box {
  border-color: var(--mint-400);
  background: var(--mint-400);
  animation: db-pop var(--dur-med) var(--ease-spring);
}

/* An out-of-order action: a gentle nudge, sun-coloured, never alarming */
.pl-warn {
  padding: var(--sp-3) var(--sp-4);
  border: var(--border) solid color-mix(in srgb, var(--sun-400) 50%, transparent);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--sun-400) 10%, var(--surface));
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  animation: db-shake var(--dur-slow) var(--ease-out);
}

/* ---- Order ---- */

.pl-slots {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-slot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-2);
  border: var(--border) dashed var(--line-strong);
  border-radius: var(--r-md);
}

.pl-slot__n {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--pl-micro);
  font-weight: 900;
}

.pl-slot__empty {
  color: var(--space-faint);
  font-size: var(--fs-1);
  font-weight: 700;
}

.pl-slot.is-filled {
  border-style: solid;
  border-color: var(--violet-300);
  background: color-mix(in srgb, var(--violet-500) 14%, var(--surface));
  animation: db-pop var(--dur-med) var(--ease-spring);
}

.pl-slot.is-ok {
  border-color: var(--mint-400);
  background: color-mix(in srgb, var(--mint-400) 12%, var(--surface));
}

.pl-slot.is-ok .pl-slot__n {
  background: var(--mint-400);
  color: var(--mint-ink);
}

.pl-slot.is-no {
  border-color: var(--sun-400);
  background: color-mix(in srgb, var(--sun-400) 10%, var(--surface));
}

.pl-slot.is-no .pl-slot__n {
  background: var(--sun-400);
  color: var(--sun-ink);
}

.pl-slot__btn {
  flex: 1;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-2);
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.pl-slot__btn:disabled {
  cursor: default;
}

.pl-poolbox {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

.pl-pool {
  min-height: 48px;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-2);
  animation: pl-in var(--dur-med) var(--ease-out) both;
}

/* ---- The foot: the one main button, or the feedback band ---- */

.pl-foot {
  padding: var(--sp-3) var(--pl-pad-x) var(--sp-5);
}

.pl-band {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 var(--pl-pad-x) var(--sp-5);
  padding: 14px 16px 16px;
  border: var(--border) solid var(--fb);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--fb) 13%, var(--surface));
  animation: pl-band-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.pl-band.is-ok {
  --fb: var(--mint-400);
}

.pl-band.is-soft {
  --fb: var(--sun-400);
}

@keyframes pl-band-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.pl-band__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.pl-band__ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fb);
  color: var(--ink);
}

.pl-band.is-ok .pl-band__ic {
  color: var(--mint-ink);
}

.pl-band.is-soft .pl-band__ic {
  color: var(--sun-ink);
}

.pl-band__ic svg {
  width: 16px;
  height: 16px;
}

.pl-band__t {
  color: var(--fb);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 28px;
}

.pl-band__why {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
}

.pl-band .btn {
  margin-top: 4px;
}


/* ==========================================================================
   Dialogs: the words list and lesson complete
   ========================================================================== */

.pl-dlg {
  padding: 0;
  border: var(--border) solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.pl-dlg::backdrop {
  background: color-mix(in srgb, var(--space-950) 80%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.pl-dlg--words {
  width: min(440px, calc(100vw - 2 * var(--sp-4)));
  max-height: min(78dvh, 640px);
  margin: auto;
  border-radius: var(--r-lg);
}

.pl-dlg--words[open] {
  display: flex;
  flex-direction: column;
  animation: pl-drop var(--dur-med) var(--ease-spring) both;
}

.pl-dlg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-3) var(--sp-2) var(--sp-5);
}

.pl-dlg__title {
  font-size: var(--fs-5);
}

.pl-dlg__body {
  overflow: auto;
  padding: var(--sp-2) var(--sp-5) var(--sp-5);
}

.pl-dlg__body .pl-ostep.is-cur {
  background: var(--surface-2);
}

.pl-dlg--done {
  width: min(520px, calc(100vw - 2 * var(--sp-4)));
  max-height: calc(100dvh - 2 * var(--sp-4));
  margin: auto;
  overflow: auto;
  border-radius: var(--r-xl);
  box-shadow: 0 8px 0 var(--space-900);
}

.pl-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-5);
  text-align: center;
}

.pl-done__art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 160px;
}

.pl-spark {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transform: rotate(45deg);
  animation: pl-burst 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.pl-done__title {
  color: var(--sun-400);
  font-size: var(--fs-7);
}

.pl-done__text {
  margin: 0;
  color: var(--pl-ink-soft);
  font-size: var(--fs-3);
  line-height: 1.45;
  max-width: 40ch;
}

.pl-tiles {
  display: flex;
  gap: var(--sp-3);
  width: 100%;
}

.pl-tile {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-3) var(--sp-2);
  border: var(--border) solid var(--line);
  border-radius: var(--r-md);
  background: var(--pl-app);
}

.pl-tile b {
  font-size: var(--fs-5);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pl-tile span {
  color: var(--text-muted);
  font-size: var(--fs-1);
  font-weight: 800;
}

.pl-tile--xp b { color: var(--sun-400); }
.pl-tile--words b { color: var(--mint-400); }
.pl-tile--streak b { color: var(--orange-400); }

.pl-next {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: var(--border) dashed var(--line-strong);
  border-radius: var(--r-md);
  text-align: left;
}

.pl-next__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-pill);
  background: var(--mint-400);
  box-shadow: 0 var(--lip-sm) 0 var(--mint-600);
  color: var(--mint-ink);
}

.pl-next__icon svg {
  width: 22px;
  height: 22px;
}

.pl-next__text b {
  display: block;
  font-size: var(--fs-3);
  font-weight: 900;
  line-height: 1.25;
}

.pl-next__text span {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-1);
  font-weight: 700;
}

.pl-done .btn--ghost {
  min-height: 48px;
}

/* The lesson is over, so this one may celebrate */
.pl-done .btn--success[data-k="cta"] {
  animation: pl-cta-pulse 1.7s ease-in-out infinite;
}

@keyframes pl-cta-pulse {
  0%, 100% { box-shadow: 0 var(--lip) 0 var(--mint-600), 0 0 0 0 color-mix(in srgb, var(--mint-400) 55%, transparent); }
  50% { box-shadow: 0 var(--lip) 0 var(--mint-600), 0 0 0 10px color-mix(in srgb, var(--mint-400) 0%, transparent); }
}

/* ---- Not found ---- */

.pl-missing {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
}

.pl-missing__title {
  font-size: var(--fs-7);
}

.pl-missing p {
  color: var(--text-muted);
}

/* ==========================================================================
   The tour: three stops, once per browser
   ========================================================================== */

.pl-tl {
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease-out, visibility 0s linear 0.35s;
}

.pl-tl.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease-out;
}

.pl-tl__block {
  position: absolute;
  inset: 0;
}

.pl-tl__spot {
  position: absolute;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: 0 0 0 3px var(--violet-300), 0 0 0 9999px rgba(14, 12, 41, 0.72);
  transition:
    left 0.55s var(--pl-ease),
    top 0.55s var(--pl-ease),
    width 0.55s var(--pl-ease),
    height 0.55s var(--pl-ease),
    border-radius 0.55s var(--pl-ease);
}

.pl-tl__tip {
  position: absolute;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 16px;
  border: var(--border) solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 8px 0 var(--space-900);
  transition: left 0.55s var(--pl-ease), top 0.55s var(--pl-ease);
}

.pl-tl.is-instant .pl-tl__spot,
.pl-tl.is-instant .pl-tl__tip {
  transition: none;
}

.pl-tl__tip:focus {
  outline: none;
}

.pl-tl__tip::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--surface);
  transform: rotate(45deg);
}

.pl-tl__tip.arr-l::before { left: -10px; top: 36px; border-left: var(--border) solid var(--line-strong); border-bottom: var(--border) solid var(--line-strong); }
.pl-tl__tip.arr-r::before { right: -10px; top: 36px; border-top: var(--border) solid var(--line-strong); border-right: var(--border) solid var(--line-strong); }
.pl-tl__tip.arr-t::before { left: var(--ax, 24px); top: -10px; border-top: var(--border) solid var(--line-strong); border-left: var(--border) solid var(--line-strong); }
.pl-tl__tip.arr-b::before { left: var(--ax, 24px); bottom: -10px; border-bottom: var(--border) solid var(--line-strong); border-right: var(--border) solid var(--line-strong); }
.pl-tl__tip.arr-none::before { display: none; }

.pl-tl__n {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.pl-tl__txt {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
}

.pl-tl__swap.is-a { animation: pl-tswap-a 0.35s ease-out both; }
.pl-tl__swap.is-b { animation: pl-tswap-b 0.35s ease-out both; }

@keyframes pl-tswap-a {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes pl-tswap-b {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.pl-tl__btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.pl-tl__skip {
  margin-right: auto;
}

.pl-tl__b {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--sun-400);
  color: var(--sun-ink);
  box-shadow: 0 var(--lip) 0 var(--sun-600);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) linear, box-shadow var(--dur-fast) linear;
}

.pl-tl__b:active {
  transform: translateY(var(--lip));
  box-shadow: 0 0 0 var(--sun-600);
}

.pl-tl__b--ghost {
  background: transparent;
  color: var(--text-muted);
  box-shadow: inset 0 0 0 var(--border) var(--space-600);
}

.pl-tl__b--ghost:active {
  transform: none;
  box-shadow: inset 0 0 0 var(--border) var(--space-600);
}

@media (hover: hover) {
  .pl-tl__b--ghost:hover {
    color: var(--text);
  }
}

/* ==========================================================================
   Big screens that are short: tighten the task column so the answers and Check fit
   ========================================================================== */

@media (min-width: 900px) {
  .pl-thumb__view {
    height: 150px;
  }
}

@media (min-width: 900px) and (max-height: 760px) {
  .pl-thumb__view {
    height: 84px;
  }

  .pl-band {
    gap: 6px;
    padding: 10px 14px 12px;
  }

  .pl[data-stage="solo"] .pl-ask {
    font-size: 22px;
  }
}

@media (min-width: 900px) and (max-height: 820px) {
  .pl-scroll {
    gap: var(--sp-3);
    padding-top: 20px;
  }

  .pl[data-stage="solo"] .pl-coach {
    top: 12px;
    bottom: 12px;
  }

  .pl[data-stage="solo"] .pl-scroll {
    padding-top: 20px;
  }

  .pl-coach .option {
    min-height: 52px;
  }

  .pl-opts {
    gap: var(--sp-2);
  }

  .pl-foot {
    padding-bottom: var(--sp-4);
  }

  .pl-band {
    margin-bottom: var(--sp-4);
  }
}

/* ==========================================================================
   Phones and small tablets (< 900px): the tool fills the screen, the task is a bottom drawer
   ========================================================================== */

@media (max-width: 899px) {
  .pl {
    --pl-top-h: 56px;
  }

  .pl-top {
    display: flex;
    gap: var(--sp-2);
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    padding-left: max(10px, env(safe-area-inset-left, 0px));
  }

  .pl-segs {
    flex: 1;
    min-width: 60px;
    gap: 5px;
  }

  .pl-seg {
    height: 8px;
  }

  .pl-stats .stat {
    font-size: 17px;
  }

  .pl-words-btn--top {
    display: none;
  }

  /* The tool */
  .pl-ws {
    left: 0;
    transform: none;
    padding-bottom: var(--pl-drawer-h);
    transition:
      opacity 0.4s ease-out 0.1s,
      visibility 0s linear 0.5s,
      padding-bottom 0.25s var(--pl-ease) 0s;
  }

  .pl[data-stage="dock"] .pl-ws {
    transition:
      opacity 0.4s ease-out 0.1s,
      visibility 0s linear 0s,
      padding-bottom 0.25s var(--pl-ease) 0s;
  }

  .pl-bar {
    flex-wrap: nowrap;
    min-height: 61px;
    padding: var(--sp-2) var(--sp-3);
    background: var(--pl-panel);
  }

  .pl-tabs {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pl-tabs::-webkit-scrollbar {
    display: none;
  }

  .pl-tab {
    flex: none;
    padding: 0 var(--sp-4);
  }

  .pl-tool__long { display: none; }
  .pl-tool__short { display: inline; }

  .pl-tool {
    padding: 0 var(--sp-3);
  }

  .pl-toast-slot {
    position: absolute;
    right: var(--sp-2);
    top: calc(100% + var(--sp-1));
    z-index: 6;
  }

  .pl-tip,
  .pl-pop {
    right: 0;
  }

  .pl-chat {
    padding: var(--sp-4);
    font-size: 16px;
  }

  .pl-comp {
    margin: 0 var(--sp-3) var(--sp-3);
  }

  .pl-acts {
    padding-inline: var(--sp-3);
  }

  .pl-prev__head {
    height: 44px;
    padding: 0 var(--sp-3);
    border-bottom: 0;
  }

  .pl-prev__head h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .pl-live {
    margin-left: auto;
  }

  .pl-prev {
    border-left: 0;
  }

  .pl-prev__body {
    padding: 0 var(--sp-3) var(--sp-3);
  }

  .pl-thumb__view {
    height: 150px;
  }

  /* The task: the first question fills the screen... */
  .pl-coach {
    --pl-pad-x: 20px;
    transition:
      height 0.25s var(--pl-ease),
      opacity 0.22s ease-in,
      transform 0.22s ease-in;
  }

  .pl[data-stage="solo"] .pl-coach {
    left: 0;
    right: 0;
    width: auto;
    top: 0;
    bottom: 0;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .pl[data-stage="solo"] .pl-scroll {
    gap: 18px;
    padding: 22px 20px 16px;
  }

  .pl[data-stage="solo"] .pl-ask {
    font-size: 19px;
  }

  .pl[data-stage="solo"] .pl-foot {
    padding: 10px 20px 20px;
  }

  .pl[data-stage="solo"] .pl-band {
    padding-bottom: 20px;
  }

  /* ...then it is a drawer with two states: open (fits its content, capped) and closed (a slim bar) */
  .pl[data-stage="dock"] .pl-coach {
    left: 0;
    right: 0;
    width: auto;
    top: auto;
    bottom: 0;
    max-height: 70vh;
    max-height: 70dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border-width: var(--border) 0 0;
    border-color: var(--line-strong);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--pl-dock);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.5);
  }

  /* the word bank keeps the file readable above it */
  .pl[data-stage="dock"] .pl-coach[data-type="bank"] {
    max-height: 45vh;
    max-height: 45dvh;
  }

  .pl-coach.is-out {
    opacity: 0;
    transform: translateY(24px);
  }

  .pl-coach.is-entering {
    animation: pl-sheetin 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.08) both;
    transition: none;
  }

  @keyframes pl-sheetin {
    from { transform: translateY(100%); }
    to { transform: none; }
  }

  .pl[data-stage="dock"] .pl-scroll {
    gap: var(--sp-3);
    padding: 10px 20px 12px;
  }

  .pl[data-stage="dock"] .pl-coach[data-open="0"] .pl-scroll {
    padding-top: 0;
    padding-bottom: 0;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 0.26s;
  }

  .pl[data-stage="dock"] .pl-ask {
    display: none;
  }

  /* The drawer header: the one instruction line, the Words button and a chevron. The whole header toggles. */
  .pl-hd {
    position: relative;
    display: block;
    flex: none;
    height: 62px;
  }

  .pl-hd__btn {
    display: flex;
    align-items: center;
    width: 100%;
    height: 62px;
    padding: 0 62px 0 20px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .pl-hd.has-words .pl-hd__btn {
    padding-right: 130px;
  }

  .pl-hd__btn:focus-visible {
    outline-offset: -5px;
    border-radius: 20px 20px 0 0;
  }

  .pl-hd__ins {
    display: block;
    max-height: 42px;
    overflow: hidden;
    font-size: 17px;
    font-weight: 900;
    line-height: 21px;
  }

  .pl-hd__chev {
    position: absolute;
    right: 10px;
    top: 11px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--text-muted);
    transition: transform 0.25s var(--pl-ease);
  }

  .pl-hd__chev svg {
    width: 22px;
    height: 22px;
  }

  .pl-hd__chev.is-up {
    transform: rotate(180deg);
  }

  .pl-words-btn--sheet {
    display: inline-flex;
    position: absolute;
    right: 56px;
    top: 9px;
    z-index: 2;
    padding: 0 12px;
    font-size: 16px;
    font-weight: 900;
  }

  .pl-words-btn--sheet .pl-words-btn__t {
    display: none;
  }

  /* The foot: one main button, or the feedback band. Closed, it shrinks to its button. */
  .pl[data-stage="dock"] .pl-foot {
    padding: 4px 20px 15px;
    background: inherit;
    box-shadow: 0 -12px 14px -10px rgba(0, 0, 0, 0.35);
  }

  .pl-band {
    margin: 0;
    padding: 12px 20px 16px;
    border-width: var(--border) 0 0;
    border-radius: 0;
    border-color: color-mix(in srgb, var(--fb) 60%, transparent);
    background: color-mix(in srgb, var(--fb) 14%, var(--pl-dock));
    box-shadow: none;
    animation: pl-band-up 0.2s ease-out both;
  }

  .pl[data-stage="solo"] .pl-band {
    background: color-mix(in srgb, var(--fb) 14%, var(--surface));
  }

  .pl[data-stage="dock"] .pl-band.is-shut {
    padding: 4px 20px 15px;
    border-top-width: 0;
    background: transparent;
    animation: none;
  }

  @keyframes pl-band-up {
    from { transform: translateY(100%); }
    to { transform: none; }
  }

  .pl-coach .option__key {
    display: none;
  }

  .pl-coach .option {
    min-height: 52px;
    padding: 10px 16px;
    font-size: 16px;
    line-height: 21px;
  }

  .pl-opts {
    gap: 10px;
  }

  .pl-done {
    padding: var(--sp-4);
  }

  .pl-done__art {
    height: 140px;
  }

  .pl-dlg--done {
    border-radius: var(--r-lg);
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .pl-tab {
    padding: 0 var(--sp-3);
  }

  .pl-stats {
    gap: var(--sp-2);
  }

  .pl-wcard__term {
    font-size: 38px;
    line-height: 42px;
  }
}

/* ==========================================================================
   Reduced motion: components.css already stops every animation and transition.
   These stay readable without them.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .pl-typing,
  .pl-spark {
    display: none;
  }
}
