/* Shared mobile shell for the ОГЭ and профильный ЕГЭ courses. */

.profil-mobile-chrome,
.profil-catalog { display: none; }

.course-profil .field:has(#statusFilter),
.course-profil .field:has(#pageSize),
.course-info .field:has(#statusFilter),
.course-info .field:has(#pageSize) { display: none; }
.course-profil .controls {
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 180px);
}
.course-info .controls { display: none; }

@media (max-width: 720px) {
  :is(.course-profil, .course-oge, .course-info) {
    --profil-ink: #12203a;
    --profil-muted: #5b6b86;
    --profil-line: #e4e9f2;
    --profil-soft: #eef3ff;
    --profil-accent: #2b4fd6;
    background: #eef1f6;
  }

  :is(.course-profil, .course-oge, .course-info) .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 52px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, .92);
  }
  :is(.course-profil, .course-oge, .course-info) .brand h1 { font-size: 13px; }
  :is(.course-profil, .course-oge, .course-info) .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 10px;
  }

  :is(.course-profil, .course-oge, .course-info) .course-navigation,
  :is(.course-profil, .course-oge, .course-info) .mobile-catalog,
  :is(.course-profil, .course-oge, .course-info) .mobile-lesson,
  :is(.course-profil, .course-oge, .course-info) .controls,
  :is(.course-profil, .course-oge, .course-info) .hero p,
  :is(.course-profil, .course-oge, .course-info) .result-count,
  :is(.course-profil, .course-oge, .course-info) .top-stats { display: none !important; }
  :is(.course-profil, .course-oge, .course-info).is-admin .controls {
    display: grid !important;
    position: static;
    grid-template-columns: 1fr;
    margin-bottom: 14px;
  }

  :is(.course-profil, .course-oge, .course-info) .hero { margin: 4px 0 12px; }
  :is(.course-profil, .course-oge, .course-info) .hero h2 {
    font-size: 22px;
    letter-spacing: -0.03em;
    text-wrap: balance;
  }

  :is(.course-profil, .course-oge, .course-info) .profil-mobile-chrome {
    display: block;
    position: sticky;
    top: 52px;
    z-index: 28;
    margin: 0;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--profil-line);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(16px);
  }

  .profil-lesson-bar {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .profil-catalog-open {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 6px 10px 6px 8px;
    border: 1px solid var(--profil-line);
    border-radius: 16px;
    background: #fff;
    color: inherit;
    text-align: left;
    box-shadow: 0 1px 0 rgba(18, 32, 58, .04);
  }

  .profil-catalog-open-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--profil-soft);
    color: var(--profil-accent);
    font-size: 16px;
    line-height: 1;
  }

  .profil-lesson-bar-text { min-width: 0; flex: 1; }
  .profil-lesson-bar-kicker {
    display: block;
    overflow: hidden;
    color: var(--profil-ink);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profil-catalog-open-label {
    flex: 0 0 auto;
    color: var(--profil-accent);
    font-size: 12px;
    font-weight: 800;
  }

  .profil-search-toggle {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--profil-line);
    border-radius: 16px;
    background: #fff;
    color: var(--profil-ink);
    font-size: 20px;
  }
  .profil-search-toggle[aria-expanded="true"] {
    border-color: #c9d6ff;
    background: var(--profil-soft);
    color: var(--profil-accent);
  }

  .profil-search-panel { padding-top: 8px; }
  .profil-search-panel[hidden] { display: none; }
  .profil-search-panel input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--profil-line);
    border-radius: 14px;
    background: #fff;
    font-size: 16px;
  }

  .profil-lesson-strip {
    display: flex;
    gap: 6px;
    margin: 8px -12px 0;
    padding: 0 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .profil-lesson-strip::-webkit-scrollbar { display: none; }
  .profil-lesson-strip[hidden] { display: none; }

  .profil-lesson-chip {
    flex: 0 0 auto;
    min-width: 40px;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--profil-line);
    border-radius: 999px;
    background: #fff;
    color: var(--profil-muted);
    font-size: 13px;
    font-weight: 750;
    scroll-snap-align: start;
  }
  .profil-lesson-chip[aria-current="page"] {
    border-color: transparent;
    background: var(--profil-accent);
    color: #fff;
  }
  .profil-lesson-chip:disabled { opacity: .4; }

  :is(.course-profil, .course-oge, .course-info) .content {
    padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
  }

  :is(.course-profil, .course-oge, .course-info) .type-navigation {
    top: 0;
    z-index: 27;
    gap: 0;
    margin: 0 0 14px;
    padding: 4px;
    border: 0;
    border-radius: 14px;
    background: rgba(231, 236, 245, .96);
    box-shadow: none;
    backdrop-filter: blur(16px);
  }
  :is(.course-profil, .course-oge, .course-info) .type-navigation-label { display: none; }
  :is(.course-profil, .course-oge, .course-info) .type-navigation-button {
    max-width: none;
    min-height: 40px;
    padding: 7px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-weight: 700;
    white-space: nowrap;
  }
  :is(.course-profil, .course-oge, .course-info) .type-navigation-button[aria-current] {
    background: #fff;
    color: var(--profil-ink);
    box-shadow: 0 1px 3px rgba(18, 32, 58, .08);
  }

  :is(.course-profil, .course-oge, .course-info) .lesson-task-list {
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: transparent;
    gap: 10px;
    display: flex;
    box-shadow: none;
  }
  :is(.course-profil, .course-oge, .course-info) .lesson-task-list > .task-row,
  :is(.course-profil, .course-oge, .course-info) .lesson-task-list > .card {
    border: 1px solid var(--profil-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(18, 32, 58, .05);
  }
  :is(.course-profil, .course-oge, .course-info) .task-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 6px 8px;
    padding: 10px 12px;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row-num {
    display: grid;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    place-items: center;
    border-radius: 7px;
    background: var(--profil-soft);
    color: var(--profil-accent);
    font-size: 12px;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .card-body {
    grid-column: 2;
    grid-row: 1;
    flex: none;
    min-width: 0;
    font-size: 15px;
    line-height: 1.35;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .task-solved-mark {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    max-width: 100%;
  }
  :is(.course-profil, .course-oge, .course-info) .task-html p { margin: 0 0 .35em; }
  :is(.course-profil, .course-oge, .course-info) .task-html,
  :is(.course-profil, .course-oge, .course-info) .card-body,
  :is(.course-profil, .course-oge, .course-info) .katex-display {
    overflow: visible;
    touch-action: pan-y;
    overscroll-behavior: none;
  }
  :is(.course-profil, .course-oge, .course-info) .math {
    white-space: normal;
  }
  :is(.course-profil, .course-oge, .course-info) .math-statement {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    padding: 0;
    line-height: 1.15;
    vertical-align: middle;
  }
  :is(.course-profil, .course-oge, .course-info) .katex-display {
    margin: 0.15em 0;
  }
  :is(.course-profil, .course-oge, .course-info) .math-statement .katex,
  :is(.course-profil, .course-oge, .course-info) .card-body .katex,
  :is(.course-profil, .course-oge, .course-info) .lesson-example-block .katex {
    font-size: 1.3em;
  }
  :is(.course-profil, .course-oge, .course-info) .lesson-example-problem {
    padding: 10px 10px;
    font-size: 16px;
  }
  :is(.course-profil, .course-oge, .course-info) .lesson-example-block {
    width: fit-content;
    max-width: 100%;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer,
  :is(.course-profil, .course-oge, .course-info) .task-row-meta,
  :is(.course-profil, .course-oge, .course-info) .task-row .task-official-answer,
  :is(.course-profil, .course-oge, .course-info) .task-row .card-actions {
    grid-column: 1 / -1;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer {
    flex: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-parts {
    gap: 6px;
    margin-bottom: 6px;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-part {
    grid-template-columns: 1fr;
  }
  :is(.course-profil, .course-oge, .course-info) .student-answer-row { grid-template-columns: 1fr; gap: 6px; }
  :is(.course-profil, .course-oge, .course-info) .student-answer-row:has(.student-answer-explain) {
    grid-template-columns: 1fr 1fr;
  }
  :is(.course-profil, .course-oge, .course-info) .student-answer-row:has(.student-answer-explain) .student-answer-input {
    grid-column: 1 / -1;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-check,
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-explain {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    justify-content: center;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-input {
    height: 40px;
    min-height: 40px;
    padding: 6px 10px;
    font-size: 16px;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-feedback {
    margin-top: 4px;
    min-height: 0;
  }
  :is(.course-profil, .course-oge, .course-info) .task-row .student-answer-feedback:empty { display: none; }
  :is(.course-profil, .course-oge, .course-info) .task-row-meta {
    padding: 0;
    font-size: 11px;
  }
  :is(.course-profil, .course-oge, .course-info):not(.is-admin) .task-row-meta { display: none; }

  :is(.course-profil, .course-oge, .course-info) .lesson-task-head h3 { font-size: 18px; letter-spacing: -0.02em; }
  :is(.course-profil, .course-oge, .course-info) .pagination { gap: 8px; }
  :is(.course-profil, .course-oge, .course-info) .page-button { min-width: 44px; min-height: 44px; border-radius: 12px; }

  :is(.course-profil, .course-oge, .course-info) .profil-catalog:not([open]) { display: none; }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog[open] {
    display: flex;
    flex-direction: column;
    inset: 0;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #f4f6fb;
    color: var(--profil-ink);
  }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog::backdrop { background: #10182ad9; }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 10px 12px calc(10px + env(safe-area-inset-top));
    padding-top: max(10px, env(safe-area-inset-top));
    background: #fff;
    border-bottom: 1px solid var(--profil-line);
  }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog-head h2 {
    flex: 1;
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
  }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog-head button {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--profil-soft);
    color: var(--profil-accent);
    font-weight: 800;
  }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog-body {
    flex: 1;
    overflow: auto;
    padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
  }
  :is(.course-profil, .course-oge, .course-info) .profil-catalog-lead {
    margin: 0 2px 14px;
    color: var(--profil-muted);
    font-size: 15px;
    font-weight: 650;
    line-height: 1.35;
  }

  .profil-section-card,
  .profil-lesson-row {
    width: 100%;
    border: 1px solid var(--profil-line);
    background: #fff;
    color: inherit;
    text-align: left;
  }
  .profil-section-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }
  .profil-section-card {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(18, 32, 58, .04);
  }
  .profil-section-print {
    display: none;
    align-self: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--profil-line);
    border-radius: 14px;
    background: #fff;
    color: var(--profil-accent);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
  }
  :is(.course-profil, .course-oge, .course-info).is-admin.is-admin-print .profil-section-print { display: inline-flex; align-items: center; }
  .profil-catalog-lead + .profil-section-print {
    margin: 0 0 14px;
    width: 100%;
    justify-content: center;
  }
  .profil-lesson-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
  }
  .profil-lesson-wrap .profil-lesson-row { margin-bottom: 0; }
  .profil-lesson-pdf {
    display: none;
    align-self: center;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--profil-line);
    border-radius: 14px;
    background: #fff;
    color: var(--profil-accent);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
  }
  :is(.course-profil, .course-oge, .course-info).is-admin.is-admin-print .profil-lesson-pdf { display: inline-flex; align-items: center; }
  .profil-section-card:disabled,
  .profil-lesson-row:disabled {
    opacity: .48;
  }
  .profil-section-num,
  .profil-lesson-num {
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--profil-soft);
    color: var(--profil-accent);
    font-weight: 800;
  }
  .profil-section-num { width: 44px; height: 44px; font-size: 15px; }
  .profil-section-card strong,
  .profil-lesson-row strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
  }
  .profil-section-card span,
  .profil-lesson-row span {
    color: var(--profil-muted);
    font-size: 12px;
    font-weight: 650;
  }
  .profil-section-card em {
    font-style: normal;
    color: #8a94a7;
    font-size: 12px;
    font-weight: 750;
  }
  .profil-section-card[data-current="true"],
  .profil-lesson-row[aria-current="page"] {
    border-color: #c9d6ff;
    background: #f5f8ff;
  }

  .profil-lesson-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 16px;
  }
  .profil-lesson-num { width: 36px; height: 36px; font-size: 13px; }

  :is(.course-profil, .course-oge, .course-info) .material-frame {
    min-height: 70dvh;
    border: 0;
    border-radius: 16px;
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  :is(.course-profil, .course-oge, .course-info) .profil-mobile-chrome,
  :is(.course-profil, .course-oge, .course-info) .topbar,
  :is(.course-profil, .course-oge, .course-info) .type-navigation { backdrop-filter: none; }
}
