.mobile-history-toolbar,
.mobile-task-pagination {
  display: none;
}

@media (max-width: 760px) {
  body {
    background: #f3f6f5;
  }

  .app {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .sidebar {
    height: 58px;
    padding: 9px 12px;
    background: #ffffff;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

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

  .brand span {
    font-size: 9px;
  }

  .sidebar-actions .icon-action {
    width: 40px;
    min-height: 40px;
  }

  main {
    padding: 12px 10px 22px;
  }

  .topbar {
    display: none;
  }

  nav[aria-label="主导航"] {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }

  .nav-item {
    min-height: 46px;
  }

  #create {
    padding: 15px;
  }

  #create > .panel-head {
    margin-bottom: 13px;
    padding-bottom: 13px;
  }

  #create .task-form {
    gap: 10px;
  }

  #create .form-section {
    gap: 12px;
    padding: 13px;
  }

  #create .matching-grid {
    gap: 10px;
  }

  #create .matching-card {
    padding: 12px;
  }

  #create .label-row {
    gap: 8px;
  }

  #create .form-hint {
    line-height: 1.55;
  }

  #history .history-layout {
    display: block;
  }

  #history .history-list-panel,
  #history .history-detail-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #history .history-list-panel > .panel-head {
    margin: 0;
    padding: 4px 3px 11px;
    border: 0;
  }

  #history .history-list-panel > .panel-head h2 {
    font-size: 20px;
    line-height: 1.25;
  }

  #history .history-list-panel > .panel-head p {
    display: none;
  }

  .mobile-history-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 9px;
    padding: 8px 9px;
    border: 1px solid #dce5e2;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    color: #66736f;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(24, 33, 31, 0.05);
  }

  .mobile-history-toolbar > span b,
  .mobile-task-pagination b {
    color: #18211f;
  }

  .mobile-task-pagination {
    position: static;
    inset: auto;
    z-index: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-task-pagination .icon-action {
    width: 32px;
    min-height: 32px;
    border: 1px solid #dce5e2;
    background: #ffffff;
    color: #087565;
  }

  .mobile-task-pagination .icon-action:disabled {
    opacity: 0.35;
  }

  #history .task-list {
    gap: 7px;
  }

  #history .task-card {
    min-height: 78px;
    padding: 11px 12px;
    border-color: #dfe5e2;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: none;
  }

  #history .task-card.active {
    border-color: #74b3a7;
    background: #f8fcfb;
    box-shadow: inset 3px 0 0 #087565;
  }

  #history .task-title-row h3 {
    max-width: min(235px, 62vw);
    font-size: 14px;
    line-height: 1.35;
  }

  #history .task-card-meta {
    margin-top: 7px;
  }

  #history .platform-badge,
  #history .status-pill {
    min-height: 22px;
    padding: 0 7px;
    font-size: 10px;
  }

  #history .result-count {
    flex-basis: 48px;
  }

  #history .result-count b {
    font-size: 18px;
  }

  #history .result-count small {
    font-size: 9px;
  }

  #history .task-pagination {
    display: none;
  }

  #history .mobile-back {
    min-height: 34px;
    margin: 0 0 10px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: #087565;
  }

  #history .detail-head {
    gap: 14px;
    margin-bottom: 12px;
    padding: 15px 14px;
    border: 1px solid #dfe5e2;
    border-radius: 8px;
    background: #ffffff;
  }

  #history .detail-title-line {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 6px;
  }

  #history .detail-title-line h2 {
    grid-column: 1 / -1;
    font-size: 18px;
    line-height: 1.35;
  }

  #history .detail-head > div > p:last-child {
    margin-top: 8px;
    font-size: 11px;
  }

  #history .detail-actions {
    display: grid;
    grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
    gap: 7px;
  }

  #history .detail-actions button {
    min-height: 40px;
    font-size: 12px;
  }

  #history .detail-actions button:last-child {
    grid-column: 2;
    grid-row: 1;
    min-height: 44px;
  }

  #history .detail-actions .danger-button {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
  }

  #history .screening-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 0 0 12px;
  }

  #history .screening-summary > div {
    min-height: 60px;
    padding: 8px 9px;
    background: #ffffff;
  }

  #history .empty {
    min-height: 116px;
    padding: 24px 18px;
    border-radius: 8px;
    background: #ffffff;
    line-height: 1.65;
  }

  #history .sub-panel {
    margin-top: 10px;
    padding: 13px;
    border-color: #dfe5e2;
    background: #ffffff;
  }

  #history .sub-panel-head {
    gap: 8px;
    padding-bottom: 10px;
  }

  #history .sub-panel-head p {
    font-size: 11px;
  }

  #history .table-toolbar {
    margin-bottom: 9px;
    padding: 10px;
  }

  #history .result-table tbody {
    gap: 9px;
  }

  #history .result-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    border-radius: 8px;
    background: #ffffff;
  }

  #history .result-table td,
  #history .result-table td:nth-child(1),
  #history .result-table td:nth-child(2),
  #history .result-table td:nth-child(3),
  #history .result-table td:nth-child(4),
  #history .result-table td:nth-child(5),
  #history .result-table td:nth-child(6),
  #history .result-table td:nth-child(7),
  #history .result-table td:nth-child(8),
  #history .result-table td:nth-child(9) {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  #history .result-song-cell {
    min-width: 0;
    padding: 13px 44px 11px 13px !important;
  }

  #history .result-song-cell > strong {
    width: 100%;
    overflow-wrap: anywhere;
  }

  #history .result-song-cell a,
  #history .whitelist-item .link {
    display: none !important;
  }

  #history .result-match-cell {
    width: 100%;
    padding: 10px 13px !important;
    border-top: 1px solid #edf1ef;
    background: #fbfcfc;
  }

  #history .result-match-cell::before {
    margin-bottom: 6px;
  }

  #history .hit-line {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    line-height: 1.55;
  }

  #history .result-action-cell {
    display: flex;
    width: 100%;
    padding: 10px 13px 12px !important;
    border-top: 1px solid #edf1ef;
  }

  #history .result-action-cell button {
    width: 100%;
    min-height: 38px;
  }
}

@media (max-width: 360px) {
  .brand span {
    display: none;
  }

  .mobile-history-toolbar {
    padding: 7px;
  }

  .mobile-history-toolbar > span {
    display: none;
  }

  .mobile-task-pagination {
    width: 100%;
    justify-content: space-between;
  }

  #create {
    padding: 12px;
  }

  #create .form-section,
  #create .matching-card {
    padding: 11px;
  }

  #create .label-row .compact {
    padding-inline: 9px;
  }
}
