:root {
  color-scheme: dark;
  --bg: #050506;
  --surface: #090b0f;
  --surface-2: #0f1218;
  --surface-3: #151a23;
  --glass: rgba(18, 20, 25, 0.52);
  --glass-strong: rgba(24, 27, 34, 0.68);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --muted: #8b93a3;
  --soft: #d3d8e3;
  --text: #f7f8fb;
  --accent: #ffbe45;
  --accent-2: #ffd36d;
  --danger: #ff5f4f;
  --green: #45d6a6;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(
      900px 420px at 70% -12%,
      rgba(255, 255, 255, 0.075),
      transparent 62%
    ),
    radial-gradient(
      760px 360px at 18% 8%,
      rgba(255, 190, 69, 0.07),
      transparent 68%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.035),
      transparent 34%
    ),
    linear-gradient(180deg, rgba(255, 190, 69, 0.03), transparent 42%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1720px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 6, 0.86);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 0;
  background: transparent;
  overflow: visible;
}

.brand-mark img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.58));
}

.topbar-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(240, 184, 74, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.topbar-link:hover {
  border-color: rgba(240, 184, 74, 0.72);
  background: rgba(240, 184, 74, 0.1);
  color: var(--accent-2);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-top: 16px;
}

.control-rail {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding-right: 2px;
}

.workbench {
  min-width: 0;
  position: relative;
}

.workbench::before {
  content: "";
  position: fixed;
  inset: 88px 0 auto 430px;
  height: 360px;
  pointer-events: none;
  background: radial-gradient(
    620px 280px at 26% 0%,
    rgba(255, 255, 255, 0.055),
    transparent 68%
  );
  opacity: 0.72;
  z-index: -1;
}

.tool-panel,
.utility-panel,
.empty-workbench,
.progress-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.055),
      rgba(255, 255, 255, 0.018)
    ),
    var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}

.tool-panel {
  padding: 14px;
}

.utility-panel {
  padding: 14px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.058),
      rgba(255, 255, 255, 0.018)
    ),
    var(--glass-strong);
  margin-bottom: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.results-heading {
  margin-bottom: 14px;
}

.status-pill,
.ghost-button,
.primary-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  white-space: nowrap;
}

.status-pill {
  min-height: 30px;
  padding: 0 10px;
  color: var(--soft);
  font-size: 12px;
}

.status-pill.ok {
  border-color: rgba(69, 214, 166, 0.32);
  background: rgba(69, 214, 166, 0.08);
  color: var(--green);
}

.status-pill.bad {
  border-color: rgba(255, 95, 79, 0.38);
  background: rgba(255, 95, 79, 0.08);
  color: var(--danger);
}

.file-button,
.primary-button,
.ghost-button {
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    opacity 0.16s ease;
}

.primary-button {
  border-color: rgba(255, 210, 120, 0.42);
  background: linear-gradient(
    180deg,
    rgba(255, 222, 149, 0.96),
    rgba(255, 182, 62, 0.94)
  );
  color: #090909;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-2);
}

.ghost-button:hover:not(:disabled),
.file-button:hover {
  border-color: #555b68;
  background: var(--surface-3);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.file-button input {
  display: none;
}

.upload-panel.dragging {
  border-color: rgba(245, 184, 75, 0.72);
  background: rgba(245, 184, 75, 0.055);
}

.upload-drop {
  display: grid;
  gap: 6px;
  min-height: 116px;
  place-content: center;
  margin-bottom: 12px;
  border: 1px dashed #3b404b;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(3, 5, 8, 0.5);
  text-align: center;
}

.upload-drop strong {
  font-size: 20px;
}

.upload-drop span {
  color: var(--muted);
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
  margin-bottom: 12px;
}

.target-row {
  display: grid;
  gap: 7px;
}

.target-row label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.target-row label span {
  color: var(--muted);
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

input::placeholder {
  color: #666c78;
}

input:focus {
  border-color: #596071;
  background: #090a0d;
}

.file-list {
  display: grid;
  gap: 6px;
}

.file-list.empty,
.steam-result.empty,
.steam-result.loading {
  color: var(--muted);
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
}

.file-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.steam-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
}

.steam-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06),
      transparent 38%
    ),
    linear-gradient(180deg, rgba(255, 190, 69, 0.035), transparent 42%),
    rgba(4, 6, 9, 0.52);
  padding: 18px;
}

