/* /practice/ — учебные проекты и их живые проверки.
   Окна-терминалы и секции берём из platform.css, здесь только своё. */

.practice-toolbar {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  margin-top: var(--space-6);
}
.practice-updated { font-size: var(--text-xs); }

.practice-project-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4);
}
.practice-project-head .platform-h2 { margin-bottom: var(--space-2); }
.practice-summary { margin: 0 0 var(--space-3); max-width: 46rem; }

.practice-badge {
  flex-shrink: 0;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); color: var(--text-dim);
  max-width: 18rem; text-align: right;
}
.practice-badge[data-status="ok"]   { color: #1f9d55; border-color: rgba(95,211,138,0.6); }
.practice-badge[data-status="warn"] { color: #b7791f; border-color: rgba(230,164,23,0.6); }
.practice-badge[data-status="bad"]  { color: var(--red); border-color: var(--red); }

.practice-stack {
  list-style: none; margin: 0 0 var(--space-4); padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}
.practice-stack li {
  font-size: 0.72rem; padding: 2px 8px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); color: var(--text-dim);
}

.practice-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.practice-check { margin: 0; }
.practice-check .platform-window-state[data-status="ok"]  { color: #5fd38a; }
.practice-check .platform-window-state[data-status="bad"] { color: #f87171; }
.practice-check .platform-term { min-height: 7.5rem; max-height: 16rem; }
.practice-prompt { color: #5fd38a; }
.practice-command { color: #e4e4e7; }
.practice-output { color: #a1a1aa; }
.practice-check-foot {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); background: #111318; border-top: 1px solid #232733;
}
.practice-check-title { margin: 0; font-size: var(--text-xs); color: #e4e4e7; }
.practice-run {
  flex-shrink: 0; font: inherit; font-size: var(--text-xs); cursor: pointer;
  padding: 4px 12px; border-radius: var(--radius-pill);
  border: 1px solid #3a3f4a; background: transparent; color: #e4e4e7;
}
.practice-run:hover:not(:disabled) { border-color: #5fd38a; color: #5fd38a; }
.practice-run:disabled { opacity: 0.5; cursor: default; }
.practice-foot { margin-top: var(--space-8); }

.practice-number { color: var(--red); margin-right: 6px; }

/* Сводка: кольцо — доля пройденных проверок задания */
.practice-overview {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3);
  margin-top: var(--space-8);
}
.practice-card {
  display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto auto; column-gap: var(--space-3);
  align-items: center; text-decoration: none; color: var(--text);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-surface);
  background: var(--card); transition: border-color .2s, transform .2s;
}
.practice-card:hover { border-color: var(--red); transform: translateY(-2px); }
.practice-ring { grid-row: 1 / 4; width: 52px; height: 52px; transform: rotate(-90deg); }
.practice-ring circle { fill: none; stroke-width: 3.5; }
.practice-ring-track { stroke: var(--border); }
.practice-ring-value { stroke: var(--text-dim); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .9s ease; }
.practice-card[data-status="ok"]  .practice-ring-value { stroke: #1f9d55; }
.practice-card[data-status="bad"] .practice-ring-value { stroke: var(--red); }
.practice-card-number { font-size: var(--text-2xs); color: var(--red); font-weight: 600; }
.practice-card-title { font-size: var(--text-xs); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.practice-card-state { font-size: var(--text-2xs); color: var(--text-dim); }
.practice-card[data-status="ok"]  .practice-card-state { color: #1f9d55; }
.practice-card[data-status="bad"] .practice-card-state { color: var(--red); }

/* Матрица «инструмент × задание» */
.practice-matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--card); }
.practice-matrix { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.practice-matrix th, .practice-matrix td { padding: 7px var(--space-3); border-top: 1px solid var(--border); }
.practice-matrix thead th { border-top: 0; position: sticky; top: 0; background: var(--card); }
.practice-matrix thead a { color: var(--red); text-decoration: none; font-weight: 600; }
.practice-matrix tbody th[scope="row"] { text-align: left; font-weight: 400; color: var(--text); }
.practice-matrix td { text-align: center; width: 56px; }
.practice-matrix tr:hover td, .practice-matrix tr:hover th[scope="row"] { background: var(--card-alt); }
.practice-matrix-group th {
  text-align: left; font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); background: var(--card-alt); font-weight: 600;
}
.practice-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--red); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Схема проекта: колонки узлов со стрелками; цвет узла — итог его проверок */
.practice-flow-figure { margin: 0 0 var(--space-6); }
.practice-flow {
  display: flex; align-items: stretch; gap: 0;
  padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-surface);
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 18px 18px,
    var(--card);
}
.practice-flow-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.practice-flow-title {
  margin: 0 0 2px; font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim);
}
.practice-flow-arrow { flex: 0 0 28px; position: relative; align-self: center; height: 2px; margin: 0 2px; background: var(--border); }
.practice-flow-arrow::after {
  content: ""; position: absolute; right: -1px; top: -4px;
  border: 5px solid transparent; border-left-color: var(--text-dim); border-right: 0;
}
.practice-node {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px 8px 12px; border: 1px solid var(--border); border-left-width: 3px; border-radius: 8px;
  background: var(--card); font-size: var(--text-2xs); line-height: 1.3; cursor: default;
  transition: border-color .4s, box-shadow .4s;
}
.practice-node b { font-size: var(--text-xs); color: var(--heading); font-weight: 600; overflow-wrap: anywhere; }
.practice-node span { color: var(--text-dim); }
.practice-node[data-status="ok"]  { border-left-color: #1f9d55; }
.practice-node[data-status="bad"] { border-left-color: var(--red); box-shadow: 0 0 0 1px var(--border-red); }
.practice-node[data-status="none"] { border-style: dashed; border-left-style: solid; }
.practice-node[data-status="ok"]::after, .practice-node[data-status="bad"]::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: #1f9d55; box-shadow: 0 0 0 3px rgba(31,157,85,.15);
}
.practice-node[data-status="bad"]::after { background: var(--red); box-shadow: 0 0 0 3px var(--border-red); }
.practice-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-2); font-size: var(--text-2xs); color: var(--text-dim); }
.practice-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border-radius: 3px; border: 1px solid var(--border); border-left: 3px solid var(--text-dim);
}
.practice-legend [data-status="ok"]::before  { border-left-color: #1f9d55; }
.practice-legend [data-status="bad"]::before { border-left-color: var(--red); }
.practice-legend [data-status="none"]::before { border-style: dashed; border-left-style: solid; }

/* Что показано в проекте */
.practice-facts { margin: 0 0 var(--space-4); padding-left: 1.2rem; max-width: 46rem; }
.practice-facts li { margin: 2px 0; font-size: var(--text-sm); }
.practice-note {
  margin: 0 0 var(--space-4); max-width: 46rem; font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3); border-left: 3px solid #e6a417; background: var(--card-alt);
}
.practice-meet { margin: 0 0 var(--space-6); font-size: var(--text-sm); }
.practice-meet a { color: var(--red); font-weight: 600; }
.practice-repo { margin: 0 0 var(--space-4); font-size: var(--text-xs); }
.practice-repo a { color: var(--red); }

