/* ==========================================================================
   Mentor (mentor.js): pasek z okraglym kadrem wideo i napisami. Ten sam widok
   w trzech miejscach: panel symulatora CI (miedzy naglowkiem a trescia panelu),
   gora tresci lekcji i podpowiedz w cwiczeniu terminala (--samodzielny).
   ========================================================================== */
/* ---------------------------------------------------------------- mentor
   Pasek miedzy naglowkiem a trescia panelu (mentor.js). Nie nachodzi na graf
   ani logi - gdy mowi, ma okragly kadr z napisami obok; po klipie zwija sie
   do jednej linii z miniaturka. Edytor (absolute, inset 0) przykrywa go jak reszte. */
.ci-mentor {
  --m-kadr: 152px;
  flex: none;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: .4rem 1.1rem;
  padding: .9rem 1rem .9rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--accent-soft) 0%, transparent 62%), var(--surface);
}
.ci-mentor[hidden] { display: none; }
.ci-mentor-kadr {
  position: relative; flex: none; width: var(--m-kadr); height: var(--m-kadr);
  border-radius: 50%; cursor: pointer;
  transition: width .32s cubic-bezier(.2, .7, .2, 1), height .32s cubic-bezier(.2, .7, .2, 1);
}
.ci-mentor-wideo {
  display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent-soft), var(--shadow-lg);
  transition: box-shadow .25s;
}
.ci-mentor--gra .ci-mentor-wideo { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), var(--shadow-lg); }
/* fala wokol kadru, gdy mentor mowi */
.ci-mentor-kadr::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0; pointer-events: none;
}
.ci-mentor--gra .ci-mentor-kadr::before { animation: ci-mentor-fala 2.4s ease-out infinite; }
@keyframes ci-mentor-fala { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.13); opacity: 0; } }
/* kropka "nowa wskazowka" przy zwinietym pasku */
.ci-mentor--nowe .ci-mentor-kadr::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.ci-mentor-graj {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(13, 17, 23, .6); color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22), 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .15s, background .15s, opacity .2s;
}
.ci-mentor-graj svg { width: 24px; height: 24px; margin-left: 3px; }
.ci-mentor-graj:hover { transform: scale(1.07); background: var(--accent); }
.ci-mentor--gra .ci-mentor-graj { opacity: 0; pointer-events: none; }
/* "Wlacz dzwiek" - gdy przegladarka pozwolila tylko na wyciszony start */
.ci-mentor-dzwiek {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); z-index: 1;
  display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
  padding: .3rem .65rem .3rem .5rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-size: .74rem; font-weight: 700;
  box-shadow: 0 0 0 2px var(--surface), 0 4px 12px rgba(0, 0, 0, .28);
}
.ci-mentor-dzwiek:hover { background: var(--accent-hover, var(--accent)); }
.ci-mentor-dzwiek[hidden] { display: none; }
.ci-mentor-dzwiek .ci-mentor-ik { stroke-width: 2; }
.ci-mentor[data-stan="mini"] .ci-mentor-dzwiek { display: none; }

.ci-mentor-tresc { min-width: 0; }
.ci-mentor-kto {
  margin: 0 0 .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--fg-muted);
}
.ci-mentor-kto strong { color: var(--accent); }
.ci-mentor-napis { margin: 0; max-width: 48ch; font-size: .97rem; line-height: 1.5; color: var(--fg); text-wrap: pretty; }
.ci-mentor-zd { transition: color .25s; }
.ci-mentor--napisy .ci-mentor-zd { color: var(--fg-faint); }
.ci-mentor--napisy .ci-mentor-zd--teraz { color: var(--fg); }

