/* Life Timeline — Общие мобильные правила (до 760px) для всех блоков — должен подключаться последним.
   Вынесено без изменений из app/life-timeline.html (строки 4356–4788 на 31.10.2026).
   Порядок подключения файлов важен: он повторяет исходный порядок правил. */
@media (max-width: 760px) {
  body[data-mobile-limited="true"] .map-stage {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: auto;
    width: auto;
    height: 184px;
    overflow: hidden;
    border: 1px solid rgba(238, 243, 239, .12);
    border-radius: 10px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.040), rgba(255,255,255,.012)),
      rgba(18, 22, 25, .24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 16px 42px rgba(0,0,0,.22);
    pointer-events: none;
  }

  body[data-mobile-limited="true"] .map-stage::before {
    content: "Карта-превью";
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 2;
    color: rgba(238, 243, 239, .48);
    font-size: 11px;
    line-height: 1;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  body[data-mobile-limited="true"] .map-stage::after {
    content: "События сохраняются на вашей линии";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 2;
    color: rgba(238, 243, 239, .58);
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
  }

  body[data-mobile-limited="true"] #timelineSvg {
    opacity: .92;
  }

  body[data-mobile-limited="true"] .emotion-layer,
  body[data-mobile-limited="true"] .period-layer,
  body[data-mobile-limited="true"] .sphere-lines,
  body[data-mobile-limited="true"] .draft-layer,
  body[data-mobile-limited="true"] .timeline-cards,
  body[data-mobile-limited="true"] .map-date-chip {
    display: none;
  }

  body[data-mobile-limited="true"] .labels {
    opacity: .58;
  }

  body[data-mobile-limited="true"] .life-path-wide {
    stroke-width: 7;
    opacity: .8;
  }

  body[data-mobile-limited="true"] .life-path {
    stroke-width: 1.1;
    opacity: .95;
  }

  body[data-mobile-limited="true"] .event-node {
    cursor: default;
    pointer-events: none;
  }

  body[data-mobile-limited="true"] .event-halo {
    opacity: .14;
  }

  body[data-mobile-limited="true"] .anchor-label,
  body[data-mobile-limited="true"] .year-label,
  body[data-mobile-limited="true"] .today-label {
    font-size: 10px;
  }

  body[data-mobile-limited="true"] .topbar {
    display: none;
  }

  body[data-mobile-limited="true"] .corner-actions {
    top: calc(var(--visual-offset-top, 0px) + max(22px, env(safe-area-inset-top)));
    right: 24px;
    bottom: auto;
    z-index: 72;
  }

  body[data-mobile-limited="true"] .account-button,
  body[data-mobile-limited="true"] .feedback-button {
    width: 36px;
    height: 36px;
  }

  body[data-mobile-limited="true"] .remember-more-fab {
    display: none;
  }

  body[data-mobile-limited="true"] .mobile-mode-notice {
    top: 210px;
    max-height: calc(100vh - 230px);
    overflow: auto;
  }

  body[data-mobile-limited="true"] .mobile-mode-title {
    font-size: 15px;
  }

  body[data-mobile-limited="true"] .mobile-mode-copy {
    font-size: 12.5px;
  }

  body[data-mobile-limited="true"] .mobile-mode-preview-note {
    display: block;
    margin-top: 7px;
    color: rgba(238, 243, 239, .56);
    font-size: 11.5px;
    line-height: 1.35;
  }

  body[data-mobile-limited="true"] .mobile-mode-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body[data-mobile-limited="true"] .left-panel {
    top: 210px;
    left: 12px;
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: auto;
    min-width: 0;
    height: auto;
    padding: 12px 12px 16px;
    border-radius: 10px;
    transform: none;
  }

  body[data-mobile-limited="true"][data-panel="form"] .left-panel {
    top: calc(var(--visual-offset-top, 0px) + max(12px, env(safe-area-inset-top)));
    bottom: auto;
    height: calc(var(--visual-vh, 100vh) - max(24px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
    max-height: calc(var(--visual-vh, 100vh) - max(24px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
    padding: 12px 12px 14px;
    z-index: 82;
    overflow: hidden;
  }

  body[data-mobile-limited="true"][data-panel="form"] .panel-header {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -12px -12px 10px;
    padding: 12px 12px 10px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, .060), rgba(255, 255, 255, .012) 44%, rgba(255, 255, 255, .032)),
      rgba(18, 22, 25, .94);
    backdrop-filter: blur(16px) saturate(1.05);
  }

  body[data-mobile-limited="true"] .panel-header {
    padding: 0;
  }

  body[data-mobile-limited="true"] .panel-title {
    font-size: 18px;
  }

  body[data-mobile-limited="true"] .panel-toggle,
  body[data-mobile-limited="true"][data-panel="closed"] .panel-toggle {
    display: none;
  }

  body[data-mobile-limited="true"][data-panel="closed"] .left-panel {
    transform: none;
    border-color: var(--panel-border);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, .060), rgba(255, 255, 255, .012) 44%, rgba(255, 255, 255, .032)),
      var(--panel);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .13),
      inset 0 -1px 0 rgba(255, 255, 255, .040),
      0 18px 54px rgba(0, 0, 0, .30);
    backdrop-filter: blur(16px) saturate(1.05);
  }

  body[data-mobile-limited="true"][data-panel="closed"] .panel-title,
  body[data-mobile-limited="true"][data-panel="closed"] .add-button,
  body[data-mobile-limited="true"][data-panel="closed"] .saved-count {
    display: flex;
  }

  body[data-mobile-limited="true"][data-panel="closed"] .event-list {
    display: block;
  }

  body[data-mobile-limited="true"][data-panel="closed"] .scope-chip.is-visible {
    display: inline-flex;
  }

  body[data-mobile-limited="true"] .saved-count {
    margin: 0 0 10px;
  }

  body[data-mobile-limited="true"] .event-list {
    padding: 0 0 22px;
  }

  body[data-mobile-limited="true"] .event-row {
    min-height: 44px;
    grid-template-columns: 24px 82px minmax(0, 1fr);
    font-size: 13px;
  }

  body[data-mobile-limited="true"] .event-form {
    display: none;
    padding: 0 1px 44px;
    scroll-padding-bottom: 44px;
  }

  body[data-mobile-limited="true"][data-panel="form"] .event-form {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-limited="true"][data-panel="form"] .form-save {
    position: static;
    bottom: auto;
    margin-top: 14px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .08),
      0 0 0 1px rgba(156, 200, 194, .035);
  }

  body[data-mobile-limited="true"] .form-main-grid,
  body[data-mobile-limited="true"] .date-refinement-row {
    grid-template-columns: 1fr;
  }

  body[data-mobile-limited="true"] .field-row.compact,
  body[data-mobile-limited="true"] .field-row.three,
  body[data-mobile-limited="true"] .period-range-fields {
    grid-template-columns: 1fr;
  }

  body[data-mobile-limited="true"] .form-impact-wrap {
    display: grid;
    gap: 8px;
  }

  body[data-mobile-limited="true"] .form-impact-field {
    justify-content: flex-start;
  }

  body[data-mobile-limited="true"] .field input,
  body[data-mobile-limited="true"] .field textarea,
  body[data-mobile-limited="true"] .form-picker-button,
  body[data-mobile-limited="true"] .cluster-select,
  body[data-mobile-limited="true"] .media-button {
    font-size: 16px;
  }

  body[data-mobile-limited="true"] .form-detail-section {
    margin: 0 0 10px;
    border: 1px solid rgba(238, 243, 239, .11);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
  }

  body[data-mobile-limited="true"] .form-detail-section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 10px;
    color: rgba(238, 243, 239, .78);
    font-size: 13px;
    list-style: none;
    cursor: pointer;
  }

  body[data-mobile-limited="true"] .form-detail-section > summary::-webkit-details-marker {
    display: none;
  }

  body[data-mobile-limited="true"] .form-detail-section > summary::after {
    content: "⌄";
    color: rgba(238, 243, 239, .52);
    font-size: 18px;
    line-height: 1;
  }

  body[data-mobile-limited="true"] .form-detail-section[open] > summary {
    border-bottom: 1px solid rgba(238, 243, 239, .08);
  }

  body[data-mobile-limited="true"] .form-detail-section[open] > summary::after {
    transform: rotate(180deg);
  }

  body[data-mobile-limited="true"] .form-detail-section > .field,
  body[data-mobile-limited="true"] .form-detail-section > .form-impact-wrap,
  body[data-mobile-limited="true"] .form-detail-section > .cluster-field {
    margin: 10px;
  }

  body[data-mobile-limited="true"] .sphere-select-popover.is-open,
  body[data-mobile-limited="true"] .people-suggestions.is-open,
  body[data-mobile-limited="true"] .period-suggestions.is-open,
  body[data-mobile-limited="true"] .cluster-select-popover.is-open {
    position: fixed;
    z-index: 90;
    top: auto;
    left: 14px;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: auto;
    max-height: min(54vh, 360px);
    border-radius: 12px;
    padding: 10px;
    background:
      linear-gradient(135deg, rgba(255,255,255,.080), rgba(255,255,255,.024)),
      rgba(18, 22, 25, .985);
    box-shadow: 0 22px 70px rgba(0,0,0,.52);
    overscroll-behavior: contain;
  }

  body[data-mobile-limited="true"] .sphere-create-input,
  body[data-mobile-limited="true"] .cluster-search {
    min-height: 38px;
  }

  body[data-mobile-limited="true"] .people-suggestion,
  body[data-mobile-limited="true"] .period-suggestion,
  body[data-mobile-limited="true"] .sphere-suggestion,
  body[data-mobile-limited="true"] .cluster-select-popover .cluster-choice {
    min-height: 40px;
    padding: 8px 9px;
    font-size: 13px;
  }

  .topbar {
    left: 12px;
    right: 12px;
    transform: none;
    overflow-x: auto;
    justify-content: flex-start;
  }


  body[data-mobile-limited="true"] .remember-more-modal {
    align-items: end;
    padding: 10px;
  }

  body[data-mobile-limited="true"] .remember-more-panel {
    width: 100%;
    max-height: calc(var(--visual-vh, 100vh) - 20px);
    padding: 16px;
    border-radius: 10px;
  }

  body[data-mobile-limited="true"] .remember-more-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  body[data-mobile-limited="true"] .remember-more-card {
    min-height: 0;
    padding: 14px;
  }

  body[data-mobile-limited="true"] .remember-more-title {
    font-size: 21px;
  }

  body[data-mobile-limited="true"] .remember-more-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  body[data-mobile-limited="true"] .remember-more-catalog-link {
    min-height: 28px;
  }

  .corner-actions {
    top: auto;
    right: 12px;
    bottom: 12px;
  }

  .left-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 58px;
    width: auto;
    height: min(46vh, 430px);
  }

  .panel-header {
    padding-right: 46px;
  }

  .panel-toggle,
  body[data-panel="closed"] .panel-toggle {
    top: 14px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    transform: none;
  }

  .field-row.three {
    grid-template-columns: 1fr 1fr;
  }

}
