/* practice.css — Практика: check · talk · scenarios · my text. Root = .screen.chat (flex column). */

/* centred column: full width on phone, 760px on desktop */
.chat-top, .pane { width: 100%; max-width: 760px; margin-inline: auto; min-width: 0; }
.chat-top { flex: none; display: flex; flex-direction: column; gap: var(--s-3);
  padding: calc(var(--s-4) + env(safe-area-inset-top)) max(var(--s-5), env(safe-area-inset-right)) var(--s-3) max(var(--s-5), env(safe-area-inset-left)); }
.chat-top .pagehead h1 { font-size: var(--t-2xl); margin-top: 0; }
.chat-top .pagehead-acts .iconbtn { margin: -4px -8px -4px 0; }
.chat-top .tts { border: 1px solid var(--line2); width: 44px; height: 44px; margin: 0; }
.chat-top .tts[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-3) max(var(--s-5), env(safe-area-inset-right)) var(--s-6) max(var(--s-5), env(safe-area-inset-left)); scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.pane-scroll > .lede { margin-top: 0; font-size: var(--t-md); }
.pane-scroll .pagehead h1 { font-size: var(--t-2xl); }
.pane-scroll .sec-h { margin-top: var(--s-2); }
.pane-scroll .inp { min-height: 140px; font-family: var(--font-head); font-size: 1rem; line-height: 1.5; }
.pane > .empty, .scen-view > .empty { flex: 1; }

/* chat view */
.scen-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--s-5);
  padding: var(--s-4) max(var(--s-5), env(safe-area-inset-right)) var(--s-4) max(var(--s-5), env(safe-area-inset-left)); scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.msgs > .empty { margin: auto; }
.msg { max-width: 92%; overflow-wrap: anywhere; min-width: 0; }
.msg.tutor { align-self: flex-start; padding-left: var(--s-4); border-left: 1px solid var(--line2); font-family: var(--font-head); font-size: var(--t-lg); line-height: 1.5; }
.msg.you { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 2px; padding: var(--s-3) var(--s-4); font-size: var(--t-md); line-height: 1.5;
  box-shadow: 0 1px 0 var(--line), 0 6px 12px -10px var(--shadow); max-width: 85%; }
.msg.typing { display: flex; gap: 6px; align-items: center; min-height: 30px; }
.msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .35; animation: typing 1.2s ease-in-out infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; }
.msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 50% { opacity: .9; } }

