@media (max-width: 1440px) {
  .workbench {
    grid-template-columns: 384px minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .studio {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  .workbench {
    grid-template-columns: 352px minmax(0, 1fr);
  }

  .compose {
    padding: 18px 18px 0 20px;
  }

  .shell-search {
    width: 160px;
  }

  .history-row {
    grid-template-columns: 64px minmax(130px, 1fr) 140px minmax(140px, 1fr) 180px;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .app-header {
    gap: 10px;
  }

  .shell-brand {
    padding: 0 12px;
  }

  .shell-nav {
    gap: 2px;
  }

  .shell-nav > a {
    padding: 0 10px;
  }

  .sandbox-state {
    display: none;
  }

  .studio {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-columns: minmax(0, 1fr);
  }

  .studio-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-brand {
    display: none;
  }

  .side-nav {
    display: flex;
    flex: 1;
    gap: 6px;
    overflow-x: auto;
  }

  .side-nav button {
    width: auto;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .side-nav button[aria-selected="true"]::before,
  .side-eyebrow {
    display: none;
  }

  .side-nav button svg {
    width: 28px;
    height: 28px;
    padding: 6px;
  }

  .side-nav-text small,
  .side-nav button em,
  .shell-search {
    display: none;
  }

  .side-foot {
    display: flex;
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* 单列时用 minmax(0, 1fr)：否则结果区工具条的最小内容宽会把整个工作台撑出屏幕 */
  .workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .results,
  .results-head,
  .results-status,
  .results-tools {
    min-width: 0;
  }

  .results-status,
  .results-tools {
    flex-wrap: wrap;
  }

  .compose {
    padding: 16px 16px 0;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .compose-footer {
    position: static;
    margin: 0 -16px;
    padding: 12px 16px;
    box-shadow: none;
  }

  .results {
    min-height: 560px;
    padding: 16px;
  }

  .stage-frame,
  .stage-frame img,
  .stage-frame video {
    max-height: 70vh;
  }

  .page-main {
    padding-right: 24px;
    padding-left: 24px;
  }

  .landing {
    padding: calc(var(--header-height) + 32px) 20px 56px;
  }

  .hero {
    gap: 28px;
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 34px;
  }

  /* 窄屏：藏掉“说明”列，保留缩略图 / 模型 / 规格 / 动作 */
  .history-row {
    grid-template-columns: 64px minmax(140px, 1fr) 150px 170px;
  }

  .history-row > p {
    display: none;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 100px;
    --rail-width: 0px;
  }

  .app-header {
    height: var(--header-height);
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0 8px;
    padding-right: 10px;
  }

  .shell-brand {
    height: 56px;
    padding: 0 12px;
  }

  .shell-account {
    height: 56px;
  }

  .shell-nav {
    order: 3;
    width: 100%;
    height: 44px;
    gap: 0;
    padding: 0 8px;
    overflow-x: auto;
    border-top: 1px solid var(--line);
  }

  /* 只作用于顶栏直接子链接，不能漏到下拉菜单里的链接（否则下拉项被居中、缩小） */
  .shell-nav > a {
    min-width: max-content;
    min-height: 30px;
    flex: 1;
    justify-content: center;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 11px;
  }

  /* 手机端顶栏是横向滚动条（overflow-x:auto 会把纵向溢出一起裁掉），
     创意中心 / 更多 的下拉改为固定定位挂在顶栏正下方、撑满宽度，不再被裁看不见 */
  .shell-nav .nav-menu > .nav-dropdown {
    position: fixed;
    top: calc(var(--header-height) + 6px);
    right: 8px;
    left: 8px;
    min-width: 0;
    max-height: calc(100vh - var(--header-height) - 16px);
    overflow-y: auto;
  }

  .account-dot {
    display: none;
  }

  .studio,
  .page-main,
  .shell-footer {
    margin-left: 0;
  }

  .mode-actions {
    display: none;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .stage-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-picker {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .picker-head {
    flex-wrap: wrap;
  }

  .picker-search {
    order: 3;
    flex-basis: 100%;
  }

  .page-main {
    padding: calc(var(--header-height) + 28px) 16px 44px;
  }

  .shell-footer {
    padding: 18px 16px 26px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 26px;
  }

  .history-summary,
  .wallet-grid {
    grid-template-columns: 1fr;
  }

  .history-summary article,
  .wallet-grid article {
    min-height: 90px;
  }

  .history-panel > header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  /* 手机：缩略图 + 其余信息两列，动作行铺满 */
  .history-row {
    align-items: flex-start;
    grid-template-columns: 64px 1fr;
  }

  .history-row > p {
    display: block;
    grid-column: 2;
  }

  .history-row > div:last-child {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .account-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .wallet-pill {
    padding: 0 8px;
  }

  .shell-brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 22px;
    height: 22px;
  }

  .brand-mark::after {
    inset: 6px;
  }

  .compose {
    padding: 14px 12px 0;
  }

  /* 吸底栏的出血边距跟随 compose 的内边距，否则多出的几像素会撑出横向滚动 */
  .compose-footer {
    margin: 0 -12px;
    padding: 12px;
  }

  .results-meta {
    display: none;
  }

  .hero-tiles {
    grid-template-columns: 1fr;
  }

  .hero-tile {
    min-height: 140px;
  }

  .section-head h2,
  .closing h2 {
    font-size: 22px;
  }

  .ratio-row {
    gap: 6px;
  }

  .empty-result h3 {
    font-size: 20px;
  }
}