.steam-profile {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 128px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.steam-profile img,
.avatar-fallback {
  width: 112px;
  height: 112px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  object-fit: cover;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
}

.steam-avatar-wrap {
  position: relative;
}

.steam-avatar-wrap::after {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border-radius: 8px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.18),
    transparent 68%
  );
}

.steam-profile-main {
  min-width: 0;
}

.steam-profile-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.steam-state,
.steam-country,
.steam-risk {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.steam-state.online,
.steam-risk.clean {
  border-color: rgba(69, 214, 166, 0.34);
  background: rgba(69, 214, 166, 0.08);
  color: var(--green);
}

.steam-risk.warning {
  border-color: rgba(245, 184, 75, 0.38);
  background: rgba(245, 184, 75, 0.09);
  color: var(--accent-2);
}

.steam-profile h3 {
  overflow-wrap: anywhere;
  margin-bottom: 6px;
  font-size: 32px;
  line-height: 1;
}

.steam-profile p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 15px;
}

.steam-profile a {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.steam-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.steam-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 12px;
}

.steam-data-section {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(5, 5, 6, 0.28);
  padding: 0;
  overflow: hidden;
}

.steam-section-title {
  margin-bottom: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.steam-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.steam-field {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  background: rgba(9, 11, 15, 0.62);
}

.steam-chip-grid .steam-field {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.02)
    ),
    rgba(9, 11, 15, 0.56);
}

.steam-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.steam-field strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--soft);
  font-size: 14px;
}

.raw-json {
  margin-top: 10px;
  color: var(--muted);
}

.raw-json summary {
  cursor: pointer;
  font-weight: 800;
}

.raw-json pre {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050506;
  padding: 10px;
  color: var(--soft);
  font-size: 12px;
}

/* Glass pass */
.tool-panel,
.utility-panel,
.empty-workbench,
.progress-panel,
.results-panel,
.metric-card,
.chart-card,
.match-card,
.report-table,
.candidate-list,
.steam-result,
.steam-data-section,
.steam-chip-grid .steam-field,
.file-item,
.upload-drop,
.mini-stat,
input,
.primary-button,
.ghost-button,
.file-button,
.status-pill {
  border-radius: 10px;
}

.empty-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 14px;
  min-height: 420px;
  padding: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.055),
      transparent 32%
    ),
    var(--glass-strong);
}

.empty-workbench.hidden {
  display: none;
}

.empty-main {
  align-self: start;
}

.empty-main h2 {
  max-width: 680px;
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1;
}

.empty-copy {
  max-width: 620px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.empty-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 620px;
}

.empty-stats div {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(5, 5, 6, 0.54);
}

.empty-stats span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.empty-stats strong {
  color: var(--soft);
}

.empty-preview {
  align-self: stretch;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #07080a;
}

.preview-header {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.45fr;
  gap: 10px;
  margin-bottom: 26px;
}

.preview-header span,
.preview-line,
.preview-grid span {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, #171a21, #222631);
}

.preview-header span {
  height: 42px;
}

.preview-line {
  width: 62%;
  height: 12px;
  margin-bottom: 12px;
}

.preview-line.wide {
  width: 88%;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 30px;
}

.preview-grid span {
  height: 90px;
}

.progress-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.progress-panel.hidden,
.results-panel.hidden {
  display: none;
}

.progress-panel h2 {
  margin-bottom: 4px;
}

.progress-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.pulse-loader {
  width: 34px;
  height: 34px;
  border: 2px solid #323640;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.results-panel {
  padding: 16px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.055),
      transparent 38%
    ),
    linear-gradient(180deg, rgba(255, 190, 69, 0.035), transparent 42%),
    var(--glass-strong);
}

.utility-panel,
.results-panel,
.tool-panel {
  position: relative;
}

.utility-panel::before,
.results-panel::before,
.tool-panel::before {
  display: none;
}

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

.metric-card,
.chart-card,
.match-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
}

.metric-card {
  display: grid;
  min-height: 90px;
  align-content: space-between;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    var(--surface-2);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  color: var(--accent-2);
  font-size: 34px;
  line-height: 1;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 360px;
  gap: 10px;
  margin-top: 10px;
}

.chart-card {
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--surface-2);
}

canvas {
  display: block;
  width: 100%;
  height: 260px;
  border-radius: 8px;
  background: #010102;
}

