/* A bounded thumbnail index: opening it never resizes or rebuilds the ink canvas. */
.has-note-editor .note-editor-material {
  position: relative;
}

.has-note-editor .note-pagebar .study-page-list-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
}

.has-note-editor .note-pagebar .study-page-list-toggle > span {
  display: inline;
}

.has-note-editor .note-pagebar .study-page-list-toggle[aria-expanded="true"] {
  border-color: #087b62;
  background: #e9f6ef;
}

.has-note-editor .study-page-list-layer {
  position: absolute;
  z-index: 450;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  background: rgba(16, 37, 29, .22);
  overscroll-behavior: contain;
}

.has-note-editor .study-page-list-layer[hidden] {
  display: none;
}

.has-note-editor .study-page-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(640px, 100%);
  height: min(680px, 100%);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dbe6de;
  border-radius: 18px;
  background: #fff;
  color: #16382d;
  box-shadow: 0 18px 55px rgba(15, 41, 30, .2);
  font-size: 14px;
  line-height: 1.4;
}

.has-note-editor .study-page-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 16px 16px 12px;
}

.has-note-editor .study-page-list-header > div {
  min-width: 0;
}

.has-note-editor .study-page-list-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.3;
}

.has-note-editor .study-page-list-header p {
  margin: 0;
  overflow: hidden;
  color: #66786d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.has-note-editor .study-page-list-panel button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.has-note-editor .study-page-list-panel button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.has-note-editor .study-page-list-panel button:focus-visible,
.has-note-editor .study-page-list-panel select:focus-visible {
  outline: 2px solid #087b62;
  outline-offset: 2px;
}

.has-note-editor .study-page-list-close,
.has-note-editor .study-page-list-range > button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #dbe6de;
  border-radius: 10px;
  background: #fff;
  color: #087b62;
}

.has-note-editor .study-page-list-close svg,
.has-note-editor .study-page-list-range > button svg {
  width: 19px;
  height: 19px;
}

.has-note-editor .study-page-list-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 12px;
  border-bottom: 1px solid #e5ede7;
}

.has-note-editor .study-page-list-range label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #66786d;
  font-size: 12px;
}

.has-note-editor .study-page-list-range select {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid #dbe6de;
  border-radius: 10px;
  background: #fff;
  color: #16382d;
  font: inherit;
  font-size: 13px;
}

.has-note-editor .study-page-list-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.has-note-editor .study-page-list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  min-height: max-content;
  height: auto;
  padding: 6px 6px 8px;
  border: 1px solid #dbe6de;
  border-radius: 12px;
  background: #f7faf8;
  color: #304d3e;
}

.has-note-editor .study-page-list-preview {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid #e4ebe6;
  border-radius: 6px;
  background: #fff;
  isolation: isolate;
}

.has-note-editor .study-page-list-preview > img,
.has-note-editor .study-page-list-preview > canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 0;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.has-note-editor .study-page-list-preview > canvas {
  background: transparent;
}

.has-note-editor .study-page-list-preview > img[hidden],
.has-note-editor .study-page-list-preview > canvas[hidden] {
  display: none;
}

.has-note-editor .study-page-list-ink-label {
  position: absolute;
  z-index: 1;
  right: 3px;
  bottom: 3px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(233, 246, 239, .92);
  color: #087b62;
  font-size: 9px;
  line-height: 1.2;
  pointer-events: none;
}

.has-note-editor .study-page-list-ink-label[hidden] {
  display: none;
}

.has-note-editor .study-page-list-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  background: #f0f4f1;
  color: #66786d;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
  word-break: keep-all;
  pointer-events: none;
}

.has-note-editor .study-page-list-placeholder > span {
  position: relative;
  z-index: 1;
  font-size: 10px;
  line-height: 1.4;
}

.has-note-editor .study-page-list-preview[data-study-preview-state="loading"] .study-page-list-placeholder::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, .8) 50%, transparent 80%);
  animation: study-page-preview-shimmer 1.8s ease-in-out infinite;
}

.has-note-editor .study-page-list-preview[data-study-preview-state="ready"] .study-page-list-placeholder {
  display: none;
}

.has-note-editor .study-page-list-preview[data-study-preview-state="error"] .study-page-list-placeholder {
  background: #f3f5f3;
  color: #728077;
}

.has-note-editor .study-page-list-caption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.has-note-editor .study-page-list-caption > strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.has-note-editor .study-page-list-caption > span {
  font-size: 10px;
  line-height: 1.2;
}

.has-note-editor .study-page-list-item:hover {
  border-color: #91bba6;
  background: #edf7f1;
}

.has-note-editor .study-page-list-item.is-current {
  border-color: #087b62;
  background: #087b62;
  color: #fff;
}

.has-note-editor .study-page-list-item.is-current .study-page-list-preview {
  border-color: rgba(255, 255, 255, .7);
}

.has-note-editor .study-page-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #e5ede7;
  background: #f8fbf9;
  color: #66786d;
  font-size: 12px;
}

.has-note-editor .study-page-list-footer button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: #e9f6ef;
  color: #087b62;
  font-size: 12px;
  font-weight: 700;
}

@keyframes study-page-preview-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (max-width: 700px) {
  .has-note-editor .study-page-list-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .has-note-editor .study-page-list-layer {
    padding: 8px;
  }

  .has-note-editor .study-page-list-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .has-note-editor .note-pagebar .study-page-list-toggle {
    min-height: 37px;
    gap: 4px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .has-note-editor .note-pagebar .note-page-progress {
    display: none;
  }
}

@media (max-width: 299px) {
  .has-note-editor .study-page-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .has-note-editor .study-page-list-preview[data-study-preview-state="loading"] .study-page-list-placeholder::before {
    animation: none;
  }
}
