:root {
  color-scheme: light;
  --page: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --ink: #17212b;
  --muted: #68737f;
  --line: #d8dee5;
  --line-strong: #b9c2cc;
  --nav: #17202a;
  --green: #19704a;
  --green-dark: #105a3a;
  --blue: #2667a8;
  --amber: #a86306;
  --red: #b23a38;
  --shadow: 0 2px 10px rgba(23, 33, 43, 0.08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

body[data-portal]:not(.portal-ready) > .topbar,
body[data-portal]:not(.portal-ready) > .portal-nav,
body[data-portal]:not(.portal-ready) > main {
  visibility: hidden;
}

.portal-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.portal-account span {
  color: #d8e0e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-account .secondary {
  min-height: 34px;
  padding: 7px 13px;
  border-color: #596878;
  background: transparent;
  color: #ffffff;
}

.portal-nav {
  width: 100%;
  min-height: 48px;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.portal-nav-button {
  min-width: max-content;
  padding: 0 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

.portal-nav-button:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.portal-nav-button.active {
  color: var(--green-dark);
  border-bottom-color: var(--green);
}

.portal-page {
  min-height: calc(100vh - 121px);
  padding: 22px 24px 30px;
  background: var(--surface);
}

.portal-page-heading {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.portal-page-heading h2 {
  font-size: 18px;
}

.portal-page-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.overview-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.user-overview-metrics {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.user-overview-metrics strong.metric-positive {
  color: var(--green-dark);
}

.user-overview-metrics strong.metric-negative {
  color: var(--red);
}

.overview-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.overview-chart-card {
  position: relative;
  min-width: 0;
  padding: 14px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.overview-chart-card-wide {
  grid-column: 1 / -1;
}

.overview-trading-heading {
  align-items: center;
}

.overview-trading-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.overview-range-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: var(--surface-muted);
  border-radius: 4px;
}

.overview-range-buttons button {
  height: 26px;
  padding: 3px 8px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 11px;
}

.overview-range-buttons button.active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.overview-trading-chart {
  height: 420px;
}

@media (max-width: 680px) {
  .overview-trading-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-trading-tools {
    width: 100%;
    justify-content: space-between;
  }

  .overview-trading-chart {
    height: 360px;
  }
}

.overview-chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.overview-chart-heading h3 {
  font-size: 14px;
}

.overview-chart-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.chart-legend::before {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.legend-turnover { color: #287d59; }
.legend-profit { color: #bd6b28; }
.legend-rtp { color: #5368b8; }
.legend-average { color: #2f8f6b; }
.legend-average::before { height: 0; border-top: 3px dashed currentColor; border-radius: 0; background: none; }
.chart-legend-group { display: inline-flex; align-items: center; gap: 10px; }

.overview-chart {
  display: block;
  width: 100%;
  height: 220px;
  margin-top: 8px;
  cursor: crosshair;
  touch-action: manipulation;
}

.overview-chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 132px;
  padding: 7px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 5px 14px rgba(25, 35, 45, 0.14);
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

.overview-chart-tooltip[hidden] {
  display: none;
}

.overview-chart-tooltip strong,
.overview-chart-tooltip span {
  display: block;
  font-size: 11px;
  letter-spacing: 0;
}

.overview-chart-tooltip .overview-trading-tooltip-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 12px;
  margin-top: 5px;
}

.overview-trading-tooltip-grid b,
.overview-trading-tooltip-grid em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

.overview-trading-tooltip-grid em {
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.overview-chart-tooltip span {
  margin-top: 3px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.overview-chart-tooltip.pinned {
  border-color: #9bc9ae;
}

.overview-games {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.overview-game-table-wrap {
  max-height: 280px;
}

.overview-metrics,
.api-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.api-summary {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.overview-metrics > div,
.api-summary > div {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.overview-metrics > div:last-child,
.api-summary > div:last-child {
  border-right: 0;
}

.overview-metrics span,
.api-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.overview-metrics strong,
.api-summary strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.api-summary strong {
  font-size: 15px;
}

.management-band {
  margin-top: 20px;
  padding: 16px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.inline-management-form,
.user-create-form {
  display: grid;
  align-items: end;
  gap: 12px;
}

.inline-management-form {
  grid-template-columns: minmax(220px, 1fr) minmax(240px, auto) auto;
}

.api-key-scope-fieldset {
  display: flex;
	flex-wrap: wrap;
  min-width: 240px;
  min-height: 40px;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.api-key-scope-fieldset legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.api-key-scope-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.user-create-form {
  grid-template-columns: minmax(180px, 1fr) minmax(200px, 1fr) 150px auto;
}

.inline-management-form button,
.user-create-form button {
  min-height: 40px;
}

.one-time-secret {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-left: 3px solid var(--amber);
  background: #fff8e8;
}

.one-time-secret span {
  color: var(--muted);
  font-size: 12px;
}

.one-time-secret strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.portal-table-wrap {
  margin-top: 18px;
  max-height: calc(100vh - 300px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
}

.admin-rtp-breakdown {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rtp-breakdown-heading {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.rtp-breakdown-actions {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.rtp-sort-field {
  min-width: 108px;
}

.rtp-sort-field select {
  width: 100%;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.rtp-breakdown-heading h3 {
  font-size: 14px;
}

.rtp-breakdown-heading p,
.rtp-breakdown-heading > span,
.rtp-breakdown-actions > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.rtp-game-table-wrap {
  position: relative;
  min-width: 0;
  max-height: 230px;
  margin-top: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
}

.admin-rtp-table-wrap {
  max-height: calc(100vh - 430px);
  min-height: 130px;
}

.rtp-game-table {
  min-width: 650px;
}

.rtp-game-table td:first-child strong,
.rtp-game-table td:first-child span {
  display: block;
}

.rtp-game-table td:first-child strong {
  font-size: 12px;
}

.rtp-game-table td:first-child span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.management-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.management-table th,
.management-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.management-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.management-table tbody tr:last-child td {
  border-bottom: 0;
}

.management-table .row-actions {
  width: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: normal;
}

.management-table .row-actions button {
  width: auto;
  min-width: 72px;
}

.compact-action {
  min-height: 30px;
  padding: 5px 9px;
}

.system-log-table td:last-child {
  min-width: 280px;
  max-width: 720px;
  overflow-wrap: anywhere;
}

.management-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.management-dialog::backdrop {
  background: rgba(23, 33, 43, 0.42);
}

.management-dialog .field {
  margin-top: 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #e9edf1;
}

.login-shell {
  width: min(420px, 100%);
  margin: 0;
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading h1 {
  font-size: 22px;
}

.login-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 10px;
}

.login-heading p {
  margin-top: 5px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-error {
  min-height: 18px;
}

.login-button {
  width: 100%;
  min-height: 42px;
}

@media (max-width: 980px) {
  .overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-metrics > div:nth-child(3n) {
    border-right: 0;
  }

  .overview-metrics > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .user-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .portal-account {
    width: 100%;
    justify-content: space-between;
  }

  .portal-nav {
    padding: 0 12px;
    flex-wrap: wrap;
    overflow-x: visible;
    min-height: 48px;
  }

  .portal-nav-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
    white-space: nowrap;
  }

  .portal-page {
    min-height: calc(100vh - 169px);
    padding: 18px 12px 24px;
  }

  .overview-metrics,
  .api-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-metrics > div,
  .overview-metrics > div:nth-child(3n),
  .api-summary > div {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .overview-metrics > div:nth-child(2n),
  .api-summary > div:nth-child(2n) {
    border-right: 0;
  }

  .overview-metrics > div:nth-last-child(-n + 2),
  .api-summary > div:last-child {
    border-bottom: 0;
  }

  .api-summary > div:last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .inline-management-form,
  .user-create-form {
    grid-template-columns: 1fr;
  }

  .one-time-secret {
    grid-template-columns: 1fr;
  }

  .one-time-secret button {
    width: 100%;
  }

  .login-page {
    padding: 14px;
  }

  .login-panel {
    padding: 22px 18px;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  min-height: 70px;
  padding: 14px 24px;
  background: var(--nav);
  color: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 3px solid #2f8b62;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
}

.provider-field {
  width: 150px;
  flex: 0 0 150px;
}

.provider-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.provider-band > div {
  min-width: 0;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
}

.provider-band > div:last-child {
  border-right: 0;
}

.provider-band span,
.provider-band small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.provider-band strong {
  display: block;
  margin: 5px 0;
  font-size: 15px;
}

.provider-ready {
  color: var(--green-dark) !important;
  font-weight: 700;
}

.api-docs-entry {
  display: grid;
  grid-template-columns: minmax(250px, 1.1fr) minmax(210px, 0.9fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #b9d5c5;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: #f5faf7;
}

.api-docs-entry-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-docs-entry-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9fc4ae;
  border-radius: 5px;
  color: var(--green-dark);
  background: #e5f2ea;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.api-docs-entry-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.api-docs-entry-title-row h3 {
  font-size: 15px;
}

.api-docs-entry-title-row span {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}

.api-docs-entry-main p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.api-docs-entry-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 11px;
}

.api-docs-entry-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.api-docs-entry-meta span::before {
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: #77a88d;
}

.api-docs-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.api-docs-entry-actions a {
  min-height: 34px;
  font-size: 12px;
}

.api-docs-entry-actions .primary {
  padding: 0 14px;
}

.api-docs-entry-actions .primary span {
  margin-left: 7px;
  font-size: 14px;
  line-height: 1;
}

.api-docs-entry-actions .secondary {
  padding: 0 11px;
}

.provider-reserved {
  color: var(--amber);
  font-weight: 700;
}

.settings-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.settings-card .section-heading {
  margin-bottom: 12px;
}

.settings-card h3 {
  margin: 0;
  font-size: 15px;
}

.settings-card .section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.inline-settings-form {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) 1fr;
  align-items: end;
  gap: 12px;
}

.inline-settings-form .form-actions {
  margin: 0;
}

@media (max-width: 700px) {
  .inline-settings-form {
    grid-template-columns: 1fr;
  }
}

.key-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  z-index: 2;
  width: 7px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer:hover,
.column-resizer:active {
  background: var(--green);
}

.proxy-pool-table {
  min-width: 1080px;
  table-layout: fixed;
}

.proxy-pool-table th,
.proxy-pool-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-pool-table th:nth-child(1),
.proxy-pool-table td:nth-child(1) { width: 170px; }
.proxy-pool-table th:nth-child(2),
.proxy-pool-table td:nth-child(2) { width: 92px; }
.proxy-pool-table th:nth-child(3),
.proxy-pool-table td:nth-child(3) { width: 120px; }
.proxy-pool-table th:nth-child(4),
.proxy-pool-table td:nth-child(4) { width: 220px; }
.proxy-pool-table th:nth-child(5),
.proxy-pool-table td:nth-child(5) { width: 92px; }
.proxy-pool-table th:nth-child(6),
.proxy-pool-table td:nth-child(6) { width: 82px; }
.proxy-pool-table th:nth-child(7),
.proxy-pool-table td:nth-child(7) { width: 82px; }
.proxy-pool-table th:nth-child(8),
.proxy-pool-table td:nth-child(8) { width: 110px; }
.proxy-pool-table th:nth-child(9),
.proxy-pool-table td:nth-child(9) { width: 150px; }
.proxy-pool-table th:nth-child(10),
.proxy-pool-table td:nth-child(10) { width: 230px; }

.key-status-active {
  color: var(--green-dark);
  background: #eaf5ef;
}

.key-status-revoked {
  color: var(--red);
  background: #fff0ef;
}

.key-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.key-list-heading h3 {
  font-size: 15px;
}

.key-visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.key-visibility-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}

.api-contract-band {
  margin-top: 20px;
}

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

.api-contract-heading h3 {
  font-size: 15px;
}

.api-contract-heading p,
.api-contract-heading > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.api-contract-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.api-contract-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.docs-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  white-space: nowrap;
  font-size: 12px;
}

.api-contract-table code {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

h1 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

.topbar p {
  margin-top: 4px;
  color: #aeb8c2;
  font-size: 12px;
}

.header-stats {
  display: flex;
  gap: 24px;
  color: #cbd3dc;
  white-space: nowrap;
}

.header-stats strong {
  color: #ffffff;
  font-size: 18px;
  margin-right: 4px;
}

main {
  width: min(1800px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.control-band {
  padding: 20px 24px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.mode-bar {
  min-height: 34px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  padding: 2px;
  background: #e8ecf0;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.mode-button {
  height: 30px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
}

.mode-button:hover {
  color: var(--ink);
}

.mode-button.active {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 33, 43, 0.14);
}

.mode-meta {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.section-heading,
.pane-heading,
.log-heading,
.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

h2 {
  font-size: 16px;
  line-height: 1.4;
}

h3 {
  font-size: 14px;
}

.inspection-result {
  color: var(--green-dark);
  font-size: 13px;
  min-height: 20px;
  margin-top: 6px;
  text-align: left;
}

.inspection-result.pending {
  color: var(--blue);
}

.inspection-result.error {
  color: var(--red);
}

.inspection-result.success {
  color: var(--green-dark);
}

.url-hint {
  display: block;
  min-height: 17px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.url-hint.warning {
  color: #956b14;
}

.url-hint.error {
  color: var(--red);
}

.source-badge {
  display: inline-flex;
  min-height: 17px;
  align-items: center;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: 1px;
}

.source-trial {
  color: #235c91;
  background: #dfeaf5;
}

.source-real {
  color: #125c3c;
  background: #dcefe5;
}

.source-unknown {
  color: #5e6873;
  background: #e9edf1;
}

.source-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.source-note-trial {
  color: #235c91;
}

.source-note-real {
  color: var(--green-dark);
}

.source-note-unknown {
  color: #956b14;
}

input.url-invalid {
  border-color: var(--red);
}

input.url-valid {
  border-color: var(--green-dark);
}

.url-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.url-row > button {
  margin-top: 20px;
}

.wg-session-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(260px, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
}

.wg-session-fields[hidden] {
  display: none;
}

.wg-login-response-field {
  grid-column: 1 / -1;
}

.wg-session-fields textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.game-plan {
  min-width: 0;
  margin: 16px 0 0;
  padding: 13px 0 14px;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.game-plan > legend {
  padding: 0 10px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.game-plan-settings {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 118px minmax(220px, 1fr) minmax(180px, 0.9fr);
  gap: 12px;
  align-items: end;
}

.game-switch-settings {
  min-width: 0;
  margin-top: 12px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: minmax(78px, auto) minmax(130px, 180px) 20px minmax(130px, 180px) minmax(150px, 1fr);
  align-items: end;
  gap: 10px;
  border-top: 1px solid #e7ebef;
}

.game-switch-settings-title {
  align-self: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.game-switch-round-field input {
  font-variant-numeric: tabular-nums;
}

.game-switch-range-mark {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.game-switch-cadence-summary {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.compact-choice {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.compact-choice > legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.segmented-options {
  width: 100%;
  height: 38px;
  padding: 2px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #e8ecf0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.first-game-choice .segmented-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* The game-count field is hidden in manual mode; keep the first-game control
   in its intended third track instead of falling into the narrow count track. */
.first-game-choice {
  grid-column: 3;
}

.segmented-options label {
  min-width: 0;
  cursor: pointer;
}

.segmented-options label:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.segmented-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-options span {
  height: 32px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented-options input:checked + span {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 33, 43, 0.14);
}

.segmented-options input:focus-visible + span {
  outline: 2px solid rgba(38, 103, 168, 0.45);
  outline-offset: -2px;
}

.game-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.game-picker-panel {
  min-width: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.game-filter-grid .game-picker-panel {
  margin-top: 0;
}

.game-picker-heading {
  min-height: 36px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.game-picker-heading strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.game-picker-scope {
  min-width: 0;
  padding: 5px 9px;
  overflow: hidden;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-picker-bulk-actions {
  padding: 6px 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.game-picker-bulk-status {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.game-picker-bulk-buttons {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.game-picker-bulk-buttons button {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 7px;
  font-size: 11px;
}

.game-picker-shortcuts {
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(250px, 1.15fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.game-picker-shortcut {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.game-picker-shortcut-stack {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.ranking-game-shortcut {
  min-width: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 6px;
}

.ranking-game-limit {
  height: 32px;
  padding: 0 6px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 11px;
}

.ranking-game-limit input[type="number"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 24px;
  padding: 0;
  appearance: textfield;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
  font-size: 12px;
  line-height: 24px;
}

.ranking-game-limit input[type="number"]::-webkit-inner-spin-button,
.ranking-game-limit input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.ranking-game-limit input[type="number"]:focus {
  outline: 0;
  border-color: transparent;
  box-shadow: none;
}

.ranking-game-limit:focus-within {
  outline: 2px solid rgba(38, 103, 168, 0.45);
  outline-offset: -2px;
}

.game-picker-preset-status {
  padding: 6px 9px;
  color: var(--green-dark);
  background: #edf6f1;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.game-picker-preset-status:empty {
  display: none;
}

.game-picker-preset-status.error {
  color: var(--red);
  background: #fff4f3;
}

.game-search {
  display: block;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.game-search input {
  height: 34px;
  background: var(--surface-muted);
  font-size: 12px;
}

.game-picker-list {
  min-height: 72px;
  max-height: 184px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  overflow: auto;
  overscroll-behavior: contain;
}

.game-picker-option {
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border-right: 1px solid #e7ebef;
  border-bottom: 1px solid #e7ebef;
  cursor: pointer;
}

.game-picker-option:nth-child(3n) {
  border-right: 0;
}

.game-picker-option:has(input:checked) {
  background: #edf6f1;
}

.game-picker-option.conflict {
  background: #fff4f3;
}

.game-picker-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.game-picker-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--green);
}

.game-picker-option-text {
  min-width: 0;
}

.game-picker-option-name,
.game-picker-option-id {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-picker-option-name {
  font-size: 12px;
}

.game-picker-option-id {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.game-picker-empty {
  grid-column: 1 / -1;
  padding: 26px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.game-plan-summary {
  min-height: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.game-plan-summary.error {
  color: var(--red);
}

.grow {
  flex: 1;
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(112px, 1fr));
  gap: 12px;
  margin-top: 13px;
}

.scan-form-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(6, minmax(120px, 0.8fr));
  gap: 12px;
  margin-top: 13px;
}

.field,
.toggle-field {
  min-width: 0;
}

.field > span,
.toggle-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.field-hint {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted, #718096);
  font-size: 12px;
  line-height: 1.5;
}

.proxy-subscription-node-row td {
  background: color-mix(in srgb, var(--surface, #fff) 92%, var(--accent, #2f6fed));
}

.proxy-subscription-node-row[hidden] {
  display: none;
}

.proxy-node-picker {
  display: grid;
  gap: 10px;
}

.proxy-node-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 12px;
  max-height: 220px;
  overflow: auto;
  padding: 4px 0;
}

.proxy-node-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proxy-node-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
}

.proxy-node-option input {
  flex: 0 0 auto;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(38, 103, 168, 0.14);
}

select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(38, 103, 168, 0.14);
}

input:disabled {
  background: #eceff2;
  color: #8b949e;
}

.toggle-field {
  position: relative;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  display: block;
  width: 48px;
  height: 26px;
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #dfe4e9;
  cursor: pointer;
}

.toggle::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.toggle-field input:checked + .toggle {
  background: var(--green);
  border-color: var(--green);
}

.toggle-field input:checked + .toggle::after {
  left: 25px;
}

.strategy-field {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.strategy-field legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.strategy-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-option {
  min-width: 116px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.check-option:has(input:checked) {
  color: var(--green-dark);
  background: #edf6f1;
  border-color: #8dbba4;
}

.check-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--green);
}

button,
.icon-button {
  height: 38px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

button.is-busy:disabled {
	cursor: wait;
}

.primary {
  padding: 0 18px;
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
  font-weight: 700;
}

.primary:hover {
  background: var(--green-dark);
}

.secondary {
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.secondary:hover,
.icon-button:hover {
  border-color: #8e9ba8;
  background: #e9edf1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  margin-top: 10px;
}

.form-error {
  color: var(--red);
  flex: 1;
  text-align: right;
}

.bet-map-panel {
  width: 100%;
  min-width: 0;
  padding: 16px 24px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bet-map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.bet-map-heading > div:first-child {
  min-width: 0;
}

.bet-map-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bet-map-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.bet-map-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.bet-map-search {
  width: min(330px, 36vw);
  min-width: 190px;
}

.bet-map-search input {
  height: 36px;
  background: var(--surface-muted);
}

.bet-map-refresh-button {
  min-width: 108px;
  height: 36px;
}

.bet-map-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.bet-map-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.bet-map-summary > div:first-child {
  padding-left: 0;
}

.bet-map-summary > div:last-child {
  border-right: 0;
}

.bet-map-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.bet-map-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.bet-map-progress {
  padding: 11px 0 13px;
}

.bet-map-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.bet-map-progress-heading span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-map-progress .progress-track span {
  background: var(--blue);
  transition: none;
}

.bet-map-error {
  margin-top: 9px;
  padding: 8px 10px;
  color: var(--red);
  background: #fff8f7;
  border: 1px solid #efd7d5;
  border-radius: 4px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.bet-map-table-wrap {
  max-height: 430px;
  margin: 0 -24px;
  overflow: auto;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
}

.bet-map-table {
  min-width: 1360px;
}

.bet-map-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.bet-map-table th:first-child,
.bet-map-table td:first-child,
.bet-map-table th:nth-child(5),
.bet-map-table td:nth-child(5) {
  text-align: left;
}

.bet-map-table th:nth-child(2),
.bet-map-table td:nth-child(2),
.bet-map-table th:nth-child(6),
.bet-map-table td:nth-child(6) {
  text-align: left;
}

.bet-map-game {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.bet-map-route {
  display: block;
  max-width: 230px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
}

.bet-map-domain {
  min-width: 220px;
  max-width: 300px;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}

.bet-map-host {
  display: block;
  max-width: 300px;
  overflow-wrap: anywhere;
  line-height: 1.35;
  color: var(--muted);
  font-size: 11px;
}

.bet-map-values {
  max-width: 245px;
  overflow: hidden;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  text-overflow: ellipsis;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(720px, 1.45fr) minmax(460px, 0.85fr);
  gap: 16px;
  padding: 16px 24px 24px;
  align-items: start;
}

.scan-workspace {
  grid-template-columns: minmax(880px, 1.55fr) minmax(430px, 0.75fr);
}

.task-pane,
.analysis-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 0;
}

@media (min-width: 1081px) {
  .task-pane,
  .analysis-pane {
    max-height: calc(100vh - 32px);
    overflow: auto;
  }

  .analysis-pane {
    position: sticky;
    top: 16px;
  }
}

.pane-heading {
  min-height: 54px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.pane-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.scan-pane-heading {
  align-items: flex-start;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.compact-select {
  width: min(260px, 24vw);
  height: 36px;
  padding: 6px 28px 6px 9px;
  background: var(--surface-muted);
  font-size: 12px;
}

.icon-button {
  width: 36px;
  padding: 0;
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line);
  font-size: 18px;
}

.icon-button.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.stop-scan-button {
  color: var(--red);
}

.stop-scan-button:not(:disabled):hover {
  color: #8a2928;
  border-color: #d6a4a2;
  background: #f9eceb;
}

.scan-overview {
  padding: 13px 14px 0;
  border-bottom: 1px solid var(--line);
}

.scan-progress-heading,
.scan-progress-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-progress-heading strong,
.scan-progress-heading > span {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.scan-stage-detail {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.progress-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  background: #e3e8ed;
  border-radius: 3px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease-out;
}

.scan-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--red);
  background: #fff8f7;
  border: 1px solid #efd7d5;
  border-radius: 4px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  margin-top: 12px;
}

.scan-summary div,
.scan-summary-filter {
  padding: 9px 10px 11px;
  border-right: 1px solid var(--line);
}

.scan-summary > :first-child {
  padding-left: 0;
}

.scan-summary > :last-child {
  border-right: 0;
}

.scan-summary span,
.candidate-detail span,
.leaderboard-heading span {
  color: var(--muted);
  font-size: 11px;
}

.scan-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.scan-summary-filter {
  height: auto;
  color: inherit;
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  align-items: flex-start;
  flex-direction: column;
  text-align: left;
}

.scan-summary-filter:hover:not(:disabled),
.scan-summary-filter.active {
  background: #f1f7f4;
}

.scan-summary-filter.active {
  box-shadow: inset 0 -3px 0 var(--green);
}

.scan-summary-filter:disabled {
  cursor: default;
  opacity: 1;
}

.candidate-filter-bar {
  min-height: 35px;
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  background: #f6f8fa;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.candidate-filter-bar button {
  height: 26px;
  padding: 0 9px;
  color: var(--green-dark);
  background: #ffffff;
  border-color: var(--line);
  font-size: 11px;
}

.table-wrap,
.log-table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 9px 10px;
  color: var(--muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  padding: 10px;
  border-bottom: 1px solid #e7ebef;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.task-table tbody tr {
  cursor: pointer;
}

.scan-table {
  min-width: 1080px;
}

.scan-table th:first-child,
.scan-table td:first-child,
.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
  width: 44px;
  text-align: center;
}

.scan-table th:nth-child(2),
.scan-table td:nth-child(2),
.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
  text-align: left;
}

.scan-table tbody tr,
.leaderboard-table tbody tr {
  cursor: pointer;
}

.scan-table tbody tr:hover,
.scan-table tbody tr.selected,
.leaderboard-table tbody tr:hover,
.leaderboard-table tbody tr.selected {
  background: #f1f7f4;
}

.candidate-identity {
  display: block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.candidate-strategy,
.candidate-stage-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.candidate-status-cell {
  max-width: 210px;
}

.candidate-error-line {
  display: block;
  max-width: 190px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--red);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-progress {
  min-width: 128px;
}

.candidate-progress > span:first-child {
  display: block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.candidate-progress-track {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 5px;
  overflow: hidden;
  background: #e3e8ed;
  border-radius: 2px;
}

.candidate-progress-track i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.task-table tbody tr:hover,
.task-table tbody tr.selected {
  background: #f1f7f4;
}

.task-name {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.game-name {
  display: block;
  margin-top: 3px;
  max-width: 230px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-progress {
  display: block;
  margin-top: 2px;
  color: #71808e;
  font-size: 10px;
}

.status {
  display: inline-flex;
  min-width: 56px;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.status-running,
.status-starting {
  color: #125c3c;
  background: #dcefe5;
}

.status-stopped {
  color: #5e6873;
  background: #e9edf1;
}

.status-error {
  color: #8a2928;
  background: #f5dedd;
}

.status-completed {
  color: #125c3c;
  background: #dcefe5;
}

.status-queued,
.status-pending,
.status-discovering,
.status-screening,
.status-final {
  color: #235c91;
  background: #dfeaf5;
}

.status-stopping {
  color: #7b4a05;
  background: #f4e8d5;
}

.status-failed,
.status-cancelled,
.status-interrupted {
  color: #8a2928;
  background: #f5dedd;
}

.status-skipped {
  color: #5e6873;
  background: #e9edf1;
}

.profit-positive {
  color: var(--green-dark);
}

.profit-negative {
  color: var(--red);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.task-table th:last-child,
.task-table td:last-child {
  min-width: 124px;
}

.row-actions button {
  width: 30px;
  height: 30px;
  padding: 0;
  background: #ffffff;
  border-color: var(--line);
}

.row-actions .stop-button {
  color: var(--red);
}

.row-actions .resume-button {
  color: var(--green-dark);
}

.row-actions .switch-resume-button {
  color: var(--blue);
}

.row-actions .cancel-button,
.task-pane-actions .danger {
  color: var(--red);
}

.task-pane-title,
.task-pane-actions,
.task-view-switch {
  min-width: 0;
  display: flex;
  align-items: center;
}

.task-pane-title {
  gap: 12px;
}

.task-pane-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.task-view-switch {
  gap: 4px;
}

.task-view-switch button,
.task-pane-actions .history-action {
  height: 30px;
  padding: 4px 9px;
  font-size: 11px;
}

.task-view-switch button.active {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
}

.task-pane-actions .history-action.active {
  color: var(--green-dark);
  border-color: #9bc9ae;
  background: #eaf6ef;
}

.task-list-toolbar {
  min-width: 0;
  container-type: inline-size;
  container-name: task-toolbar;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.task-search-field {
  min-width: 0;
  flex: 1 1 220px;
}

.task-history-provider-field {
  min-width: 0;
  width: 104px;
  flex: 0 0 104px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  overflow: hidden;
}

.task-history-provider-field span {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-history-provider-field select {
  min-width: 0;
  width: 0;
  flex: 1;
  height: 22px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.task-history-provider-field[hidden] {
  display: none;
}

.task-search-field input,
.task-sort-field select {
  min-width: 0;
}

@container task-toolbar (max-width: 520px) {
  .task-search-field {
    flex-basis: 100%;
    order: 2;
  }

  .task-history-provider-field {
    order: 1;
  }

  .task-sort-field {
    order: 3;
  }

  .task-list-toolbar .icon-button {
    order: 4;
  }

  .task-history-zero-filter {
    order: 5;
  }
}

@media (max-width: 760px) {
  .task-search-field {
    flex-basis: 100%;
  }
}

.task-sort-field select {
  width: 100%;
  height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.task-sort-field {
  width: 128px;
  flex: 0 0 128px;
}

.task-list-toolbar .icon-button {
  width: 32px;
  height: 32px;
  font-size: 17px;
}

.task-history-zero-filter {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.task-history-zero-filter input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--green);
}

.task-history-zero-filter[hidden] {
  display: none;
}

.task-history-selection {
  width: 42px;
  padding-right: 7px !important;
  padding-left: 7px !important;
  text-align: center;
}

.task-selection-control {
  position: relative;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  cursor: pointer;
  vertical-align: middle;
}

.task-selection-control:hover {
  background: #f1f7f4;
}

.task-selection-control input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.task-selection-box {
  width: 16px;
  height: 16px;
  display: block;
  border: 1.5px solid #b7c2cc;
  border-radius: 4px;
  background: #ffffff;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.task-selection-control input:focus-visible + .task-selection-box {
  outline: 2px solid rgba(44, 125, 91, 0.28);
  outline-offset: 2px;
}

.task-selection-control input:checked + .task-selection-box {
  position: relative;
  border-color: var(--green);
  background: var(--green);
  box-shadow: none;
}

.task-selection-control input:checked + .task-selection-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.task-history-pagination {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.task-history-pagination button {
  min-width: 64px;
  height: 30px;
  padding: 4px 9px;
  font-size: 11px;
}

.history-rtp-panel {
  min-width: 0;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.history-rtp-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.history-rtp-metrics > div {
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
}

.history-rtp-metrics > div:last-child {
  border-right: 0;
}

.history-rtp-metrics span,
.history-rtp-metrics strong {
  display: block;
}

.history-rtp-metrics span {
  color: var(--muted);
  font-size: 10px;
}

.history-rtp-metrics strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.history-rtp-panel .form-error {
  min-height: 0;
  margin-top: 8px;
}

@media (max-width: 760px) {
  .user-overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-overview-metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .user-overview-metrics > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .overview-chart-grid {
    grid-template-columns: 1fr;
  }

  .overview-chart-card-wide {
    grid-column: auto;
  }

  .overview-heading-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }

  .api-contract-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-contract-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .rtp-breakdown-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .rtp-breakdown-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .rtp-sort-field {
    flex: 1;
  }

  .history-rtp-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-rtp-metrics > div {
    border-bottom: 1px solid var(--line);
  }

  .history-rtp-metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .history-rtp-metrics > div:last-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }
}

.task-resume-bar {
  min-width: 0;
  padding: 11px 14px 12px;
  background: #f4f8f6;
  border-bottom: 1px solid var(--line);
}

.task-resume-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.task-resume-copy strong {
  flex: 0 0 auto;
  font-size: 13px;
}

.task-resume-copy span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  overflow-wrap: anywhere;
}

.task-resume-settings {
  min-width: 0;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.task-resume-settings-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.task-resume-settings-heading strong {
  font-size: 12px;
}

.task-resume-settings-heading span {
  color: var(--muted);
  font-size: 11px;
}

.task-resume-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.task-resume-field,
.task-resume-toggle {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.task-resume-field > span,
.task-resume-toggle > span:first-child {
  color: var(--muted);
  font-size: 11px;
}

.task-resume-field input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 4px 7px;
  font-size: 12px;
}

.task-resume-toggle {
  position: relative;
  grid-template-columns: 1fr auto;
  align-items: center;
  align-content: center;
  min-height: 51px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
}

.task-resume-toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.task-resume-toggle .toggle {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 12px;
  background: #cbd5d1;
  transition: background .15s ease;
}

.task-resume-toggle .toggle::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  content: "";
  transition: transform .15s ease;
}

.task-resume-toggle input[type="checkbox"]:checked + .toggle {
  background: var(--green);
}

.task-resume-toggle input[type="checkbox"]:checked + .toggle::after {
  transform: translateX(14px);
}

.task-resume-toggle input[type="checkbox"]:focus-visible + .toggle {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.task-resume-field input:disabled,
.task-resume-toggle input[type="checkbox"]:disabled + .toggle {
  opacity: .55;
  cursor: not-allowed;
}

.task-resume-controls {
  min-width: 0;
  margin-top: 9px;
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.task-resume-controls button {
  height: 34px;
  padding-right: 12px;
  padding-left: 12px;
  font-size: 12px;
}

.task-resume-controls button:disabled {
  cursor: not-allowed;
}

.task-resume-controls button.is-busy:disabled {
  cursor: wait;
}

.task-resume-target {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.task-resume-target span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.task-resume-target select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 5px 28px 5px 8px;
  background: #ffffff;
  font-size: 12px;
  text-overflow: ellipsis;
}

.empty-state {
  padding: 64px 20px;
  color: var(--muted);
  text-align: center;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.metrics div {
  padding: 12px 10px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.protocol-state {
  border-bottom: 1px solid var(--line);
}

.protocol-state-heading {
  min-height: 54px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.protocol-state-heading > div:first-child > span,
.protocol-state-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.protocol-state-status {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.protocol-state-idle {
  color: var(--green-dark);
}

.protocol-state-continuation,
.protocol-state-free,
.protocol-state-selection {
  color: #7b4a05;
}

.protocol-state-actions {
  display: flex;
  gap: 6px;
}

.protocol-state-actions .icon-button {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.protocol-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.protocol-state-grid > div {
  min-width: 0;
  min-height: 60px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.protocol-state-grid > div:nth-child(2n) {
  border-right: 0;
}

.protocol-state-grid > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.protocol-state-grid strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.protocol-id-field strong,
#protocol-request-id,
#protocol-wk {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.rank-mark {
  min-width: 46px;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.leaderboard-heading {
  padding: 12px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.leaderboard-wrap {
  max-height: 330px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.leaderboard-table td,
.leaderboard-table th {
  padding: 8px 7px;
  font-size: 11px;
}

.leaderboard-table .candidate-identity {
  max-width: 150px;
  font-size: 11px;
}

.leaderboard-table .candidate-strategy {
  font-size: 10px;
}

.compact-empty {
  padding: 42px 16px;
}

.candidate-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.candidate-detail div {
  min-width: 0;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.candidate-detail div:nth-child(2n) {
  border-right: 0;
}

.candidate-detail strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.candidate-error {
  margin: 0;
  padding: 10px 14px;
  color: var(--red);
  background: #fff8f7;
  border-bottom: 1px solid #efd7d5;
  font-size: 12px;
}

.chart-shell {
  position: relative;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line);
}

.chart-heading {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chart-heading strong {
  color: var(--ink);
}

#balance-chart {
  display: block;
  width: 100%;
  height: 210px;
  background: #fbfcfd;
  border: 1px solid #e3e8ed;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: manipulation;
}

.balance-chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 180px;
  padding: 7px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 5px 14px rgba(25, 35, 45, 0.14);
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

.balance-chart-tooltip[hidden] {
  display: none;
}

.balance-chart-tooltip strong {
  display: block;
  font-size: 11px;
}

.balance-chart-tooltip-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 12px;
  margin-top: 5px;
}

.balance-chart-tooltip-grid b,
.balance-chart-tooltip-grid em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

.balance-chart-tooltip-grid em {
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.balance-chart-tooltip.pinned {
  border-color: #9bc9ae;
}

.log-heading {
  padding: 12px 14px 8px;
}

.log-heading span {
  color: var(--muted);
  font-size: 11px;
}

.log-pagination {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.log-pagination .compact-button {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 11px;
}

.log-table-wrap {
  max-height: 330px;
}

.log-table td,
.log-table th {
  padding: 8px 7px;
  font-size: 11px;
}

.log-parent-row {
  background: #fbfcfd;
}

.log-parent-sequence {
  display: flex;
  align-items: center;
  gap: 5px;
}

.log-group-toggle {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.log-group-toggle:hover,
.log-group-toggle:focus-visible {
  color: var(--ink);
  background: #e9eef3;
}

.log-group-toggle span {
  display: block;
  font-size: 20px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.log-group-toggle[aria-expanded="true"] span {
  transform: rotate(90deg);
}

.log-child-row {
  color: #4f5d69;
  background: #f7f9fb;
}

.log-child-row td {
  border-bottom-color: #edf0f3;
}

.log-child-sequence {
  position: relative;
  padding-left: 36px !important;
}

.log-child-connector {
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 11px;
  pointer-events: none;
}

.log-child-connector::before,
.log-child-connector::after {
  content: "";
  position: absolute;
  background: var(--line-strong);
}

/* Middle children use the continuous vertical leg of a standard tree (├─). */
.log-child-connector::before {
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
}

.log-child-connector::after {
  left: 0;
  top: 50%;
  width: 11px;
  height: 1px;
  transform: translateY(-50%);
}

/* The final child stops the vertical leg at the branch (└─). */
.log-child-sequence.is-last .log-child-connector::before {
  bottom: 50%;
}

.log-child-count {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
}

.log-group-total {
  color: var(--green-dark);
  font-weight: 700;
}

.free-label {
	color: var(--blue);
	font-weight: 700;
}

.gamble-label {
	color: #7a4d9b;
	font-weight: 700;
}

.paid-label {
  color: var(--green-dark);
}

.continuation-label {
  color: var(--amber);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 14px;
  color: #ffffff;
  background: #26313d;
  border-left: 4px solid #58a77d;
  border-radius: 4px;
  box-shadow: 0 5px 18px rgba(23, 33, 43, 0.24);
  display: none;
}

.toast.show {
  display: block;
}

@media (max-width: 1380px) {
  .game-plan-settings {
    grid-template-columns: minmax(220px, 1fr) 118px minmax(220px, 1fr);
  }

  #fixed-first-field {
    grid-column: 1 / -1;
  }

  .form-grid {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
  }

  .scan-form-grid {
    grid-template-columns: repeat(4, minmax(135px, 1fr));
  }

}

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

@media (max-width: 760px) {
  .topbar,
  .control-band,
  .bet-map-panel,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .header-stats {
    width: 100%;
    justify-content: space-between;
  }

  .url-row {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-field {
    width: 100%;
    flex-basis: auto;
  }

  .provider-band {
    grid-template-columns: 1fr;
  }

  .provider-band > div,
  .provider-band > div:last-child {
    border-right: 0;
  }

  .provider-band > div:first-child {
    border-bottom: 1px solid var(--line);
  }

  .api-docs-entry {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .api-docs-entry-meta {
    padding-left: 50px;
  }

  .api-docs-entry-actions {
    justify-content: flex-start;
  }

  .api-docs-entry-actions .primary {
    flex: 1 1 180px;
  }

  .url-row > button {
    margin-top: 0;
  }

  .wg-session-fields {
    grid-template-columns: 1fr;
  }

  .wg-login-response-field {
    grid-column: auto;
  }

  .game-plan-settings,
  .game-filter-grid {
    grid-template-columns: 1fr;
  }

  .first-game-choice {
    grid-column: auto;
  }

  .game-switch-settings {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  }

  .game-switch-settings-title,
  .game-switch-cadence-summary {
    grid-column: 1 / -1;
  }

  .game-switch-settings-title {
    margin-bottom: -2px;
  }

  .game-switch-cadence-summary {
    min-height: 20px;
  }

  .game-picker-shortcuts {
    grid-template-columns: 1fr;
  }

  #fixed-first-field {
    grid-column: auto;
  }

  .game-picker-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-picker-option:nth-child(3n) {
    border-right: 1px solid #e7ebef;
  }

  .game-picker-option:nth-child(2n) {
    border-right: 0;
  }

  .mode-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .task-pane > .pane-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .task-list-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .task-search-field {
    flex-basis: 100%;
  }

  .task-sort-field {
    flex: 1;
    width: auto;
  }

  .task-pane-title,
  .task-pane-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .mode-switch {
    width: 100%;
  }

  .bet-map-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .bet-map-tools {
    width: 100%;
  }

  .bet-map-search {
    width: auto;
    min-width: 0;
    flex: 1;
  }

  .bet-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bet-map-summary > div,
  .bet-map-summary > div:first-child {
    padding: 9px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .bet-map-summary > div:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .bet-map-summary > div:last-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }

  .bet-map-table-wrap {
    margin-right: -14px;
    margin-left: -14px;
  }

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

  .strategy-field {
    grid-column: 1 / -1;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-error {
    text-align: left;
  }

  .primary {
    width: 100%;
  }

  .workspace {
    padding-top: 12px;
  }

  .task-table {
    min-width: 820px;
  }

  .task-resume-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .task-resume-copy span {
    text-align: left;
  }

  .task-resume-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-resume-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .task-resume-controls button,
  .task-resume-target,
  .task-resume-target select {
    width: 100%;
  }

  .task-resume-target {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .scan-pane-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .pane-actions {
    width: 100%;
  }

  .compact-select {
    width: auto;
    flex: 1;
  }

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

  .scan-summary > *,
  .scan-summary > :first-child {
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scan-summary > :nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .scan-summary > :last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics div:nth-child(2) {
    border-right: 0;
  }

  .metrics div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .protocol-state-grid {
    grid-template-columns: 1fr;
  }

  .protocol-state-grid > div,
  .protocol-state-grid > div:nth-child(2n),
  .protocol-state-grid > div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .protocol-state-grid > div:last-child {
    border-bottom: 0;
  }

  .log-table {
    min-width: 760px;
  }
}
