/* PAKT screens: layout and the app pieces the component kit doesn't cover. Loaded after tokens.css and bundle.css; tokens only. */
[data-theme="dark"] { color-scheme: dark; }
.ds *, .ds *::before, .ds *::after { box-sizing: border-box; }
.ds [hidden] { display: none !important; }
:where(.ds) a { color: inherit; }
:where(.ds) a[class] { text-decoration: none; }
:where(.ds) :focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.ds-skip { position: fixed; z-index: 20; left: var(--space-4); top: calc(var(--space-16) * -1); padding: var(--space-3) var(--space-4); border-radius: var(--radius-full); background: var(--ink); color: var(--on-ink); font: var(--text-label); }
.ds-skip:focus { top: var(--space-4); }

/* ---------- Screen anatomy: one column, space-5 gutters, room under the floating tab bar ---------- */
.ds-screen {
  display: flex; flex-direction: column; gap: var(--space-8); width: 100%; max-width: 40rem; margin-inline: auto;
  padding: var(--space-10) var(--space-5) calc(var(--size-control-lg) + var(--space-16) + env(safe-area-inset-bottom, 0px));
}
.ds-screen h1, .ds-screen h2, .ds-screen h3, .ds-screen p { margin: 0; }
.ds-screen > * { min-width: 0; }
.ds-screen > :empty:not(img) { display: none; }
.ds-dock { position: fixed; z-index: 10; left: var(--space-4); right: var(--space-4); bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); max-width: 30rem; margin-inline: auto; }
.ds-rail-logo { display: none; }
.pakt-tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.pakt-tab[aria-current="page"] .pakt-tab__pill { color: var(--accent); }
.pakt-tab[aria-current="page"] .pakt-tab__pill::before { transform: scaleX(1); opacity: 1; box-shadow: inset 0 0 0 1.5px var(--edge); }

/* The You tab (.pakt-me) and its XP floats are the design system's (bundle.css); here only the app's layering. */
.ds-dock:has(.pakt-xp) { z-index: 13; }  /* above the coach's round button while it shows */

.ds-head { display: flex; flex-direction: column; gap: var(--space-2); }
.ds-head h1 { text-wrap: balance; }
.ds-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.ds-brand { display: flex; align-items: center; gap: var(--space-3); }
.ds-block { display: flex; flex-direction: column; gap: var(--space-5); }
.ds-section { display: flex; flex-direction: column; gap: var(--space-3); }
.ds-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.ds-list { display: flex; flex-direction: column; gap: var(--space-3); }
.ds-chips, .ds-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ds-stats, .ds-areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: var(--space-4); }
.ds-grid .pakt-lesson { max-width: none; height: 100%; }
.ds-carousel {
  display: flex; gap: var(--space-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(var(--space-5) * -1); padding: var(--space-1) var(--space-5) var(--space-3); scroll-padding-inline: var(--space-5);
}
.ds-carousel > * { flex: 0 0 75%; scroll-snap-align: start; }
.ds-brand .ds-head { gap: var(--space-1); }
/* WeekStreak on the narrowest phones: let the seven discs shrink instead of spilling out of the card. */
.pakt-streak__days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pakt-streak__dot { max-width: 100%; height: auto; aspect-ratio: 1; }
.ds-muted { color: var(--ink-muted); }
.ds-kicker { color: var(--accent); text-transform: uppercase; }
.ds-grow { flex: 1; }
.ds-prose a { color: var(--accent); text-underline-offset: 0.2em; }

/* ---------- Surfaces ---------- */
.ds-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); border: 1.5px solid var(--edge); border-radius: var(--radius-lg); background: var(--paper-raised); box-shadow: var(--shadow-sm); }
details.ds-card { display: block; padding-block: var(--space-1); }
details.ds-card[open] { padding-bottom: var(--space-5); }
.ds-disclosure > summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--size-control); cursor: pointer; font: var(--text-label); color: var(--ink); list-style: none; }
.ds-disclosure > summary::-webkit-details-marker { display: none; }
.ds-disclosure > summary > .pakt-icon:last-child { margin-left: auto; color: var(--ink-muted); transition: transform var(--dur-quick) var(--ease-out); }
.ds-disclosure[open] > summary { margin-bottom: var(--space-4); }
.ds-disclosure[open] > summary > .pakt-icon:last-child { transform: rotate(90deg); }
.ds-disclosure .ds-disclosure { margin-top: var(--space-3); }
.ds-badge { display: grid; place-items: center; flex: none; width: var(--size-control); height: var(--size-control); border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); }
.ds-empty { align-items: flex-start; }
.ds-toast { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--ink); color: var(--on-ink); font: var(--text-label); }
/* Messages float above the tab bar and fade: an action keeps its scroll (nav.js), so the top of the page may be out of view. */
.ds-toasts { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--size-control-lg) + var(--space-10) + var(--space-3) + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); width: min(100% - var(--space-8), 32rem); translate: -50% 0; pointer-events: none; }
.ds-toasts .ds-toast { box-shadow: var(--shadow-lg); text-align: center; animation: pakt-toast 6s var(--ease-out) both; }
.ds-toasts .ds-toast[data-kind="error"] { animation-duration: 12s; }
@keyframes pakt-toast { from { opacity: 0; translate: 0 var(--space-2); } 4%, 92% { opacity: 1; translate: 0 0; } to { opacity: 0; visibility: hidden; } }
@media (min-width: 48rem) { .ds-toasts { left: calc(50% + var(--rail, 0px) / 2); bottom: var(--space-6); } }

