/* ============================================================
   Khan SAT-1600 · Стили мультипредметности
   Author: Xudoyorxon Bunyodov / Худоёрхон Бунёдов
   ============================================================ */

:root {
  --subj-color: #1B5E20;
  --subj-accent: #C9A227;
}

/* ---------- кнопка предмета в шапке ---------- */
.subj-btn-wrap { display: inline-flex; margin-left: 10px; }

.subj-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s;
}
.subj-btn:hover { background: rgba(255, 255, 255, .22); }
.subj-btn:focus-visible { outline: 3px solid var(--subj-accent); outline-offset: 2px; }
.subj-btn__ico { font-size: 16px; line-height: 1; }
.subj-btn__caret { font-size: 10px; opacity: .8; }

@media (max-width: 620px) {
  .subj-btn__name { display: none; }
  .subj-btn { padding: 6px 10px; }
}

/* ---------- модальное окно выбора ---------- */
.subj-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10, 20, 10, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overscroll-behavior: contain;
}
.subj-modal__box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.subj-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #D8E0D8;
  background: #FAFBFA;
}
.subj-modal__head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--green-900, #1B5E20);
}
.subj-modal__x {
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #5A6B5A;
  padding: 0 4px;
}
.subj-modal__body {
  padding: 16px 20px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.subj-group + .subj-group { margin-top: 20px; }
.subj-group__ttl {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #5A6B5A;
  margin-bottom: 10px;
}
.subj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.subj-card {
  --c: #1B5E20;
  --a: #C9A227;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px 11px;
  border: 1px solid #D8E0D8;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color .14s, transform .14s;
}
.subj-card:hover { border-color: var(--c); transform: translateY(-2px); }
.subj-card:focus-visible { outline: 3px solid var(--a); outline-offset: 2px; }
.subj-card--on {
  border-color: var(--c);
  border-width: 2px;
  background: color-mix(in srgb, var(--c) 7%, #fff);
}
.subj-card--empty { opacity: .62; }
.subj-card__ico { font-size: 26px; line-height: 1; }
.subj-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c);
  line-height: 1.25;
}
.subj-card__meta { font-size: 11.5px; color: #5A6B5A; }
.subj-card__soon {
  display: inline-block;
  background: #EEF2EE;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

/* ---------- хлебные крошки ---------- */
.subj-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: #5A6B5A;
  margin-bottom: 12px;
}
.subj-crumbs a { color: var(--subj-color); text-decoration: none; font-weight: 600; }
.subj-crumbs a:hover { text-decoration: underline; }
.subj-crumbs__sep { opacity: .5; }
.subj-crumbs [aria-current="page"] { color: #1A1A1A; }

/* ---------- заголовок предмета ---------- */
.subj-head h1 { display: flex; align-items: center; gap: 10px; }
.subj-head__ico { font-size: 1.1em; }

/* ---------- цвет предмета на акцентах ----------
   Применяется только там, где предмет не SAT: базовое зелёно-золотое
   оформление платформы остаётся нетронутым. */
html:not([data-subject="sat"]) .btn-primary {
  background: var(--subj-color);
  border-color: var(--subj-color);
}
html:not([data-subject="sat"]) .page-head .eyebrow { color: var(--subj-accent); }
html:not([data-subject="sat"]) .vc-prog-fill,
html:not([data-subject="sat"]) .progress-fill { background: var(--subj-color); }
html:not([data-subject="sat"]) .topnav { border-bottom-color: var(--subj-accent); }

/* ---------- письмо справа налево ----------
   Разворачивается только контент задания. Интерфейс, кнопки и
   навигация остаются слева направо, иначе ученик теряет ориентиры. */
html[data-subj-dir="rtl"] .q-text,
html[data-subj-dir="rtl"] .ksat-media__passage,
html[data-subj-dir="rtl"] .choices .ctxt,
html[data-subj-dir="rtl"] .q-alt__body {
  direction: rtl;
  text-align: right;
  unicode-bidi: isolate;
}

@media (max-width: 560px) {
  .subj-modal { padding: 0; align-items: flex-end; }
  .subj-modal__box { max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .subj-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .subj-card, .subj-btn { transition: none; }
  .subj-card:hover { transform: none; }
}

/* ---------- тарифы по предметам ---------- */
.ksa-plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ksa-plan {
  border: 1px solid #D8E0D8;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ksa-plan__name { font-weight: 700; color: var(--subj-color); font-size: 15px; }
.ksa-plan__price { font-size: 19px; font-weight: 700; color: #1A1A1A; }
.ksa-plan__price small { font-size: 13px; font-weight: 500; color: #5A6B5A; }
.ksa-plan__desc { font-size: 13px; color: #5A6B5A; flex: 1; line-height: 1.45; }

/* ---------- IELTS: плеер и шум зала ---------- */
.iel-player {
  border: 1px solid #D8E0D8;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.iel-player__once {
  font-size: 12.5px;
  color: #B23B3B;
  background: #FDF2F2;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 10px;
}
.iel-player audio { width: 100%; }
.iel-noise { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13.5px; }
.iel-noise input[type=range] { flex: 1; accent-color: var(--subj-color); }
.iel-band {
  display: inline-block;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: var(--subj-color);
  border-radius: 10px;
  padding: 6px 16px;
}

/* ============ IELTS: экраны предмета ============ */
.iel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.iel-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-align: left;
  border: 1px solid #D8E0D8;
  border-radius: 14px;
  background: #fff;
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color .14s, transform .14s;
}
.iel-card:hover:not(:disabled) { border-color: var(--subj-color); transform: translateY(-2px); }
.iel-card:disabled { opacity: .5; cursor: default; }
.iel-card__ico { font-size: 30px; line-height: 1; }
.iel-card__ttl { font-size: 17px; font-weight: 700; color: var(--subj-color); }
.iel-card__ru { font-size: 13px; color: #5A6B5A; }
.iel-card__desc { font-size: 13px; color: #4A5A4A; line-height: 1.45; flex: 1; margin-top: 4px; }
.iel-card__n {
  margin-top: 8px; font-size: 12px; font-weight: 700;
  background: #EEF2EE; color: #3A4A3A; border-radius: 999px; padding: 3px 10px;
}

.iel-levels { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.iel-levels .ks-chip small { opacity: .75; font-weight: 400; }

.iel-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.iel-type {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid #D8E0D8; border-radius: 10px; background: #fff;
  padding: 10px 12px; cursor: pointer; font-size: 13.5px; color: #2A3A2A;
}
.iel-type:hover { border-color: var(--subj-color); }
.iel-type--on { border-color: var(--subj-color); border-width: 2px; background: #F2F7F2; }
.iel-type__n {
  flex: 0 0 auto; min-width: 34px; text-align: center;
  font-weight: 700; color: var(--subj-color);
  background: #EEF2EE; border-radius: 8px; padding: 3px 6px; font-size: 12.5px;
}
.iel-type__t { line-height: 1.3; }

.iel-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.iel-lvl {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: #fff; background: var(--subj-color);
  border-radius: 999px; padding: 3px 10px; margin-bottom: 10px;
}

@media (max-width: 560px) {
  .iel-grid { grid-template-columns: 1fr; }
  .iel-types { grid-template-columns: 1fr; }
  .iel-actions .btn { flex: 1; }
}

/* ============ IELTS: band, работы, проверка ============ */
.iel-band-box {
  border: 1px solid #D8E0D8; border-radius: 14px; background: #fff;
  padding: 18px; margin: 16px 0;
}
.iel-band-box h3 { margin: 0 0 12px; color: var(--green-900, #1B5E20); }
.iel-band-hero { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.iel-band-num {
  font-size: 44px; font-weight: 800; line-height: 1;
  color: var(--subj-color, #1B5E20);
}
.iel-band-cap { font-size: 13.5px; color: #5A6B5A; }
.iel-band-note {
  margin-top: 12px; font-size: 13px; color: #5A6B5A;
  background: #FAFBFA; border-left: 3px solid #C9A227;
  border-radius: 0 8px 8px 0; padding: 10px 13px; line-height: 1.5;
}

.iel-task {
  background: #FBFCFB; border-left: 3px solid var(--subj-color, #1B5E20);
  border-radius: 0 10px 10px 0; padding: 14px 16px;
  font-size: 15.5px; line-height: 1.6; margin-bottom: 14px;
}
.iel-cue {
  background: #FFF8E6; border: 2px solid #C9A227; border-radius: 12px;
  padding: 16px; font-size: 16px; line-height: 1.6; margin-bottom: 10px;
}
.iel-cue--hidden { background: #F2F2F2; border-color: #CCC; color: #888; font-style: italic; }

.iel-wbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 8px;
}
.iel-wtimer {
  font-family: ui-monospace, Menlo, monospace; font-size: 20px; font-weight: 700;
  color: var(--green-900, #1B5E20);
}
.iel-wtimer--warn { color: #B23B3B; }
.iel-wcount { font-size: 14px; font-weight: 600; color: #B23B3B; }
.iel-wcount--ok { color: #2E7D32; }

.iel-essay {
  width: 100%; border: 1px solid #D8E0D8; border-radius: 10px;
  padding: 14px; font-size: 15.5px; line-height: 1.65;
  font-family: inherit; resize: vertical;
}
.iel-essay:focus { outline: 2px solid var(--subj-color, #1B5E20); outline-offset: -1px; }
.iel-essay-view { font-size: 15.5px; line-height: 1.7; white-space: pre-wrap; }

.iel-check { margin-top: 14px; }
.iel-chk { margin: 8px 0; padding-left: 20px; font-size: 14.5px; line-height: 1.7; }
.iel-chk .ok { color: #2E7D32; font-weight: 700; }
.iel-chk .no { color: #B23B3B; }
.iel-chk-notes {
  background: #FDF6E3; border-left: 3px solid #C9A227;
  border-radius: 0 8px 8px 0; padding: 10px 13px;
  font-size: 13.5px; line-height: 1.6; margin: 8px 0;
}

.iel-rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.iel-rec__time {
  font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 700;
  color: var(--green-900, #1B5E20); min-width: 78px;
}
.iel-rec__done { margin-top: 14px; }
.iel-rec__done audio { width: 100%; max-width: 420px; }

.iel-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.iel-work {
  border: 1px solid #D8E0D8; border-radius: 12px; background: #fff;
  padding: 14px; display: flex; flex-direction: column; gap: 7px;
}
.iel-work--done { border-color: #2E7D32; }
.iel-work__top { display: flex; justify-content: space-between; align-items: center; }
.iel-work__kind { font-weight: 700; color: var(--green-900, #1B5E20); font-size: 14.5px; }
.iel-work__id { font-size: 13px; color: #5A6B5A; }
.iel-work__band {
  font-size: 22px; font-weight: 800; color: #2E7D32;
}
.iel-work__wait {
  font-size: 13px; color: #8A7A2A; background: #FDF6E3;
  border-radius: 999px; padding: 4px 12px; display: inline-block; width: fit-content;
}

.iel-tasklist { display: grid; gap: 8px; margin-bottom: 14px; }
.iel-task-row {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  border: 1px solid #D8E0D8; border-radius: 10px; background: #fff;
  padding: 12px 14px; cursor: pointer;
}
.iel-task-row:hover { border-color: var(--subj-color, #1B5E20); }
.iel-task-row__t { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #5A6B5A; }
.iel-task-row__x { font-size: 14.5px; color: #1A1A1A; line-height: 1.45; }

.iel-crit { border-top: 1px solid #EEF2EE; padding: 12px 0; }
.iel-crit:first-of-type { border-top: 0; }
.iel-crit__h { font-size: 15px; color: #1A1A1A; }
.iel-crit__bands { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.iel-crit__bands .ks-chip { padding: 5px 11px; font-size: 13px; }
.iel-crit__total { font-size: 16px; font-weight: 700; color: var(--green-900, #1B5E20); margin-right: auto; }
.iel-metrics {
  margin-top: 10px; font-size: 13px; color: #5A6B5A;
  background: #FAFBFA; border-radius: 8px; padding: 8px 12px;
}

@media (max-width: 560px) {
  .iel-works { grid-template-columns: 1fr; }
  .iel-band-num { font-size: 36px; }
}

/* ============ Экосистема предмета: режимы ============ */
.eco-h {
  font-size: 17px; color: var(--green-900, #1B5E20);
  margin: 22px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--subj-accent, #C9A227); display: inline-block;
}
.eco-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.eco-mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; border: 1px solid #D8E0D8; border-radius: 12px;
  background: #fff; padding: 14px; cursor: pointer;
  transition: border-color .14s, transform .14s;
}
.eco-mode:hover { border-color: var(--subj-color, #1B5E20); transform: translateY(-2px); }
.eco-mode__ico { font-size: 24px; line-height: 1; }
.eco-mode__n { font-size: 15px; font-weight: 700; color: var(--subj-color, #1B5E20); }
.eco-mode__d { font-size: 12.5px; color: #5A6B5A; line-height: 1.4; }

.iel-player__err {
  margin-top: 10px; font-size: 13px; color: #B3261E;
  background: #FDF2F2; border-radius: 8px; padding: 10px 12px;
  word-break: break-all;
}
.iel-player__err small { color: #7A4040; }

@media (max-width: 560px) { .eco-modes { grid-template-columns: 1fr 1fr; } }

/* ============ ШАПКА ============
   Раскладка верхней панели полностью переписана и вынесена в
   css/ksat-topbar.css: прежние правки подгоняли элементы под
   строку, в которую они всё равно не помещались.

   Здесь остались только цвета кнопки предмета — размеры и
   расположение задаёт новый файл. */

.topbar > .subj-btn-wrap .subj-btn__name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ Прохождение IELTS группой ============
   Материал сверху, вопросы под ним. На широком экране текст
   и вопросы становятся двумя колонками — как на настоящем
   экзамене, где пассаж слева, а вопросы справа. */

.ir { padding-bottom: 90px; }

.ir-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line, #D8E0D8);
}
.ir-top__l, .ir-top__r { display: flex; align-items: center; gap: 10px; }
.ir-step { font-size: 13px; color: #5A6B5A; }
.ir-kind { font-weight: 700; color: var(--green-900, #1B5E20); font-size: 15px; }
.ir-count {
  font-size: 14px; font-weight: 700; color: var(--green-900, #1B5E20);
  background: #EEF2EE; border-radius: 999px; padding: 4px 12px;
}

/* ---------- материал ---------- */
.ir-material {
  border: 1px solid var(--line, #D8E0D8); border-radius: 14px;
  background: #fff; padding: 14px; margin-bottom: 16px;
}
.ir-once {
  font-size: 13px; color: #7A1F1F; background: #FDF2F2;
  border-radius: 8px; padding: 9px 12px; margin-bottom: 10px; line-height: 1.5;
}
.ir-material audio { width: 100%; }
.ir-err {
  margin-top: 10px; font-size: 13px; color: #B3261E;
  background: #FDF2F2; border-radius: 8px; padding: 10px 12px;
}
.ir-played {
  margin-top: 8px; font-size: 12.5px; color: #6B5A17;
  background: #FDF6E3; border-radius: 8px; padding: 7px 11px;
}
.ir-noise {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 13px; color: #5A6B5A;
}
.ir-noise input { flex: 1; accent-color: var(--green-900, #1B5E20); }

/* Текст сворачивается: на телефоне длинный пассаж вытеснял
   вопросы за экран, и ученик не понимал, что там что-то есть. */
.ir-passage {
  font-size: 15.5px; line-height: 1.65; color: #1A1A1A;
  max-height: 260px; overflow: hidden; position: relative;
}
.ir-passage::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.ir-passage--open { max-height: none; }
.ir-passage--open::after { display: none; }
.ir-passage p { margin: 0 0 12px; }
.ir-passage p:last-child { margin-bottom: 0; }
.ir-passage__more {
  margin-top: 10px; border: 1px solid var(--green-900, #1B5E20);
  background: #fff; color: var(--green-900, #1B5E20);
  border-radius: 999px; padding: 7px 16px; font-size: 13.5px;
  font-weight: 600; cursor: pointer;
}

/* ---------- вопросы ---------- */
.ir-questions { display: grid; gap: 14px; }
.ir-q {
  display: flex; gap: 12px;
  border: 1px solid var(--line, #D8E0D8); border-radius: 14px;
  background: #fff; padding: 14px;
}
.ir-q__n {
  flex: 0 0 auto; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--green-900, #1B5E20);
  color: #fff; font-weight: 700; font-size: 13.5px;
}
.ir-q__body { flex: 1; min-width: 0; }
.ir-q__txt {
  font-size: 15.5px; line-height: 1.55; color: #1A1A1A; margin-bottom: 10px;
}

.ir-opts { display: grid; gap: 7px; }
.ir-opt {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  border: 1px solid var(--line, #D8E0D8); border-radius: 10px;
  background: #fff; padding: 11px 13px; cursor: pointer;
  font-size: 15px; line-height: 1.45; color: #1A1A1A;
  /* Крупная зона нажатия: пальцем по мелкой кнопке не попасть */
  min-height: 44px;
}
.ir-opt:hover { border-color: var(--green-900, #1B5E20); }
.ir-opt--on {
  border-color: var(--green-900, #1B5E20); border-width: 2px;
  background: #F2F7F2; padding: 10px 12px;
}
.ir-opt__l {
  flex: 0 0 auto; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #EEF2EE;
  color: var(--green-900, #1B5E20); font-weight: 700; font-size: 12.5px;
}
.ir-opt--on .ir-opt__l { background: var(--green-900, #1B5E20); color: #fff; }
.ir-opt__t { flex: 1; min-width: 0; }

.ir-input {
  width: 100%; border: 1px solid var(--line, #D8E0D8); border-radius: 10px;
  padding: 11px 13px; font-size: 16px; /* 16px — иначе iOS увеличивает страницу */
  font-family: inherit;
}
.ir-input:focus {
  outline: 2px solid var(--green-900, #1B5E20); outline-offset: -1px;
}

/* ---------- переходы ---------- */
.ir-nav {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px; padding: 12px 0;
  background: linear-gradient(rgba(247,249,247,0), var(--bg, #F7F9F7) 40%);
}
.ir-nav .btn { min-height: 44px; }

/* ---------- широкий экран: две колонки ---------- */
@media (min-width: 900px) {
  .ir-material--text {
    position: sticky; top: 76px;
    max-height: calc(100vh - 190px); overflow-y: auto;
  }
  .ir-body-2col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
  }
  .ir-passage { max-height: none; }
  .ir-passage::after { display: none; }
  .ir-passage__more { display: none; }
}

@media (max-width: 480px) {
  .ir-q { padding: 12px; gap: 10px; }
  .ir-q__n { width: 24px; height: 24px; font-size: 12.5px; }
  .ir-top { font-size: 13px; }
  .ir-kind { font-size: 14px; }
}
/* Защищаем кнопку предмета от сплющивания в столбик */



/* Защищаем кнопку предмета от сплющивания в столбик */
.subj-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    min-width: max-content !important;
}

.subj-btn__name {
    white-space: nowrap !important;
}
/* Пока открыта шторка выбора предмета, фон зафиксирован скриптом.
   Само окно центрируется и не двигается вместе со страницей. */
body[data-ksat-lock] { overflow: hidden; }
.subj-modal { position: fixed; inset: 0; }
.subj-modal__box { position: relative; margin: auto; }
