/* Practice (simulation) page layout. Design tokens + base components come from
   app.css; the header/card/toast follow the deals.html page-local pattern. */

header.bar { display: flex; align-items: center; gap: var(--sp-3); padding: 12px var(--sp-5); border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), var(--c-translation)); color: #fff; font-weight: 800; }
.brand .sub { color: var(--text-faint); font-weight: 500; font-size: 12px; }
.bar-spacer { margin-left: auto; }
.status-label { color: var(--text-dim); font-size: 13px; margin-right: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border-strong); padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; z-index: 40; }
.toast.err { background: var(--c-now-bg); color: var(--bad); border-color: var(--bad); }
.toast.ok { color: var(--good); border-color: var(--good); }
.toast[hidden] { display: none; }

/* The whole page is a live surface, not a scrolling document. */
.notice { max-width: 560px; margin: 12vh auto; text-align: center; color: var(--text-dim); }
.notice h2 { color: var(--text); }

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--sp-5);
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--sp-5);
  align-items: start;
}

/* ---- builder (left) ---- */
.builder { display: flex; flex-direction: column; gap: var(--sp-4); }
.builder .card { padding: var(--sp-4); }
.builder h2 { font-size: 14px; margin: 0 0 var(--sp-3); display: flex; gap: 8px; align-items: baseline; }
.builder h2 .hint { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.field { display: block; margin-bottom: var(--sp-3); }
.field > span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.field > span.red { color: var(--c-now); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
textarea.input { resize: vertical; font: inherit; }
.row { margin-bottom: 2px; display: flex; gap: 6px; }
.row select { flex: 1; }

.actions { display: flex; gap: var(--sp-3); position: sticky; bottom: 0; align-items: center; }
.actions .btn { flex: 1; }
.actions .btn.danger { flex: 0; color: var(--bad); }

/* ---- chip editor (reused pattern) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--surface-3); font-size: 12px; }
.chip.red { background: var(--c-now-bg); color: var(--c-now); }
.chip button { background: none; border: none; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; }
.chip-add { display: flex; gap: 6px; }
.chip-add .input { padding: 6px 9px; }
.chip-add .btn { padding: 6px 10px; }

/* ---- dropzone ---- */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--sp-4);
  text-align: center; color: var(--text-faint); cursor: pointer; font-size: 13px; transition: var(--t-fast); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--text-dim); }
.dz-file { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.dz-file span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.doc-list .doc { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-dim); }

/* ---- live feed (right) ---- */
.live { position: sticky; top: var(--sp-4); }
.live-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.live-head h2 { font-size: 15px; margin: 0; }
.feed { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 60vh;
  max-height: calc(100vh - 140px); overflow-y: auto; padding-right: 6px; }
.feed .empty { margin: auto; text-align: center; color: var(--text-faint); }
.feed .empty .big { display: block; font-size: 34px; margin-bottom: 8px; }

/* turn bubbles */
.turn { display: flex; flex-direction: column; max-width: 76%; animation: fade .25s ease; }
.turn.them { align-items: flex-start; }
.turn.us { align-items: flex-end; margin-left: auto; }
.turn .who { font-size: 11px; color: var(--text-faint); margin: 0 6px 3px; text-transform: uppercase; letter-spacing: .04em; }
.coached-badge { margin-left: 6px; color: var(--c-now); font-weight: 650; letter-spacing: 0; text-transform: none; }
.turn .bubble { padding: 9px 13px; border-radius: 14px; line-height: 1.45; }
.turn.them .bubble { background: var(--surface-3); border-bottom-left-radius: 4px; }
.turn.us .bubble { background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; }

/* advice cards (inline, styled by urgency/type via app.css tokens) */
.advice { border-left: 3px solid var(--c-ambient); background: var(--surface-2); border-radius: var(--r-md);
  padding: 10px 13px; animation: fade .25s ease; }
.advice.now { border-color: var(--c-now); background: var(--c-now-bg); }
.advice.note { border-color: var(--c-note); }
.advice.action_item { border-color: var(--c-action); }
.advice.translation { border-color: var(--c-translation); }
.advice .atag { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }
.advice.now .atag { color: var(--c-now); }
.advice .ahead { font-weight: 650; margin-bottom: 2px; }
.advice .adetail { font-size: 13px; color: var(--text-dim); }
.advice .refs { font-size: 10px; color: var(--c-ambient); margin-top: 4px; }

/* synthesis card */
.synthesis { border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-4);
  background: var(--surface-2); animation: fade .3s ease; }
.synthesis h3 { margin: 0 0 8px; font-size: 15px; }
.synthesis .sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 14px 0 4px; }
.synthesis ul { margin: 0; padding-left: 18px; }
.synthesis li { margin: 3px 0; font-size: 13px; }

.pending { color: var(--text-faint); font-size: 13px; text-align: center; padding: 8px; }

/* ---------------------------------------------------------------- discovery */

/* The human rep's composer. Only visible while a live round is actually waiting
   on a turn — the engine is blocked at that moment, so the state must be
   unmistakable rather than decorative. */
.composer { border-top: 1px solid var(--border); padding-top: var(--sp-3); margin-top: var(--sp-3);
  display: flex; flex-direction: column; gap: 6px; animation: fade .2s ease; }
.composer textarea.input { resize: vertical; font: inherit; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.composer.waiting textarea.input { border-color: var(--accent); }

/* The pains editor: one row per hidden problem. */
.pain { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px;
  margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.pain .pain-head { display: flex; align-items: center; gap: 8px; }
.pain .pain-head .idx { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.pain .pain-head button { margin-left: auto; }

/* The debrief. Deliberately moment-first: the quoted turn and the better
   question come before any number, because a quote is checkable by the reader
   even when a sub-score is arguable — and reps act on the quote. */
.debrief { border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-4);
  background: var(--surface-2); animation: fade .3s ease; }
.debrief h3 { margin: 0 0 4px; font-size: 15px; }
.debrief .dframework { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: var(--sp-3); }
.debrief .miss { border-left: 3px solid var(--c-now); background: var(--c-now-bg); border-radius: var(--r-md);
  padding: 10px 13px; margin-bottom: var(--sp-3); }
.debrief .miss .mlabel { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--c-now); margin-bottom: 4px; }
.debrief .quote { font-style: italic; margin-bottom: 4px; }
.debrief .better { font-weight: 650; }
.debrief .moment { border-left: 2px solid var(--border-strong); padding: 6px 11px; margin-bottom: 8px; font-size: 13px; }
.debrief .sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 14px 0 6px; }
.debrief ul { margin: 0; padding-left: 18px; }
.debrief li { margin: 3px 0; font-size: 13px; }
.debrief .overall { font-size: 26px; font-weight: 700; line-height: 1; }
.debrief .overall span { font-size: 12px; font-weight: 500; color: var(--text-faint); }

/* Sub-scores: a label, a bar, a number. A bar makes "48 out of 100" legible at a
   glance without pretending to a precision the judge does not have. */
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 11rem 1fr 2.5rem; align-items: center; gap: 8px; font-size: 12.5px; }
.bar-row .track { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: var(--accent); }
.bar-row .fill.low { background: var(--bad); }
.bar-row .fill.mid { background: var(--c-action); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.bar-row .na { color: var(--text-faint); font-size: 11px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.facts b { color: var(--text); font-variant-numeric: tabular-nums; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .live { position: static; } }
