.responsive-chart-surface { display: contents; }
.win-rate-chart .responsive-chart-surface > svg { flex-shrink: 0; }
.notebook-fullscreen .workshop-growth-controls { align-items: center; }
.workshop-growth-controls > label { display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; font-size: 12px; }
.workshop-growth-controls > label select { margin: 0; }
.notebook-fullscreen :is(.player-retention-table, .workshop-history-scroll) tbody tr:nth-child(even) { background: #f0f5fa; }

@media (max-width: 760px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  #dashboard.workspace { --notebook-page-start: max(10px, env(safe-area-inset-left)); --notebook-page-end: max(10px, env(safe-area-inset-right)); }
  .dashboard-topbar { position: relative; display: block; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
  .mobile-toolbar-heading { display: flex; }
  #mobile-filter-toggle, #mobile-refresh { min-height: 44px; }
  .dashboard-topbar .dashboard-toolbar-content { display: block; max-height: none; overflow: visible; padding: 12px 0 0; }
  .dashboard-topbar[data-mobile-ready="true"][data-mobile-open="false"] .dashboard-toolbar-content { display: none; }
  .dashboard-filters { display: grid; grid-template-columns: minmax(0, 1fr) 94px; gap: 10px 8px; width: 100%; }
  .dashboard-filters .notebook-compact-title { display: none; }
  .dashboard-filters .mod-release-filter { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-column: 1 / -1; align-items: center; gap: 8px; width: 100%; }
  .dashboard-filters .version-filter { grid-column: 1; display: grid; min-width: 0; width: 100%; gap: 4px; }
  .dashboard-filters .version-filter select, .dashboard-filters .mod-release-filter select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  #name-build { grid-column: 2; align-self: end; min-height: 44px; }
  .dashboard-filters :is(.activity-range, .activity-mode) { display: grid; grid-column: 1 / -1; width: 100%; gap: 4px; border: 0; padding: 3px; }
  .dashboard-filters .activity-range { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .dashboard-filters .activity-mode { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-filters .activity-language { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dashboard-filters :is(.activity-range, .activity-mode) button { min-height: 44px; min-width: 0; font-size: 12px; padding: 8px 2px; }
  .dashboard-toolbar-content .header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin: 10px 0 0; gap: 8px; }
  #dashboard-topbar #storage-usage { grid-column: 1 / -1; width: 100%; padding: 8px 10px; font-size: 12px; }
  #storage-usage meter { height: 7px; }
  .activity-summary-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 6px; }
  .activity-summary-links .dashboard-summary-button { display: flex; flex-direction: column; white-space: normal; min-height: 66px; padding: 8px 3px; gap: 5px; font-size: 11px; text-align: center; }
  .activity-summary-links #last-updated { grid-column: 1 / -1; font-size: 10px; padding: 2px 0; }
  .activity-summary-actions { gap: 10px; }
  .overall-outcome-wrap, .overall-outcomes { width: 100%; }
  .overall-outcome-track { height: 10px; }
  .mobile-overview-toggle { display: flex; background: #edf3f8; border-color: #d5e0eb; margin-bottom: 10px; }
  #activity-panel[data-mobile-ready="true"][data-mobile-open="false"] > .activity-charts { display: none; }
  .activity-pair-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .activity-chart-pair { display: flex; flex-direction: column; padding: 12px 8px; }
  .activity-charts h3 { font-size: 14px; margin-bottom: 8px; }
  .chart-scroll, .card-balance-scroll, .player-run-distribution-chart, .record-outcome-trend-chart { min-width: 0; max-width: 100%; overflow: visible; }
  .chart-scroll::before, .card-balance-scroll::before, .player-run-distribution-chart::before { display: none; }
  /* Override old phone rules that forced 500–1120px-wide figures. No clipping. */
  #dashboard :is(.count-chart, .ascension-chart, .card-balance-scroll),
  #chart-zoom .chart-zoom-stage :is(.count-chart, .ascension-chart, .card-balance-scroll),
  .notebook-fullscreen :is(.count-chart, .ascension-chart, .workshop-chart) {
    width: 100%; min-width: 0; max-width: 100%; margin-inline: 0;
  }
  #dashboard :is(.count-chart, .ascension-chart, .card-balance-scroll) svg,
  #chart-zoom .chart-zoom-stage svg, .notebook-fullscreen .workshop-chart svg { display: block; width: 100%; min-width: 0; max-width: 100%; height: auto; }
  #dashboard .chart-axis, #chart-zoom .chart-axis, .notebook-fullscreen .chart-axis { font-size: 11px; }
  .chart-expandable { padding-top: 44px; }
  .chart-expand-button { min-height: 36px; min-width: 48px; font-size: 11px; }
  .chart-forecast-note { font-size: 11px; gap: 4px 8px; padding-right: 0; }
  .hourly-legend { padding-right: 0; font-size: 10px; }
  .chart-readout { height: auto; white-space: normal; font-size: 11px; overflow-wrap: anywhere; }
  .activity-charts .activity-share-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .activity-pie { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .activity-pie svg { width: min(100%, 260px); margin-inline: auto; }
  .activity-pie-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); font-size: 12px; }
  #ascension-pages { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  #ascension-pages a { min-height: 44px; padding: 8px 2px; font-size: 14px; }
  #view-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; gap: 4px; }
  #view-nav button { min-width: 0; min-height: 44px; padding: 8px 3px; font-size: 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 10px; background: #f3f7fa; border-radius: 8px; }
  .metric-value { font-size: 24px; }
  .card-statistics-grid, .card-act-grid, .card-balance-view, .record-list-summary { grid-template-columns: minmax(0, 1fr); }
  .card-balance-heading, .card-balance-heading-meta { flex-wrap: wrap; }
  .card-balance-map { padding: 10px 6px; }
  .card-balance-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-balance-tabs button { min-width: 0; min-height: 44px; padding-inline: 3px; }
  .balance-quadrant-label { display: none; }
  .balance-tick, .balance-legend-label { font-size: 10px; }
  .balance-axis { font-size: 11px; }
  .balance-average-label { font-size: 9px; }
  .notebook-fullscreen > .notebook-fullscreen-header { flex-wrap: wrap; padding: max(10px, env(safe-area-inset-top)) 12px 10px; gap: 8px; }
  .notebook-fullscreen-header h2 { font-size: 17px; }
  .notebook-fullscreen-header :is(button, select) { min-height: 44px; font-size: 12px; }
  .notebook-fullscreen > .notebook-fullscreen-body,
  .notebook-fullscreen :is(#player-retention-body, #achievement-rates-body) { padding: 12px 10px max(16px, env(safe-area-inset-bottom)); overflow: auto; }
  .notebook-fullscreen .player-retention-content { display: flex; flex-direction: column; height: auto; gap: 12px; }
  .notebook-fullscreen .player-retention-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .notebook-fullscreen .player-retention-metric { padding: 10px; }
  .notebook-fullscreen .player-retention-rate { font-size: 27px; }
  .notebook-fullscreen .player-retention-table { border: 0; background: transparent; overflow: visible; }
  .notebook-fullscreen .player-retention-table table { display: block; width: 100%; min-width: 0; }
  .notebook-fullscreen .player-retention-table thead,
  .notebook-fullscreen .workshop-history-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .notebook-fullscreen .player-retention-table :is(tbody, tfoot) { display: grid; gap: 10px; position: static; }
  .notebook-fullscreen .player-retention-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; margin-bottom: 10px; background: #fff; border: 1px solid #dce5ee; border-radius: 10px; }
  .notebook-fullscreen .player-retention-table :is(th, td) { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; font-size: 16px; }
  .notebook-fullscreen .player-retention-table tbody th { grid-column: 1 / -1; padding-bottom: 8px; border-bottom: 1px solid #e4eaf2; font-size: 16px; color: #4f4273; }
  .notebook-fullscreen .player-retention-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 12px; color: #60738b; }
  .notebook-fullscreen .player-retention-table tfoot tr { background: #f1edf7; border-color: #dcd2ea; }
  .notebook-fullscreen .player-retention-table tfoot th { grid-column: 1 / -1; }
  .notebook-fullscreen .workshop-growth-body { display: block; }
  .workshop-growth-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
  .workshop-growth-controls label { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; }
  .workshop-growth-controls select { flex: 1; min-width: 0; font-size: 16px; }
  .workshop-workspace { display: flex; flex-direction: column; }
  .notebook-fullscreen .workshop-growth-plots { grid-template-columns: minmax(0, 1fr); }
  .notebook-fullscreen .workshop-chart { display: block; }
  .workshop-history-panel { max-height: none; }
  .notebook-fullscreen .workshop-history-scroll { overflow: visible; padding: 10px; }
  .notebook-fullscreen .workshop-history-scroll table { display: block; min-width: 0; width: 100%; }
  .workshop-history-scroll tbody { display: grid; gap: 10px; }
  .workshop-history-scroll tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; border: 1px solid #dce5ee; border-radius: 8px; }
  .notebook-fullscreen .workshop-history-scroll td { display: block; padding: 0; border: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
  .workshop-history-scroll td:first-child { grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: #526a84; }
  .workshop-history-scroll td:not(:first-child):not(:last-child)::before { content: attr(data-label); display: block; font-size: 12px; color: #60738b; }
  .workshop-history-scroll td:last-child { grid-column: 1 / -1; }
  .workshop-history-scroll td button { width: 100%; min-height: 44px; }
  .notebook-fullscreen .workshop-edit { max-height: none; }
  #chart-zoom.chart-zoom { inset: 0; margin: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  #chart-zoom .chart-zoom-content { padding: 12px 10px max(16px, env(safe-area-inset-bottom)); overflow: auto; }
  #chart-zoom .chart-zoom-stage { width: 100%; min-width: 0; }
  #chart-zoom .chart-zoom-stage[data-source] :is(.count-chart, .ascension-chart, .card-balance-scroll) { width: 100%; min-width: 0; }
  #chart-zoom .chart-expandable { padding-top: 0; }
}
