/* Phone layout only; desktop and PDF retain their existing presentation. */
.attribute-methodology { margin: 12px 0; font-size: 13px; color: var(--muted); }
.attribute-methodology summary { padding: 10px 0; }
@media screen and (max-width: 680px) {
  #recent-analyses .entry-heading > p { display: none; }
  main { padding: 20px 16px 40px; }
  .workbench-shell { min-height: 100dvh; }
  .workbench-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--line);
  }
  .workbench-sidebar .sidebar-brand { margin: 0; padding: 0; align-self: center; }
  .workbench-sidebar .account-controls { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; }
  .account-summary { min-height: 44px; padding: 4px 8px; }
  #account-name { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  #logout-confirm { top: calc(100% + 8px); right: 0; bottom: auto; left: auto; }
  .workbench-sidebar > nav { grid-column: 1 / -1; min-width: 0; overflow-x: auto; padding: 2px 0; }
  .workspace-nav-link { flex: none; min-height: 44px; padding: 10px 12px; font-size: 13px; white-space: nowrap; gap: 6px; }
  .workspace-nav-link svg { flex: none; }
  .recent-nav-heading { flex: none; margin: 0; }
  .recent-nav-heading .workspace-nav-link { padding-right: 12px; }
  /* The full history remains available through the 最近研究 navigation link. */
  #sidebar-research-history, #toggle-research-history { display: none; }
  .workbench-content { padding: 24px 16px 36px; }
  .workspace-breadcrumb { font-size: 21px; margin-bottom: 16px; }
  .workspace-map { grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 8px 0 12px; overflow: hidden; }
  .workspace-map picture { display: block; min-width: 0; }
  .workspace-map img { width: 100%; height: auto; aspect-ratio: 50 / 17; object-fit: fill; margin: 0; }
  .workspace-map .map-legend { display: flex; justify-content: center; gap: 20px; padding: 0; font-size: 11px; }
  .research-card { padding: 20px 16px; }
  .research-card .keyword-label-row .field-hint, .research-card label span { font-size: 12px; }
  .research-card label { font-size: 14px; }
  .keyword-examples { gap: 2px 4px; }
  .keyword-examples > span { font-size: 12px; }
  .keyword-examples button { min-height: 44px; font-size: 12px; padding: 8px; }
  .research-card .form-bottom { padding-top: 4px; }
  .research-card .form-bottom .primary-button { min-height: 48px; justify-content: center; font-size: 16px; }
  .guide-card { padding: 18px 16px 0; }
  .guide-card h2 { margin: 0 0 16px; }
  .research-questions li { padding-bottom: 16px; }
  .research-questions h3 { font-size: 14px; }
  .research-questions p { font-size: 13px; }
  .workspace-references > summary { flex-wrap: wrap; gap: 8px; min-height: 44px; }
  .workspace-references .market-trends { padding: 0 12px 16px; }
  .trends-heading { flex-wrap: wrap; }
  .trends-heading h2, .trends-table-title { font-size: 20px; }
  .trends-table-title { font-family: inherit; letter-spacing: 0; }
  .market-insight-card { padding: 18px 14px; }
  .trends-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
  .trend-keywords { display: block; width: 100%; min-width: 0; }
  .trend-keywords > caption { display: block; text-align: left; padding: 4px 0 8px; }
  .trend-keywords > thead { display: none; }
  .trend-keywords > tbody { display: block; }
  .trend-keywords > tbody > tr:not(.trend-detail) {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0 8px; padding: 10px 12px; margin-top: 8px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff;
  }
  .trend-keywords > tbody > tr > td {
    display: block; grid-column: span 2; width: auto; min-width: 0; padding: 5px 0;
    border: 0; text-align: left; font-size: 15px; line-height: 1.4;
  }
  .trend-keywords > tbody > tr > td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
  .trend-keywords > tbody > tr > td:first-child { width: auto; grid-column: 1 / -1; padding: 0; order: -3; }
  .trend-keywords > tbody > tr > td:first-child::before { display: none; }
  .trend-keywords > tbody > tr > td:nth-child(2) { grid-column: 1 / -1; order: -2; text-align: left; padding: 8px 0; }
  .trend-keywords > tbody > tr > td:nth-child(3) { grid-column: 1 / -1; order: -1; text-align: left; padding: 4px 0 6px; }
  .trend-keywords > tbody > tr > td:nth-child(3):not(:has(.trend-tag)) { display: none; }
  .trend-keywords > tbody > tr > td:nth-child(3)::before { display: none; }
  .trend-keywords > tbody > tr > td:nth-child(4) { grid-column: span 4; }
  .trend-keywords .trend-keyword-button { min-height: 44px; padding: 0; font-size: 18px; line-height: 1.4; }
  .trend-keywords .trend-research-button { font-size: 12px; }
  .trend-keywords .trend-tag { display: inline-block; margin: 0 6px 4px 0; font-size: 11px; }
  .trend-keywords .trend-secondary { margin-top: 0; font-size: 12px; line-height: 1.5; }
  .trend-keywords .trend-rank-change { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 2px; font-size: 12px; line-height: 1.6; }
  .trend-keywords progress { margin: 5px 0 0; }
  .trend-keywords > tbody > .trend-detail:not([hidden]) { display: block; }
  .trend-keywords > tbody > .trend-detail > td { padding: 12px; border-radius: 0 0 12px 12px; }
  .trend-products, .trend-products caption, .trend-products tbody { display: block; width: 100%; }
  .trend-products thead { display: none; }
  .trend-products tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 8px; border-bottom: 1px solid var(--line); }
  .trend-products th, .trend-products td, .trend-products td:first-child { display: block; width: auto; border: 0; padding: 0; text-align: left; }
  .trend-products td:nth-child(3)::before { content: '转化率 '; color: var(--muted); }
  .trend-products td:nth-child(4)::before { content: '点击集中度 '; color: var(--muted); }
  .trend-products td:last-child { grid-column: 1 / -1; }
  .trend-products .trend-thumbnail { margin-left: 0; }
  .trend-products-dialog {
    position: fixed; inset: auto 0 0; margin: 0 auto;
    width: 100%; max-width: 680px; max-height: 85dvh;
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
    border: 0; border-radius: 16px 16px 0 0;
    background: white; color: var(--ink);
  }
  .trend-products-dialog::backdrop { background: #172c4670; }
  body:has(.trend-products-dialog[open]) { overflow: hidden; }
  .trend-dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: white; border-bottom: 1px solid var(--line); }
  .trend-dialog-header h2 { flex: 1; min-width: 0; margin: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
  .trend-dialog-close { flex: none; min-width: 52px; min-height: 44px; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
  .trend-products-dialog .trend-products { border: 0; }
  .trend-products-dialog caption { display: none; }
  .trend-products-dialog .trend-products tbody tr { grid-template-columns: 64px minmax(0, 1fr); padding: 12px 0; gap: 4px 12px; }
  .trend-products-dialog .trend-products td:first-child { grid-column: 2; font-weight: 600; font-size: 14px; }
  .trend-products-dialog .trend-products td:nth-child(2) { grid-column: 1; grid-row: 1 / span 4; }
  .trend-products-dialog .trend-products td:nth-child(n+3) { grid-column: 2; font-size: 12px; }
  .trend-products-dialog .trend-product-link { min-height: 44px; padding: 10px 0; }
  .history-panel { padding: 16px; }

  .site-header { min-height: 64px; padding: 12px 16px; }
  .brand { gap: 8px; flex-wrap: wrap; }
  .brand-subtitle { font-size: 12px; }
  .report-layout { gap: 20px; }
  .report-content { min-width: 0; }
  .product-history-row .product-trend-control { grid-column: 1; align-self: end; }
  .product-history-row .product-card-sales,
  .product-history-row .product-card .field-hint,
  .product-history-row .product-card-rank { font-size: 10px; }
  .product-history-row .product-card-sales strong { font-size: 13px; }
  .product-history-row .product-trend-badge { font-size: 9px; padding: 3px 6px; white-space: nowrap; }
  .product-history-row .product-card a { grid-column: 2; grid-row: 5; justify-self: end; align-self: end; font-size: 9px; padding: 0; }
  .report-toc { position: sticky; top: 0; z-index: 20; background: #fff; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .report-toc-heading { margin: 0 0 4px; padding: 0; font-size: 11px; }
  .report-toc ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 4px; padding: 0; overflow: visible; }
  .report-toc a { font-size: 12px; padding: 8px; min-height: 40px; white-space: normal; border-radius: 6px; }
  .report-content > section, .report-content > article { scroll-margin-top: 190px; }
  .result-heading { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 24px; }
  .result-heading h1 { font-size: 28px; }
  .report-actions { width: 100%; }
  .report-action { flex: 1; }
  .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 28px; }
  .metric-card, .metric-card:first-child { padding: 12px 8px; }
  .metric-card:nth-child(-n+2) { grid-column: span 3; }
  .metric-card:nth-child(n+3) { grid-column: span 2; }
  .metric-card:nth-child(n) { border-right: 0; }
  .metric-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric-card strong { margin: 10px 0 6px; }
  .metric-card:nth-child(2) strong, #unit-profit { white-space: normal; overflow-wrap: anywhere; }
  .metric-card:nth-child(n+3) > span, .metric-card:nth-child(n+3) small { font-size: 11px; }
  .metric-card:nth-child(n+3) strong { font-size: 18px; }
  #unit-profit { flex-wrap: wrap; gap: 4px; font-size: 18px; }
  #unit-profit .profit-cny { font-size: 10px; white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
  .report-heading { flex-wrap: wrap; }
  .profit-chart, .demand-chart-scroll, .fee-table-scroll { max-width: 100%; overscroll-behavior-x: contain; }
  .demand-chart-scroll::before, .fee-table-scroll::before {
    content: "左右滑动查看完整数据";
    display: block; position: sticky; left: 0; width: fit-content;
    padding: 8px 12px; font-size: 12px; color: var(--muted);
  }
  .high-match-summary, .unit-profit-summary { padding: 16px; font-size: 14px; overflow-wrap: anywhere; }
  .unit-profit-summary .unit-profit-label { font-size: 12px; }
  .demand-conclusions p, #sales-summary,
  #supplier-analysis-points li { font-size: 12px; line-height: 1.65; }
  .sales-insight-label { font-size: 11px; }
  .next-actions-content .next-action-conclusion { font-size: 14px; line-height: 1.5; }
  .next-action-evidence, .next-action-advice,
  .next-action-research p, .next-action-keywords > li { font-size: 12px; }
  .next-actions-content .next-action-advice-title,
  .next-action-research h3 { font-size: 13px; }
  .next-action-growth span { font-size: 11px; }
  .next-action-growth strong { font-size: 16px; }
  #profit-chart { overflow: visible; }
  #profit-chart > svg { display: none; }
  .price-comparison-mobile { display: block; padding: 12px; }
  .price-comparison-row + .price-comparison-row { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
  .price-comparison-spec { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; margin-bottom: 8px; }
  .price-comparison-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .price-comparison-products .price-point-card { height: auto; padding: 8px; display: block; }
  .price-comparison-products .price-point-image { float: right; width: 36px; height: 36px; margin: 0 0 4px 4px; }
  .price-comparison-products .price-point-image img { width: 36px; height: 36px; }
  .price-comparison-products .price-point-card span { font-size: 11px; }
  .price-comparison-products .price-point-card a { clear: both; display: block; -webkit-line-clamp: unset; overflow: visible; overflow-wrap: anywhere; font-size: 11px; line-height: 1.45; min-height: 44px; }
  .price-comparison-products .price-point-card strong { font-size: 14px; }
  .price-comparison-products .price-point-sales, .profit-legend { display: none; }
  .price-comparison-summary { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--ink); }
  #waiting-view .state-card { padding: 20px 16px; }
  .state-card h1 { font-size: 26px; }
  .waiting-expectation { padding: 16px; }
  .waiting-home { min-height: 44px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #auth-dialog, #credits-dialog { padding: 28px 20px 20px; max-height: calc(100dvh - 32px); overflow-y: auto; }
  #auth-form input, input:not([type="checkbox"]):not([type="radio"]), select { font-size: 16px; }
  #auth-send { min-height: 44px; }
  footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .demand-chart-scroll { display: none; }
  .mobile-demand { display: block; margin-top: 16px; }
  .mobile-trend-month { font-size: 11px; color: var(--muted); }
  .mobile-trend-hit { cursor: pointer; }
  .mobile-trend-hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 1; }
  .mobile-trend-series { padding: 12px 8px 4px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .mobile-trend-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px; font-size: 14px; }
  .mobile-trend-heading strong { font-size: 18px; }
  .mobile-trend-series svg { display: block; width: 100%; height: auto; }
  .mobile-demand > p { margin: 8px 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
  #attribute-chart .attribute-filters > span { display: none; }
  #attribute-chart .attribute-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px; }
  #attribute-chart .attribute-filter { position: relative; min-width: 0; min-height: 44px; gap: 5px; padding: 6px; border: 1px solid color-mix(in srgb, var(--category-color) 35%, white); border-radius: 8px; background: color-mix(in srgb, var(--category-color) 9%, white); font-size: 12px; font-weight: 500; }
  #attribute-chart .attribute-filter input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; }
  #attribute-chart .attribute-filter-swatch { width: 8px; height: 8px; border-radius: 50%; }
  #attribute-chart .attribute-filter > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  #attribute-chart .attribute-filter::after { content: '✓'; margin-left: auto; flex: none; font-size: 11px; }
  #attribute-chart .attribute-filter:has(input:not(:checked)) { background: white; border-color: var(--line); border-style: dashed; }
  #attribute-chart .attribute-filter:has(input:not(:checked))::after { content: ''; width: 9px; }
  #attribute-chart .attribute-filter:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  #attribute-chart .attribute-plot { display: block; padding-top: 0; }
  #attribute-chart svg .attribute-axis-title { font-size: 14px; }
  #attribute-chart .attribute-selection:not(:empty) { display: block; margin: 0 12px 12px; padding: 10px 12px; background: #f1f5fc; border-radius: 8px; white-space: pre-line; font-size: 13px; line-height: 1.7; }
  #attribute-chart > .attribute-legend { display: none; }
  #attribute-chart .attribute-methodology { display: block; }
  #attribute-chart .attribute-directory { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 0 12px 12px; }
  #attribute-chart .attribute-directory:empty::after { content: '请选择上方特征类别'; padding: 12px 0; color: var(--muted); font-size: 13px; }
  #attribute-chart .attribute-category-list { padding: 8px 10px; }
  #attribute-chart .attribute-category-list summary { min-height: 44px; padding: 12px 0; }
  #attribute-chart .attribute-list-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); align-items: center; gap: 10px; min-height: 52px; padding: 10px 0; border-top: 1px solid var(--line); }
  #attribute-chart .attribute-item-name { font-size: 13px; }
  #attribute-chart .attribute-metric-value { font-size: 15px; }
  #attribute-chart .attribute-metric-caption { font-size: 10px; }
  #attribute-chart .attribute-mobile-key { display: block; margin: 0; padding: 0 12px 12px; font-size: 12px; line-height: 1.6; color: var(--muted); }
  #attribute-chart .attribute-list-item { row-gap: 6px; }
  .attribute-item-detail { margin: 0 0 8px; padding: 10px; background: white; white-space: pre-line; font-size: 12px; line-height: 1.7; }
  #supplier-analysis-chart::before { display: none; }
  #supplier-analysis-chart { display: flex; flex-direction: column; border: 0; background: none; overflow: visible; }
  #supplier-analysis-chart .supplier-chart-hint { display: block; }
  #supplier-analysis-chart .supplier-chart-scroll { display: none; }
  #supplier-analysis-chart .supplier-horizontal { display: block; width: 100%; min-width: 0; height: auto; border: 1px solid var(--line); border-radius: 10px; }
  .supplier-detail-dialog > p { margin: 4px 0 12px; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8; }
  .supplier-detail-dialog .trend-dialog-close { outline: none; box-shadow: none; border: 0; background: transparent; }
  .supplier-detail-dialog .trend-dialog-close:focus-visible { text-decoration: underline; }
  .supplier-detail-dialog .trend-dialog-header:focus { outline: none; }
  .attribute-tooltip { display: none !important; }
  .supplier-horizontal-row { cursor: pointer; }
  .supplier-horizontal-row:focus-visible { outline: none; stroke: var(--accent); stroke-width: 1; }
  .amazon-fee-estimate > .fee-table-scroll { margin-top: 12px; overflow: visible; }
  .fee-table-scroll::before { display: none; }
  .fee-table { display: block; width: 100%; min-width: 0; font-size: 12px; }
  .fee-table caption { display: block; padding: 12px; font-size: 13px; }
  .fee-table thead, .fee-table tbody { display: block; }
  .fee-table tr { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, .8fr); padding: 8px 10px; column-gap: 8px; border-top: 1px solid var(--line); }
  .fee-table thead tr { background: var(--accent-soft); }
  .fee-table th, .fee-table td { display: block; min-width: 0; padding: 0; border: 0; line-height: 1.6; overflow-wrap: anywhere; }
  .fee-table th:nth-child(n), .fee-table td:nth-child(n) { white-space: normal; }
  .fee-table thead th:last-child { display: none; }
  .fee-table td:last-child { grid-column: 1 / -1; min-width: 0; margin-top: 6px; padding-top: 0; color: var(--muted); font-size: 11px; }
  .fee-table td:last-child::before { content: '计算依据：'; font-weight: 600; }

  /* Use spacing for section separation; retain control outlines and active indicators. */
  .site-header, .workbench-sidebar, .report-toc, .report-card,
  .history-row, .trend-dialog-header, .trend-products tbody tr,
  .related-trends-table th, .related-trends-table td { border-bottom: 0; }
  footer, .account-controls, .metric-card:nth-child(n),
  .price-comparison-row + .price-comparison-row,
  #attribute-chart .attribute-list-item,
  .fee-table tr, .fee-table th, .fee-table td { border-top: 0; }
  .metrics { border-top: 0; border-bottom: 0; }
  .trend-keywords > tbody > tr > td:nth-child(2) { border-bottom: 0; }
  .fee-table tbody tr + tr { margin-top: 6px; }
}