.timeline-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid rgba(240, 184, 74, 0.18);
  border-radius: 5px;
  background: #010102;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

#timeline-canvas {
  min-width: 900px;
}

.timeline-tooltip {
  position: fixed;
  z-index: 1000;
  width: 280px;
  max-height: min(420px, 70vh);
  overflow: auto;
  padding: 12px;
  border: 1px solid #424754;
  border-radius: 5px;
  background: #050506;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

.timeline-tooltip.hidden {
  display: none;
}

.tooltip-title {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 900;
}

.tooltip-candidates {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--accent-2);
}

.tooltip-id {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.tooltip-id span {
  color: var(--soft);
  font-weight: 900;
}

.rank-list {
  display: grid;
  gap: 4px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row span {
  color: var(--muted);
  font-size: 12px;
}

.rank-match {
  display: block;
  margin-top: 4px;
  color: var(--accent-2) !important;
  font-size: 11px !important;
  font-weight: 800;
}

.rank-count {
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 900;
}

.match-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.match-card {
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent),
    var(--surface-2);
}

.match-card.failed {
  border-color: rgba(255, 95, 79, 0.42);
}

.match-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.match-name {
  font-size: 16px;
  font-weight: 900;
}

.match-meta {
  color: var(--muted);
  font-size: 12px;
}

.match-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-stat {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 9px;
  color: var(--soft);
  font-size: 12px;
}

.report-table {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #08090b;
}

.report-table.empty {
  padding: 12px;
  color: var(--muted);
}

.report-head,
.report-row {
  display: grid;
  grid-template-columns: 78px minmax(220px, 1fr) minmax(220px, 1fr) 100px;
  gap: 14px;
  align-items: center;
}

.report-head {
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #070a0f;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.report-row {
  min-height: 64px;
  padding: 10px 12px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.008);
}

.report-block {
  border-top: 1px solid rgba(36, 39, 48, 0.72);
}

.report-block:first-of-type {
  border-top: 0;
}

.report-block.selected {
  background: rgba(245, 184, 75, 0.065);
  outline: 1px solid rgba(245, 184, 75, 0.46);
  outline-offset: -1px;
}

.time-cell {
  color: var(--accent-2);
  font-size: 16px;
  font-weight: 900;
}

.id-stack {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.team-friendly,
.team-enemy {
  font-weight: 900;
  letter-spacing: 0.02em;
}

.team-friendly {
  color: var(--green);
}

.team-enemy {
  color: var(--danger);
}

.candidate-list {
  margin: 0 12px 12px 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: linear-gradient(
      135deg,
      rgba(255, 190, 69, 0.045),
      transparent 40%
    ),
    #050506;
}

.candidate-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.candidate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 54px;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  color: var(--soft);
}

.candidate-row + .candidate-row {
  border-top: 1px solid rgba(36, 39, 48, 0.72);
}

.candidate-row.selected {
  color: var(--text);
}

.candidate-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #272a33;
}

.candidate-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.candidate-row strong {
  color: var(--accent-2);
  font-size: 18px;
  text-align: right;
}

