/* Keep each section's own artwork visible throughout the viewport, including
   when the page is taller than the first screen. */
body[data-studyhub-view]:not([data-studyhub-view="home"]) .workspace::before {
  position: fixed;
  inset: 0 0 0 286px;
  height: auto;
  background-image:
    linear-gradient(90deg, rgba(4, 10, 33, .70) 0%, rgba(4, 10, 33, .43) 48%, rgba(4, 10, 33, .20) 100%),
    linear-gradient(180deg, rgba(4, 10, 33, .16), rgba(4, 10, 33, .40)),
    var(--section-art);
  background-position: center, center, center center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Major content surfaces share the lit frame used on the study desk. The
   inner content stays dark enough for long Chinese text and charts. */
body[data-studyhub-view]:not([data-studyhub-view="home"]) :is(
  .library-table-card, .library-overview, .library-recent, .library-lecture, .merge-card,
  .video-search-bar, .video-results, .video-player, .video-focus, .video-learning-card,
  .lecture-recorder-card, .lecture-output-preview,
  .master-diagnosis, .graph-canvas, .knowledge-detail,
  .practice-settings-panel, .practice-question-main, .practice-board, .practice-tutor-panel,
  .mistake-book, .mistake-analysis,
  .training-steps, .training-answer, .training-coach, .training-gain,
  .planner-setup, .planner-main, .planner-right > section, .today-plan,
  .report-nav, .report-metrics article, .mastery-chart, .error-donut,
  .report-weak, .report-example, .note-suggestions,
  .tutor-profile, .tutor-conversation, .tutor-side-panel,
  .exam-paper, .exam-side, .exam-setup, .exam-report,
  .exam-report-section, .exam-chart-card
) {
  border-color: rgba(133, 146, 255, .74);
  background-color: rgba(9, 22, 56, .88);
  box-shadow: inset 0 0 0 1px rgba(160, 177, 255, .13),
              0 0 27px rgba(82, 95, 241, .25),
              0 16px 35px rgba(1, 4, 21, .30);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .24s ease, box-shadow .24s ease, background-color .24s ease;
}

body[data-studyhub-view]:not([data-studyhub-view="home"]) :is(
  .library-table-card, .library-overview, .library-recent,
  .video-results, .video-player, .video-focus,
  .lecture-recorder-card, .lecture-output-preview,
  .master-diagnosis, .graph-canvas, .knowledge-detail,
  .practice-settings-panel, .practice-question-main, .practice-board, .practice-tutor-panel,
  .mistake-book, .mistake-analysis,
  .training-answer, .training-coach,
  .planner-setup, .planner-main, .planner-right > section,
  .mastery-chart, .error-donut, .report-weak, .report-example, .note-suggestions,
  .tutor-profile, .tutor-conversation, .exam-paper, .exam-side
):hover {
  border-color: rgba(176, 169, 255, .88);
  box-shadow: inset 0 0 0 1px rgba(182, 190, 255, .12),
              0 0 34px rgba(94, 93, 255, .33),
              0 18px 38px rgba(1, 4, 21, .31);
}

/* Existing artwork on feature banners and colorful callouts is intentional. */
body[data-studyhub-view="knowledge"] .master-library-hero,
body[data-studyhub-view="planner"] .planner-hero,
body[data-studyhub-view="report"] .report-ai,
body[data-studyhub-view="tutor"] .tutor-classroom-stage {
  box-shadow: inset 0 0 0 1px rgba(154, 169, 255, .17),
              0 0 30px rgba(99, 83, 255, .25),
              0 16px 36px rgba(1, 4, 21, .30);
}

/* The Live2D host is transparent so the figure can sit directly in the room.
   Blurring this host produces a visible rectangular patch over the chalkboard. */
body[data-studyhub-view="tutor"] .classroom-avatar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body[data-studyhub-view="tutor"] .classroom-avatar .tutor-avatar-stage[data-avatar-state="loading"] .tutor-avatar-fallback {
  opacity: 0;
}

@media (max-width: 1180px) {
  body[data-studyhub-view]:not([data-studyhub-view="home"]) .workspace::before {
    left: 78px;
  }
}

@media (max-width: 860px) {
  body[data-studyhub-view]:not([data-studyhub-view="home"]) .workspace::before {
    left: 0;
    background-position: center, center, 65% center;
  }
}

@media (prefers-reduced-transparency: reduce) {
  body[data-studyhub-view]:not([data-studyhub-view="home"]) :is(
    .library-table-card, .library-overview, .library-recent,
    .lecture-recorder-card, .lecture-output-preview,
    .master-diagnosis, .graph-canvas, .knowledge-detail,
    .practice-settings-panel, .practice-question-main, .practice-board, .practice-tutor-panel,
    .mistake-book, .mistake-analysis, .training-answer, .training-coach,
    .planner-setup, .planner-main, .planner-right > section,
    .tutor-profile, .tutor-conversation, .exam-paper, .exam-side
  ) {
    background-color: #0d1b40;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-studyhub-view]:not([data-studyhub-view="home"]) :is(
    .library-table-card, .library-overview, .library-recent,
    .lecture-recorder-card, .lecture-output-preview,
    .master-diagnosis, .graph-canvas, .knowledge-detail,
    .practice-settings-panel, .practice-question-main, .practice-tutor-panel,
    .mistake-book, .mistake-analysis, .training-answer, .training-coach,
    .planner-setup, .planner-main, .planner-right > section,
    .tutor-profile, .tutor-conversation, .exam-paper, .exam-side
  ) { transition: none; }
}

@media print {
  body[data-studyhub-view] .workspace::before { display: none; }
  body[data-studyhub-view] .workspace :is(article, section, aside) {
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
}
