@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .rightbar {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  /* topbar scrolls away on mobile so the sticky school strip can pin to the top */
  .topbar {
    position: static;
    padding: 10px 12px;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand span {
    white-space: normal;
  }

  .topbar-right {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .mode-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mode-tabs::-webkit-scrollbar {
    display: none;
  }

  .layout {
    display: block;
    width: calc(100vw - 24px);
    margin-top: 0;
  }

  .rightbar {
    position: static;
    max-height: none;
    grid-template-columns: 1fr;
  }

  /*院校目录 → 顶部 sticky 横向条，一点切换，首屏立即见真题 */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 16;
    margin: 8px 0 14px;
    padding: 8px 10px;
    max-height: none;
    overflow: visible;
    border-radius: 14px;
    background: rgba(247, 241, 228, 0.96);
    box-shadow: 0 6px 16px rgba(49, 45, 33, 0.1);
  }

  .side-title {
    display: none;
  }

  .school-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .school-list::-webkit-scrollbar {
    display: none;
  }

  .school-btn {
    flex: 0 0 auto;
    width: auto;
    grid-template-columns: 28px auto;
    gap: 7px;
    padding: 6px 12px 6px 7px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 240, 0.7);
  }

  .school-btn.is-active {
    border-color: transparent;
    background: var(--green);
  }

  .school-btn.is-active .school-chip {
    color: #fff9ed;
  }

  .school-btn .logo {
    width: 28px;
    height: 28px;
  }

  .school-btn .school-full,
  .school-btn em {
    display: none;
  }

  .school-btn .school-chip {
    display: block;
    font-size: 13px;
    white-space: nowrap;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .paper-grid {
    grid-template-columns: 1fr;
  }

  .reader {
    width: calc(100vw - 12px);
    max-height: 94dvh;
    border-radius: 16px;
  }

  .reader-shell {
    max-height: 94dvh;
  }

  .reader-shell > article {
    padding: 16px 14px 48px;
  }

  .reader-tabs > span,
  .reader-tab-actions span {
    display: none;
  }

  .reader-tabs {
    margin-bottom: 12px;
  }

  .solution-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    top: 124px;
    gap: 7px;
    margin-inline: -4px;
    padding: 7px;
    border-radius: 12px;
  }

  .solution-nav-meta {
    display: none;
  }

  .solution-toolbar-actions {
    gap: 4px;
  }

  .solution-toolbar-actions button {
    min-height: 30px;
    padding: 0 7px;
    font-size: 11px;
  }

  .solution-question-nav button {
    min-width: 30px;
    min-height: 30px;
    padding: 0 7px;
  }

  .solution-question {
    gap: 12px;
    padding: 14px;
    scroll-margin-top: 178px;
  }

  .solution-question-head {
    align-items: flex-start;
  }

  .solution-question-text {
    padding: 11px 12px;
  }

  .solution-work summary small {
    display: none;
  }

  .solution-work-body {
    padding-inline: 12px;
  }

  .solution-exam-link {
    width: 100%;
    min-height: 44px;
    justify-self: stretch;
  }

  .reader.is-fullscreen,
  .reader.is-fullscreen .reader-shell {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

  .reader.is-fullscreen .reader-shell > article {
    width: 100%;
    padding: 18px 14px 64px;
  }

  .reader.is-fullscreen .reader-content {
    font-size: 16px;
    line-height: 1.85;
  }

  .reader-head .reader-fullscreen {
    min-width: 42px;
    padding: 0 10px;
  }

  .reader-head .reader-fullscreen span:last-child {
    display: none;
  }

  .heatmap-grid {
    grid-template-columns: minmax(128px, 160px) repeat(var(--year-count), minmax(50px, 1fr));
  }
}

/* ---- Motion: hover transitions + entrance animations ---- */
.mode-tabs button,
.toolbar-actions button,
.next-list button,
.chips button,
.school-btn,
.paper-card,
.paper-actions button,
.heatmap-topic,
.heatmap-cell,
.reader-head button,
.search {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.22s ease,
    transform 0.18s ease;
}

.paper-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(56, 50, 35, 0.16);
}

.school-btn:hover,
.heatmap-topic:hover {
  transform: translateX(2px);
}

.heatmap-topic:hover,
.heatmap-cell:hover {
  background: rgba(255, 250, 240, 0.92);
}

.chips button:active,
.mode-tabs button:active,
.toolbar-actions button:active,
.paper-actions button:active,
.next-list button:active {
  transform: translateY(1px);
}

.reader-head button:hover {
  background: rgba(201, 91, 79, 0.14);
}

.search:focus-within {
  border-color: rgba(47, 103, 88, 0.45);
  box-shadow: 0 0 0 3px rgba(47, 103, 88, 0.12);
}

/* cards fade in when the wall re-renders (opacity only, so :hover transform still works) */
.paper-card {
  animation: cardIn 0.24s ease both;
}

@keyframes cardIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* reader modal + backdrop ease in */
.reader[open] {
  animation: readerIn 0.24s ease;
}

