/* =========================================================
   Плеер
   ========================================================= */
.lesson-heading { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.15; margin: var(--s2) 0 var(--s4); overflow-wrap: anywhere; }
.task-prompt { font-size: var(--fs-md); font-weight: 800; line-height: 1.35; margin: 0 0 var(--s4); }
.rich { max-width: 68ch; line-height: 1.65; overflow-wrap: anywhere; }
.rich-heading { font-size: 25px; font-weight: 800; line-height: 1.25; margin: 0 0 var(--s2); overflow-wrap: anywhere; }
.link-row { margin-top: var(--s4); }
.empty-note { color: var(--muted); font-size: var(--fs-sm); font-style: italic; margin: var(--s2) 0 0; }
.card.is-empty { border-style: dashed; box-shadow: none; background: transparent; }

/* Шапка карточки задания: условие слева, результат и кнопки справа */
/* В одну строку, пока условию хватает места; на узком экране кнопки уходят на строку ниже, вправо */
.task-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s2) var(--s3); margin-bottom: var(--s4); }
.task-head .task-prompt { flex: 1 1 280px; min-width: 0; margin: 0; }
.task-actions { display: flex; flex: none; align-items: center; gap: 6px; margin-left: auto; }
.result { font-weight: 700; font-size: var(--fs-sm); padding: 3px 12px; border-radius: var(--r-pill); }
.result:empty { display: none; }
.result.ok { background: var(--ok-soft); color: var(--ok); }
.result.no { background: var(--bad-soft); color: var(--bad); }

