/* Live workspace tracks are independent of feed contents and the active language.
   These rules affect the arena only; the focused trading workspace keeps its own grid. */
.arena-shell {
  --arena-market-height: 42rem;
  --arena-lower-height: 20rem;
  --arena-standings-height: 32rem;
  --arena-chat-height: 44rem;
}

.arena-shell .market-panel,
.arena-shell .tape-panel,
.arena-shell .standings-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.arena-shell .market-panel { height: var(--arena-market-height); }
.arena-shell .tape-panel { height: var(--arena-lower-height); }
.arena-shell .standings-panel { height: var(--arena-standings-height); }
.arena-shell .bulletin-panel {
  display: flex;
  flex-direction: column;
  height: var(--arena-lower-height);
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.arena-shell .bulletin-panel .panel-heading { flex-wrap: wrap; }

.arena-shell .market-header,
.arena-shell .chart-toolbar,
.arena-shell .chart-legend,
.arena-shell .market-bottom,
.arena-shell .panel-heading,
.arena-shell .standings-meta,
.arena-shell .standings-clear,
.arena-shell .panel-footnote { flex: none; }

.arena-shell .chart-root {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
.arena-shell .chart-root .arena-chart { min-height: 0; }
.arena-shell .chart-root .arena-chart__canvas { min-height: 220px; }
.arena-shell .standings-scroll,
.arena-shell .tape-scroll {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.arena-shell .tape-scroll thead { position: sticky; top: 0; z-index: 1; }

.arena-shell .chat-column,
.arena-shell .chat-column > #chat-root,
.arena-shell .chat-column .arena-chat { min-height: 0; }
.arena-shell .chat-column > #chat-root { display: flex; }
.arena-shell .chat-column .arena-chat {
  flex: 1 1 0;
  height: 100%;
  min-height: 0;
}
.arena-shell .arena-chat__header,
.arena-shell .arena-chat__tabs,
.arena-shell .arena-chat__status { flex: none; }
.arena-shell .arena-chat__panel { min-height: 0; }
.arena-shell .arena-chat__body { min-height: 0; }
.arena-shell .arena-chat__messages { overscroll-behavior: contain; }
.arena-shell .arena-chat__composer { flex-shrink: 0; }

@media (min-width: 1001px) {
  .arena-shell .arena-grid {
    grid-template-rows: var(--arena-market-height) var(--arena-lower-height);
    min-height: 0;
    align-items: stretch;
  }
  .arena-shell .standings-column,
  .arena-shell .market-column {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / span 2;
    gap: inherit;
    min-height: 0;
  }
  .arena-shell .standings-panel,
  .arena-shell .market-panel,
  .arena-shell .tape-panel,
  .arena-shell .bulletin-panel { height: 100%; }
  .arena-shell .chat-column { grid-row: 1 / span 2; }
  .arena-shell .chat-column > #chat-root { height: 100%; }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .arena-shell .arena-grid {
    grid-template-rows: calc(var(--arena-market-height) + var(--arena-lower-height) + 12px) auto;
    align-items: start;
    gap: 12px;
  }
  .arena-shell .market-column { min-height: 0; gap: 12px; }
  .arena-shell .market-panel,
  .arena-shell .tape-panel { flex: none; }
  .arena-shell .chat-column {
    align-self: stretch;
    height: calc(var(--arena-market-height) + var(--arena-lower-height) + 12px);
  }
  .arena-shell .chat-column > #chat-root { height: 100%; }
  .arena-shell .standings-column { align-items: start; }
}

@media (max-width: 760px) {
  .arena-shell {
    --arena-market-height: 40rem;
    --arena-lower-height: 22rem;
    --arena-standings-height: 32rem;
  }
  .arena-shell .market-column,
  .arena-shell .standings-column { gap: 16px; align-items: stretch; }
  .arena-shell .market-panel,
  .arena-shell .tape-panel,
  .arena-shell .standings-panel,
  .arena-shell .bulletin-panel { flex: none; }
  .arena-shell .chat-column > #chat-root {
    height: var(--arena-chat-height);
    min-height: 0;
  }
  .arena-shell .market-bottom { min-height: 3rem; }
  .arena-shell .chart-root .arena-chart__canvas { min-height: 200px; }
}
