/* Talk it through, with a voice (src/interview/talk.js; research/INTERVIEW_V3_PLAN.md features 1 and 4). Loads after
   interview.css, which keeps the older .tk-* rules. The lesson's card system: notes on an index card (a serif title
   over an orange line, ruled lines), your answer on an exercise-book sheet (ruled, an orange margin), the key ideas on
   an index card, the AI pack on a paper slip. The instrument keeps its clock; its grill is the mic and its lamp lights
   while it listens. No level meter. Light and dark both work; motion stops under prefers-reduced-motion. */

.tk {
  --ws-bg: #FFFEFB; --ws-line: rgba(29, 28, 26, .085); --ws-edge: rgba(29, 28, 26, .10);
  --ic-bg: #FFFEFB; --ic-edge: rgba(29, 28, 26, .07);
  --paper-lift: 0 1px 2px rgba(60, 48, 30, .06), 0 10px 22px -12px rgba(60, 48, 30, .22);
}
[data-theme="dark"] .tk {
  --ws-bg: #22211E; --ws-line: rgba(238, 235, 228, .075); --ws-edge: rgba(238, 235, 228, .09);
  --ic-bg: #252420; --ic-edge: rgba(238, 235, 228, .08);
  --paper-lift: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 22px -12px rgba(0, 0, 0, .5);
}

/* Headings in sentence case, no tracked capitals. */
.tk .tk-h { margin: 0 0 12px; font: 600 16px/1.35 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); }