/* Плашки-слова — главный «характерный» элемент интерфейса */
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  margin: 3px; padding: 6px 14px;   /* плашки: чуть крупнее основного текста */
  font-size: 19px; font-weight: 600; line-height: 1.3;
  color: var(--ink); background: var(--tile);
  border: 0; border-radius: var(--r-md);
  box-shadow: 0 2px 0 var(--tile-edge);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  animation: pop .35s var(--spring) backwards;
  transition: transform .2s var(--spring), box-shadow .2s var(--ease), background-color .15s var(--ease);
}
.chip:hover { transform: translateY(-2px) rotate(-2deg); box-shadow: 0 4px 0 var(--tile-edge), 0 8px 12px #0002; } /* наклон при наведении */
.chip[aria-pressed="true"] { background: var(--tile-picked); transform: scale(1.08) rotate(2deg); box-shadow: 0 5px 0 #cc8a00; } /* выбранная плашка — жёлтая, без фиолетовой обводки */
.chip:focus { outline: none; }
.chip:focus-visible { outline: 2px dashed var(--tile-edge); outline-offset: 2px; } /* для клавиатуры — не фиолетовая рамка */
.chip.static { cursor: default; background: var(--canvas); box-shadow: none; animation: none; }
.chip.static:hover { transform: none; box-shadow: none; }
.chip[data-pair] { background: color-mix(in srgb, var(--pair) 28%, var(--tile)); }
.chip.ok { background: var(--ok-tile); box-shadow: 0 2px 0 var(--ok-edge); }
.chip.no { background: var(--bad-tile); box-shadow: 0 2px 0 var(--bad-edge); }

.zone { border-radius: var(--r-md); background: var(--primary-soft); transition: background-color .15s var(--ease), box-shadow .15s var(--ease); }
body.picking .zone, body.dragging-chip .zone { box-shadow: inset 0 0 0 2px #f3d98c; } /* подсказка «сюда можно положить» — в тон плашкам, не фиолетовая */
body.picking .zone:hover { background: #ffe06666; box-shadow: inset 0 0 0 2px var(--tile-edge); }
.slot {
  display: inline-flex; align-items: center; justify-content: center;   /* плашка встаёт ровно по центру пропуска */
  min-width: 96px; min-height: 42px; margin: 0 4px; padding: 1px; vertical-align: middle;
}
.slot > .chip { margin: 0; }
.slot:has(.chip) { background: none; box-shadow: none; } /* ширину не меняем: иначе при перетаскивании текст «прыгает» */
.slot.no { box-shadow: inset 0 0 0 2px var(--bad); background: var(--bad-soft); }
.bank, .answer { min-height: 70px; padding: 6px; margin-top: var(--s2); }
.bank { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; } /* плашки — по центру своего поля */
.answer { position: relative; padding-right: 44px; }
.answer.ok { background: var(--ok-soft); box-shadow: inset 0 0 0 2px var(--ok); }
.answer.no { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.answer.ok::after, .answer.no::after {
  position: absolute; top: 10px; right: 10px; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13.5px;
}
.answer.ok::after { content: "✓"; background: var(--ok); }
.answer.no::after { content: "✗"; background: var(--bad); }
.zone-label { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.build-item + .build-item { margin-top: var(--s5); }

/* Перетаскивание (SortableJS) */
.chip-ghost { opacity: .35; animation: none; }                  /* место, куда встанет плашка */
.chip-flying {                                                  /* плашка «в руке» */
  animation: none !important; transition: none !important; /* иначе плашка отстаёт от пальца */
  opacity: 1 !important; z-index: 1000;
  box-shadow: 0 6px 0 var(--tile-edge), 0 16px 26px #0004 !important;
}
body.dragging-chip, body.dragging-chip * { cursor: grabbing !important; }

/* Соединение пар протягиванием */
.connect .chip { touch-action: none; } /* иначе на телефоне жест превратится в прокрутку */
.chip.linking { box-shadow: 0 4px 0 var(--tile-edge), 0 0 0 3px var(--primary); }
.chip.link-target { transform: scale(1.08); box-shadow: 0 4px 0 var(--tile-edge), 0 0 0 3px var(--primary); }

/* Пропуски и поля ответа */
.gaps-text { font-size: var(--fs-md); line-height: 2.6; white-space: pre-wrap; margin: 0; }
.gap {
  display: inline-block; width: auto; height: 52px; padding: 0 14px; margin: 0 2px;
  border: 2px solid transparent; border-radius: var(--r-md);
  background: var(--primary-soft); font-size: 17px; text-align: center; vertical-align: middle;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.gap:focus { outline: none; background: var(--primary-soft-2); border-color: var(--primary); }
.gap.ok { background: var(--ok-soft); border-color: var(--ok); }
.gap.no { background: var(--bad-soft); border-color: var(--bad); }
.mark {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin: 0 4px;
  border-radius: 50%; color: #fff; font-size: 14px; font-weight: 800; line-height: 1; vertical-align: middle;
}
.mark.ok { background: var(--ok); }
.mark.no { background: var(--bad); }

/* Сопоставление */
.pair-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s3); margin: 6px 0; }
.pair-row .arrow { color: var(--muted); font-size: 20px; }
.pair-row .chip.static { min-width: 120px; justify-content: center; }
.pair-row .slot { min-width: 140px; }
.pair-row .gap { width: 200px; }
.pair-bank { text-align: center; }
.connect { position: relative; display: flex; justify-content: center; gap: 120px; }
.connect-col { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }

/* Линии между парами (SVG поверх колонок, клики проходят сквозь него) */
.connect-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.pair-line path { fill: none; stroke: var(--pair); stroke-width: 3; stroke-linecap: round; transition: stroke .2s var(--ease); }
.pair-line circle { fill: var(--pair); }
.pair-line.fresh path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line .35s var(--ease) forwards; }
.pair-line.ok path { stroke: var(--ok); }
.pair-line.ok circle { fill: var(--ok); }
.pair-line.no path { stroke: var(--bad); }
.pair-line.no circle { fill: var(--bad); }
.temp-line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 6 6; opacity: .7; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }

/* Категории */
.cats { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-col { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; }
.cat-col > b { text-align: center; }
.cat-zone { min-height: 130px; padding: 8px; }

/* Тест */
.question { border: 0; padding: 0; margin: 0 0 var(--s5); min-width: 0; }
.question legend { padding: 0; margin-bottom: 6px; font-size: var(--fs-md); font-weight: 800; }
.question-img { max-height: 260px; border-radius: var(--r-md); margin: var(--s2) 0; }
.question small { display: block; margin-bottom: 4px; color: var(--muted); font-size: var(--fs-sm); }
.opt {
  position: relative; display: flex; align-items: center; gap: 12px;
  margin: 6px 0; padding: 13px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  font-size: 17px; cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.no { border-color: var(--bad); background: var(--bad-soft); }
.opt.ok::after, .opt.no::after { margin-left: auto; font-weight: 800; }
.opt.ok::after { content: "✓"; color: var(--ok); }
.opt.no::after { content: "✗"; color: var(--bad); }

/* Эссе */
.essay {
  width: 100%; min-height: 160px; padding: 12px 16px;
  border: 2px solid transparent; border-radius: var(--r-md);
  background: var(--primary-soft); font-size: 17px; line-height: 1.6; resize: vertical;
}
.essay:focus { outline: none; border-color: var(--primary); background: var(--primary-soft-2); }
.essay.ok { border-color: var(--ok); }
.essay.no { border-color: var(--bad); }
.word-count { margin-top: var(--s2); color: var(--muted); }
.word-count b.enough { color: var(--ok); }

/* Карусель */
.carousel { border-radius: var(--r-lg); overflow: hidden; background: var(--canvas); }
.carousel-stage { position: relative; overflow: hidden; }
.carousel-track { display: flex; transition: transform .5s var(--ease); }
.carousel-track img { flex: 0 0 100%; width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: #1d1a3acc; color: #fff; font-size: 21.5px; line-height: 1; cursor: pointer;
  transition: background-color .15s var(--ease);
}
.carousel-nav:hover { background: var(--primary); }
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }
.carousel-foot { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3); }
.carousel-caption { margin: 0; min-height: 1.5em; color: var(--muted); text-align: center; }
.dots { display: flex; gap: 6px; }
.dot {
  position: relative; width: 10px; height: 10px; padding: 0;
  border: 0; border-radius: 10px; background: #c9c3e6; cursor: pointer;
  transition: width .25s var(--ease), background-color .25s var(--ease);
}
.dot::after { content: ""; position: absolute; inset: -8px; }
.dot[aria-current="true"] { width: 26px; background: var(--primary); }

/* Медиа */
.media-frame { display: block; width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--r-lg); background: #000; }
.media-audio { width: 100%; }
.media-link { display: inline-block; margin-top: var(--s2); color: var(--muted); font-size: var(--fs-sm); }

/* Итог урока */
.finish { text-align: center; }
.finish h2 { font-size: var(--fs-xl); }
.finish:focus { outline: none; }
.score-big { margin: var(--s2) 0 0; font-size: 57.5px; font-weight: 800; line-height: 1; color: var(--primary); }
.breakdown { max-width: 440px; margin: var(--s4) auto; padding: 0; list-style: none; text-align: left; }
.breakdown li { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.breakdown .ok { color: var(--ok); font-weight: 800; }
.breakdown .no { color: var(--bad); font-weight: 800; }
.media-frame.media-drive-audio { aspect-ratio: auto; height: 64px; } .media-note { margin: 6px 0 0; }


/* =========================================================
   Поздние правки (tasks.css подключается после screens.css — правила здесь главнее)
   ========================================================= */


/* Условие задания — полужирным */
.task-prompt { font-weight: 600; }

/* Варианты ответа в задании «Тест»: короткие — сеткой 2 × 2, длинные — по одному в строке */
.opts { display: flex; flex-direction: column; gap: 6px; }
.opts.opts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--s2); }
.opts .opt { margin: 0; }
@media (max-width: 480px) { .opts.opts-grid { grid-template-columns: 1fr; } }

/* Перетаскивание: подсвечиваются только зоны текущего задания */
body.picking .zone:not(.drop-target), body.dragging-chip .zone:not(.drop-target) { box-shadow: none; }
body .zone.drop-target { box-shadow: inset 0 0 0 2px #f3d98c; }
body .slot.drop-target:has(.chip) { box-shadow: none; }
body.picking .zone.drop-target:hover { background: #ffe06666; box-shadow: inset 0 0 0 2px var(--tile-edge); }

/* Окно результата: кольцо с процентом, баллы, монеты, разбор */
.rp { padding: var(--s5); }
.rp-top { display: flex; align-items: center; gap: var(--s5); }
.rp-ring { --c: var(--ok); flex: none; display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79%), conic-gradient(var(--c) calc(var(--p) * 1%), #ece9f6 0); }
.rp-ring.great { --c: var(--ok); } .rp-ring.good { --c: #2f9e6e; } .rp-ring.mid { --c: #e09b00; } .rp-ring.low { --c: var(--bad); }
.rp-pct { font-size: 28px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.rp-info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.rp-title { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.rp-title .title-3 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rp-verdict { margin: 0; font-size: 22px; font-weight: 800; color: var(--ink); }
.rp-points { margin: 0; font-size: 16px; color: var(--muted); }
.rp-points b { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rp .coins-earned { margin: 6px 0 0; }
.rp .test-reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; padding: 6px 12px; border-radius: var(--r-pill); background: var(--canvas); color: var(--muted); font-size: 14px; justify-content: flex-start; }
.rp-breakdown { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.rp-sub { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rp .breakdown { max-width: none; margin: 0; }
.rp .breakdown li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding: 8px 0; border-bottom: 1px solid var(--line); border-top: 0; }
.rp .breakdown li:last-child { border-bottom: 0; }
.bd-dot { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; }
li.ok .bd-dot { background: var(--ok); } li.part .bd-dot { background: #e09b00; } li.no .bd-dot { background: var(--bad); }
.bd-name { overflow-wrap: anywhere; }
.bd-pts { padding: 2px 10px; border-radius: var(--r-pill); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-pts.ok { background: var(--ok-soft); color: var(--ok); } .bd-pts.part { background: var(--warn-bg); color: var(--warn-ink); } .bd-pts.no { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 520px) { .rp { padding: var(--s4); } .rp-top { gap: var(--s3); } .rp-ring { width: 88px; height: 88px; } .rp-pct { font-size: 22px; } .rp-verdict { font-size: 18px; } }

/* Таблица лидеров: тройка лидеров построчно + строка ученика (красная обводка) */
.runner .test-topbar { display: contents; }
.runner .test-topbar > .test-timer { float: right; position: sticky; top: 72px; z-index: 6; margin: 0 0 var(--s3) var(--s3); }
.runner .test-topbar ~ * { clear: both; }
.test-board { display: block; width: 100%; max-width: 360px; margin: 0 0 var(--s3); padding: var(--s3); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 15px; }
.tb-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: 6px; }
.tb-title { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tb-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding: 5px 8px; border-radius: 10px; border: 2px solid transparent; }
.tb-row.me { border-color: var(--el-test); background: #fff5f5; }
.tb-row.self { margin-top: 4px; }
.tb-place { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--canvas); color: var(--muted); font-size: 12px; font-weight: 800; }
.tb-place.m1 { background: #e0a100; color: #fff; } .tb-place.m2 { background: #9aa3b5; color: #fff; } .tb-place.m3 { background: #c7773a; color: #fff; }
.tb-row.self .tb-place { background: var(--el-test); color: #fff; }
.tb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; max-width: none; }
.tb-pts { font-variant-numeric: tabular-nums; font-weight: 800; }
.tb-row.me .tb-pts { color: var(--el-test); }
.test-submitted .test-topbar { display: block; position: static; }
@media (max-width: 600px) { .runner .test-topbar > .test-timer { top: 64px; } .test-board { max-width: none; } }

/* Настройки теста — компактно, две колонки на широком экране */
.test-settings { gap: var(--s3); }
.test-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s5); align-items: start; }
.test-settings-grid .inline-field .input { width: 120px; }
.switch-placeholder { align-self: center; }
@media (max-width: 700px) { .test-settings-grid { grid-template-columns: 1fr; } }
.rp .breakdown li, .rp .breakdown li.ok, .rp .breakdown li.no, .rp .breakdown li.part { color: var(--ink); font-weight: 500; }

/* Разбор теста после окончания */
.test-review .review-head { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--s3); padding: 10px 14px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.review-pts { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; vertical-align: middle; margin-left: 6px; }
.question legend .review-pts { font-size: 12px; }
.opt.missed { border-color: var(--ok); border-style: dashed; background: color-mix(in srgb, var(--ok-soft) 50%, transparent); }
.opt.missed::after { content: '✓'; margin-left: auto; color: var(--ok); font-weight: 800; }
.review-key { margin-top: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--ok-soft); }
.review-key > summary { cursor: pointer; color: var(--ok); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.review-key[open] > summary { margin-bottom: 6px; }
.test-review > .result-panel { margin-top: var(--s4); }

/* Страница результатов: итог сверху */
.test-review > .rp-summary { margin: 0 0 var(--s3); }
.test-review > .review-head { margin-top: 0; }

/* Перетаскиваемые плашки: плоские, с мягкой тенью (без «объёма» — нижней кромки) */
.chip { box-shadow: 0 2px 6px #2e385624, 0 1px 2px #2e385614; }
.chip:hover { box-shadow: 0 6px 14px #2e38562e, 0 2px 4px #2e38561a; }
.chip[aria-pressed="true"] { box-shadow: 0 8px 18px #cc8a0040, 0 2px 4px #2e38561f; }
.chip.ok { box-shadow: 0 2px 6px #12804f2e; }
.chip.no { box-shadow: 0 2px 6px #c92a472e; }

/* Задание «Тест»: вопрос — полужирным, варианты ответа — чуть меньше */
.question legend { font-weight: 600; }
.opt { font-size: 15.5px; padding: 11px 14px; }

/* Единые отступы между карточками на всём сайте */
.task-list, .review-list { gap: var(--gap); }
.test-review > * + * { margin-top: var(--gap); }
.test-review > .card { margin-bottom: 0; }
