@media (max-width: 900px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 74px;
    padding: 8px 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand-logo {
    max-width: min(160px, 45vw);
    height: 34px;
    object-fit: contain;
  }

  .header-meta {
    min-width: 0;
  }

  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding: 6px 0 0;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .ghost-button,
  .run-button,
  .context-toggle,
  .match-card,
  .market-tab,
  .market-line-card button,
  .agent-grid select,
  .date-filter,
  .decision-console-pill {
    min-height: 44px;
  }

  .auth-menu {
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }

  .auth-menu .auth-link,
  .auth-menu button {
    min-height: 24px;
    line-height: 1.1;
  }

  .match-card,
  .market-line-card,
  .agent-output-card,
  .final-result,
  .selected-market,
  .billing-card {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .agent-grid {
    gap: 10px;
  }

  .agent-grid label,
  .agent-grid select {
    min-width: 0;
  }

  .top-nav-divider {
    flex: 0 0 auto;
    font-size: 12px;
  }

  .workspace {
    min-height: auto;
  }

  .workflow-guide {
    grid-template-columns: 1fr;
  }

  .workflow-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 7px 12px;
  }

  .workflow-copy span {
    font-size: 10px;
  }

  .workflow-copy strong {
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: visible;
  }

  .workflow-step {
    grid-template-columns: 32px minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    min-height: 52px;
    gap: 8px;
    padding: 8px;
    border-right: 1px solid var(--fine);
    border-bottom: 0;
  }

  .workflow-step:last-child {
    border-right: 0;
  }

  .workflow-step-index {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .workflow-step-main {
    min-width: 0;
  }

  .workflow-step-main > span {
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-step-main strong {
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-step-main small {
    display: none;
  }

  .workflow-step-status {
    display: none;
  }

  .breadcrumbs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }

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

  .breadcrumb {
    flex: 0 0 auto;
    max-width: min(70vw, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .match-title {
    grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .hero-team,
  .hero-team:last-child {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    padding: 0;
    text-align: left;
  }

  .hero-team:last-child img {
    grid-column: 1;
    grid-row: 1;
  }

  .hero-team:last-child div {
    grid-column: 2;
    grid-row: 1;
  }

  .hero-team img {
    width: 28px;
    height: 19px;
  }

  .hero-team h2 {
    font-size: 15px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-team span {
    display: block;
    font-size: 10px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .versus {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .match-browser,
  .detail-board,
  .debate-panel {
    min-width: 0;
    max-width: 100vw;
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .detail-board > *,
  .match-hero,
  .context-panel,
  .market-board {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .match-title {
    width: 100%;
    min-width: 0;
  }

  .market-board-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 9px;
    margin-bottom: 10px;
  }

  .market-board-header > div:first-child {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
  }

  .market-board-header .eyebrow {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
  }

  .market-board-header h2 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 19px;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .market-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    width: 100%;
    min-width: 0;
    border-width: 1px 0 0 1px;
  }

  .market-tab {
    min-width: 0;
    min-height: 42px;
    padding: 8px 6px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    font-size: 12px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .market-tab:last-child {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .market-table,
  .market-table > *,
  .market-line-card,
  .market-selection-grid,
  .market-selection {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .market-refresh-status {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    justify-content: start;
    gap: 4px;
  }

  .market-refresh-copy {
    display: grid;
    justify-content: start;
    gap: 3px;
  }

  .market-refresh-copy span,
  .market-refresh-copy em {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .market-line-card {
    gap: 10px;
    overflow: hidden;
  }

  .market-line-head,
  .market-line-head > div {
    min-width: 0;
  }

  .market-line-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .market-line-head strong,
  .market-line-head span {
    overflow-wrap: anywhere;
  }

  .market-selection-grid {
    grid-template-columns: 1fr;
  }

  .market-selection {
    min-height: 46px;
  }

  .market-selection span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .match-browser,
  .detail-board,
  .debate-panel,
  .market-board {
    scroll-margin-top: 126px;
  }
}

@media (max-width: 540px) {
  .shell-header {
    padding: 8px 10px;
  }

  .top-nav {
    gap: 8px;
  }

  .top-nav-item {
    font-size: 10px;
  }

  .workflow-copy {
    padding: 6px 10px;
  }

  .workflow-step {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 48px;
    gap: 6px;
    padding: 7px 6px;
  }

  .workflow-step-index {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .workflow-step-main strong {
    font-size: 11px;
  }

  .match-hero {
    padding: 10px;
  }

  .market-board {
    padding: 10px;
  }

  .match-title {
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
    gap: 5px;
  }

  .hero-team,
  .hero-team:last-child {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 5px;
  }

  .hero-team img {
    width: 24px;
    height: 16px;
  }

  .hero-team h2 {
    font-size: 13px;
  }

  .hero-team span {
    font-size: 9px;
  }

  .versus {
    width: 28px;
    height: 28px;
    border-width: 1px;
    font-size: 10px;
  }

  .market-board-header {
    gap: 8px;
  }

  .market-board-header h2 {
    font-size: 18px;
  }

  .market-tabs {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .market-tab {
    min-height: 40px;
    padding: 8px 6px;
    text-align: center;
  }

  .market-line-card {
    padding: 10px;
  }

  .market-line-head strong {
    font-size: 14px;
  }

  .market-selection {
    padding: 8px;
  }

  .market-selection strong {
    font-size: 15px;
  }

  .match-browser,
  .detail-board,
  .debate-panel,
  .market-board {
    scroll-margin-top: 116px;
  }
}