.error-text {
  color: var(--danger);
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workbench::before {
    inset: 86px 0 auto 0;
  }

  .control-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

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

  .steam-chip-grid,
  .steam-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .empty-workbench {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 10px;
  }

  .topbar,
  .brand-lockup,
  .match-top {
    align-items: flex-start;
  }

  .topbar,
  .control-rail,
  .empty-stats,
  .preview-header,
  .preview-grid,
  .analysis-grid,
  .metric-grid,
  .steam-fields,
  .steam-chip-grid,
  .steam-section-grid,
  .report-head,
  .report-row,
  .candidate-row {
    grid-template-columns: 1fr;
  }

  .steam-profile {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .steam-profile img,
  .avatar-fallback {
    width: 84px;
    height: 84px;
  }

  .steam-profile h3 {
    font-size: 24px;
  }

  .topbar {
    display: grid;
    gap: 10px;
  }
  .topbar-actions {
    justify-content: center;
    width: 100%;
  }

  .topbar-link,
  .status-pill {
    min-height: 32px;
  }

  .metric-card {
    min-height: 74px;
  }

  .candidate-list {
    margin-left: 12px;
  }

  .report-head {
    display: none;
  }
}

/* Black minimal theme override */
:root {
  --bg: #000000;
  --surface: #050506;
  --surface-2: #0a0b0d;
  --surface-3: #101114;
  --glass: #060708;
  --glass-strong: #08090b;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --muted: #858b96;
  --soft: #d4d7dd;
  --text: #f7f7f8;
  --accent: #f0b84a;
  --accent-2: #ffd070;
  --shadow: none;
}

html,
body {
  background: #000;
}

body {
  background: #000;
}

body::before,
.workbench::before,
.steam-avatar-wrap::after,
.utility-panel::before,
.results-panel::before,
.tool-panel::before {
  display: none;
}

.topbar {
  background: #000;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
}

.tool-panel,
.utility-panel,
.empty-workbench,
.progress-panel,
.results-panel,
.metric-card,
.chart-card,
.match-card,
.steam-result,
.steam-data-section {
  background: #07080a;
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: none;
  backdrop-filter: none;
}

.utility-panel,
.results-panel,
.empty-workbench {
  background: #07080a;
}

.upload-drop,
.timeline-wrap,
.report-table,
.candidate-list,
.raw-json pre,
input {
  background: #020203;
}

.file-item,
.mini-stat,
.steam-field,
.metric-card,
.chart-card,
.match-card {
  background: #0b0c0f;
}

.steam-chip-grid .steam-field {
  border-color: rgba(240, 184, 74, 0.18);
  background: #0b0a07;
}

.preview-header span,
.preview-line,
.preview-grid span {
  background: #151820;
}

.primary-button {
  background: rgba(240, 184, 74, 0.08);
  border-color: rgba(240, 184, 74, 0.62);
  color: var(--accent-2);
}

.primary-button:hover:not(:disabled) {
  background: rgba(240, 184, 74, 0.16);
  border-color: var(--accent-2);
  color: #ffe3a3;
}

.file-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(240, 184, 74, 0.32);
  color: var(--soft);
}

.file-button:hover,
.ghost-button:hover:not(:disabled) {
  background: rgba(240, 184, 74, 0.08);
  border-color: rgba(240, 184, 74, 0.62);
  color: var(--accent-2);
}

.status-pill.ok {
  border-color: rgba(240, 184, 74, 0.44);
  background: rgba(240, 184, 74, 0.06);
  color: var(--accent-2);
}

body {
  background: linear-gradient(180deg, #050505 0, #000 180px), #000;
}

.app-shell {
  width: min(1760px, calc(100vw - 48px));
}

.topbar {
  min-height: 78px;
  border-bottom: 1px solid rgba(240, 184, 74, 0.16);
}

.brand-lockup {
  gap: 16px;
}

.brand-mark {
  width: 68px;
  height: 68px;
}

.brand-mark img {
  width: 66px;
  height: 66px;
}

h1 {
  font-size: 28px;
}

.eyebrow {
  color: #aa8b4d;
  letter-spacing: 0.18em;
}

.workspace-grid {
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 20px;
  padding-top: 20px;
}

.tool-panel,
.utility-panel,
.empty-workbench,
.progress-panel,
.results-panel {
  position: relative;
  border-color: rgba(240, 184, 74, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent),
    #050506;
}

.tool-panel::after,
.utility-panel::after,
.results-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 1px solid rgba(255, 220, 150, 0.16);
}

.section-heading h2,
.results-heading h2 {
  color: #fff8e9;
}

.upload-drop {
  min-height: 150px;
  border-color: rgba(240, 184, 74, 0.28);
  background: repeating-linear-gradient(
      135deg,
      rgba(240, 184, 74, 0.035) 0 1px,
      transparent 1px 12px
    ),
    #020203;
}

.upload-drop strong {
  color: #fff8e9;
  font-size: 26px;
}

input {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.12);
}

input:focus {
  border-color: rgba(240, 184, 74, 0.68);
  box-shadow: 0 0 0 3px rgba(240, 184, 74, 0.08);
}