@media screen and (max-width: 360px) {
  .product-history-row .product-card-image { flex-basis: 24px; }
}

@media (max-width: 680px) {
  .mobile-trend-heading { gap: 8px; }
  .mobile-trend-heading strong { margin-left: auto; }
  .demand-expand { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 10px; border: 1px solid #dbe3ee; border-radius: 8px; background: #fff; color: var(--accent); }
  .mobile-trend-heading .demand-expand svg { width: 20px; height: 20px; }
  .demand-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .research-confirm-dialog { padding: 24px 20px; }
  .research-confirm-actions button { flex: 1; }
}

/* H5 研究入口靠右放在类目下方，不额外占用卡片底部。 */
@media (max-width: 680px) {
  .board-keywords .trend-keyword-line { display: block; }
  .board-keywords > .trend-keywords > tbody > tr > td:nth-child(3) {
    min-height: 58px;
  }
  .board-keywords > .trend-keywords > tbody > tr > td:nth-child(3) .trend-tag {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .board-keywords .trend-keyword-line .trend-research-button {
    position: absolute;
    right: 12px;
    top: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    min-width: 0;
    min-height: 28px;
    margin: 0;
    padding: 0 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #2468d8;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
  }
  .board-keywords .trend-keyword-line .trend-research-button:active { color: #174caa; }
}

/* 保留右下角反馈浮块，报告末尾留足滚动空间。 */
@media screen and (max-width: 680px) {
  #result-view { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .report-feedback { padding: 2px 10px; gap: 6px; }
  .report-feedback p { font-size: 12px; line-height: 1.4; }
  .report-feedback-buttons button { width: 30px; min-width: 30px; height: 40px; padding: 10px 5px; }
  .report-feedback-buttons svg { width: 20px; height: 20px; }
}