@keyframes readerIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.reader[open]::backdrop {
  animation: backdropIn 0.24s ease;
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 2026-07 canonical wall usability pass ---- */
:root {
  --muted: #5f7066;
  --red: #b6473f;
}

.brand-short,
.practice-cta-mobile {
  display: none;
}

.paper-card mark,
.hero-panel mark {
  padding: 0 0.08em;
  border-radius: 0.2em;
  color: inherit;
  background: rgba(225, 179, 74, 0.34);
}

.paper-title,
.paper-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.paper-title {
  -webkit-line-clamp: 2;
}

.paper-preview {
  -webkit-line-clamp: 3;
}

.topic-more {
  cursor: help;
}

.empty-search {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.empty-search strong {
  color: var(--ink);
  font-size: 17px;
}

.empty-search p {
  margin: 0;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-actions button,
.practice-cta-mobile {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--green);
  background: rgba(255, 250, 240, 0.9);
  font-weight: 800;
  text-decoration: none;
}

.topic-bars {
  position: relative;
  background:
    linear-gradient(90deg, rgba(250, 246, 235, 0.96), transparent 18px) left / 22px 100% no-repeat,
    linear-gradient(270deg, rgba(250, 246, 235, 0.96), transparent 18px) right / 22px 100% no-repeat;
}

.heatmap-corner,
.heatmap-topic {
  position: sticky;
  left: 0;
}

.heatmap-corner {
  z-index: 4;
  align-self: stretch;
  display: flex;
  align-items: center;
  background: #f7f1e4;
}

.heatmap-topic {
  z-index: 3;
  box-shadow: 8px 0 12px -12px rgba(31, 54, 45, 0.7);
}

.reader-pane,
.solution-view,
.reader-content {
  width: 100%;
  min-width: 0;
}

.site-announcement[open] {
  position: fixed;
  inset: 92px 20px auto auto;
  width: min(520px, calc(100vw - 40px));
  max-width: none;
  margin: 0;
  z-index: 80;
}

.site-announcement::backdrop {
  background: transparent;
  backdrop-filter: none;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(260px, 1fr) auto;
  }

  .topbar .search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .topbar-right {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}

@media (max-width: 900px) and (min-width: 761px) {
  .layout {
    display: block;
    width: calc(100vw - 32px);
    margin-top: 14px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 16;
    margin: 0 0 14px;
    padding: 8px 10px;
    max-height: none;
    overflow: visible;
    border-radius: 14px;
    background: rgba(247, 241, 228, 0.96);
    box-shadow: 0 6px 16px rgba(49, 45, 33, 0.1);
  }

  .side-title {
    display: none;
  }

  .school-list {
    display: flex;
    flex-flow: row nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .school-list::-webkit-scrollbar {
    display: none;
  }

  .school-btn {
    flex: 0 0 auto;
    width: auto;
    grid-template-columns: 30px auto;
    gap: 7px;
    min-height: 46px;
    padding: 7px 12px 7px 7px;
  }

  .school-btn .logo {
    width: 30px;
    height: 30px;
  }

  .school-btn .school-full,
  .school-btn em {
    display: none;
  }

  .school-btn .school-chip {
    display: block;
    white-space: nowrap;
  }

  .paper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-seal {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 14px;
  }

  .brand-long,
  .brand > div > span,
  .practice-cta {
    display: none;
  }

  .brand-short {
    display: block;
    font-size: 16px;
    white-space: nowrap;
  }

  .topbar .search {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 46px;
    padding-block: 0;
  }

  .topbar .search input {
    height: 44px;
  }

  .topbar-right {
    grid-column: 2;
    grid-row: 1;
    flex-wrap: nowrap;
    justify-self: end;
  }

  .mode-tabs {
    gap: 2px;
    padding: 2px;
    border-radius: 13px;
  }

  .mode-tabs button,
  .mode-tabs .tab-link {
    min-width: 64px;
    height: 44px;
    padding-inline: 9px;
    font-size: 13px;
  }

  .hero-topic-chip {
    min-height: 44px;
  }

  .content {
    min-width: 0;
  }

  .hero-panel {
    padding: 14px;
  }

  .hero-seal {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }

  .hero-title h1 {
    font-size: 24px;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 0 5px;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chips button {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .toolbar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar-actions button,
  .practice-cta-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 13px;
  }

  .paper-grid {
    gap: 10px;
  }

  .paper-card {
    min-height: 0;
    padding: 62px 12px 12px;
  }

  .paper-meta {
    margin: 9px 0;
  }

  .topic-pill {
    min-height: 44px;
    padding: 7px 10px;
  }

  .paper-actions button {
    min-height: 44px;
  }

  .site-announcement[open] {
    inset: 8px 8px auto;
    width: auto;
  }

  .export-dialog[open] {
    inset: 8px 8px auto;
    width: auto;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }

  .export-dialog-panel > header,
  .export-dialog-panel > footer,
  .export-dialog-body {
    padding: 14px;
  }

  .export-dialog-body label {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .export-dialog-panel > footer button {
    min-height: 44px;
  }

  .reader:not(.is-fullscreen) {
    width: calc(100vw - 8px);
    max-height: calc(100dvh - 8px);
    margin: 4px;
    border-radius: 14px;
  }

  .reader:not(.is-fullscreen) .reader-shell {
    max-height: calc(100dvh - 8px);
  }

  .reader-head {
    min-height: 58px;
    padding: 8px 10px;
  }

  .reader-school img {
    width: 34px;
    height: 34px;
  }

  .reader-head button,
  .reader-head .reader-fullscreen {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .reader-tabs {
    top: 58px;
    min-height: 50px;
    padding-block: 5px 7px;
  }

  .reader-tabs button {
    min-height: 44px;
  }

  .solution-toolbar {
    top: 108px;
    margin-inline: 0;
  }

  .solution-toolbar-actions button,
  .solution-question-nav button {
    min-width: 44px;
    min-height: 44px;
    font-size: 12px;
  }

  .solution-work summary {
    min-height: 44px;
  }

  .solution-question {
    scroll-margin-top: 164px;
  }

  .reader-shell > article,
  .reader.is-fullscreen .reader-shell > article {
    padding-inline: 12px;
  }

  .heatmap-grid {
    grid-template-columns: minmax(132px, 148px) repeat(var(--year-count), minmax(54px, 1fr));
  }
}
