/* SuperSystem v287 — responsive edge rules.

   The reference desktop composition is defined by workspace.css: the match
   table stays on the left and the analysis column stays on the right. This
   file deliberately leaves that composition alone at 1150px and above.
   Only smaller viewports get alternate flow/table rules.
*/

@media (max-width: 1149px) {
  :root {
    --ss-small-gutter: clamp(10px, 2.8vw, 20px);
    --ss-small-gap: clamp(10px, 2vw, 14px);
  }

  html,
  body.workspace-app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body.workspace-app {
    height: auto !important;
    min-height: 100dvh;
    display: flex !important;
    flex-direction: column;
  }

  body.workspace-app > .topbar,
  body.workspace-app > #workspace,
  body.workspace-app > .workspace-footer {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  /* Header controls may wrap, but never widen the page. */
  .workspace-app .topbar {
    flex: 0 0 auto;
    min-width: 0;
    padding: 12px var(--ss-small-gutter) 10px !important;
    gap: 9px 12px;
  }

  .workspace-app .topbar > div:first-child,
  .workspace-app .topbar h1,
  .workspace-app .topbar .topbar-eyebrow,
  .workspace-app .workspace-deadline,
  .workspace-app .workspace-top-actions {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-app .topbar > div:first-child {
    flex: 1 1 180px;
  }

  .workspace-app .topbar h1 {
    font-size: clamp(21px, 4vw, 25px) !important;
    line-height: 1.05;
  }

  .workspace-app .topbar .topbar-eyebrow {
    line-height: 1.25;
  }

  .workspace-app .workspace-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 250px;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
  }

  .workspace-app .workspace-top-actions .button,
  .workspace-app #workspaceRound {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .workspace-app .workspace-deadline {
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  /* v303: settings first and results last; matches keep their own slot. */
  #workspace {
    flex: 0 0 auto;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "settings"
      "match"
      "colors"
      "results";
    align-items: start;
    gap: var(--ss-small-gap);
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 10px var(--ss-small-gutter) 26px !important;
  }

  #workspace > .match-panel {
    grid-area: match;
    min-width: 0;
    width: 100%;
    margin: 0 !important;
  }

  #workspace > .workspace-right {
    display: contents !important;
    min-width: 0;
  }

  #workspace > .workspace-right > .color-rules-side {
    grid-area: colors;
  }

  #workspace > .workspace-right > .results {
    grid-area: results;
  }

  #workspace > .workspace-right > .system-panel {
    grid-area: settings;
  }

  #workspace > .match-panel,
  #workspace > .workspace-right > .color-rules-side,
  #workspace > .workspace-right > .results,
  #workspace > .workspace-right > .system-panel,
  #workspace .match-workspace,
  #workspace .match-main {
    min-width: 0;
    max-width: 100%;
  }

  #workspace > .match-panel,
  #workspace > .workspace-right > .color-rules-side,
  #workspace > .workspace-right > .results,
  #workspace > .workspace-right > .system-panel {
    padding: clamp(11px, 2.4vw, 15px) !important;
    overflow: visible;
  }

  #workspace .match-workspace,
  #workspace .match-main {
    display: block !important;
  }

  #workspace .color-rules-side {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  #workspace .side-collapse-button,
  #workspace .panel-collapse-button {
    display: none !important;
  }

  #workspace .section-title {
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 10px;
    margin-bottom: 9px !important;
  }

  #workspace .section-title > div:first-child,
  #workspace .section-title h2,
  #workspace .section-title .hint {
    min-width: 0;
    max-width: 100%;
  }

  #workspace .section-title h2 {
    font-size: clamp(17px, 3.8vw, 21px) !important;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  #workspace .section-title .hint {
    flex: 1 1 180px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .workspace-match-tools {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 240px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
  }

  .workspace-palette {
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .workspace-palette [data-workspace-paint]:not([data-workspace-paint=""]) {
    flex: 0 0 auto;
  }

  /* Tablet: retain the table shape and let each column shrink. */
  @media (min-width: 721px) {
    #workspace .paint-table {
      display: table !important;
      width: 100% !important;
      min-width: 0 !important;
      table-layout: fixed !important;
      border-collapse: separate;
      border-spacing: 0 7px;
    }

    #workspace .paint-table thead {
      display: table-header-group !important;
    }

    #workspace .paint-table thead tr {
      display: table-row !important;
    }

    #workspace #matches {
      display: table-row-group !important;
      width: 100%;
      height: auto !important;
    }

    #workspace #matches > tr {
      display: table-row !important;
      height: auto !important;
      min-height: 0 !important;
    }

    #workspace .paint-table thead th:first-child,
    #workspace #matches td.match-name {
      width: 29% !important;
    }

    #workspace .paint-table thead th:not(:first-child),
    #workspace #matches td:not(.match-name) {
      width: 23.6666% !important;
    }

    #workspace #matches > tr > td {
      display: table-cell !important;
      width: auto !important;
      min-width: 0;
      padding: 6px 4px;
      vertical-align: middle;
    }

    #workspace #matches td.match-name {
      position: relative;
      padding: 7px 6px 7px 5px !important;
      text-align: left !important;
      overflow-wrap: anywhere;
    }

    #workspace #matches td.match-name::before {
      display: none !important;
    }

    #workspace #matches .match-meta {
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      width: 25px;
      margin-right: 6px;
      vertical-align: middle;
      text-align: center;
    }

    #workspace #matches .match-number {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 23px;
      height: 23px;
      margin: 0;
      border: 1px solid rgba(83, 126, 163, .58);
      border-radius: 7px;
      background: rgba(7, 22, 37, .78);
      color: #9fb8cf;
      font: 700 10px/1 'DM Mono', monospace;
    }

    #workspace #matches .match-copy {
      display: inline-flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      min-width: 0;
      max-width: calc(100% - 34px);
      vertical-align: middle;
    }

    #workspace #matches .match-name-text {
      display: block;
      min-width: 0;
      max-width: 100%;
      line-height: 1.25;
      overflow-wrap: anywhere;
      white-space: normal;
    }

    #workspace #matches .match-name small {
      display: none !important;
    }

    #workspace #matches .match-kickoff {
      margin-top: 3px;
      line-height: 1.1;
      white-space: nowrap;
    }

    #workspace .outcome-tile,
    #workspace .outcome-tile.live-current-sign,
    body.live-edit-locked #workspace .outcome-tile {
      box-sizing: border-box !important;
      width: 100% !important;
      min-width: 0 !important;
      height: 70px !important;
      min-height: 70px !important;
      max-height: 70px !important;
      padding: 6px 4px !important;
      overflow: hidden !important;
    }

    #workspace .outcome-tile > b {
      display: none !important;
    }

    #workspace .outcome-tile .odds-line,
    #workspace .outcome-tile > small {
      position: relative;
      z-index: 3;
      width: 100%;
      min-width: 0;
      text-align: center;
    }

    #workspace .outcome-tile .odds-value {
      margin-top: 0;
      font-size: clamp(14px, 1.7vw, 17px) !important;
      line-height: 1;
    }

    #workspace .outcome-tile small {
      margin-top: 3px;
      font-size: clamp(9px, 1.05vw, 11px);
      line-height: 1.15;
      white-space: nowrap;
    }

    #workspace .outcome-tile .value-edge {
      margin-left: 2px;
      font-size: 9px;
    }

    #workspace .tile-editors {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      width: 100%;
      min-width: 0;
      gap: 4px;
      margin-top: 4px;
    }

    #workspace .tile-editors input,
    #workspace .tile-editors .percent {
      width: 100% !important;
      min-width: 0 !important;
      height: 27px !important;
      min-height: 27px !important;
      padding: 3px 2px !important;
      font-size: 11px !important;
      text-align: center;
    }

    #workspace .outcome-tile .row-share,
    #workspace .outcome-tile.live-current-sign > .row-share {
      top: 50% !important;
      right: 4px !important;
      bottom: auto !important;
      width: 31px !important;
      min-width: 31px !important;
      height: 31px !important;
      transform: translateY(-50%) !important;
      font-size: 10px !important;
    }
  }

  /* Colour cards remain complete and readable; they never become a clipped
     fixed-height box on tablet or mobile. */
  #workspace #filters {
    width: 100%;
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
    align-items: stretch;
  }

  #workspace #filters .filter {
    min-width: 0;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px !important;
    overflow: visible !important;
  }

  #workspace #filters .filter > label {
    min-width: 0;
    margin-bottom: 5px;
    line-height: 1.15;
  }

  #workspace #filters .filter-color-name,
  #workspace #filters .filter-paint-button {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  #workspace #filters .range-inputs {
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    align-items: end;
  }

  #workspace #filters .range-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }

  #workspace #filters .range-caption {
    min-width: 0;
    font-size: 8px;
    line-height: 1;
    text-align: center;
  }

  #workspace #filters .range-field input {
    width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 4px 3px !important;
    font-size: 14px !important;
    text-align: center;
  }

  #workspace #filters .filter-impact {
    min-width: 0;
    min-height: 0 !important;
    height: auto !important;
    margin-top: 6px !important;
    padding-top: 5px !important;
    display: flex !important;
    flex-direction: column;
    gap: 2px !important;
    overflow: visible !important;
    font-size: 10px;
    line-height: 1.2;
  }

  #workspace #filters .impact-stat-row {
    min-width: 0;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: baseline;
    gap: 5px;
    width: 100%;
    line-height: 1.2;
  }

  #workspace #filters .impact-stat-row > span:first-child {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #workspace #filters .impact-stat-row > strong {
    min-width: 0;
    max-width: 100%;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
    font: 500 10px/1.2 'DM Mono', monospace;
  }

  #workspace #filters .impact-stat-row .impact-relative {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #workspace #filters .more-colors-button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 34px;
  }

  /* Results and settings use the available width rather than their desktop
     minimums. Charts/tables scroll only inside their own surface. */
  #workspace .results,
  #workspace .system-panel,
  #workspace .result-summary,
  #workspace .workspace-overview-card,
  #workspace .workspace-distribution-card,
  #workspace #metrics,
  #workspace .workspace-counts,
  #workspace .workspace-additional,
  #workspace .system-panel .settings {
    min-width: 0;
    max-width: 100%;
  }

  #workspace .system-panel .settings {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)) !important;
    gap: 9px !important;
  }

  #workspace .system-panel .settings label {
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    line-height: 1.25;
  }

  #workspace .system-panel .settings input {
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    min-height: 38px !important;
    font-size: 15px !important;
  }

  #workspace .workspace-overview-card,
  #workspace .workspace-distribution-card {
    min-width: 0;
    overflow: hidden;
  }

  #workspace .workspace-distribution-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #workspace .workspace-distribution-card .interval-chart {
    min-width: 520px;
  }

  #workspace .result-table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #workspace .result-table {
    min-width: 720px;
  }

  /* The footer is allowed to wrap below the table instead of squeezing the
     totals into unreadable columns. */
  .workspace-footer {
    flex: 0 0 auto;
    min-width: 0;
    width: auto !important;
    margin: 0 var(--ss-small-gutter) var(--ss-small-gutter) !important;
    padding: 10px 12px !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .workspace-totals,
  .workspace-total,
  .workspace-total strong,
  .workspace-footer-actions {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
  }

  .workspace-total strong {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: clamp(16px, 2.7vw, 21px) !important;
  }

  .workspace-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .workspace-footer-actions .button {
    min-width: 0;
    white-space: normal;
  }

  /* Dialog content must shrink on narrow screens too. */
  .workspace-dialog {
    box-sizing: border-box;
    width: min(1000px, calc(100vw - 20px)) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    min-width: 0;
    overflow: hidden;
  }

  .workspace-dialog-content {
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .workspace-dialog .panel,
  .workspace-dialog .live-launch-box,
  .workspace-dialog .quick-view,
  .workspace-dialog .latest-goals-side,
  .workspace-dialog .rows-details {
    width: 100% !important;
    min-width: 0;
    max-width: 100% !important;
  }

  .workspace-dialog .quick-view,
  .workspace-dialog .latest-goals-side {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin: 10px 0 !important;
  }

  .workspace-dialog .live-actions,
  .workspace-dialog .archive-actions,
  .workspace-dialog .round-import-controls,
  .workspace-dialog .system-json-import {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-dialog .live-actions,
  .workspace-dialog .archive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .workspace-dialog .live-actions .button,
  .workspace-dialog .archive-actions .button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }
}

/* v290: the responsive chart uses three shared rows. Bar height is therefore
   independent of any label/value wrapping in a neighbouring interval. */

@media (min-width: 0px) {
  #workspace .workspace-distribution-card .interval-chart-legacy {
    display: none !important;
  }

  #workspace .workspace-distribution-card .stable-interval-chart {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 78px 14px 22px !important;
    gap: 0 !important;
    align-items: stretch !important;
    height: 114px !important;
    min-height: 114px !important;
    flex: none !important;
  }

  #workspace .workspace-distribution-card .stable-bars-row,
  #workspace .workspace-distribution-card .stable-labels-row,
  #workspace .workspace-distribution-card .stable-values-row {
    display: grid !important;
    grid-template-columns: repeat(11, minmax(0, 1fr)) !important;
    min-width: 0;
  }

  #workspace .workspace-distribution-card .stable-bars-row {
    height: 78px;
    align-items: stretch;
  }

  #workspace .workspace-distribution-card .stable-bar-column {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
    height: 78px;
  }

  #workspace .workspace-distribution-card .stable-bar-column .bar-zone {
    width: 100%;
    height: 78px !important;
    min-height: 78px !important;
    max-height: 78px !important;
    flex: none !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center;
    gap: 3px;
    padding: 0 2px;
    box-sizing: border-box;
  }

  #workspace .workspace-distribution-card .stable-bar-column .chart-bar {
    flex: 0 0 auto;
    align-self: flex-end;
    min-height: 2px;
  }

  #workspace .workspace-distribution-card .stable-labels-row .interval-label {
    display: block;
    height: 14px;
    min-height: 14px;
    margin: 0;
    line-height: 14px;
    text-align: center;
    white-space: nowrap;
  }

  #workspace .workspace-distribution-card .stable-values-row .interval-values {
    display: block;
    height: 22px;
    min-height: 22px;
    margin: 0;
    line-height: 10px;
    text-align: center;
    white-space: normal;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .workspace-app .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .workspace-app .topbar > div:first-child {
    grid-column: 1;
  }

  .workspace-app #workspaceRound {
    grid-column: 2;
    align-self: end;
  }

  .workspace-app .workspace-deadline {
    grid-column: 1 / -1;
    font-size: 11px;
  }

  .workspace-app .workspace-top-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-left: 0;
  }

  .workspace-app .workspace-top-actions .button {
    width: 100%;
    min-height: 36px;
    padding-inline: 7px;
  }

  .workspace-app .workspace-top-actions #reset {
    grid-column: 1 / -1;
  }

  #workspace .section-title .hint {
    flex-basis: 100%;
  }

  #workspace .workspace-match-tools {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  #workspace .workspace-palette [data-workspace-paint]:not([data-workspace-paint=""]) {
    width: 22px;
    height: 22px;
    min-height: 22px;
  }

  /* Mobile match cards: the match heading occupies one row and 1/X/2 are
     three equal columns beneath it. */
  #workspace .match-table-wrap {
    width: 100%;
    min-width: 0;
    overflow: visible !important;
  }

  #workspace .paint-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    white-space: normal !important;
  }

  #workspace .paint-table thead {
    display: none !important;
  }

  #workspace .paint-table tbody {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    gap: 9px;
  }

  #workspace .paint-table tbody > tr {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 5px;
    padding: 8px;
    border: 1px solid rgba(45, 73, 97, .82);
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(10, 27, 43, .96), rgba(7, 20, 33, .96));
    overflow: hidden;
  }

  #workspace .paint-table tbody > tr > td,
  #workspace .paint-table tbody > tr > td:not(.match-name),
  #workspace .paint-table tbody > tr > td.match-name {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    border: 0 !important;
  }

  #workspace #matches td.match-name {
    display: grid !important;
    grid-column: 1 / -1;
    grid-template-columns: 27px minmax(0, 1fr) !important;
    align-items: center;
    column-gap: 8px;
    min-height: 36px;
    padding: 0 0 7px !important;
    border-bottom: 1px solid rgba(45, 73, 97, .62) !important;
    text-align: left !important;
    overflow: visible !important;
  }

  #workspace #matches td.match-name::before {
    display: none !important;
  }

  #workspace #matches .match-meta {
    grid-column: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }

  #workspace #matches .match-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 1px solid rgba(83, 126, 163, .58);
    border-radius: 7px;
    background: rgba(7, 22, 37, .78);
    color: #9fb8cf;
    font: 700 10px/1 'DM Mono', monospace;
  }

  #workspace #matches .match-copy {
    grid-column: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  #workspace #matches .match-name-text {
    display: block;
    width: 100%;
    min-width: 0;
    font-size: clamp(12px, 3.6vw, 14px);
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-align: left !important;
  }

  #workspace #matches .match-name small {
    display: none !important;
  }

  #workspace #matches td.match-name .match-kickoff {
    margin-top: 3px;
    font-size: 9px;
    line-height: 1.1;
    text-align: left;
    white-space: nowrap;
  }

  #workspace .paint-table tbody > tr > td:not(.match-name) {
    padding: 0 !important;
  }

  #workspace .outcome-tile,
  #workspace .outcome-tile.live-current-sign,
  body.live-edit-locked #workspace .outcome-tile,
  body.live-edit-locked #workspace .outcome-tile.live-current-sign {
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100% !important;
    min-width: 0 !important;
    height: clamp(78px, 22vw, 88px) !important;
    min-height: clamp(78px, 22vw, 88px) !important;
    max-height: clamp(78px, 22vw, 88px) !important;
    padding: 6px 3px !important;
    border-radius: 9px;
    overflow: hidden !important;
    touch-action: manipulation;
  }

  #workspace .outcome-tile > b {
    display: block !important;
    position: relative;
    z-index: 4;
    margin: 0;
    font-size: 15px;
    line-height: 1;
  }

  #workspace .outcome-tile .odds-line {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-width: 0;
    margin-top: 5px;
  }

  #workspace .outcome-tile .odds-line .odds-value {
    margin-top: 0;
    font-size: clamp(12px, 3.6vw, 15px) !important;
    line-height: 1;
  }

  #workspace .outcome-tile .value-edge {
    min-width: 0;
    margin-left: 1px;
    font-size: 8px;
  }

  #workspace .outcome-tile > small {
    position: relative;
    z-index: 4;
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 4px;
    padding: 0 !important;
    font-size: clamp(8px, 2.45vw, 10px);
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
  }

  #workspace .tile-editors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 3px;
    margin-top: 4px;
  }

  #workspace .tile-editors input,
  #workspace .tile-editors .percent {
    width: 100% !important;
    min-width: 0 !important;
    height: clamp(32px, 9vw, 38px) !important;
    min-height: clamp(32px, 9vw, 38px) !important;
    padding: 4px 2px !important;
    font-size: clamp(12px, 3.8vw, 15px) !important;
    text-align: center;
  }

  /* Row percentages stay out of the flow and obey the existing visibility
     toggle. */
  #workspace .outcome-tile .row-share,
  #workspace .outcome-tile.live-current-sign > .row-share {
    position: absolute !important;
    top: auto !important;
    right: 4px !important;
    bottom: 4px !important;
    left: auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 22px !important;
    padding: 0 6px !important;
    margin: 0 !important;
    transform: none !important;
    border-radius: 999px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    display: none !important;
  }

  body.show-mobile-row-share:not(.hide-rows-on-signs) #workspace .outcome-tile .row-share,
  body.show-mobile-row-share:not(.hide-rows-on-signs) #workspace .outcome-tile.live-current-sign > .row-share {
    display: inline-flex !important;
  }

  body.hide-rows-on-signs #workspace .outcome-tile .row-share,
  body.hide-rows-on-signs #workspace .outcome-tile.live-current-sign > .row-share {
    display: none !important;
  }

  #workspace .inline-live-bar {
    min-width: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  #workspace .inline-live-bar > div {
    min-width: 0;
    flex-wrap: wrap;
    row-gap: 4px;
  }

  #workspace .inline-live-bar #inlineLiveStop {
    width: 100%;
    min-height: 38px;
  }

  #workspace .workspace-counts,
  #workspace .workspace-additional {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #workspace .workspace-overview-card,
  #workspace .workspace-distribution-card {
    padding: 9px !important;
  }

  #workspace .workspace-distribution-card .interval-chart {
    min-width: 480px;
  }

  .workspace-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-total + .workspace-total {
    padding-left: 0;
    border-left: 0;
  }

  .workspace-footer-actions {
    width: 100%;
  }

  .workspace-footer-actions .button {
    flex: 1 1 0;
  }

  .workspace-dialog {
    width: calc(100vw - 14px) !important;
    max-width: calc(100vw - 14px) !important;
    max-height: calc(100dvh - 14px) !important;
  }

  .workspace-dialog-head {
    padding: 11px 12px;
  }

  .workspace-dialog-head h2 {
    font-size: 17px;
  }

  .workspace-dialog-content {
    padding: 10px !important;
  }

  .workspace-dialog .quick-view-metrics {
    grid-template-columns: 1fr;
  }

  .workspace-dialog .live-actions,
  .workspace-dialog .archive-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-dialog .live-actions .button,
  .workspace-dialog .archive-actions .button {
    width: 100%;
  }

  .workspace-dialog .live-actions .button:last-child,
  .workspace-dialog .archive-actions .button:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .workspace-app .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-app #workspaceRound,
  .workspace-app .workspace-deadline,
  .workspace-app .workspace-top-actions {
    grid-column: 1;
  }

  .workspace-app #workspaceRound {
    width: 100%;
  }

  #workspace #filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #workspace .paint-table tbody > tr {
    gap: 4px;
    padding: 6px;
  }

  #workspace .outcome-tile,
  #workspace .outcome-tile.live-current-sign,
  body.live-edit-locked #workspace .outcome-tile,
  body.live-edit-locked #workspace .outcome-tile.live-current-sign {
    height: 78px !important;
    min-height: 78px !important;
    max-height: 78px !important;
    padding-inline: 2px !important;
  }

  #workspace .outcome-tile .odds-line .odds-value {
    font-size: 12px !important;
  }

  #workspace .outcome-tile > small {
    font-size: 8px;
  }

  #workspace .tile-editors input,
  #workspace .tile-editors .percent {
    font-size: 12px !important;
  }
}

@media (max-width: 280px) {
  #workspace #filters {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #workspace .paint-table tbody > tr {
    padding-inline: 5px;
  }
}

/* A long imported value or status message must not create a page scrollbar. */
@media (max-width: 1149px) {
  #workspace *,
  .workspace-footer *,
  .workspace-dialog * {
    min-width: 0;
  }
}

/* v301: legacy per-column rules removed. The shared three-row chart above
   handles mobile; desktop sizing lives in desktop-layout.css. */

/* v319: the factor uses the free upper-left corner on narrower tiles. */
@media (min-width:721px) and (max-width:1149px) {
  #workspace .outcome-tile .popularity-sign {
    left:6px;
    top:5px;
    bottom:auto;
    font-size:clamp(8px,.95vw,9px);
  }
}
@media (max-width:720px) {
  #workspace .outcome-tile .popularity-sign {
    left:4px;
    top:5px;
    bottom:auto;
    font-size:clamp(7px,2.1vw,8px);
  }
}
