/* «Написать в чат пары» (js/pair-chat.js): нативный <dialog> поверх любого экрана, как «На доработку». */

.pc {
  width: min(520px, calc(100vw - 2 * var(--gutter)));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: transparent;
  overflow: visible;
}
.pc:not([open]) { display: none; }
.pc::backdrop {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pc-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-height: min(86dvh, 840px);
  overflow: hidden;
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.pc-card > * { flex: none; }
.pc-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.pc-card__top .panel__label { margin-bottom: var(--s-1); }
.pc-card__subject { font-size: var(--fs-18); font-weight: 700; line-height: 1.3; }
.pc-quick { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pc-quick .chip-f { min-height: 34px; padding: 0 12px; }
.pc-hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.pc-hint:empty { display: none; }
.pc-hint__chip { min-height: 34px; padding: 0 12px; background: var(--accent-soft); color: var(--accent-text); }
.pc-hint__note { color: var(--text-3); font-size: var(--fs-14); }
.pc-text {
  width: 100%;
  min-height: 88px;
  padding: var(--s-3) var(--s-4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-16);
  resize: vertical;
}
.pc-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pc-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); }
.pc-left { margin-right: auto; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
/* What was sent: a messenger's thread above the box, the newest at the bottom, the student's side on the right. */
/* Only the thread scrolls: the header and the box stay where the thumb is. */
.pc-card > .pc-log {
  display: grid;
  align-content: start;
  flex: 0 1 auto;
  min-height: 0;
  gap: var(--s-3);
  margin: 0 calc(-1 * var(--s-2));
  padding: 2px var(--s-2);
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.pc-card > .pc-log:empty { display: none; }
.pc-msg { display: grid; justify-items: end; gap: 4px; animation: pc-in 0.32s var(--ease-out) both; }
.pc-msg__bubble {
  display: grid;
  gap: 6px;
  max-width: min(88%, 26rem);
  padding: 9px 14px;
  border-radius: 18px 18px 6px 18px;
  background: var(--surface-2);
  color: var(--text);
}
.pc-msg__text { margin: 0; font-size: var(--fs-15, 15px); line-height: 1.4; overflow-wrap: anywhere; }
.pc-msg__meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-right: 4px;
  color: var(--text-3);
  font-size: var(--fs-12);
}
.pc-msg__badge { display: inline-flex; }
.pc-msg__badge svg { width: 13px; height: 13px; }
.pc-msg.is-ok .pc-msg__meta { color: var(--success); }
.pc-msg.is-bad .pc-msg__meta { color: var(--danger); }
.pc-msg.is-bad .pc-msg__bubble { opacity: 0.7; }

/* «отправляю…»: three dots, one after another */
.pc-dots { display: inline-flex; gap: 2px; }
.pc-dots b { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: pc-dot 1.1s ease-in-out infinite; }
.pc-dots b:nth-child(2) { animation-delay: 0.15s; }
.pc-dots b:nth-child(3) { animation-delay: 0.3s; }

/* «Голосом»: a voice message — the mic, the phrase's own wave, the words under it. The wave lives with the stage:
   breathes while the voice is made, plays like a meter while it sounds in the room, stays filled once said. */
.pc-msg.is-voice .pc-msg__bubble { background: var(--accent-soft); min-width: 13rem; }
.pc-msg.is-voice .pc-msg__text { color: var(--text-2); font-size: var(--fs-14); }
.pc-voice { display: flex; align-items: center; gap: 10px; }
.pc-voice__mic {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
.pc-voice__mic svg { width: 16px; height: 16px; }
.pc-wave { display: flex; align-items: center; gap: 2px; height: 26px; flex: 1; min-width: 0; }
.pc-wave i {
  flex: 1 1 0;
  max-width: 4px;
  min-width: 2px;
  height: calc(var(--h) * 1%);
  border-radius: 2px;
  background: var(--accent-text);
  opacity: 0.35;
  transform-origin: center;
  transition: opacity 0.4s var(--ease-out);
}
.pc-msg.is-voice.is-wait .pc-wave i,
.pc-msg.is-voice.is-making .pc-wave i { animation: pc-breathe 1.4s ease-in-out infinite; animation-delay: var(--d); }
.pc-msg.is-voice.is-speaking .pc-wave i { opacity: 1; animation: pc-meter 0.62s ease-in-out infinite alternate; animation-delay: var(--d); }
.pc-msg.is-voice.is-speaking .pc-voice__mic { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); animation: pc-ring 1.3s ease-out infinite; }
.pc-msg.is-voice.is-ok .pc-wave i { opacity: 1; }
.pc-msg.is-voice.is-ok .pc-voice__mic { background: var(--success); }
.pc-msg.is-voice.is-bad .pc-wave i { background: var(--text-3); opacity: 0.4; }
.pc-msg.is-voice.is-bad .pc-voice__mic { background: var(--text-3); }

@keyframes pc-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pc-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes pc-breathe { 0%, 100% { opacity: 0.25; transform: scaleY(0.55); } 50% { opacity: 0.7; transform: scaleY(1); } }
@keyframes pc-meter { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
@keyframes pc-ring { to { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  .pc-msg, .pc-dots b, .pc-wave i, .pc-voice__mic { animation: none !important; }
  .pc-msg.is-voice.is-making .pc-wave i { opacity: 0.6; }
}

/* «Голосом» (28.10): the switch */
.pc-mode { align-self: flex-start; }
.pc-mode[hidden] { display: none; }
@media (max-width: 599px) {
  .pc-card { padding: var(--s-4); }
  /* the ready phrases in one row that scrolls sideways: three rows of chips pushed the box off a phone's screen */
  .pc-quick { flex-wrap: nowrap; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4); overflow-x: auto; scrollbar-width: none; }
  .pc-quick::-webkit-scrollbar { display: none; }
  .pc-quick .chip-f { flex: none; }
}

/* «Что было на паре» (js/pair-recap.js) — the same dialog frame. */
.pr-seg { justify-self: start; }
.pr-body { display: grid; gap: var(--s-2); min-height: 120px; font-size: var(--fs-16); line-height: 1.5; }
.pr-body p { margin: 0; }
.pr-lead b { font-weight: 700; }
.pr-lead.is-key { padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--warning-soft); }
.pr-list { display: grid; gap: var(--s-2); margin: 0; padding-left: 1.1em; }
.pr-at { margin-right: 6px; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.pr-wait { color: var(--text-3); }
