:root {
  --profit-page: #070913;
  --profit-panel: #10081e;
  --profit-panel-alt: #170c27;
  --profit-line: rgba(125, 85, 184, 0.34);
  --profit-cyan: #55f5e8;
  --profit-pink: #ff5ddd;
  --profit-purple: #9b72ff;
  --profit-green: #53f3a7;
  --profit-gold: #ffcc57;
  --profit-red: #ff7087;
  --profit-text: #f7f4ff;
  --profit-muted: #9ea7bd;
}

body[data-page="winning-strat-per-th"] { background: var(--profit-page); }

.profit-page { min-width: 0; padding: clamp(18px, 2.3vw, 34px); }

.profit-board {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 93, 221, 0.44);
  border-radius: 20px;
  background:
    radial-gradient(circle at 83% 0%, rgba(85, 245, 232, 0.09), transparent 28%),
    linear-gradient(135deg, rgba(255, 93, 221, 0.07), transparent 25%),
    var(--profit-panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255,255,255,0.04);
}

.profit-board::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--profit-pink), var(--profit-cyan), transparent);
}

.profit-board-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--profit-line);
}

.profit-overline {
  color: var(--profit-pink);
  font: 900 0.64rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.17em;
}

.profit-board-header h1 {
  margin: 6px 0 2px;
  color: var(--profit-text);
  font-size: clamp(1.45rem, 2.4vw, 2.3rem);
  letter-spacing: -0.035em;
}

.profit-board-header p,
.leaderboard-caption p { margin: 0; color: var(--profit-muted); font-size: 0.78rem; line-height: 1.5; }

.profit-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.profit-summary span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 93, 221, 0.34);
  border-radius: 999px;
  background: rgba(7, 9, 19, 0.72);
  color: #cbd4e8;
  font-size: 0.68rem;
}
.profit-summary b { color: var(--profit-cyan); }

.profit-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) auto minmax(170px, 1fr) auto auto;
  gap: 9px;
  align-items: end;
  margin: 14px 20px;
  padding: 12px;
  border: 1px solid rgba(85, 245, 232, 0.18);
  border-radius: 13px;
  background: linear-gradient(110deg, rgba(18, 11, 33, 0.95), rgba(9, 22, 37, 0.94));
}

.profit-field { display: grid; gap: 5px; min-width: 0; }
.profit-field > span { color: var(--profit-muted); font: 800 0.6rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.1em; text-transform: uppercase; }
.profit-field input,
.profit-field select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #35405a;
  border-radius: 9px;
  outline: 0;
  background: #080e1a;
  color: var(--profit-text);
}
.profit-field input:focus,
.profit-field select:focus { border-color: var(--profit-cyan); box-shadow: 0 0 0 2px rgba(85, 245, 232, 0.14); }

.profit-button,
.profit-cycle-controls button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #4b3566;
  border-radius: 9px;
  background: #17112a;
  color: var(--profit-text);
  font-weight: 850;
  cursor: pointer;
}
.profit-button:hover,
.profit-cycle-controls button:hover:not(:disabled) { border-color: var(--profit-cyan); }
.profit-button.primary { border-color: rgba(85, 245, 232, 0.45); background: linear-gradient(110deg, #11324b, #382059); }
.profit-button.profile { color: var(--profit-cyan); }
.profit-button:disabled,
.profit-cycle-controls button:disabled { cursor: not-allowed; opacity: 0.4; }

.profit-cycle-controls { display: flex; gap: 6px; align-items: stretch; }
.profit-cycle-controls button { min-width: 40px; padding-inline: 10px; }
.profit-cycle-controls > span {
  display: grid;
  min-width: 66px;
  place-content: center;
  border: 1px solid #35405a;
  border-radius: 9px;
  background: #080e1a;
  text-align: center;
}
.profit-cycle-controls small { color: var(--profit-muted); font: 700 0.52rem ui-monospace, monospace; letter-spacing: 0.1em; text-transform: uppercase; }
.profit-cycle-controls b { color: var(--profit-cyan); font: 900 0.88rem ui-monospace, monospace; }
.profit-cycle-controls .cycle-current { color: var(--profit-pink); }
.profile-status { grid-column: 1 / -1; min-height: 15px; margin: 0; color: var(--profit-green); font-size: 0.68rem; }
.profile-status.error { color: var(--profit-red); }

.leaderboard-caption {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 22px 10px;
}
.leaderboard-caption span { color: var(--profit-cyan); font: 900 0.58rem ui-monospace, monospace; letter-spacing: 0.14em; }
.leaderboard-caption h2 { margin: 4px 0 0; color: var(--profit-text); font-size: 1.15rem; }
.leaderboard-caption p { max-width: 650px; text-align: right; }

.profit-table-shell {
  margin: 0 20px;
  overflow-x: auto;
  border: 1px solid rgba(255, 93, 221, 0.36);
  border-radius: 11px;
  scrollbar-color: auto;
}

.profit-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--profit-text);
}