/* Page changes crossfade instead of blanking, and the tab bar stays put (Chrome, Edge, Safari 18+; elsewhere pages change as before). */
@view-transition { navigation: auto; }
.ds-dock { view-transition-name: pakt-dock; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
/* A page on its way (nav.js): a thin bar after a short pause, so quick changes show nothing. */
html.is-leaving::after { content: ""; position: fixed; z-index: 1000; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); transform-origin: left; pointer-events: none; animation: pakt-leaving 10s cubic-bezier(0.1, 0.8, 0.2, 1) 0.2s both; }
@keyframes pakt-leaving { from { transform: scaleX(0); } to { transform: scaleX(0.95); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .ds-toasts .ds-toast { animation-name: none; }
  html.is-leaving::after { animation: none; transform: scaleX(0.6); }
}

/* Rows: a PlanItem that opens its session, and plain navigation rows. */
.ds-plan { position: relative; }
.ds-plan .pakt-check { cursor: inherit; }
.ds-plan[data-done="true"] .pakt-check__box { background: var(--accent); box-shadow: var(--shadow-xs); }
.ds-stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ds-stretch:focus-visible { box-shadow: none; }
.ds-stretch:focus-visible::after { box-shadow: var(--focus-ring); }
.ds-plan .pakt-iconbtn, .ds-plan .pakt-btn { position: relative; z-index: 1; }
.ds-row {
  position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: var(--size-control-lg); padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  border: 1.5px solid var(--edge); border-radius: var(--radius-md); background: var(--paper-raised); box-shadow: var(--shadow-sm); color: var(--ink);
  transition: box-shadow var(--dur-quick) var(--ease-out);
}
.ds-row > .pakt-icon:last-child { color: var(--ink-muted); }
.ds-row:hover, .ds-link:hover { box-shadow: var(--shadow-md); }
.ds-row button, .ds-plan button.pakt-plan__text { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ds-lesson { position: relative; }
.ds-lesson .quick-skip { position: absolute; top: var(--space-3); right: var(--space-3); background: var(--paper-raised); }
/* A model at work (static/orb.js); the size is reserved before the module draws. */
pakt-orb { display: inline-block; flex: none; width: 20px; height: 20px; vertical-align: middle; line-height: 0; }
pakt-orb[size="64"] { width: 64px; height: 64px; }
pakt-orb canvas { display: block; width: 100%; height: 100%; }

/* Chips that navigate or choose */
.pakt-chip[aria-current="page"], .ds-choice:has(input:checked) { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.ds-choice { position: relative; }
.ds-choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ds-choice:has(input:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--line-strong), var(--focus-ring); }

/* ---------- Forms ---------- */
.ds-form { display: flex; flex-direction: column; gap: var(--space-4); }
.ds-form > .pakt-btn { align-self: flex-start; }
.ds-fieldset { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.pakt-btn.ds-danger { background: var(--critical); color: var(--on-critical); }
.ds-field { display: flex; flex-direction: column; gap: var(--space-2); font: var(--text-label); color: var(--ink); }
.ds-input {
  width: 100%; min-height: var(--size-control); padding: var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-md);
  background: var(--paper-sunken); color: var(--ink); font: var(--text-body-lg); box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.ds-input::placeholder { color: var(--ink-muted); }
textarea.ds-input { resize: vertical; min-height: calc(var(--size-control) * 2.5); }
.ds-input:focus-visible { box-shadow: inset 0 0 0 1.5px var(--line-strong), var(--focus-ring); }

/* ---------- Text buttons and job rows ---------- */
.ds .fine { margin: 0; font: var(--text-caption); color: var(--ink-muted); }
.ds .text-btn { min-height: var(--size-control-sm); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-full); background: transparent; color: var(--ink); font: var(--text-label); box-shadow: inset 0 0 0 1.5px var(--line-strong); cursor: pointer; }
.ds .text-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.job-row { border-top: 1px solid var(--line); }
.job-row > summary { display: flex; align-items: center; gap: var(--space-2); min-height: var(--size-control-sm); padding-block: var(--space-1); font: var(--text-caption); color: var(--ink); list-style: none; cursor: pointer; }
.job-row > summary::-webkit-details-marker { display: none; }
.job-row > summary strong { flex: none; font-weight: 650; }
.job-state { flex: none; color: var(--accent); font-weight: 650; }
.job-stage { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-muted); text-overflow: ellipsis; white-space: nowrap; }
.job-row[open] .job-stage { white-space: normal; }
.job-hide { flex: none; min-width: var(--size-control-sm); min-height: var(--size-control-sm); border: 0; border-radius: var(--radius-full); background: transparent; color: var(--ink-muted); font: var(--text-label); cursor: pointer; }
.job-details { font: var(--text-caption); color: var(--ink-muted); }

/* Receipts and task feedback stay visible while the technical details are closed. */
.job-row > summary { padding-block: var(--space-4); align-items: flex-start; }
.job-main { flex: 1; min-width: 0; display: grid; gap: var(--space-2); }
.job-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); }
.job-row > summary .job-heading strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font: var(--text-label); }
.job-stage { display: block; }
.file-meta { display: block; font: var(--text-caption); color: var(--ink-muted); }
.file-thumbnail { flex: none; display: block; width: 68px; height: 90px; object-fit: contain; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper-raised); box-shadow: 0 3px 8px var(--line); }
.file-thumbnail--text { position: relative; padding: 7px; overflow: hidden; font: 7px/1.4 sans-serif; color: var(--ink); }
.file-thumbnail--text > span { display: block; max-height: 64px; overflow: hidden; }
.ds .ds-screen .file-thumbnail small { display: block; font: 9px/1.3 sans-serif; text-align: center; color: var(--ink-muted); }
.file-thumbnail--text small { position: absolute; bottom: 4px; inset-inline: 1px; background: var(--paper-raised); }
.file-thumbnail--pending { display: grid; align-content: center; gap: 8px; text-align: center; font: var(--text-label); color: var(--accent); }
.task-progress { display: block; height: 6px; overflow: hidden; border-radius: var(--radius-full); background: var(--paper-sunken); }
.task-progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--tide),var(--accent)); transition: width 800ms ease; }
[data-state="done"] .task-progress-fill { background: var(--positive); }
[data-state="failed"] .task-progress-fill { background: var(--critical); }
[data-state="failed"] .job-state { color: var(--critical); }
[data-state="done"] .job-state { color: var(--positive); }
.task-timing { display: flex; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; font: var(--text-caption); color: var(--ink-muted); }
.task-timing b { color: var(--ink); font-variant-numeric: tabular-nums; }
.is-indeterminate { animation: task-wait 2s ease-in-out infinite alternate; }
@keyframes task-wait { to { transform: translateX(250%); } }
@media (max-width: 600px) {
  .job-row > summary { flex-wrap: wrap; }
  .job-main { flex-basis: calc(100% - 110px); }
  .job-retry { margin-left: 76px; }
  .file-thumbnail { width: 56px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .task-progress-fill { transition: none; animation: none; }
}

/* ---------- Flash ---------- */
.ds-flash { display: flex; flex-direction: column; gap: var(--space-5); }
.ds-flash__top { display: flex; align-items: center; gap: var(--space-3); }
.ds-flash__top .pakt-bar { flex: 1; }
.ds-flash .flash-visual { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-lg); }
.ds-answer { position: relative; }
.ds-answer .ds-input { padding-right: var(--size-control-lg); }
.ds-answer .voice-answer { position: absolute; right: var(--space-2); bottom: var(--space-2); }
.voice-answer.listening { background: var(--accent); color: var(--on-accent); }
.ds-solution { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border: 1.5px solid var(--edge); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--ink); animation: pakt-rise var(--dur-smooth) var(--ease-out); }
.ds-solution .ds-sources { display: flex; flex-direction: column; gap: var(--space-1); font: var(--text-caption); }
.ds-solution .ds-sources a { color: var(--ink); text-underline-offset: 0.2em; }
.ds-rating { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.ds-rating .pakt-btn { height: auto; min-height: var(--size-control); padding-block: var(--space-2); white-space: normal; }
.ds-flash__nav { display: flex; justify-content: space-between; gap: var(--space-2); }
/* One counter and bar for the whole pack (flash.js); a card passed with a reason; the coach's reply under the answer. */
.flash-progress { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.flash-progress__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.flash-progress h1 { margin: 0; }
.flash-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.flash-skip { background: var(--paper-sunken); }
.flash-coach .pakt-msg__col { max-width: none; }
.flash-coach__text, .flash-coach__translation p { white-space: pre-line; }

/* The strip above a chained block (ds.chain_strip): done, current, to come. The bridge between two blocks (bridge.html). */
.ds-chain { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.ds-chain__segs { display: flex; gap: var(--space-1); }
.ds-chain__seg { flex: 1; min-width: 0; height: var(--space-1); border-radius: var(--radius-full); background: var(--paper-sunken); transition: background-color var(--dur-smooth) var(--ease-out); }
.ds-chain__seg[data-state="done"] { background: var(--accent); }
.ds-chain__seg[data-state="skipped"] { background: var(--line); }
.ds-chain__seg[data-current="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.bridge { max-width: 36rem; margin-inline: auto; }
.bridge .ds-empty { gap: var(--space-3); }
.bridge__next { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); border: 1.5px solid var(--edge); border-radius: var(--radius-lg); background: var(--paper-raised); }
.bridge__next .title { margin: 0; }
.bridge__steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.bridge__steps li { display: flex; align-items: center; gap: var(--space-2); }

/* ---------- Fitness ---------- */
.pakt-macros .pakt-bar__head { flex-wrap: wrap; }
.pakt-meal__main > a { color: var(--accent); font: var(--text-caption); font-weight: 650; }
.ds-chart { display: block; width: 100%; height: auto; }
.ds-chart .chart-grid { fill: none; stroke: var(--line); vector-effect: non-scaling-stroke; }
.ds-chart .chart-target { fill: none; stroke: var(--ink-muted); stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; }
.ds-chart .chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ds-chart circle { fill: var(--accent); }
.ds-chart .partial-point { fill: var(--paper-raised); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ds-axis { display: flex; justify-content: space-between; gap: var(--space-3); font: var(--text-caption); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.ds-table-wrap { overflow-x: auto; }
.ds-table { width: 100%; border-collapse: collapse; font: var(--text-caption); font-variant-numeric: tabular-nums; }
.ds-table th, .ds-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); text-align: left; }
.ds-table th { color: var(--ink-muted); font-weight: 650; }
.pakt-msg__bubble strong { display: block; font: var(--text-label); }
.ds-timeline { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.ds-timeline .ds-disclosure > summary { min-height: var(--size-control-sm); }
.ds-pre { margin: 0; padding: var(--space-3); overflow-x: auto; border-radius: var(--radius-sm); background: var(--paper-sunken); font: var(--text-caption); white-space: pre-wrap; overflow-wrap: anywhere; }
.pakt-msg__bubble a { color: var(--accent); font: var(--text-label); }

/* ---------- Today · fitness: five indicators, four actions, their popovers ---------- */
.fit-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-1); }
.fit-ring { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: var(--space-2) 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); font: inherit; text-align: center; cursor: pointer; }
.fit-ring:hover { background: var(--paper-sunken); }
.fit-ring > [aria-hidden] { display: contents; }
.fit-ring .pakt-ring { margin-bottom: var(--space-1); }
.fit-ring .pakt-ring__value { color: var(--accent); }
.fit-ring .pakt-ring__center .pakt-icon { position: static; transform: none; }
.fit-cell[data-fit="deficit"] { --accent: var(--critical); }
.fit-cell[data-fit="steps"] { --accent: var(--berry); }
.fit-cell[data-fit="exercise"] { --accent: var(--tide); }
.fit-ring__value { font-size: 13px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fit-ring__under { font-size: 11px; line-height: 1.2; color: var(--ink-muted); white-space: nowrap; }
.fit-disc { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: var(--space-1); border-radius: var(--radius-full); background: var(--paper-sunken); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fit-cell { position: relative; display: grid; min-width: 0; }
.fit-plus {
  position: absolute; top: 2px; left: calc(50% + 12px); display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: var(--radius-full); background: var(--accent); color: var(--paper-raised); box-shadow: 0 0 0 2px var(--paper); cursor: pointer;
}
.fit-plus::after { content: ""; position: absolute; inset: -8px; }  /* a finger-sized target around the small badge */
.fit-plus:hover { filter: brightness(1.1); }
.fit-pop { width: min(22rem, calc(100vw - 2 * var(--space-4))); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-lg); }
.fit-pop::backdrop { background: var(--scrim); }
.fit-pop > .ds-list { margin-top: var(--space-3); }
.ds-row--alert > .pakt-icon:first-child { color: var(--critical); }
.fit-weight__now { margin: 0; font: var(--text-body); color: var(--ink); }
.fit-weight__now strong { margin-right: var(--space-1); font-size: 2.25rem; line-height: 1; }

/* ---------- Tablet and desktop: the tab bar becomes a left rail, same five destinations and tab pills ---------- */
@media (min-width: 48rem) {
  .ds { --rail: calc(var(--size-control-lg) + var(--space-8)); padding-left: var(--rail); }
  .ds-dock {
    top: 0; right: auto; bottom: 0; left: 0; width: var(--rail); max-width: none; margin: 0;
    display: flex; flex-direction: column; align-items: center; gap: var(--space-8);
    padding: var(--space-8) var(--space-2) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
    border-right: 1px solid var(--line); background: var(--paper-raised);
  }
  .ds-dock .pakt-tabbar { grid-auto-flow: row; gap: var(--space-2); padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .ds-rail-logo { display: inline-flex; border-radius: var(--radius-full); }
  .ds-top .pakt-logo { display: none; }
  .ds-screen { padding-bottom: var(--space-16); }
  .ds.ds--practice { --rail: 0px; }
  .pakt-me .pakt-tab__pill { height: 46px; }
  .pakt-me__pic { width: 42px; height: 42px; }
  .pakt-me__lvl { right: 0; }
  .pakt-me__bar { width: 48px; height: 4px; margin-top: 2px; }
}
/* Focus mode: the practice cockpit and the guided workout hide the navigation; their × leaves. */
.ds--practice .ds-dock { display: none; }

/* ---------- Scripts and the in-app keyboard (keyboard.js) ---------- */
:lang(ar) { font-family: "Noto Naskh Arabic", var(--font-sans); }  /* --font-arabic's face for Arabic letters (its unicode-range); Darija transcriptions keep the Latin face */
.pakt-chip[aria-pressed="false"] > .pakt-chip__check { display: none; }  /* a toggle chip's tick shows once pressed */
/* Docked to the bottom edge, over the tab bar, while its answer field is in use; the page makes room above it. */
.ds-kbd-dock { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-width: 30rem; margin-inline: auto; }
body.has-kbd .ds-screen { padding-bottom: calc(var(--kbd-h, 0px) + var(--space-5)); }
@media (min-width: 48rem) { .ds-kbd-dock { left: var(--rail); } }

@media (prefers-reduced-motion: reduce) {
  .ds-solution { animation: none; }
}

/* A subject's level on Today: a small ring (XP toward the next level) with the level inside, linking to its progress page. */
.subject-level { position: relative; z-index: 1; display: inline-flex; flex: none; border-radius: var(--radius-full); color: inherit; text-decoration: none; }
.subject-level .pakt-ring__value { font-size: 13px !important; font-weight: 800; color: var(--accent); }
.subject-level:hover .pakt-ring__track { stroke: var(--line-strong); }

/* The progress page: level card, mastery bar by state (lighter = less solid; the legend names each), tracks, drills. */
.prog-level { display: flex; flex-direction: row; align-items: center; gap: var(--space-4); }
.prog-level__text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.prog-level__text p { margin: 0; }
.prog-bar { display: flex; gap: 3px; height: 12px; border-radius: var(--radius-full); overflow: hidden; background: var(--paper-sunken); }
.prog-bar > span { min-width: 6px; }
[data-g="solid"] { --g: var(--accent); }
[data-g="practice"] { --g: color-mix(in srgb, var(--accent) 60%, var(--paper-sunken)); }
[data-g="learning"] { --g: color-mix(in srgb, var(--accent) 28%, var(--paper-sunken)); }
[data-g="unseen"] { --g: var(--paper-sunken); }
.prog-bar > span { background: var(--g); }
.prog-bar > [data-g="unseen"] { box-shadow: inset 0 0 0 1px var(--line); }
.prog-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none; font: var(--text-caption); color: var(--ink-muted); }
.prog-legend li { display: inline-flex; align-items: center; gap: var(--space-1); }
.prog-legend li > span { width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--g); box-shadow: inset 0 0 0 1px var(--line); }
.prog-legend strong { color: var(--ink); }
.prog-track__head { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 0; }
.prog-units { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font: var(--text-body); }
.prog-units li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); }
.prog-units__dot { width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--paper-sunken); box-shadow: inset 0 0 0 1px var(--line-strong); }
.prog-units [data-state="stable"] .prog-units__dot, .prog-units [data-state="transferable"] .prog-units__dot, .prog-units [data-state="assumed"] .prog-units__dot { background: var(--accent); box-shadow: none; }
.prog-units [data-state="practicing"] .prog-units__dot { background: color-mix(in srgb, var(--accent) 60%, var(--paper-sunken)); box-shadow: none; }
.prog-units [data-state="learning"] .prog-units__dot, .prog-units [data-state="introduced"] .prog-units__dot { background: color-mix(in srgb, var(--accent) 28%, var(--paper-sunken)); }
.prog-results { display: inline-flex; gap: 2px; color: var(--accent); letter-spacing: 1px; }