/* ---------------------------------------------------------------- the instrument */
.tk .dr-lamp.on i { background: #E5483A; box-shadow: 0 0 10px rgba(229, 72, 58, .75), 0 0 24px rgba(229, 72, 58, .3); animation: tk-breathe 2.6s ease-in-out infinite; }
.tk.is-live .dr-grill { opacity: .95; background-image: radial-gradient(circle, rgba(194, 65, 12, .75) 1.6px, transparent 2px); }
[data-theme="dark"] .tk.is-live .dr-grill { background-image: radial-gradient(circle, rgba(255, 122, 69, .7) 1.6px, transparent 2px); }
.tk .dr-screen { min-height: 92px; }
.tk .dr-screen:not(.is-intro) .dr-sub { text-align: center; }
.tk .tk-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #FF5A1F; box-shadow: 0 0 6px rgba(255, 90, 31, .7); vertical-align: 1px; animation: tk-blink 1.6s ease-in-out infinite; }
.tk .dr-row .dr-key.light { padding: 0 14px; }
.tk .dr-row .dr-key:disabled { cursor: progress; }
@keyframes tk-breathe { 50% { box-shadow: 0 0 4px rgba(229, 72, 58, .45), 0 0 10px rgba(229, 72, 58, .12); } }
@keyframes tk-blink { 50% { opacity: .35; } }

/* Wide: a slimmer instrument gives the sheet room for your words beside our answer, and it stays in view. */
@container (min-width: 860px) {
  .tk .dr-wrap { grid-template-columns: minmax(0, 1fr) 340px; }
  .tk .dr-side { position: sticky; top: 14px; }
}
/* Narrow: the instrument rides along the bottom as a slim bar (the clock and its keys), so Speak and Next question
   are always in reach. Above the floating tab bar on phones. */
@container (max-width: 859px) {
  .tk .dr-side { position: sticky; bottom: 10px; z-index: 5; margin-top: 4px; }
  .tk .dr-inst { padding: 8px 8px 10px; border-radius: 16px; }
  .tk .dr-top { display: none; }
  .tk .dr-screen { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 0; padding: 7px 14px; }
  .tk .dr-big { margin: 0; font-size: 24px; text-align: left; }
  .tk .dr-screen .dr-sub, .tk .dr-screen:not(.is-intro) .dr-sub { min-height: 0; margin: 0; text-align: right; }
  .tk .dr-row { margin-top: 8px; }
  .tk .dr-row .dr-key { min-height: 50px; }
}
@media (max-width: 900px) {
  .st-shell .tk .dr-side { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- notes: an index card under the prompt */
.tk-notes { margin: 24px 0 0; padding: 12px 22px 6px; border-radius: 4px; background: var(--ic-bg); box-shadow: 0 0 0 1px var(--ic-edge), var(--lift-1); transition: box-shadow .16s var(--ease); }
.tk-notes:focus-within { box-shadow: 0 0 0 1px var(--ic-edge), 0 0 0 3px color-mix(in srgb, var(--orange) 35%, transparent), var(--lift-1); }
.tk-notes-h { display: block; padding-bottom: 7px; border-bottom: 2px solid var(--orange); font: 400 18px/1.3 var(--serif); font-variation-settings: "opsz" 72; letter-spacing: -.005em; color: var(--ink); cursor: text; }
.tk-notes-in, .tk-type {
  display: block; width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; outline: none; background-color: transparent;
  background-image: repeating-linear-gradient(180deg, transparent 0 29px, var(--ws-line) 29px 30px); background-attachment: local;
  font: 400 16.5px/30px var(--sans); color: var(--ink); caret-color: var(--orange); resize: none; overflow: hidden;
}
.tk-notes-in { min-height: 30px; }
.tk-notes-in::placeholder, .tk-type::placeholder { color: var(--ink-3); opacity: 1; }

/* ---------------------------------------------------------------- your answer: an exercise-book sheet */
.tk-said { position: relative; margin: 18px 0 0; padding: 14px 22px 16px 60px; border-radius: 14px; background: var(--ws-bg); box-shadow: 0 0 0 1px var(--ws-edge), var(--paper-lift); }
.tk-said::before { content: ""; position: absolute; left: 40px; top: 0; bottom: 0; width: 1.5px; background: var(--orange); opacity: .5; }
.tk-said:has(.tk-type:focus) { box-shadow: 0 0 0 1px var(--ws-edge), 0 0 0 3px color-mix(in srgb, var(--orange) 30%, transparent), var(--paper-lift); }
.tk-said-h { margin: 0 0 4px; font: 700 14px/1.4 var(--sans); color: var(--orange-ink); outline: none; }
.tk-said-x { min-height: 90px; font: 400 16.5px/30px var(--sans); color: var(--ink); background-image: repeating-linear-gradient(180deg, transparent 0 29px, var(--ws-line) 29px 30px); }
.tk-said-x.is-live { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.tk-said-x.is-typing { min-height: 0; background-image: none; }
.tk-said-x.is-clip { max-height: 300px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.tk-said-x p { margin: 0; }
.tk-type { min-height: 150px; }
.tk-said-x.is-typing { max-height: none; overflow: visible; }
.tk-words { white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-int { color: var(--ink-3); }
.tk-ph { color: var(--ink-3); }
.tk-said-x .tk-warn { color: var(--ink); }
.tk-said-n { margin: 10px 0 0; max-width: 62ch; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.tk-said-n:empty { display: none; }
.tk-said-x .tk-said-n { margin-top: 8px; }

/* Quiet link-buttons: an underline, a visible focus ring. */
.tk-lbtn { display: inline; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--rule-2); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: text-decoration-color .16s var(--ease); }
.tk-lbtn:hover { text-decoration-color: var(--ink-3); }
.tk button:focus-visible, .tk a:focus-visible, .tk summary:focus-visible, .tk .tk-pack:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }
.tk .tk-tick:focus-visible { border-radius: 6px; }
.tk-fine { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.tk-fine .tk-lbtn { color: var(--ink-2); }

/* ---------------------------------------------------------------- the check: your words beside our answer */
.tk-cmpw { container: tkcmp / inline-size; margin-top: 24px; }
.tk-cmp { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.tk-cmp > .tk-said { margin: 0; }
@container tkcmp (min-width: 700px) {
  .tk-cmp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
  .tk-cmp > .tk-said { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.tk-said.is-done { padding: 14px 20px 14px 44px; }
.tk-said.is-done::before { left: 28px; }
.tk-said.is-done .tk-said-x { min-height: 30px; }
.tk-play + .tk-fine .tk-lbtn { white-space: nowrap; }
.tk-all { margin-top: 6px; font-size: 14px; }
.tk-mynotes { margin: 12px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere; }
.tk-mynotes b { font-weight: 600; color: var(--ink); }

/* play it back: a key, a thin line for where you are, the time */
.tk-play { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.tk-pbtn { flex: none; display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--ink); color: var(--card); font: 500 14.5px var(--sans); transition: filter .16s var(--ease); }
.tk-pbtn:hover { filter: brightness(1.12); }
.tk-glyph { position: relative; width: 14px; height: 14px; }
.tk-glyph::before { content: ""; position: absolute; left: 3px; top: 1px; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }
.tk-pbtn.on .tk-glyph::before { left: 2px; top: 1px; width: 3px; height: 12px; border: 0; background: currentColor; box-shadow: 6px 0 0 currentColor; }
.tk-pbar { position: relative; flex: 1; min-width: 40px; height: 4px; border-radius: 4px; background: var(--ws-line); overflow: hidden; }
.tk-pbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--orange); transition: width .25s linear; }
.tk-ptime { flex: none; font: 12.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* folds inside your sheet */
.tk-said .tk-fold { margin-top: 14px; }
.tk-said .tk-fold summary { font-size: 14.5px; }
.tk-how p, .tk-last p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.tk-how p.tk-fine, .tk-last p.tk-fine { font-size: 13px; color: var(--ink-3); }
.tk-words.is-last { font-size: 15px; line-height: 1.6; color: var(--ink); }

/* How it sounded: a ruler in minutes, our guide shaded, a pencil mark where you landed */
.tk-rule { position: relative; height: 40px; margin: 10px 8px 12px 4px; }
.tk-rule::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; border-top: 1.5px solid var(--ink-3); }
.tk-band { position: absolute; top: 6px; height: 12px; border-radius: 2px; background: color-mix(in srgb, var(--orange) 20%, transparent); }
.tk-tk { position: absolute; top: 7px; width: 0; height: 10px; border-left: 1.5px solid var(--ink-3); font-style: normal; }
.tk-tk b { position: absolute; top: 14px; left: 0; transform: translateX(-50%); font: 500 11.5px var(--mono); color: var(--ink-3); white-space: nowrap; }
.tk-tk.is-0 b { transform: none; left: -2px; }
.tk-tk.is-end b { transform: translateX(-100%); left: 2px; }
.tk-you { position: absolute; top: -3px; width: 0; height: 0; margin-left: -6px; border-style: solid; border-width: 9px 6px 0 6px; border-color: var(--ink) transparent transparent transparent; }
.tk-you::after { content: ""; position: absolute; left: -1px; top: -1px; width: 2px; height: 16px; background: var(--ink); }

/* The key ideas on an index card, ruled, a tick box on each line */
.tk-card { padding: 14px 22px 16px; border-radius: 4px; background: var(--ic-bg); box-shadow: 0 0 0 1px var(--ic-edge), var(--paper-lift); }
.tk-card-h { margin: 0 0 6px; padding-bottom: 8px; border-bottom: 2px solid var(--orange); font: 400 21px/1.3 var(--serif); font-variation-settings: "opsz" 72; letter-spacing: -.01em; color: var(--ink); }
.tk-card .tk-ideas { gap: 0; }
.tk-card .tk-ideas li { padding: 9px 0 10px; border-bottom: 1px solid var(--ws-line); font-size: 15.5px; line-height: 1.5; }
.tk-card .tk-tick { width: 24px; height: 24px; margin-top: 0; }
.tk-card .tk-tick::before { content: ""; position: absolute; inset: -10px; }
.tk .tk-tick { position: relative; }
.tk-card .tk-note { margin-top: 10px; }
.tk-heard { margin-left: 4px; font: italic 400 13.5px var(--serif); color: var(--orange-ink); opacity: .75; }
.tk-model { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ws-line); }
.tk-model summary { font-weight: 500; }

/* ---------------------------------------------------------------- Copy for your own AI: a paper slip */
.tk-ai { padding-top: 16px; }
.tk-ai-b { font-size: 15px; }
.tk-slip { margin-top: 14px; padding: 14px 22px 16px; border-radius: 4px; background: var(--ic-bg); box-shadow: 0 0 0 1px var(--ic-edge), var(--paper-lift); animation: tk-in .24s var(--enter); }
.tk-slip-h { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--orange); font: 400 20px/1.3 var(--serif); font-variation-settings: "opsz" 72; letter-spacing: -.01em; color: var(--ink); }
.tk-slip-p { margin: 0 0 12px; max-width: 64ch; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.tk-pack { max-height: 230px; margin: 0; padding: 12px 14px; overflow: auto; border-radius: 8px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--rule); font: 12.5px/1.6 var(--mono); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-slip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.tk-slip-row .st-btn { min-height: 44px; }
.tk-copied { font-size: 14px; font-weight: 500; color: var(--green); }
.tk-copied:empty { display: none; }
.tk-endline + .tk-ai { margin-top: 18px; border-top: 0; padding-top: 0; }
@keyframes tk-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------------------------------------------------------------- narrow sheets */
@container (max-width: 620px) {
  .tk-notes { padding: 10px 16px 4px; }
  .tk-said { padding: 12px 16px 14px 40px; border-radius: 12px; }
  .tk-said::before { left: 26px; }
  .tk-card { padding: 12px 16px 14px; }
  .tk-slip { padding: 12px 16px 14px; }
  .tk-said-x.is-clip { max-height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .tk .dr-lamp.on i, .tk .tk-dot, .tk-slip { animation: none; }
  .tk-pbar i, .tk-notes, .tk-lbtn, .tk-pbtn { transition: none; }
}