/* napisy domyslnie wylaczone (przycisk w akcjach, wybor w localStorage) */
.ci-mentor--bez-napisow .ci-mentor-napis { display: none; }
.ci-mentor--bez-napisow .ci-mentor-kto { margin: 0; }
.ci-mentor-btn--napisy[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.ci-mentor-akcje { display: flex; flex-direction: column; gap: .3rem; align-self: start; }
.ci-mentor-btn {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg-muted); cursor: pointer;
}
.ci-mentor-btn:hover { color: var(--fg); background: var(--surface-2); }
.ci-mentor-ik { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ci-mentor-ik--pelna { fill: currentColor; stroke: none; }
.ci-mentor-btn--mini { display: none; }

/* zwiniety: jedna linia z miniaturka */
.ci-mentor[data-stan="mini"] {
  --m-kadr: 32px;
  gap: .75rem; padding: .4rem .8rem .4rem 1rem;
  background: var(--surface-2);
}
.ci-mentor[data-stan="mini"] .ci-mentor-graj,
.ci-mentor[data-stan="mini"] .ci-mentor-kto,
.ci-mentor[data-stan="mini"] .ci-mentor-btn--ponow,
.ci-mentor[data-stan="mini"] .ci-mentor-btn--napisy,
.ci-mentor[data-stan="mini"] .ci-mentor-btn--zwin { display: none; }
/* zwiniety bez napisow: zamiast linii tekstu sama etykieta "Mentorka · podpowiedz" */
.ci-mentor--bez-napisow[data-stan="mini"] .ci-mentor-kto { display: block; }
.ci-mentor[data-stan="mini"] .ci-mentor-wideo { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong); }
.ci-mentor[data-stan="mini"] .ci-mentor-napis {
  max-width: none; font-size: .82rem; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ci-mentor--nowe[data-stan="mini"] .ci-mentor-napis { color: var(--fg); }
.ci-mentor[data-stan="mini"] .ci-mentor-akcje { flex-direction: row; align-self: center; }
.ci-mentor[data-stan="mini"] .ci-mentor-btn { width: 28px; height: 28px; }
.ci-mentor[data-stan="mini"] .ci-mentor-btn--mini { display: grid; color: var(--accent); }

@media (max-width: 720px) {
  .ci-mentor { --m-kadr: 88px; gap: .3rem .8rem; padding: .7rem .75rem; }
  .ci-mentor-napis { font-size: .88rem; }
  .ci-mentor-graj { width: 40px; height: 40px; }
  .ci-mentor-graj svg { width: 18px; height: 18px; }
  .ci-mentor-dzwiek { font-size: .66rem; padding: .22rem .5rem .22rem .4rem; }
  .ci-mentor[data-stan="mini"] { --m-kadr: 28px; padding: .35rem .6rem .35rem .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ci-mentor-kadr, .ci-mentor-wideo, .ci-mentor-graj, .ci-mentor-zd { transition: none; }
  .ci-mentor--gra .ci-mentor-kadr::before { animation: none; }
}

/* ------------------------------------------------- poza panelem CI
   Pasek jako osobna karta: na gorze tresci lekcji i w cwiczeniu terminala
   (po kliknieciu podpowiedzi). Mniejszy kadr - obok jest zwykla tresc strony. */
.ci-mentor--samodzielny {
  --m-kadr: 120px;
  margin: 0 0 1.25rem;
  border: 1px solid var(--line); border-radius: var(--radius, 10px);
  overflow: hidden;
}
.ci-mentor--samodzielny[data-stan="mini"] { --m-kadr: 32px; }

/* Podpowiedz mentorki w cwiczeniu: przycisk obok zwyklej podpowiedzi + dymek,
   gdy kursant utknie (najwyzej raz na wejscie, nic nie gra samo). */
.mentor-podp { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0 0; }
.mentor-podp .btn { margin: 0; }
.mentor-dymek {
  position: relative; display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .8rem .38rem .7rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-size: .84rem; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  animation: mentor-dymek-wej .35s cubic-bezier(.2, .7, .2, 1) both, mentor-dymek-puls 2.6s ease-in-out .4s 3;
}
.mentor-dymek::before {
  content: ""; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  background: inherit; transform: rotate(45deg); border-radius: 2px;
}
.mentor-dymek:hover { background: var(--accent-hover, var(--accent)); }
.mentor-dymek[hidden] { display: none; }
.mentor-dymek-x {
  display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; margin-left: .15rem;
  border-radius: 50%; background: rgba(255, 255, 255, .22); font-size: .8rem; line-height: 1;
}
/* Gratulacje po zaliczeniu cwiczenia (terminal.js odslania, tekst losowany z app/mentor.py BRAWO). */
.term-brawo {
  display: flex; align-items: flex-start; gap: .85rem;
  margin: 1.25rem 0 0; padding: 1rem 1.15rem;
  border: 1px solid var(--accent-soft); border-left: 4px solid var(--accent); border-radius: var(--radius, 10px);
  background: linear-gradient(120deg, var(--accent-soft) 0%, transparent 70%), var(--surface);
  animation: term-brawo-wej .45s cubic-bezier(.2, .7, .2, 1) both;
}
.term-brawo[hidden] { display: none; }
.term-brawo-ikona { flex: none; font-size: 1.6rem; line-height: 1; }
.term-brawo-tytul { margin: 0 0 .2rem; font-weight: 700; color: var(--fg); }
.term-brawo-tekst { margin: 0; max-width: 62ch; color: var(--fg-muted); line-height: 1.5; text-wrap: pretty; }
@keyframes term-brawo-wej { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .term-brawo { animation: none; } }

.mentor-cw { margin-top: 1rem; }
.mentor-cw:empty { display: none; }
@keyframes mentor-dymek-wej { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes mentor-dymek-puls { 0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, .18); } 50% { box-shadow: 0 0 0 6px var(--accent-soft), 0 4px 14px rgba(0, 0, 0, .18); } }
@media (max-width: 720px) {
  .ci-mentor--samodzielny { --m-kadr: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  .mentor-dymek { animation: none; }
}

/* Glos podpowiedzi do zadan (mentor.js GlosPodpowiedzi): zdjecie w kolku,
   dymek z pelnym tekstem; gdy nagranie gra, kolko pulsuje. */
.q-hint.podp-glos {
  display: flex; align-items: flex-start; gap: .75rem;
  margin: .7rem 0 0; color: var(--fg); font-size: .9rem;
}
.podp-glos-awatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-soft);
  transition: box-shadow .25s;
}
.podp-glos--mowi .podp-glos-awatar { animation: podp-glos-mowi 1.4s ease-in-out infinite; }
.podp-glos-dymek {
  position: relative; min-width: 0; max-width: 72ch;
  padding: .6rem .85rem; border-radius: 12px; border-top-left-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  line-height: 1.5; overflow-wrap: anywhere; text-wrap: pretty;
}
@keyframes podp-glos-mowi {
  0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 7px var(--accent-soft); }
}
@media (prefers-reduced-motion: reduce) { .podp-glos--mowi .podp-glos-awatar { animation: none; } }