.profit-table th,
.profit-table td { padding: 9px; border-right: 1px solid #31163f; border-bottom: 1px solid #31163f; text-align: left; vertical-align: middle; }
.profit-table tr > :last-child { border-right: 0; }
.profit-table tbody tr:last-child > * { border-bottom: 0; }
.profit-table thead th { background: #27113b; color: #dfe6f6; font: 900 0.63rem ui-monospace, monospace; letter-spacing: 0.06em; }
.profit-table tbody td { height: 58px; background: #130a21; font-size: 0.72rem; }
.profit-table tbody tr:nth-child(even) td { background: var(--profit-panel-alt); }
.profit-table tbody tr:hover td { background: #201136; }
.profit-table tbody tr:first-child td { box-shadow: inset 0 2px var(--profit-green); }
.profit-table th:nth-child(1) { width: 48px; text-align: center; }
.profit-table th:nth-child(2) { width: 17%; }
.profit-table th:nth-child(3) { width: 100px; }
.profit-table th:nth-child(4) { width: 105px; }
.profit-table th:nth-child(5) { width: 90px; }
.profit-table th:nth-child(6),
.profit-table th:nth-child(7) { width: 104px; }
.profit-table th:nth-child(8) { width: 28%; }
.profit-table th:nth-child(9) { width: 130px; }

.profit-rank { display: grid; place-items: center; width: 26px; height: 26px; margin: auto; border-radius: 8px; background: #28143a; color: var(--profit-cyan); font: 900 0.65rem ui-monospace, monospace; }
.profit-user { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; align-items: center; min-width: 0; }
.profit-avatar { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #663a82; border-radius: 9px; background: linear-gradient(135deg, #25334e, #3a1b4d); font-size: 0.62rem; font-weight: 900; }
.profit-user strong,
.profit-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profit-user strong { font-size: 0.73rem; }
.profit-user small { margin-top: 3px; color: var(--profit-muted); font-size: 0.58rem; }
.profit-league { color: var(--profit-cyan); font: 850 0.65rem ui-monospace, monospace; }
.profit-number { font: 850 0.71rem ui-monospace, monospace; }
.profit-gross { color: var(--profit-cyan); }
.profit-cost { color: var(--profit-gold); }
.profit-net { color: var(--profit-green); font: 900 0.78rem ui-monospace, monospace; }
.profit-net.negative { color: var(--profit-red); }
.th-match { display: block; margin-top: 3px; color: var(--profit-muted); font-size: 0.54rem; }

.boost-pattern { display: flex; flex-wrap: wrap; gap: 4px; }
.boost-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid #33415e; border-radius: 999px; background: #0a1220; color: #cbd7ed; font: 800 0.56rem ui-monospace, monospace; }
.boost-pill i { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--boost-color, var(--profit-purple)); box-shadow: 0 0 8px var(--boost-color, var(--profit-purple)); }
.boost-empty { color: var(--profit-muted); font-size: 0.65rem; }

.multiplier-boosts { display: grid; gap: 4px; }
.multiplier-boost-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 3px 6px;
  border-left: 2px solid var(--boost-color, var(--profit-purple));
  border-radius: 4px;
  background: rgba(6, 12, 24, 0.56);
  color: #cbd7ed;
  font: 750 0.54rem/1.35 ui-monospace, monospace;
}
.multiplier-boost-row b { color: var(--profit-pink); font-size: 0.59rem; }
.multiplier-boost-row span { overflow-wrap: anywhere; }

.profit-status { margin: 12px 20px 0; padding: 10px 12px; border: 1px solid rgba(85, 245, 232, 0.18); border-radius: 9px; background: rgba(5, 12, 24, 0.78); color: var(--profit-cyan); font-size: 0.7rem; }
.profit-status.ready { color: var(--profit-green); }
.profit-status.warning { color: var(--profit-gold); }
.profit-status.error { color: var(--profit-red); border-color: rgba(255, 112, 135, 0.34); }
.profit-empty-row td { height: 180px !important; color: var(--profit-muted); text-align: center !important; }
.profit-notes { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 22px 20px; color: var(--profit-muted); font-size: 0.62rem; }
.profit-notes span:first-child { color: var(--profit-cyan); }

@media (max-width: 1120px) {
  .profit-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profit-cycle-controls { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .profit-page { padding: 12px 9px 20px; }
  .profit-board { border-radius: 14px; }
  .profit-board-header,
  .leaderboard-caption { align-items: flex-start; flex-direction: column; }
  .profit-board-header { padding: 18px 14px 12px; }
  .profit-summary { justify-content: flex-start; }
  .profit-controls { grid-template-columns: 1fr 1fr; margin: 10px; padding: 10px; }
  .profit-field { grid-column: 1 / -1; }
  .profit-button { width: 100%; }
  .profit-cycle-controls { overflow-x: auto; }
  .leaderboard-caption { padding: 4px 12px 9px; }
  .leaderboard-caption p { text-align: left; }
  .profit-table-shell { margin-inline: 10px; }
  .profit-status { margin-inline: 10px; }
  .profit-notes { padding-inline: 12px; }
}
