/* Study Mode responsive
   Caricare dopo study-mode.css. */
@media screen and (max-width: 1180px) {
  .study-mode-reader-status-line {
    padding: 8px 88px 7px 120px;
  }

  .study-mode-workspace-body {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .study-mode-shell.is-reader-panel-open .study-mode-workspace-body {
    grid-template-columns: minmax(240px, var(--study-reader-panel-width, 260px)) minmax(0, 1fr);
  }

  .study-mode-workspace-topbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .study-mode-workspace-primary,
  .study-mode-workspace-search,
  .study-mode-workspace-secondary {
    justify-content: space-between;
    width: 100%;
  }

  .study-mode-workspace-secondary {
    display: flex;
  }

  .study-mode-reader-position {
    width: 100%;
    text-align: left;
  }
}

@media screen and (max-width: 1024px) {
  .study-mode-landing {
    padding: 22px 18px 18px;
  }

  .study-mode-workspace-body,
  .study-mode-shell.is-reader-panel-open .study-mode-workspace-body {
    grid-template-columns: 1fr;
  }

  .study-mode-side {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    max-height: 32vh;
  }

  .study-mode-side-resizer {
    display: none;
  }

  .study-mode-reader-area {
    padding: 0;
  }

  .study-mode-reader-stack {
    width: 100%;
  }

  .study-mode-page {
    padding: 22px 24px 20px;
  }
}

@media screen and (max-width: 720px) {
  .study-mode-reader-status-line {
    padding: 8px 16px 7px;
    justify-content: flex-start;
    text-align: left;
  }

  .study-mode-selection-pop {
    grid-template-columns: 1fr 1fr;
    max-width: calc(100vw - 24px);
  }

  .study-mode-selection-colors {
    justify-content: flex-start;
  }

  .study-mode-reader-actions-menu {
    min-width: 214px;
    max-width: min(280px, calc(100vw - 32px));
  }

  .study-mode-reader-zoom-submenu,
  .study-mode-reader-focus-submenu {
    position: static;
    min-width: 0;
    margin-top: 4px;
    box-shadow: none;
  }

  .study-mode-library.grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .study-mode-empty-copy {
    white-space: normal;
  }

  .study-mode-empty-title {
    white-space: normal;
  }

  .study-mode-library > .study-mode-empty {
    width: 100%;
    min-height: auto;
    padding: 12px 16px;
  }

  .study-mode-library > .study-mode-empty .study-mode-empty-owl {
    width: 88px;
    height: 88px;
  }

  .study-mode-library > .study-mode-empty .study-mode-empty-title {
    font-size: 1.28rem;
  }

  .study-mode-library > .study-mode-empty .study-mode-empty-copy {
    max-width: 100%;
    font-size: 0.92rem;
    line-height: 1.58;
  }

  .study-mode-source-item,
  .study-mode-collection-card__head,
  .study-mode-collection-detail__head,
  .study-mode-field-head {
    flex-direction: column;
  }

  .study-mode-flash-source-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .study-mode-flash-source-count {
    grid-column: 2;
  }

  .study-mode-manual-row {
    grid-template-columns: 1fr;
  }

  .study-mode-doc-card,
  .study-mode-library.list .study-mode-doc-card {
    grid-template-columns: 1fr;
  }

  .study-mode-doc-preview {
    min-height: 148px;
  }

  .study-mode-btn,
  .study-mode-workspace-search,
  .study-mode-searchbar,
  .study-mode-toolbar-group,
  .study-mode-actions-row,
  .study-mode-doc-actions,
  .study-mode-hero-actions {
    width: 100%;
  }

  .study-mode-btn {
    justify-content: center;
  }

  .study-mode-icon-btn {
    min-width: 98px;
    justify-content: flex-start;
  }

  .study-mode-workspace-primary {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .study-mode-reader-shortcuts {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .study-mode-reader-shortcuts .study-mode-icon-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .study-mode-workspace-search {
    justify-content: center;
    gap: 8px;
  }

  .study-mode-reader-add {
    width: 100%;
  }

  .study-mode-reader-add-toggle {
    width: 100%;
    min-height: 58px;
  }

  .study-mode-reader-add-menu {
    left: 0;
    right: 0;
    transform: none;
    min-width: 0;
  }

  .study-mode-page-bookmark-marker {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
  }

  .study-mode-page-note-marker {
    width: 30px;
    height: 30px;
  }

  .study-mode-pdf-note-card {
    width: min(calc(100% - 24px), 286px) !important;
    max-width: calc(100% - 24px);
    gap: 10px;
    padding: 12px;
  }

  .study-mode-pdf-note-card__field textarea {
    min-height: 92px;
  }

  .study-mode-reader-side-note-input {
    min-height: 56px;
  }

  .study-mode-searchbar {
    padding-right: 8px;
  }

  .study-mode-tabs {
    gap: 6px;
  }

  .study-mode-tab {
    padding: 9px 10px;
    font-size: 0.88rem;
  }

  .study-mode-reader-toolbar {
    padding: 16px;
  }

  .study-mode-modal-card {
    max-height: calc(100vh - 24px);
    padding: 18px;
    border-radius: 22px;
  }

  .study-mode-modal-card--wide {
    width: 100%;
  }

  .study-mode-modal-head {
    gap: 12px;
  }

  .study-mode-modal-card h4 {
    font-size: 1.2rem;
  }

  .study-mode-modal-body {
    padding-right: 2px;
  }

  .study-mode-modal-actions--sticky {
    padding-top: 12px;
  }
}

@media screen and (max-width: 1180px) {
  .study-mode-hub {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
  }

  .study-mode-library-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-mode-library-search,
  .study-mode-library-toolbar-actions {
    width: 100%;
  }

  .study-mode-library-search-dropdown {
    left: 0;
    right: 0;
    width: auto;
    top: calc(100% + 8px);
  }

  .study-mode-library-search-result {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .study-mode-library-search-result__type {
    grid-column: 2;
    justify-self: flex-start;
    margin-top: 2px;
  }

  .study-mode-library-filter-toggle {
    padding: 0 9px;
  }

  .study-mode-library-filter-menu {
    min-width: 156px;
  }

  .study-mode-library-toolbar-actions {
    justify-content: space-between;
  }

}

@media screen and (max-width: 1024px) {
  .study-mode-landing {
    padding: 16px;
    overflow: auto;
  }

  .study-mode-hub {
    grid-template-columns: 1fr;
    height: auto;
  }

  .study-mode-sidebar,
  .study-mode-library-main {
    min-height: auto;
  }

  .study-mode-sidebar {
    padding: 16px;
  }

  .study-mode-sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }

  .study-mode-library-main {
    padding: 16px;
    overflow: visible;
  }

  .study-mode-library {
    margin-block: 0;
    overflow: auto;
    padding-right: 0;
    max-height: none;
  }

  .study-mode-library-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media screen and (max-width: 720px) {
  .study-mode-hub {
    gap: 14px;
  }

  .study-mode-sidebar {
    border-radius: 20px;
  }

  .study-mode-sidebar-nav {
    grid-template-columns: 1fr;
  }

  .study-mode-sidebar-item {
    grid-template-columns: 4px minmax(0, 1fr) auto;
  }

  .study-mode-library-main,
  .study-mode-library-panel {
    padding: 16px;
    border-radius: 20px;
  }

  .study-mode-library-toolbar-actions,
  .study-mode-doc-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .study-mode-library-toolbar-actions .study-mode-btn,
  .study-mode-doc-actions .study-mode-btn {
    width: 100%;
  }

  .study-mode-icon-btn.compact {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .study-mode-options {
    width: 40px;
    align-self: flex-start;
  }

  .study-mode-options-menu {
    left: auto;
    right: 0;
    width: min(212px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    padding: 7px;
  }

  .study-mode-doc-card-head {
    min-height: 4px;
  }

  .study-mode-doc-card-head .study-mode-doc-menu-toggle.study-mode-icon-btn.compact {
    width: 8px !important;
    min-width: 8px !important;
    height: 8px !important;
    min-height: 8px !important;
  }

  .study-mode-doc-menu-dropdown {
    right: -22px;
    width: min(228px, calc(100vw - 52px));
    max-width: calc(100vw - 52px);
  }

  .study-mode-library.grid {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .study-mode-library.grid .study-mode-doc-card.is-clickable {
    width: 100%;
    min-width: 0;
    max-width: none;
    justify-self: stretch;
  }

  .study-mode-library-panel-badges {
    justify-content: flex-start;
  }

  .study-mode-add-card,
  .study-mode-doc-card,
  .study-mode-library.list .study-mode-doc-card,
  .study-mode-library.list .study-mode-add-card {
    min-height: auto;
    padding: 16px;
  }

  .study-mode-doc-card.is-clickable {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .study-mode-library.list .study-mode-doc-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .study-mode-library.list .study-mode-doc-menu-dropdown {
    right: -8px;
  }

  .study-mode-doc-preview {
    min-height: 180px;
  }

  .study-mode-doc-meta {
    gap: 12px;
    row-gap: 14px;
  }
}

@media (max-width: 768px) {
  .pdf-page-wrapper { margin: 8px auto; }
  .study-toolbar { flex-wrap: wrap; }
  .study-mode-page--pdf { padding: 8px 0 16px; }
}

@media (max-width: 768px) {
  .study-mode-page--pdf {
    padding: 4px 0 8px;
  }

  .pdf-page-wrapper {
    margin: 6px auto;
  }

  .study-mode-reader-highlight-list {
    grid-template-columns: 1fr;
  }

  .study-mode-keyword-relations {
    gap: 6px;
  }

  .study-mode-keyword-relation-badge {
    padding: 6px 12px;
    font-size: 0.84rem;
  }

  .study-mode-keyword-item .study-mode-note-actions {
    flex-direction: column;
  }

  .study-mode-keyword-item .study-mode-note-actions .study-mode-btn {
    width: 100%;
    justify-content: center;
  }

  .study-mode-pdf-context-menu {
    min-width: min(220px, calc(100vw - 24px));
  }
}

@media screen and (max-width: 1024px) {
  .study-mode-workspace-topbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .study-mode-workspace-primary,
  .study-mode-workspace-search,
  .study-mode-workspace-secondary {
    justify-content: center;
    flex-wrap: wrap;
  }

  .study-mode-shell:not(.is-tools-collapsed) .study-mode-workspace-body,
  .study-mode-shell.is-reader-panel-open:not(.is-tools-collapsed) .study-mode-workspace-body {
    grid-template-columns: 1fr;
  }

  .study-mode-shell:not(.is-tools-collapsed) .study-mode-tools {
    border-left: none;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    min-height: 38vh;
  }

  .study-mode-tools-resizer {
    display: none !important;
  }

  .study-mode-shell.is-map-editor-open .study-mode-center {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(360px, 42vh);
  }

  .study-mode-flash-deck-list {
    grid-template-columns: 1fr;
  }

  .study-mode-map-editor {
    border-left: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
  }

  .study-mode-map-editor__top {
    grid-template-columns: 1fr;
  }

  .study-mode-map-editor__aside,
  .study-mode-map-editor__switcher,
  .study-mode-map-editor__switcher-list {
    min-height: auto;
  }

  .study-mode-map-editor__summary-head {
    flex-direction: column;
  }

  .study-mode-map-editor__summary-actions {
    width: 100%;
    justify-content: stretch;
  }

  .study-mode-map-editor__summary-actions .study-mode-btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .study-mode-map-editor__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .study-mode-map-editor__body {
    grid-template-columns: 1fr;
  }

  .study-mode-map-editor__meta,
  .study-mode-map-editor__zoom {
    justify-content: center;
  }

  .study-mode-map-editor__dock {
    width: 100%;
    overflow: auto;
    justify-content: flex-start;
  }

  .study-mode-map-panel-card__words {
    grid-template-columns: 1fr 1fr;
  }

  .study-mode-map-layout {
    grid-template-columns: 1fr;
  }

  .study-mode-map-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .study-mode-map-workspace__head {
    flex-direction: column;
  }

  .study-mode-map-workspace__stats {
    justify-content: flex-start;
  }

  .study-mode-map-canvas-wrap {
    min-height: 420px;
  }

  .study-mode-map-inspector {
    min-height: auto;
  }

  .study-mode-map-toolbar__chips {
    overflow: auto;
    padding-bottom: 4px;
  }

  .study-mode-map-toolbar__chips .study-mode-btn.small {
    white-space: nowrap;
  }

  .study-mode-map-library__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .study-mode-map-library__head-actions,
  .study-mode-map-library__filters {
    width: 100%;
  }

  .study-mode-map-library__filters {
    overflow: auto;
    padding-bottom: 4px;
  }

  .study-mode-map-filter {
    white-space: nowrap;
  }
}