.practice-details > summary {
  cursor: pointer; font-size: var(--text-xs); color: var(--text-dim);
  padding: var(--space-2) 0; margin-bottom: var(--space-3);
}
.practice-details > summary:hover { color: var(--red); }


/* ---- Прогон проверок: дорожка из пяти заданий, агент, журнал ---- */
.practice-runner { margin-top: var(--space-8); }
.practice-run-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; justify-content: flex-end; }
.practice-runner .platform-run-head { margin-bottom: 96px; min-height: 5.5rem; }
.practice-runner .platform-run-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.practice-skip {
  font-size: var(--text-2xs); background: none; border: 0; color: #a1a1aa; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 0;
}
.practice-skip:hover { color: #f5f5f7; }
.practice-track { grid-template-columns: repeat(5, 1fr); }
.practice-track::before { left: 10%; right: 10%; }
.practice-stage-count { font-size: 0.68rem; color: #71717a; min-height: 1em; }
.platform-stage.is-done .practice-stage-count { color: #5fd38a; }
.platform-stage.is-failed .practice-stage-count { color: #f87171; }
.platform-stage.is-current .practice-stage-count { color: #e6a417; }

.practice-stream {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--space-4);
  margin-top: var(--space-8);
}
.practice-log { height: 280px; }
.practice-log .log-project { color: #f5f5f7; font-weight: 700; }
.practice-log .log-prompt { color: #5fd38a; }
.practice-log .log-cmd { color: #e4e4e7; }
.practice-log .log-out { color: #8b8b93; }
.practice-log .log-ok { color: #5fd38a; }
.practice-log .log-bad { color: #f87171; }
.practice-log .log-cursor { display: inline-block; width: 0.55em; background: #e4e4e7; animation: practice-blink 1s steps(1) infinite; }
@keyframes practice-blink { 50% { opacity: 0; } }
.practice-log-window.is-live { border-color: rgba(230,164,23,0.6); box-shadow: 0 0 0 1px rgba(230,164,23,0.25); }
.practice-log-window.is-live .platform-window-state { color: #e6a417; }
.practice-log-window.is-live .platform-window-state::before { content: "● "; animation: practice-blink 1.2s infinite; }

.practice-now {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border: 1px solid #232733; border-radius: var(--radius-surface); background: #0b0c0f;
}
.practice-now .platform-label { margin: 0; }
.practice-now-title { margin: 0; color: #f5f5f7; font-weight: 600; min-height: 2.6em; line-height: 1.3; }
.practice-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0; }
.practice-stats div { padding: var(--space-2) var(--space-3); border-radius: 10px; background: #141519; border: 1px solid #232733; }
.practice-stats dt { font-size: var(--text-2xs); color: #8b8b93; }
.practice-stats dd { margin: 2px 0 0; font-family: var(--font-mono); font-size: var(--text-lg); color: #f5f5f7; font-variant-numeric: tabular-nums; }
.practice-stats dd[data-status="ok"] { color: #5fd38a; }
.practice-stats dd[data-status="bad"] { color: #f87171; }
.practice-progress { height: 6px; border-radius: 99px; background: #1f222a; overflow: hidden; }
.practice-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e6a417, #5fd38a); transition: width .3s ease; }

/* Узел схемы, который проверяется прямо сейчас */
.practice-node.is-checking {
  border-color: #e6a417; border-left-color: #e6a417;
  box-shadow: 0 0 0 3px rgba(230,164,23,0.25);
}
.practice-node.is-checking::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: #e6a417; animation: practice-blink .8s steps(1) infinite;
}
.practice-project.is-running .practice-flow { border-color: rgba(230,164,23,0.6); }

@media (max-width: 960px) {
  .practice-overview { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 767px) {
  .practice-track { grid-template-columns: 1fr; }
  .practice-track::before { left: 17px; right: auto; }
  .practice-track .platform-stage { align-items: center; }
  .practice-stage-count { margin-left: auto; white-space: nowrap; }
  .practice-stream { grid-template-columns: 1fr; }
  .practice-log { height: 220px; }
  .practice-runner .platform-run-head { margin-bottom: var(--space-6); }
  .practice-run-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .practice-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-6); }
  .practice-card { grid-template-columns: 38px 1fr; padding: var(--space-2) var(--space-3); column-gap: var(--space-2); }
  .practice-ring { width: 38px; height: 38px; }
  .practice-matrix td { width: 30px; padding: 7px 2px; }
  .practice-matrix th[scope="row"] { padding-right: 4px; }
  .practice-flow { flex-direction: column; }
  .practice-flow-arrow { flex-basis: 22px; width: 2px; height: auto; min-height: 22px; margin: 2px 0; }
  .practice-flow-arrow::after { right: -4px; top: auto; bottom: -1px; border: 5px solid transparent; border-top-color: var(--text-dim); border-bottom: 0; }
  .practice-checks { grid-template-columns: 1fr; }
  .practice-project-head { flex-direction: column; }
  .practice-badge { text-align: left; }
}
