/* Mobile refinement: preserve the desktop visual language without horizontal overflow. */
.audit-item { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; margin-bottom: .55rem; background: #fff; }
.audit-item-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.audit-item-head strong { color: var(--dark); font-size: .9rem; overflow-wrap: anywhere; }
.audit-item-head time { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.audit-details { margin-top: .3rem; font-size: .78rem; overflow-wrap: anywhere; }
html, body { max-width: 100%; overflow-x: hidden; }
body { text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%; }
.container, main, section, .navbar, .footer { max-width: 100%; }
img, video, iframe { max-width: 100%; }

@media (max-width: 768px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .navbar { padding: .45rem 0; }
  /* Имя, иконки и бургер в одну строку. В styles.css на узких экранах .nav-wrap
     переключается в flex-direction: column — без явного возврата в row иконки
     уезжали на второй ряд под именем. */
  .nav-wrap { width: 100%; gap: .5rem; flex-direction: row; flex-wrap: nowrap; align-items: center; }
  .nav-left { min-width: 0; flex: 1 1 auto; max-width: none; }
  .nav-brand { min-width: 0; }
  .brand-name { font-size: .95rem; letter-spacing: .3px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Подпись на телефоне убираем целиком: она занимала две строки, из-за чего имя
     уходило выше иконок, а шапка была вдвое выше нужного. Имя центрируется по
     строке вместе с иконками. */
  .brand-sub { display: none; }
  /* Иконки и бургер центрируются по строке с именем: блоку задаётся высота этой
     строки, а элементы внутри выравниваются по центру, даже если они выше. */
  .nav-right { flex: 0 0 auto; margin-left: auto; gap: .35rem; align-items: center; height: 26px; padding-top: 0; }
  .nav-socials { gap: .3rem; }
  .social-icon { width: 26px; height: 26px; }
  .nav-burger { width: 32px; height: 28px; }
  .nav-menu { left: 12px; right: 12px; top: calc(100% + 8px); min-width: 0; max-height: calc(100dvh - 90px); overflow-y: auto; padding: .55rem; }
  .nav-menu a { padding: .7rem .8rem; }
  /* Уведомление не должно накрывать шапку и не должно висеть пустой белой
     плашкой. Раньше оно пряталось сдвигом translateY(-150%) — этого не хватало
     для низкой плашки, и она оставалась видимой. Теперь скрытие идёт через
     visibility/opacity, поэтому пустое уведомление не рисуется вовсе. */
  .notification {
    top: 70px; left: 12px; right: 12px; max-width: none;
    transform: none; opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
  }
  .notification.show { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }

  .page { padding: 1.25rem 0; }
  .hero { padding: 2.5rem 0 2.8rem; }
  /* На телефоне кнопки идут под фотографию, а не над ней. Разметка не меняется:
     обёртки становятся прозрачными для раскладки, а порядок задаётся через order.
     Иначе пришлось бы дублировать разметку ради одного устройства. */
  .hero-grid { display: flex; flex-direction: column; gap: 1.5rem; }
  .hero-left, .hero-right { display: contents; }
  .hero-kicker { order: 1; }
  .hero-title { order: 2; }
  .hero-subtitle { order: 3; }
  .hero-desc { order: 4; margin-bottom: 0; }
  .hero-photo { order: 5; }
  .hero-cta { order: 6; margin-top: .3rem; gap: .65rem; }
  .hero-title { font-size: clamp(2rem, 11vw, 3rem); letter-spacing: .2px; }
  .hero-kicker { font-size: .67rem; letter-spacing: 1.5px; padding: .3rem .7rem; }
  .hero-subtitle { font-size: 1.05rem; line-height: 1.35; }
  .hero-desc { font-size: .94rem; line-height: 1.55; }
  .download-card { flex-direction: column; align-items: flex-start; padding: 1.2rem; }
  .download-card .btn { width: 100%; }
  .footer-links { width: 100%; }
  .footer-links a { flex: 1 1 auto; justify-content: center; }
  .legal-body { max-width: none; }
  .legal-table, .legal-table thead, .legal-table tbody, .legal-table tr, .legal-table th, .legal-table td { display: block; width: 100%; }
  .legal-table thead { display: none; }
  .legal-table tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: .8rem; overflow: hidden; }
  .legal-table td { border: none; border-bottom: 1px solid var(--border); }
  .legal-table td:first-child { width: auto; background: #eef8f8; font-weight: 600; }
  .legal-table td:last-child { border-bottom: none; }
  .hero-photo { width: min(100%, 360px); margin: 0 auto; }
  .hero-photo img { border-radius: 18px; border-width: 3px; }
  .hero-sticker { top: -10px; right: 4px; padding: .4rem .7rem; font-size: .7rem; }

  h1, h2, h3, h4 { overflow-wrap: anywhere; }
  .section { padding: 2rem 0 .4rem; }
  .section h2 { font-size: 1.55rem; }
  .features-grid, .audience-grid { grid-template-columns: 1fr; gap: .9rem; }
  .feature, .audience-card { padding: 1.2rem; border-radius: 13px; }
  .feature h3, .audience-card h3 { font-size: 1.1rem; }
  .feature p, .audience-card li { font-size: .92rem; }

  .btn { min-height: 44px; padding: .72rem 1.05rem; font-size: .92rem; touch-action: manipulation; }
  .btn-small { min-height: 40px; padding: .5rem .8rem; }
  .btn-primary:hover, .btn-buy:hover, .btn-ghost:hover, .feature:hover, .audience-card:hover, .course-card:hover { transform: none; }
  .courses-grid { grid-template-columns: 1fr; gap: 1rem; }
  /* Каталог на телефоне идёт одной колонкой: три колонки на узком экране
     превращают заголовки в три коротких столбика. */
  .catalog { grid-template-columns: 1fr; gap: 1.1rem; }
  .catalog-cover { flex: 0 0 62px; height: 62px; font-size: 1.25rem; }
  .course-card { border-radius: 13px; }
  .course-thumbnail { height: 170px; font-size: 3rem; }
  .course-content { padding: 1rem; }
  .course-content h3 { font-size: 1.1rem; }
  .course-content p { font-size: .9rem; }
  .price-line { font-size: 1.2rem; }

  .course-layout, .video-layout, .about-layout { grid-template-columns: 1fr; gap: 1rem; }
  .course-buy-card { position: static; order: -1; }
  .buy-card-cover { height: 145px; font-size: 2.4rem; }
  .buy-card-body { padding: 1rem; }
  .course-main h2 { font-size: 1.55rem; }
  .course-desc { font-size: .98rem; }
  .about-photo { max-width: min(100%, 340px); margin: 0 auto; border-radius: 15px; }
  .program-list li { align-items: flex-start; padding: .75rem .8rem; }
  .program-num { width: 28px; height: 28px; font-size: .85rem; }
  .lock { white-space: normal; text-align: right; font-size: .75rem; }

  .video-sidebar { max-height: 58vh; padding: .8rem; border-radius: 12px; }
  #videoPlayer { margin-left: -2px; margin-right: -2px; }
  video { border-radius: 8px; aspect-ratio: 16 / 9; object-fit: contain; }
  .player-controls { gap: .35rem; }
  .pc-btn { min-height: 38px; padding: .4rem .65rem; font-size: .78rem; }
  .playlist-item { gap: .45rem; padding: .55rem .4rem; }
  .playlist-title { font-size: .82rem; line-height: 1.3; }

  .auth-container { width: calc(100% - 24px); margin: 1rem auto; padding: 1.25rem; border-radius: 13px; }
  .auth-container h2 { font-size: 1.4rem; }
  .auth-container input, .admin-section input, .admin-section textarea, .admin-section select, .lesson-editor-item input, .lesson-editor-item select { font-size: 16px; }
  .admin-section { padding: 1rem; border-radius: 13px; margin-bottom: 1rem; }
  .admin-section h3 { font-size: 1.15rem; }
  .admin-section form { gap: .7rem; }
  .lesson-editor-item { padding: .7rem; border-radius: 10px; }
  .lesson-editor-item .row { align-items: stretch; gap: .45rem; }
  .lesson-editor-item .row > * { min-width: 0 !important; max-width: 100%; }
  .lesson-editor-item input:not([type="checkbox"]), .lesson-editor-item textarea, .lesson-editor-item select { flex: 1 1 100% !important; width: 100% !important; }
  .lesson-editor-item button { flex: 1 1 100%; }
  .checkbox-line { align-items: flex-start; line-height: 1.35; }
  .checkbox-line input { flex: 0 0 auto; margin-top: .2rem; }
  .progress-bar { height: 22px; }

  .audit-item-head { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .audit-item-head time { white-space: normal; }
  .footer { padding: 1.2rem 0; }
  .footer-wrap { flex-direction: column; gap: .5rem; font-size: .82rem; }
  .socials { gap: .55rem; }
  .social-btn { padding: .6rem .8rem; font-size: .82rem; }
  .disclaimer-note { font-size: .78rem; padding: .5rem .7rem; }
}

@media (max-width: 380px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .brand-name { font-size: .95rem; }
  .social-icon { width: 27px; height: 27px; }
  .nav-socials { gap: .2rem; }
  .nav-right { height: 21px; }
  .hero-title { font-size: 1.9rem; }
  .hero-cta .btn { width: 100%; }
  .course-thumbnail { height: 145px; }
  .video-sidebar { max-height: 52vh; }
}