/* issues: small numbered notes */
.notes { list-style: none; padding: 0; margin: var(--s-3) 0 0; counter-reset: n; display: flex; flex-direction: column; font-family: var(--font); font-size: var(--t-md); }
.notes .issue { counter-increment: n; position: relative; padding: var(--s-3) 0 var(--s-3) 26px; border-top: 1px solid var(--line); }
.notes .issue::before { content: counter(n); position: absolute; left: 0; top: var(--s-3); font-family: var(--font-head); font-size: var(--t-sm); color: var(--accent); }
.notes .fix { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); font-family: var(--font-head); font-size: var(--t-lg); line-height: 1.35; }
.notes .fix del + ins::before { content: "→ "; color: var(--muted); font-style: normal; }
.notes .fix ins { border-bottom: 0; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.notes .fix .chip { font-family: var(--font); margin-left: auto; white-space: normal; }
.notes .issue p { margin-top: 6px; font-family: var(--font); font-size: var(--t-sm); color: var(--muted); line-height: 1.5; }
.pane-scroll .notes { margin: 0; border-bottom: 1px solid var(--line); }

/* composer: pinned to the bottom of the column; #app height tracks the keyboard */
.composer { flex: none; display: flex; align-items: flex-end; gap: var(--s-1); background: var(--bg) var(--grain); border-top: 1px solid var(--line2);
  padding: var(--s-3) max(var(--s-4), env(safe-area-inset-right)) var(--s-3) max(var(--s-4), env(safe-area-inset-left)); }
.composer .inp { flex: 1; min-width: 0; min-height: var(--tap); max-height: 160px; padding: 12px var(--s-3); font-size: 1rem; }
.composer .iconbtn { width: 44px; height: 44px; }
.composer .iconbtn.ru { font-size: var(--t-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.composer .btn.primary { flex: none; min-width: var(--tap); padding: 0 var(--s-4); }
.composer .btn.primary .ic { width: 20px; height: 20px; }

/* scenarios */
.scen-head { flex: none; display: flex; flex-direction: column; gap: var(--s-3); border-bottom: 1px solid var(--line2);
  padding: var(--s-2) max(var(--s-5), env(safe-area-inset-right)) var(--s-3) max(var(--s-5), env(safe-area-inset-left)); }
.scen-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.scen-goal { min-width: 0; }
.scen-goal h2 { font-size: var(--t-lg); font-style: italic; margin-top: 2px; }
.scen-goal p { font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }
.scen-bar .btn { flex: none; }
.scen-targets { display: flex; flex-direction: column; gap: var(--s-2); }
.targets .chip { font-family: var(--font-head); font-weight: 500; font-size: var(--t-sm); }
.targets .chip .ic { width: 14px; height: 14px; stroke-width: 2; }
.pane-scroll .scen-targets .label { margin-top: 0; }
.pane-scroll .rows { margin-top: calc(var(--s-1) * -1); }
.pane-scroll .row .nm small { max-width: 52ch; }

/* on-screen keyboard open (phone): drop the page title, keep the chat + chips in the short viewport */
@media (max-width: 1023px) {
  .kb .chat-top .pagehead, .kb .scen-goal p, .kb .scen-targets .label { display: none; }
  .kb .chat-top { padding-top: calc(var(--s-2) + env(safe-area-inset-top)); padding-bottom: var(--s-2); }
  .kb .scen-head { gap: var(--s-2); padding-bottom: var(--s-2); }
  .kb .scen-targets .targets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .kb .scen-targets .targets .chip { flex: none; }
  .kb .composer { padding-bottom: var(--s-2); }
}

/* my text: coverage */
.stats { display: flex; flex-direction: column; }
.cov-row { display: flex; flex-direction: column; gap: 6px; padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.cov-row .mini-row { display: flex; align-items: baseline; justify-content: space-between; }
.cov-row .mini-row b { font-size: var(--t-2xl); font-weight: 500; line-height: 1; }
.unk { display: flex; flex-direction: column; }
.unk-row { display: flex; align-items: baseline; gap: var(--s-3); min-height: 48px; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.unk-row > input { align-self: center; width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.unk-row b { font-family: var(--font-head); font-weight: 500; font-size: var(--t-lg); overflow-wrap: anywhere; }
.unk-row .ld { flex: 1; border-bottom: 1px dotted var(--line2); transform: translateY(-4px); min-width: 12px; }
.unk-row .vl { font-family: var(--font-head); font-variant-numeric: tabular-nums lining-nums; color: var(--muted); }
.unk-row.added { opacity: .5; }
.unk-row.added b { text-decoration: line-through; text-decoration-thickness: 1px; }
.unk-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); position: sticky; bottom: 0; padding: var(--s-3) 0; background: var(--bg) var(--grain); }

@media (min-width: 1024px) {
  .chat-top { padding: var(--s-6) 0 var(--s-3); }
  .chat-top .pagehead h1 { font-size: 2.25rem; }
  .pane-scroll { padding-inline: 0; }
  .msgs { padding-inline: 0; }
  .scen-head { padding-inline: 0; }
  .composer { padding: var(--s-3) 0 var(--s-5); }
  .composer .btn.primary { padding: 0 var(--s-4); }
  .kb .composer { padding-bottom: var(--s-3); }
}

@media (max-width: 380px) {
  .chat-top .seg button { padding: 0 2px; font-size: .8125rem; }
  .composer { gap: 0; padding-left: var(--s-3); padding-right: var(--s-3); }
  .composer .iconbtn { width: 40px; }
  .composer .btn.primary { padding: 0 var(--s-3); margin-left: var(--s-1); }
  .composer .inp { padding-inline: var(--s-3); }
}
