
.chat-message-main, .glyph-main, .scan-main {
  min-width: 0;
}

.chat-message-topline, .glyph-topline, .scan-topline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-bottom: 5px;
  display: grid;
}

.chat-speaker, .glyph-player, .scan-player {
  align-items: center;
  gap: 8px;
  min-width: 0;
  display: flex;
}

.chat-speaker {
  flex-wrap: wrap;
  align-items: baseline;
}

.chat-speaker strong, .glyph-player strong, .scan-player strong {
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
}

.chat-speaker span, .glyph-player span, .scan-player span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
}

.glyph-player .hero-map-icon, .scan-player .hero-map-icon {
  width: 24px;
  height: 24px;
}

.chat-message-tags, .glyph-meta, .scan-meta {
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  display: flex;
}

.chat-message-tags {
  justify-content: flex-end;
}

.chat-message-tags span, .chat-message-tags time, .chat-message-tags em, .glyph-meta span, .glyph-meta em, .scan-meta span, .scan-meta em {
  min-height: 20px;
  color: var(--muted);
  white-space: nowrap;
  background: #ffffff05;
  border: 1px solid #ffffff17;
  border-radius: 999px;
  align-items: center;
  padding: 2px 6px;
  font-size: 11px;
  font-style: normal;
  line-height: 1;
  display: inline-flex;
}

.chat-message-tags .chat-side.radiant, .glyph-meta .glyph-side.radiant, .scan-meta .scan-side.radiant {
  color: var(--green);
  border-color: #48ad8761;
}

.chat-message-tags .chat-side.dire, .glyph-meta .glyph-side.dire, .scan-meta .scan-side.dire {
  color: var(--red);
  border-color: #d363586b;
}

.chat-message-text {
  color: var(--soft);
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.42;
}

.glyph-topline time, .scan-topline time {
  color: var(--gold-2);
  white-space: nowrap;
  padding-left: 8px;
  font-size: 13px;
  font-weight: 800;
}

@media (width <= 1180px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    overflow-x: hidden;
  }

  .topbar {
    grid-template-columns: 1fr;
    margin: -14px -14px 14px;
    padding: 16px 14px;
  }

  .brand-lockup, .topbar-actions {
    grid-column: auto;
  }

  .topbar-actions {
    justify-content: center;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .control-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .empty-workbench, .analysis-grid, .steam-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (width <= 860px) {
  body {
    font-size: 14px;
  }

  .brand-lockup {
    text-align: center;
  }

  .workspace-grid {
    flex-direction: column;
    gap: 12px;
    display: flex;
  }

  .control-rail {
    display: contents;
  }

  .match-fetch-panel {
    order: 1;
  }

  .upload-panel {
    order: 2;
  }

  .queue-panel {
    order: 3;
  }

  .workbench {
    order: 4;
  }

  .replay-events-panel {
    order: 5;
  }

  .topbar-actions, .steam-chip-grid, .steam-fields, .empty-stats {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
  }

  .tool-panel, .utility-panel, .empty-workbench, .progress-panel, .results-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 14px;
  }

  .section-heading, .results-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading.compact {
    align-items: stretch;
  }

  .section-heading.compact h3 {
    text-align: left;
  }

  .results-heading button, .topbar-link, .status-pill {
    width: 100%;
  }

  .steam-profile {
    grid-template-columns: 1fr;
  }

  .steam-profile img, .avatar-fallback {
    width: 96px;
    height: 96px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-card {
    min-height: 94px;
    padding: 14px;
  }

  .metric-card strong {
    margin-top: 12px;
    font-size: 40px;
  }

  .timeline-actions {
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }

  .timeline-actions > *, .filter-tabs {
    min-width: 0;
  }

  .timeline-wrap {
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    overflow: auto hidden;
  }

  #timeline-canvas {
    width: 620px;
    min-width: 620px;
    max-width: none;
  }

  .filter-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    display: grid;
  }

  .filter-tab, .match-filter {
    width: 100%;
    min-width: 0;
  }

  #timeline-range {
    width: 100%;
    display: block;
  }

  .report-head {
    display: none;
  }

  .report-row, .candidate-row {
    grid-template-columns: 1fr;
  }

  .confidence-card, .candidate-list {
    margin: 0 12px 12px;
  }

  .chat-message-topline, .glyph-topline, .scan-topline {
    grid-template-columns: 1fr;
  }

  .chat-message-tags {
    justify-content: flex-start;
  }
}

@media (width <= 560px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    margin: -10px -10px 10px;
  }

  .brand-mark, .brand-mark img {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }

  .brand-lockup h1 {
    font-size: 26px;
  }

  .upload-actions, .match-fetch-row, .steam-lookup-row, .fetch-status-line, .confidence-summary, .fetch-steps, .preview-header, .preview-grid, .filter-tabs {
    grid-template-columns: 1fr;
  }

  .upload-drop {
    min-height: 112px;
  }

  .upload-drop strong {
    font-size: 22px;
  }

  .empty-main h2 {
    font-size: 34px;
  }

  .metric-card strong {
    font-size: 38px;
  }

  .section-heading h2, .results-heading h2 {
    font-size: 20px;
  }

  .tool-panel, .utility-panel, .empty-workbench, .progress-panel, .results-panel {
    padding: 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-wrap {
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  #timeline-canvas {
    width: 520px;
    min-width: 520px;
    max-width: none;
  }

  .chat-message-row {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 9px;
  }

  .chat-message-avatar, .chat-message-avatar .hero-map-icon {
    width: 30px;
    height: 30px;
  }
}

@media (width <= 420px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 82px;
    padding: 12px;
  }

  .metric-card strong {
    font-size: 34px;
  }

  #timeline-canvas {
    width: 480px;
    min-width: 480px;
  }
}

@media (width <= 760px) {
  .match-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .match-header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-header-stats span {
    min-width: 0;
  }
}
