/* Phone adaptations of the web interface. Desktop components remain the reference. */
@media (max-width: 900px) {
  html { scroll-padding-top: 120px; }
  body { -webkit-text-size-adjust: 100%; }
  body:not(.terminal-page) { font-size: 14px; }

  /* Keep the website's four destinations within reach, below the search row. */
  body .part1-module > header,
  body.overview-page .overview-header-shell > header {
    height: 108px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 56px 44px;
    gap: 0 10px;
    padding: 4px 16px;
  }
  body .part1-module > header .header-left { min-width: 0; gap: 12px; }
  body .part1-module > header .blackbook-brand-logo { width: 104px; }
  body .part1-module > header .search-bar { display: block; flex: 1; width: auto; min-width: 44px; max-width: 260px; }
  body .part1-module > header .search-input,
  body.overview-page .overview-header-shell > header .search-input {
    height: 44px; padding: 0 10px 0 34px; font-size: 16px;
    color: #ddd; border-radius: 22px;
  }
  body .part1-module > header .search-input::placeholder,
  body.overview-page .overview-header-shell > header .search-input::placeholder { color: #aaa; }
  body .part1-module > header .search-icon { left: 12px; }
  body .part1-module > header .header-right { grid-column: 2; grid-row: 1; gap: 6px; margin: 0; }
  body .part1-module > header .auth-trigger { min-height: 44px; padding: 0 10px; font-size: 13px; }
  body .part1-module > header .auth-trigger-account { padding: 0; min-width: 44px; }
  body .part1-module > header .nav-menu,
  body.overview-page .overview-header-shell > header .nav-menu {
    display: flex; grid-column: 1 / -1; grid-row: 2; justify-content: space-between;
    gap: 14px; min-width: 0; overflow-x: auto; scrollbar-width: none;
  }
  body .part1-module > header .nav-link { display: flex; align-items: center; min-height: 44px; flex-shrink: 0; font-size: 13px; }
  body .part1-module > header .nav-link::after { bottom: 4px; }

  .unified-dashboard { padding-top: 108px; }
  body .dashboard-module { --text-secondary: #aaa; --text-muted: #999; --size-small: 12px; }
  body .part1-module .module-main { padding: 0; }
  body .part1-module .hero-section { margin: 0; min-height: 360px; height: 52svh; max-height: 480px; }
  body .part1-module .hero-content { padding: 32px 24px; }
  body .part1-module .hero-heading { font-size: clamp(34px, 9vw, 44px); line-height: 1.12; margin-bottom: 20px; }
  body .part1-module .hero-subheading { max-width: 360px; margin: 0 auto 22px; font-size: 17px; line-height: 1.5; }
  body .part1-module .hero-secondary-text { font-size: 13px; color: #b5b5b5; line-height: 1.5; }
  body .part1-module .close-hero-btn { width: 44px; height: 44px; top: 8px; right: 8px; }
  body .part1-module .main-content { padding: 20px 16px 0; overflow: visible; }
  body .part1-module .dashboard-container { min-height: 0; }
  body .part1-module .market-overview { grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; }
  body .part1-module .chart-card,
  body .part1-module .indices-card { padding: 18px 16px; }
  body .part1-module .sp500-header { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px 14px; margin-bottom: 16px; }
  body .part1-module .sp500-price-row { grid-column: 1 / -1; justify-content: space-between; }
  body .part1-module .sp500-title { font-size: 17px; font-weight: 600; }
  body .part1-module .sp500-symbol { font-size: 13px; color: #aaa; line-height: 1.4; }
  body .part1-module .sp500-price { font-size: 26px; }
  body .part1-module .sp500-label { font-size: 12px; color: #aaa; }
  body .part1-module .sp500-change { font-size: 15px; }
  body .part1-module .chart-container { height: 210px; }
  body .part1-module .time-label { font-size: 12px; color: #aaa; }
  body .part1-module .indices-header { font-size: 17px; }
  body .part1-module .index-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; padding: 14px 0; }
  body .part1-module .index-item > .bb-identity { grid-row: 1 / 3; }
  body .part1-module .index-name { font-size: 14px; line-height: 1.4; }
  body .part1-module .index-symbol-label { font-size: 12px; }
  body .part1-module .index-data { grid-column: 2; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; text-align: left; }
  body .part1-module .index-value { font-size: 15px; }
  body .part1-module .index-unit { display: block; font-size: 12px; color: #aaa; }
  body .part1-module .index-change { font-size: 13px; }
  body .dashboard-module .see-all-link,
  body .dashboard-module .see-all-link-inline { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-size: 13px; color: #c2c2c2; line-height: 1.5; }

  /* Each leaderboard gets real row width; the next card stays visible as a cue. */
  body .part1-module .launch-leaders {
    display: grid; grid-template-columns: none; grid-auto-flow: column;
    grid-auto-columns: min(88%, 340px); gap: 12px;
    overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
    padding-bottom: 10px; margin-bottom: 24px; scrollbar-width: thin;
  }
  body .part1-module .launch-leaders .commodities-card { padding: 18px 16px; scroll-snap-align: start; }
  body .part1-module .launch-leaders .section-title { font-size: 17px; }
  body .part1-module .launch-leaders .commodities-list { gap: 0; }
  body .part1-module .launch-leaders .commodity-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; padding: 14px 0; }
  body .part1-module .launch-leaders .bb-identity { grid-row: 1 / 3; }
  body .part1-module .launch-leaders .commodity-info { grid-column: 2; }
  body .part1-module .launch-leaders .commodity-name { font-size: 15px; line-height: 1.4; white-space: normal; }
  body .part1-module .launch-leaders .commodity-symbol-badge { font-size: 12px; }
  body .part1-module .launch-leaders .commodity-price-data { grid-column: 2; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; text-align: left; }
  body .part1-module .launch-leaders .commodity-value { font-size: 15px; }
  body .part1-module .launch-leaders .commodity-unit { display: none; }
  body .part1-module .launch-leaders .commodity-change { font-size: 13px; }

  body .dashboard-module .section-header { margin-bottom: 18px; }
  body .dashboard-module .section-header h2 { font-size: 21px; line-height: 1.3; }
  body .dashboard-module .indicators-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
  body .dashboard-module .indicator-card { border-radius: 8px; }
  body .dashboard-module .indicator-thumbnail { height: 112px; flex-basis: 112px; }
  body .dashboard-module .indicator-content { padding: 12px 10px; gap: 10px; }
  body .dashboard-module .indicator-title { font-size: 14px; line-height: 1.45; min-height: 61px; -webkit-line-clamp: 3; }
  body .dashboard-module .indicator-desc { font-size: 12px; line-height: 1.5; min-height: 54px; -webkit-line-clamp: 3; color: #b0b0b0; }
  body .dashboard-module .indicator-meta { flex-wrap: wrap; justify-content: flex-start; gap: 8px 12px; min-height: 40px; font-size: 12px; color: #aaa; }
  body .dashboard-module .indicator-meta .author-link { width: 100%; color: #bbb; font-size: 12px; }
  body .dashboard-module .indicator-meta .stat-item { font-size: 12px; color: #aaa; }
  body .dashboard-module .indicator-label { font-size: 10px; padding: 4px; }
  body #stocks .module-main,
  body #index-rankings .module-main { padding: 12px 16px 24px; }
  body .module-divider { margin: 0; padding: 24px 16px 16px; }
  body .module-divider .section-title { font-size: 21px; }
  body #coming-soon .category-tabs { justify-content: flex-start; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding: 4px 16px 16px; margin: 0; scrollbar-width: thin; }
  body #coming-soon .tab-btn { min-height: 44px; flex: 0 0 auto; padding: 0 16px; font-size: 13px; }
  body #coming-soon .module-main { padding: 12px 16px 28px; }
  .coming-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .coming-column h3 { font-size: 18px; margin: 0 0 14px; }
  .coming-column h3.coming-column-spacer { display: block; }
  .coming-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 4px 8px; min-height: 100px; padding: 14px 0; }
  .coming-row > .bb-identity { grid-row: 1 / 3; }
  .coming-info { gap: 4px; }
  .coming-info strong { font-size: 14px; line-height: 1.4; overflow-wrap: break-word; }
  .coming-info > span { font-size: 12px; color: #aaa; }
  body .coming-row .coming-status { grid-column: 2; margin: 0; font-size: 12px; color: #aaa; white-space: normal; }
  body .part2-module .two-col-section { grid-template-columns: 1fr; gap: 28px; margin-bottom: 28px; }
  body .dashboard-module .stock-row { min-height: 84px; padding: 14px 12px; gap: 12px; }
  body .dashboard-module .stock-symbol { font-size: 15px; }
  body .dashboard-module .stock-company { font-size: 12px; line-height: 1.5; white-space: normal; color: #aaa; }
  body .dashboard-module .stock-price { font-size: 16px; }
  body .dashboard-module .stock-change { display: inline-block; font-size: 13px; padding: 3px 6px; line-height: 1.4; }
  body .dashboard-module .stock-change.positive { color: #41d7ae; background: #07251b; }
  body .dashboard-module .stock-change.negative { color: #ff6977; background: #2c0d15; }
  body .part2-module .market-tabs { display: flex; overflow-x: auto; gap: 8px; margin-bottom: 14px; }
  body .part2-module .market-tab { min-height: 44px; font-size: 13px; }
  .new-listings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body .new-listings-grid .stock-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 8px; padding: 14px 8px; }
  body .new-listings-grid .stock-row { min-height: 158px; }
  body .new-listings-grid .stock-row > .bb-identity,
  body .new-listings-grid .stock-info { grid-column: 1 / -1; }
  body .new-listings-grid .stock-symbol { font-size: 14px; }
  body .new-listings-grid .stock-price-data { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
  body .new-listings-grid .stock-price { font-size: 15px; }
  body .new-listings-grid .stock-change { font-size: 13px; padding: 3px; }
  body .new-listings-grid .stock-company { overflow-wrap: anywhere; }
  body #relative-value .main-content { padding: 20px 16px 32px; }
  body #relative-value .forex-section { margin: 0; padding: 0; }
  body #relative-value .section-title { font-size: 21px; }
  body #relative-value .time-filters { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; }
  body #relative-value .filter-btn { min-height: 44px; flex: 0 0 auto; padding: 0 14px; font-size: 13px; }
  body .part3-module .forex-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; min-height: 94px; }
  body .part3-module .pair-name { font-size: 14px; }
  body .part3-module .percentage-value { min-width: 0; font-size: 14px; }
  body .part3-module .forex-item .bar-container { grid-column: 1 / -1; grid-row: 2; margin: 0; height: 8px; }
  body .part3-module .footer { margin-top: 0; padding: 28px 16px max(24px, env(safe-area-inset-bottom)); }
  body .part3-module .footer-content { gap: 28px; }
  body .part3-module .footer-wordmark img { height: 42px; }
  body .part3-module .footer-branding p { color: #aaa; font-size: 13px; }
  body .part3-module .footer-links { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  body .part3-module .footer-column h3 { color: #bbb; font-size: 13px; }
  body .part3-module .footer-column ul li { margin: 0; }
  body .part3-module .footer-column ul li a,
  body .part3-module .footer-column [data-legal-fallback] { display: flex; align-items: center; min-height: 44px; font-size: 14px; color: #aaa; line-height: 1.4; }
  body .part3-module .footer-column a[aria-disabled=true] { opacity: 1; }
  body .part3-module .social-links { gap: 20px; }
  body .part3-module .copyright { color: #aaa; font-size: 12px; }

  /* Shared search and account forms retain the web's controls. */
  .symbol-search-overlay { padding: 120px 12px 12px; }
  .symbol-search-dialog { max-height: calc(100dvh - 132px); }
  .symbol-search-field { gap: 8px; }
  .symbol-search-field input { min-width: 0; font-size: 16px; }
  .symbol-search-close, .symbol-search-clear { min-height: 44px; min-width: 44px; }
  .symbol-search-tabs button, .symbol-search-filters button { min-height: 44px; font-size: 13px; flex: 0 0 auto; }
  .symbol-search-filters { overflow-x: auto; flex-wrap: nowrap; }
  .symbol-search-status { font-size: 12px; color: #aaa; }
  .symbol-search-status > span:last-child { display: none; }
  body .symbol-result-main,
  body .symbol-result.symbol-result-paired .symbol-result-main { grid-template-columns: auto minmax(0, 1fr); min-height: 76px; gap: 12px; }
  .symbol-result-copy strong { font-size: 15px; }
  .symbol-result-copy small { font-size: 12px; color: #aaa; white-space: normal; }
  .symbol-result-actions { padding-left: 0; }
  .symbol-result-actions button { min-height: 44px; font-size: 13px; }
  .auth-dialog { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .auth-email-input { font-size: 16px; min-height: 48px; }
  .auth-close, .auth-mode-tabs button, .auth-email-continue, .auth-signout { min-height: 44px; }
  .auth-legal { color: #aaa; line-height: 1.5; }

  /* Markets, news and the plain-language Methodology guide. */
  body.route-page .route-shell { width: calc(100% - 32px); padding: 132px 0 40px; }
  .route-page .route-back { min-height: 44px; margin-bottom: 16px; }
  .route-page .route-heading { gap: 16px; padding-bottom: 24px; }
  .route-page .route-eyebrow, .route-page .route-summary { font-size: 13px; color: #aaa; }
  .route-page .route-title { font-size: 30px; }
  .route-page .route-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 20px 0; }
  .route-page .route-controls .route-input { grid-column: 1 / -1; }
  .route-page .route-input, .route-page .route-select, .route-page .route-textarea { font-size: 16px; }
  .route-page .route-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 16px 0; }
  .route-page .route-identity { grid-column: 1 / -1; gap: 12px; }
  .route-page .route-identity strong { font-size: 16px; line-height: 1.4; }
  .route-page .route-identity small { font-size: 13px; color: #aaa; }
  .route-page .route-value { display: block; min-width: 0; font-size: 16px; text-align: left; }
  .route-page .route-change { font-size: 14px; }
  .route-page .route-button { min-height: 44px; font-size: 14px; }
  .route-page .route-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .route-page .route-tabs .route-button { flex: 0 0 auto; }

  /* Reserve the identity's actual width, including both pair legs. */
  body.overview-page .overview-shell { width: 100%; padding: 132px 16px 48px; }
  body .overview-hero { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  body .overview-hero h1 { font-size: clamp(22px, 6vw, 28px); line-height: 1.25; overflow-wrap: break-word; }
  body .overview-breadcrumbs { font-size: 13px; color: #aaa; margin-bottom: 20px; }
  body .overview-breadcrumbs a { display: inline-flex; align-items: center; min-height: 28px; }
  body .overview-instrument-line,
  body .overview-instrument-line strong { font-size: 13px; color: #b5b5b5; }
  body .overview-instrument-line { flex-wrap: wrap; line-height: 1.5; }
  body .overview-market-label { display: block; font-size: 12px; color: #aaa; }
  body .overview-view-chart { min-height: 44px; font-size: 13px; }
  body .overview-quote-block { grid-column: 1 / -1; grid-row: 2; margin: 8px 0 0; }
  body .overview-change-line { justify-content: flex-start; margin: 8px 0; }
  body .overview-change-line > span,
  body .overview-price-unit { font-size: 12px; color: #aaa; }
  body .overview-asof { justify-content: flex-start; font-size: 12px; color: #aaa; }
  body.overview-page .overview-quote-block .overview-order-actions button { min-height: 44px; font-size: 14px; flex: 1; }
  body .overview-tabs { top: 108px; margin-bottom: 20px; }
  body .overview-tab { min-height: 48px; font-size: 14px; flex: 0 0 auto; }
  body .overview-chart-topline { padding: 12px; gap: 8px; }
  body .overview-chart-heading { align-items: flex-start; flex-wrap: wrap; gap: 6px; }
  body .overview-chart-heading strong { font-size: 14px; }
  body .overview-chart-heading span { font-size: 12px; color: #aaa; }
  body .overview-chart-controls { min-width: 0; flex-wrap: wrap; }
  body .overview-range-grid { flex: 1 1 100%; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
  body .overview-range { flex: 0 0 auto; min-height: 44px; min-width: 48px; padding: 0 12px; font-size: 13px; color: #aaa; }
  body .overview-range.active { color: #fff; }
  body .overview-chart-actions { margin-left: auto; padding-left: 0; border: 0; }
  body .overview-chart-actions button { width: 44px; height: 44px; }
  body .overview-chart-frame { height: 310px; padding: 12px 66px 40px 10px; }
  body .overview-chart-frame::before { inset: 12px 66px 40px 10px; }
  body .overview-y-axis { top: 14px; bottom: 40px; right: 8px; width: 54px; font-size: 12px; color: #aaa; }
  body .overview-x-axis { left: 10px; right: 66px; bottom: 12px; gap: 12px; font-size: 12px; color: #aaa; }
  body .overview-current-marker, body .overview-prev-close-marker { right: 68px; font-size: 12px; }
  body .overview-current-marker { color: #fff; background: #087b68; }
  body .overview-stats { gap: 8px; }
  body .overview-stat { min-height: 92px; padding: 14px 12px; gap: 14px; }
  body .overview-stat span { font-size: 13px; color: #aaa; line-height: 1.4; }
  body .overview-stat strong { font-size: 16px; overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  body .overview-eyebrow, body .overview-content-heading > p,
  body .overview-news-meta, body .overview-news-meta b,
  body .overview-related-top small { font-size: 13px; color: #aaa; line-height: 1.5; }
  body .overview-component strong { font-size: 15px; color: #ddd; }
  body .overview-component span, body .overview-profile-copy > span { font-size: 13px; color: #aaa; line-height: 1.5; }
  body .overview-content-heading span { font-size: 13px; color: #aaa; }
  body .overview-news-strip-grid { gap: 16px; }
  body .overview-news-strip-grid article { flex-basis: 88%; }
  body .overview-news-more { min-height: 44px; font-size: 13px; }
  body .overview-section { margin-top: 32px; }
  body .overview-related-top strong { font-size: 15px; }
  body .overview-related-top strong, body .overview-related-top small { white-space: normal; overflow: visible; }
  body .overview-related-quote span { font-size: 16px; }
  body .overview-related-quote b { font-size: 14px; }
  body .overview-news-kicker, body .overview-news-subject,
  body .overview-news-market, body .overview-news-market small,
  body .overview-news-section-title span { font-size: 13px; color: #aaa; line-height: 1.5; }
  body .overview-trade-ticket { width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px 16px; }
  body .overview-trade-ticket input, body .overview-trade-ticket select { min-height: 44px; font-size: 16px; }
}

@media (min-width: 520px) and (max-width: 900px) {
  body .dashboard-module .indicator-thumbnail { height: 160px; flex-basis: 160px; }
  body .dashboard-module .indicator-title { font-size: 16px; }
  body .dashboard-module .indicator-desc { font-size: 13px; }
}