.primary-button,
.file-button,
.ghost-button {
  min-height: 44px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.steam-result {
  border-color: rgba(240, 184, 74, 0.2);
  background: #030304;
}

.steam-profile {
  border-bottom-color: rgba(240, 184, 74, 0.16);
}

.steam-profile img,
.avatar-fallback {
  border-color: rgba(240, 184, 74, 0.32);
}

.steam-profile h3 {
  color: #fff8e9;
}

.steam-profile a,
.rank-count,
.time-cell,
.candidate-row strong,
.metric-card strong {
  color: var(--accent-2);
}

.steam-state,
.steam-country,
.steam-risk {
  border-color: rgba(240, 184, 74, 0.28);
  background: rgba(240, 184, 74, 0.055);
  color: #f5d58f;
}

.steam-data-section,
.report-table,
.timeline-wrap,
.candidate-list {
  border-color: rgba(240, 184, 74, 0.14);
}

.steam-section-title,
.report-head,
.candidate-title {
  color: #b89755;
  background: rgba(240, 184, 74, 0.035);
}

.metric-card,
.chart-card,
.match-card,
.file-item,
.mini-stat {
  border-color: rgba(255, 255, 255, 0.09);
  background: #08090b;
}

.metric-card {
  min-height: 108px;
}

.metric-card span,
.rank-row span,
.match-meta,
.steam-field span,
.id-stack {
  color: #8f96a3;
}

.metric-card strong {
  font-size: 42px;
}

.analysis-grid {
  gap: 14px;
}

.report-head {
  min-height: 44px;
}

.report-row {
  min-height: 72px;
}

.report-block.selected {
  background: rgba(240, 184, 74, 0.08);
}

.candidate-meter {
  background: #1b1b1d;
}

.candidate-meter span {
  background: linear-gradient(90deg, #9f6b16, var(--accent-2));
}

/* Deep black panel override */
.tool-panel,
.utility-panel,
.empty-workbench,
.progress-panel,
.results-panel,
.metric-card,
.chart-card,
.match-card,
.steam-result,
.steam-data-section,
.file-item,
.mini-stat,
.report-table,
.candidate-list,
.steam-field,
.raw-json pre,
input {
  background: #030304;
  border-color: rgba(240, 184, 74, 0.14);
}

.steam-chip-grid .steam-field,
.upload-drop,
.timeline-wrap {
  background: #010102;
  border-color: rgba(240, 184, 74, 0.18);
}

.report-head,
.steam-section-title {
  background: #050505;
}

.report-row,
.candidate-row {
  background: #030304;
}

.preview-header span,
.preview-line,
.preview-grid span {
  background: #0b0c0f;
}

/* Fix top overscroll/header color and remove nested rail scrollbar */
html,
body {
  background: #000 !important;
  overscroll-behavior-y: none;
}

body {
  background-color: #000 !important;
}

.app-shell {
  background: #000;
  padding-top: 0;
}

.topbar {
  top: 0;
  margin-top: 0;
  background: #000 !important;
  border-bottom-color: rgba(240, 184, 74, 0.18);
  backdrop-filter: none !important;
}

.control-rail {
  max-height: none;
  overflow: visible;
}

/* OpenDota match fetch */
.match-fetch-panel {
  display: grid;
  gap: 12px;
}

.match-fetch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
}

.tool-note {
  margin: 0;
  color: #8f96a3;
  font-size: 12px;
  line-height: 1.45;
}

.fetch-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.fetch-steps span {
  min-height: 28px;
  border: 1px solid rgba(240, 184, 74, 0.14);
  border-radius: 5px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.36);
  color: #777d88;
  font-size: 11px;
  font-weight: 900;
}

.fetch-steps span.done {
  border-color: rgba(69, 214, 166, 0.34);
  color: #45d6a6;
}

.fetch-steps span.active {
  border-color: rgba(255, 208, 112, 0.72);
  color: #ffd070;
}

.fetch-steps span.failed {
  border-color: rgba(255, 95, 79, 0.45);
  color: #ff6b5f;
}

/* Timeline filters, confidence, and hero icon polish */
.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.filter-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-tab,
.match-filter {
  min-height: 32px;
  border: 1px solid rgba(240, 184, 74, 0.22);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.42);
  color: #c9c2b4;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.filter-tab {
  padding: 0 10px;
  cursor: pointer;
}

.filter-tab:hover,
.filter-tab.active,
.match-filter:focus {
  border-color: rgba(255, 208, 112, 0.72);
  color: #ffd070;
  outline: none;
}

.match-filter {
  max-width: 190px;
  padding: 0 10px;
}

.rank-player,
.player-identity,
.candidate-player {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.player-identity > span:last-child,
.candidate-player > span:last-child,
.rank-player > div {
  min-width: 0;
}

.player-identity strong,
.candidate-player strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-identity small,
.candidate-player small {
  display: block;
  margin-top: 2px;
  color: #8f96a3;
  font-size: 11px;
}

.hero-map-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: cover;
  image-rendering: auto;
}