/* Today's weekly review: folded, a two-line teaser and "Lire la suite"; open, the full text. */
.coach-week__head { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.coach-week__teaser { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; }
.coach-week__more { color: var(--accent); }
.coach-week[open] .coach-week__teaser, .coach-week[open] .coach-week__more { display: none; }

/* The coach speaks in paragraphs on its session page, not chat one-liners. */
.coach-voice .pakt-msg__col { max-width: min(62ch, 100%); }
.coach-voice .pakt-msg__bubble { font: var(--text-body); }

/* ---------- The coach: a bar anchored at the bottom of every screen with its portrait, and the layer its answers grow into (coach.js) ---------- */
.has-coach { --coach-bottom: calc(var(--size-control-lg) + var(--space-6) + var(--space-4) + var(--space-2) + env(safe-area-inset-bottom, 0px)); --coach-h: calc(var(--size-control-lg) + var(--space-2)); }
.has-coach .ds-screen { padding-bottom: calc(var(--coach-bottom) + var(--coach-h) + var(--space-8)); }
.coach-panel {
  position: fixed; z-index: 12; left: var(--space-4); right: var(--space-4); bottom: var(--coach-bottom);
  display: flex; flex-direction: column; gap: var(--space-2); max-width: 40rem; margin-inline: auto; pointer-events: none;  /* only its own parts take clicks: the page stays usable around it */
}
.coach-panel > * { pointer-events: auto; }
.coach-form {
  display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1); border: 1.5px solid var(--edge); border-radius: var(--radius-full);
  background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-md); transition: box-shadow .15s;
}
.coach-form:focus-within { box-shadow: var(--shadow-lg); }
.coach-form textarea.ds-input { flex: 1; min-width: 0; min-height: var(--size-control); max-height: 8rem; padding: calc((var(--size-control) - 1.5em) / 2) var(--space-2); border: 0; border-radius: var(--radius-lg); background: transparent; box-shadow: none; resize: none; }
.coach-form textarea.ds-input:focus-visible { box-shadow: none; }
.coach-toggle { position: relative; flex: none; padding: 0; border: 0; border-radius: var(--radius-full); background: none; cursor: pointer; }
.coach-toggle[data-live]::after { content: ""; position: absolute; top: 0; right: 0; width: .6rem; height: .6rem; border-radius: var(--radius-full); background: var(--accent); box-shadow: 0 0 0 2px var(--paper-raised); }
.coach-status { margin: 0; padding-inline: var(--space-4); text-align: center; }
.coach-status:empty { display: none; }
/* The layer: the latest exchange over the page (the whole session when asked), folded to one line on request. */
.coach-layer {
  display: flex; flex-direction: column; gap: var(--space-3); min-height: 0; max-height: min(62dvh, 36rem); padding: var(--space-3) var(--space-4) var(--space-4);
  border: 1.5px solid var(--edge); border-radius: var(--radius-xl); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-lg); animation: coach-rise .2s ease-out;
}
@keyframes coach-rise { from { opacity: 0; transform: translateY(.5rem); } }
.coach-panel[data-layer="folded"] .coach-layer, .coach-panel[data-layer="closed"] .coach-layer { display: none; }
.coach-layer__head { display: flex; align-items: center; gap: var(--space-1); }
.coach-who { display: flex; align-items: center; gap: var(--space-3); min-width: 0; margin-right: auto; }
.coach-who__name { display: flex; flex-direction: column; min-width: 0; }
.coach-who__name > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-thread { display: flex; flex-direction: column; gap: var(--space-4); min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.coach-layer:not(.is-past) .coach-exchange:not([data-current]) { display: none; }
.coach-layer.is-past .coach-exchange:not(:last-child) { padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.coach-layer:has(.coach-exchange) .coach-empty { display: none; }
.coach-layer:not(:has(.coach-exchange)) :is(.coach-past, .coach-new) { display: none; }
.coach-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.coach-empty p { margin: 0; }
.coach-summary { display: flex; align-items: center; gap: var(--space-2); max-width: 100%; padding: var(--space-2) var(--space-4); border: 1.5px solid var(--edge); border-radius: var(--radius-full); background: var(--paper-raised); box-shadow: var(--shadow-md); color: var(--ink); text-align: left; cursor: pointer; animation: coach-rise .2s ease-out; }
.coach-summary span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-summary .pakt-icon { flex: none; width: 16px; height: 16px; color: var(--ink-muted); }
.coach-summary[hidden] { display: none; }
.coach-exchange { display: flex; flex-direction: column; gap: var(--space-2); }
.coach-exchange .pakt-msg__col { max-width: 100%; }
.coach-exchange .pakt-msg__bubble { font: var(--text-body); }
.coach-exchange p, .coach-exchange figure { margin: 0; }
.coach-exchange[data-follow] { padding-top: var(--space-3); border-top: 1px dashed var(--line); }
.coach-image { display: block; width: 100%; border-radius: var(--radius-lg); }
.coach-thread .tutor-diagram svg { display: block; width: 100%; height: auto; }
.coach-thread .tutor-diagram rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.coach-thread .tutor-diagram text { fill: var(--ink); font: var(--text-body); }
.coach-translate summary, .coach-action { color: var(--ink-muted); cursor: pointer; }
.coach-action { cursor: default; }
.coach-cite { display: inline-block; min-width: 1.2em; margin-inline: .1em; padding: 0 .25em; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); font: 700 .75em/1.5 var(--font-sans); text-align: center; text-decoration: none; vertical-align: .15em; }
.coach-cite:hover { background: var(--accent); color: var(--on-ink); }
.coach-dig { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1); padding: 0; border: 0; background: none; color: var(--ink-muted); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.coach-dig[disabled] { opacity: .5; cursor: default; }
.coach-dig .pakt-icon { width: 14px; height: 14px; }
/* While it works: each step is something the coach really does, then the answer as it is written. */
.coach-trace { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.coach-trace:empty { display: none; }
.coach-step { display: flex; align-items: center; gap: var(--space-2); min-height: 1.25rem; font: var(--text-caption); color: var(--ink-muted); animation: coach-rise .2s ease-out; }
.coach-step__mark { display: inline-flex; flex: none; width: 1.25rem; height: 1.25rem; align-items: center; justify-content: center; }
.coach-step__mark pakt-orb { width: 1.25rem; height: 1.25rem; }
.coach-step__mark .pakt-icon { width: 14px; height: 14px; }
.coach-step[data-state="done"] .coach-step__mark { color: var(--accent); }
.coach-step[data-state="fail"] .coach-step__mark { color: var(--ink-muted); }
.coach-step[data-state="fail"] .coach-step__label { text-decoration: line-through; }
.coach-step__label { flex: none; color: var(--ink); }
.coach-step__detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-waiting { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-muted); }
.coach-exchange:has(.coach-step[data-state="run"]) .coach-waiting { display: none; }  /* a running step already has its own orb */
.coach-text.is-writing::after { content: ""; display: inline-block; width: .5em; height: 1em; margin-left: .1em; border-radius: 2px; background: var(--accent); vertical-align: text-bottom; animation: coach-caret 1s steps(2, start) infinite; }
@keyframes coach-caret { to { visibility: hidden; } }
.coach-reasoning { color: var(--ink-muted); }
.coach-reasoning > summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; list-style: none; font: var(--text-caption); }
.coach-reasoning > summary::-webkit-details-marker { display: none; }
.coach-reasoning > summary::after { content: "Voir sa réflexion"; text-decoration: underline dotted; text-underline-offset: 3px; }
.coach-reasoning[open] > summary::after { content: "Masquer"; }
.coach-reasoning.is-thinking > summary::after { content: ""; }
.coach-reasoning > p { max-height: 10rem; margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3); overflow-y: auto; border-left: 2px solid var(--line); font: var(--text-caption); white-space: pre-wrap; }
/* What it used: one chip per memory, page or source, each with its details on hover, focus or tap. */
.coach-used { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.coach-chipwrap { position: relative; display: inline-flex; max-width: 100%; }
.coach-chip { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%; min-height: 1.75rem; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-full); background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-muted); font: inherit; text-decoration: none; cursor: help; }
.coach-chip[data-kind="source"] { cursor: pointer; }
.coach-chip .pakt-icon { flex: none; width: 14px; height: 14px; }
.coach-chip[data-kind="memory"] .pakt-icon, .coach-chip[data-kind="episode"] .pakt-icon { color: var(--accent); }
.coach-chip:hover, .coach-chip:focus-visible, .coach-chip[aria-expanded="true"] { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.coach-chipwrap.is-forgotten .coach-chip { opacity: .5; text-decoration: line-through; }
.coach-tip { position: fixed; inset: auto; margin: 0; width: min(22rem, 78vw); max-height: 14rem; overflow-y: auto; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border: 0; border-radius: var(--radius-lg); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); font: var(--text-caption); text-align: left; white-space: normal; overflow-wrap: anywhere; }
.coach-tip:popover-open { display: flex; }  /* a popover sits in the top layer: no scrolling box clips it, no transformed ancestor offsets it */
.coach-forget { align-self: flex-start; padding: var(--space-1) var(--space-3); border: 0; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.coach-forget[disabled] { opacity: .6; cursor: default; }
@media (min-width: 48rem) {
  .has-coach { --coach-bottom: var(--space-4); }
  .coach-panel { left: calc(var(--rail) + var(--space-4)); }
  .has-coach .ds-screen { padding-bottom: calc(var(--coach-bottom) + var(--coach-h) + var(--space-12)); }
}
/* What floats over the page (toasts, the meal reminder) rises above the coach's bar. */
.has-coach :is(.ds-toasts, .meal-reminder) { bottom: calc(var(--coach-bottom) + var(--coach-h) + var(--space-3)); }
/* The session's main button stays on screen, just above the coach's bar. */
.coach-start { position: sticky; z-index: 3; bottom: calc(var(--coach-bottom) + var(--coach-h) + var(--space-2)); box-shadow: var(--shadow-md); }
/* Lessons dock their Back / Continue bar at the bottom: the coach stands just above it. */
.has-coach.ds--session { --coach-bottom: calc(var(--dock-top) + var(--space-2)); }
.has-coach.ds--session .ds-screen { padding-bottom: calc(var(--coach-bottom) + var(--coach-h) + var(--space-6)); }
/* The practice cockpit must fit one phone screen: its coach opens from the "Ton coach" sheet (and on request), then covers the bottom. */
@media (max-width: 63.99rem) {
  .ds--practice .coach-panel:not(.is-open) { display: none; }
  .ds--practice .coach-panel { bottom: calc(var(--nav-space) + var(--space-2)); }
  .has-coach.ds--practice .ds-screen { padding-bottom: calc(var(--nav-space) + var(--space-3)); }  /* no bar to make room for: the cockpit keeps the whole screen */
}
@media (prefers-reduced-motion: reduce) { .coach-layer, .coach-summary, .coach-step { animation: none; } .coach-text.is-writing::after { animation: none; } }

/* ---------- Teaching figures drawn from data (figures.py): keyboard, drum grid, letter forms, formulas, generated images ---------- */
.ds-visual { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: var(--space-4); border: 1.5px solid var(--edge); border-radius: var(--radius-lg); background: var(--paper-raised); overflow-x: auto; }
.ds-visual svg { display: block; width: 100%; height: auto; max-height: 22rem; }
.ds-visual img { display: block; width: 100%; border-radius: var(--radius-md); }
.kb-white { fill: #fdfbf7; stroke: var(--line-strong); stroke-width: 1; }
.kb-black { fill: #1d1a17; stroke: #1d1a17; }
.kb-on { fill: var(--accent); stroke: var(--accent); }
.kb-finger { fill: var(--on-ink); font: 700 13px var(--font-sans, sans-serif); }
.kb-white.kb-on + .kb-finger, .kb-white + .kb-finger { fill: #1d1a17; }
.kb-label { fill: var(--ink); font: 600 12px var(--font-sans, sans-serif); }
.dg-count { fill: var(--ink-muted); font: 11px var(--font-sans, sans-serif); }
.dg-count.dg-beat { fill: var(--ink); font-weight: 700; }
.dg-voice { fill: var(--ink); font: 12px var(--font-sans, sans-serif); }
.dg-line { stroke: var(--line); stroke-width: 1; }
.dg-line.dg-strong { stroke: var(--line-strong); stroke-width: 1.5; }
.dg-hit { fill: var(--ink); }
.dg-ghost { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 2 2; }
.dg-open { fill: none; stroke: var(--ink); stroke-width: 2; }
.dg-mark, .dg-stick { fill: var(--accent); font: 700 12px var(--font-sans, sans-serif); }
.lt { width: 100%; border-collapse: collapse; font: var(--text-body); }
.lt th { font: var(--text-caption); color: var(--ink-muted); text-align: center; padding: var(--space-1); }
.lt td { padding: var(--space-2); border-top: 1px solid var(--line); text-align: center; }
.lt td:last-child { text-align: left; }
.lt .lt-glyph { font-size: 2rem; line-height: 1.4; }
.ds-visual--formula math { font-size: 1.4rem; }

/* ---------- Guided workout: one exercise per screen, fits a phone above the tab bar ---------- */
.ds--workout .ds-screen { gap: var(--space-4); padding-top: var(--space-4); }
.wk { display: flex; flex-direction: column; gap: var(--space-4); --tone: var(--tide); }
.wk[data-kind="rest"] { --tone: var(--moss); }
.wk-top { display: flex; align-items: center; gap: var(--space-3); }
.wk-progress { flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--paper-sunken); overflow: hidden; }
.wk-progress__fill { display: block; width: 0; height: 100%; background: var(--tone); transition: width var(--dur-slow) linear; }
.wk-voice[aria-pressed="false"] { opacity: .45; }
.wk-start, .wk-end { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-6); }
.wk-stage { display: flex; flex-direction: column; gap: var(--space-2); }
.wk-media { position: relative; display: grid; place-items: center; margin: 0; height: min(27vh, 18rem); border-radius: var(--radius-xl); background: #fff; overflow: hidden; }
.wk-media img { width: 100%; height: 100%; object-fit: contain; }
.wk-media__none { color: var(--tone); }
.wk[data-kind="rest"] .wk-media { opacity: .55; }
.wk-name { text-wrap: balance; }
.wk-clock { font: var(--text-display); font-size: clamp(3rem, 14vw, 5.5rem); line-height: 1; font-variant-numeric: tabular-nums; color: var(--tone); }
.is-paused .wk-clock { opacity: .5; }
.wk-steps[hidden] { display: none; }
.wk-controls { display: flex; align-items: center; justify-content: center; gap: var(--space-6); }
.ds--workout .ds-screen { padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px)); }
.wk-media:has(img[hidden]) { background: var(--paper-raised); }
.ds-block > .pakt-btn--ghost:first-child { align-self: flex-start; }
.wk-main { display: grid; place-items: center; width: 76px; height: 76px; border: 0; border-radius: var(--radius-full); background: var(--tone); color: var(--paper-raised); box-shadow: var(--shadow-md); cursor: pointer; }
.wk-main__pause { width: 22px; height: 26px; border-inline: 7px solid currentColor; }
.wk-main__play { display: none; }
.is-paused .wk-main__pause { display: none; }
.is-paused .wk-main__play { display: grid; }
.wk-more { justify-content: center; }
.wk-mic.listening { color: var(--critical); }
.workout-thumbs { display: flex; gap: var(--space-2); overflow-x: auto; }
.workout-thumbs img { flex: none; width: 64px; height: 64px; border-radius: var(--radius-md); object-fit: cover; background: #fff; }
.exercise-item > summary img, .exercise-item__none { flex: none; width: 48px; height: 48px; border-radius: var(--radius-md); object-fit: cover; background: #fff; display: grid; place-items: center; color: var(--tide); }
.exercise-item > summary > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.free-clock { font: var(--text-display); font-size: clamp(3rem, 14vw, 5rem); line-height: 1.1; font-variant-numeric: tabular-nums; text-align: center; color: var(--tide); }
.free-board { display: flex; flex-direction: column; gap: var(--space-4); }
.free-pod { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; }
.free-pod[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--tide); }
.free-audio { width: 100%; }

/* ---------- Drift: one sourced story per screen, snapped one at a time; the payoff waits behind a tap ---------- */
.ds--drift .ds-screen { gap: 0; padding: 0; }
.drift-feed { position: relative; height: 100dvh; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior-y: contain; scrollbar-width: none; }
.drift-feed::-webkit-scrollbar { display: none; }
.drift-item > * { min-width: 0; }
.drift-item, .drift-end {
  display: flex; flex-direction: column; gap: var(--space-4); min-height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  padding: var(--space-6) var(--space-5) calc(var(--coach-bottom, var(--size-control-lg) * 2 + var(--space-10)) + var(--coach-h, 0px) + var(--space-4));  /* clear of the coach's bar and the tab bar */
}
.drift-item + .drift-item, .drift-end { border-top: 1px solid var(--line); }
.drift-art { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; }
.drift-art img { display: block; width: 100%; height: min(34dvh, 20rem); object-fit: cover; border-radius: var(--radius-lg); background: var(--paper-sunken); }
.drift-art figcaption { overflow: hidden; color: var(--ink-muted); text-overflow: ellipsis; white-space: nowrap; }
.drift-story { display: flex; flex-direction: column; gap: var(--space-3); }
.drift-story h2 { text-wrap: balance; }
.drift-guess { display: flex; flex-direction: column; gap: var(--space-2); }
.drift-pick { height: auto; min-height: var(--size-control-sm); padding-block: var(--space-2); white-space: normal; text-align: left; }
.drift-pick:disabled { opacity: 1; cursor: default; }
.drift-pick[data-state="right"] { background: var(--positive-soft); box-shadow: inset 0 0 0 1.5px var(--positive); }
.drift-pick[data-state="wrong"] { background: var(--critical-soft); box-shadow: inset 0 0 0 1.5px var(--critical); }
.drift-reveal { align-self: flex-start; }
.drift-item:not(.is-revealed) .drift-payoff, .drift-item.is-revealed .drift-reveal { display: none; }
.drift-payoff { display: flex; flex-direction: column; gap: var(--space-2); padding-left: var(--space-4); border-left: 3px solid var(--accent); }
.drift-payoff a { text-decoration: underline; text-underline-offset: 2px; }
.drift-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin-top: auto; }
.drift-actions [aria-pressed="true"] { color: var(--accent); }
.drift-actions [data-react="1"][aria-pressed="true"] svg { fill: currentColor; }
.drift-end { justify-content: center; }
.drift-end > [data-when] { display: none; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.drift-end[data-state="more"] > [data-when="more"], .drift-end[data-state="preparing"] > [data-when="preparing"],
.drift-end[data-state="empty"] > [data-when="empty"], .drift-end[data-state="tomorrow"] > [data-when="tomorrow"] { display: flex; }
.drift-toast { position: fixed; z-index: 14; top: var(--space-4); left: 50%; max-width: calc(100vw - var(--space-8)); transform: translateX(-50%); box-shadow: var(--shadow-md); }
@media (min-width: 48rem) { .drift-item, .drift-end { padding-bottom: calc(var(--size-control-lg) + var(--space-10)); } }

/* Dialogs are sheets: bottom on phones, centred from tablet up. */
.ds-sheet { width: min(100% - var(--space-8), 36rem); max-height: 85dvh; padding: var(--space-5); overflow-y: auto; border: 1.5px solid var(--edge); border-radius: var(--radius-xl); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-lg); }
.ds-sheet[open] { display: flex; flex-direction: column; gap: var(--space-5); }
.ds-sheet::backdrop { background: var(--scrim); }
@media (max-width: 47.99rem) {
  .ds-sheet { width: 100%; max-width: none; margin: auto auto 0; padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
}

/* Today's day program: where I am, one tap to run everything, each step able to wait. */
.day { gap: var(--space-4); }
.day-place .ds-fieldset { display: flex; flex-direction: column; gap: var(--space-2); padding: 0; border: 0; }
.day-place .ds-chips { flex-wrap: nowrap; }
.day-place .pakt-chip { flex: 1; justify-content: center; }
.day-go { display: flex; flex-direction: column; gap: var(--space-2); }
.day-step { display: flex; flex-direction: column; gap: var(--space-1); }
.day-step[data-state="skipped"] > :first-child { opacity: .55; }
.day-resume { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.day-later { margin-left: var(--space-3); }
.day-later summary { min-height: 0; padding-block: var(--space-1); }
.day-one { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.day-one .ds-field { flex: 1 1 12rem; min-width: 0; }
.screen-awake { flex-shrink: 0; }
.screen-awake[data-wake-state="on"] { color: #2778a1; background: #65baff20; }
.screen-awake[data-wake-state="blocked"], .screen-awake[data-wake-state="waiting"] { color: #b36825; }