.hero-map-icon.empty {
  background: transparent;
}

.confidence-card {
  margin: 0 12px 12px 104px;
  padding: 12px;
  border: 1px solid rgba(240, 184, 74, 0.14);
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(240, 184, 74, 0.06), transparent 44%),
    #020203;
}

.confidence-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.confidence-summary span,
.confidence-summary small {
  display: block;
  color: #8f96a3;
  font-size: 11px;
}

.confidence-summary strong {
  display: block;
  margin: 4px 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confidence-score {
  color: #ffd070;
  font-size: 28px;
  font-weight: 1000;
  line-height: 1;
}

.confidence-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.confidence-detail span {
  border: 1px solid rgba(240, 184, 74, 0.13);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.38);
  color: #c9c2b4;
  font-size: 11px;
  font-weight: 800;
}

.tooltip-confidence {
  margin-top: 8px;
  color: #ffd070;
  font-weight: 900;
}

@media (max-width: 760px) {
  .timeline-actions {
    justify-content: flex-start;
  }

  .filter-tabs,
  .match-filter {
    width: 100%;
  }

  .filter-tab {
    flex: 1 1 auto;
  }

  .confidence-card,
  .candidate-list {
    margin-left: 12px;
  }
}

/* Mobile viewport fit */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(720px, calc(100% - 24px));
    max-width: 720px;
    margin-inline: auto;
    padding-inline: 0;
  }

  .workspace-grid,
  .control-rail,
  .analysis-grid,
  .metric-grid,
  .steam-fields,
  .steam-chip-grid,
  .steam-section-grid,
  .preview-header,
  .preview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }

  .brand-lockup,
  .topbar-actions {
    grid-column: auto;
    min-width: 0;
  }

  .brand-lockup {
    justify-content: center;
  }

  .topbar-actions {
    justify-content: center;
  }

  .workspace-grid,
  .control-rail,
  .workbench,
  .tool-panel,
  .utility-panel,
  .empty-workbench,
  .progress-panel,
  .results-panel,
  .chart-card,
  .match-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .section-heading,
  .section-heading.compact,
  .match-top,
  .steam-lookup-row,
  .match-fetch-row,
  .upload-actions,
  .fetch-steps,
  .confidence-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: calc(100% - 24px);
    max-width: none;
    padding-inline: 0;
  }

  .topbar {
    padding-inline: 0;
  }

  .brand-mark,
  .brand-mark img {
    width: 54px;
    height: 54px;
  }

  h1 {
    font-size: 24px;
  }

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

  .topbar-link,
  .status-pill {
    width: 100%;
    padding-inline: 8px;
  }

  .status-pill {
    grid-column: 1 / -1;
  }

  .upload-actions,
  .match-fetch-row,
  .steam-lookup-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-panel,
  .utility-panel,
  .empty-workbench,
  .progress-panel,
  .results-panel {
    padding-inline: 12px;
  }

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

  .upload-drop {
    min-height: 128px;
  }

  .upload-drop strong {
    font-size: 24px;
  }
}

/* Hard mobile layout guard: keep the workbench below controls, never beside them. */
@media screen and (max-width: 900px) {
  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
  }

  .app-shell {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 12px 36px !important;
    overflow: visible !important;
  }

  .topbar,
  .workspace-grid,
  .control-rail,
  .workbench,
  .analysis-grid,
  .metric-grid,
  .steam-fields,
  .steam-chip-grid,
  .steam-section-grid,
  .preview-header,
  .preview-grid,
  .report-head,
  .report-row,
  .candidate-row,
  .steam-lookup-row,
  .match-fetch-row,
  .upload-actions,
  .fetch-steps {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .control-rail {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  .workbench {
    position: static !important;
  }

  .tool-panel,
  .utility-panel,
  .empty-workbench,
  .progress-panel,
  .results-panel,
  .chart-card,
  .match-card,
  .steam-result,
  input,
  button,
  .file-button,
  .primary-button,
  .ghost-button {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .topbar {
    position: static !important;
  }

  .brand-lockup,
  .topbar-actions {
    grid-column: auto !important;
  }

  .timeline-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  #timeline-canvas {
    width: 900px !important;
    max-width: none !important;
  }
}
