:root {
  --bg: #09111f;
  --bg-soft: rgba(13, 28, 50, 0.72);
  --panel: rgba(11, 24, 43, 0.78);
  --panel-border: rgba(154, 191, 255, 0.14);
  --text: #eff5ff;
  --muted: #95a8c7;
  --accent: #7cf4c7;
  --accent-strong: #21c690;
  --warm: #ffb86b;
  --rose: #ff7a90;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(48, 92, 181, 0.45), transparent 30%),
    radial-gradient(circle at top right, rgba(26, 177, 141, 0.22), transparent 32%),
    linear-gradient(180deg, #08101c 0%, #09111f 40%, #0a1423 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent);
}

.page-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 150px;
}

.site-disclosure {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(8, 19, 34, 0.78);
  border: 1px solid rgba(154, 191, 255, 0.12);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
}

.site-disclosure-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.site-disclosure-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #082038;
  background: linear-gradient(135deg, var(--warm) 0%, #ffd38a 100%);
  box-shadow: 0 10px 24px rgba(255, 184, 107, 0.2);
  transform: translateY(1px);
}

.site-disclosure p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.toolbar-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
  position: relative;
  z-index: 40;
}

.tab-bar {
  display: inline-flex;
  width: max-content;
  gap: 8px;
  padding: 6px;
  height: 78px;
  border-radius: 24px;
  background: rgba(11, 24, 43, 0.7);
  border: 1px solid rgba(154, 191, 255, 0.14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  margin-bottom: 14px;
  align-items: center;
}

.tab-button {
  border: 0;
  border-radius: 25px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.is-active {
  color: #082038;
  background: linear-gradient(135deg, var(--accent) 0%, #76d9ff 100%);
}

.tab-panel {
  display: none;
  gap: 16px;
}

.tab-panel.is-active {
  display: grid;
}

.hidden-until-run {
  display: none !important;
}

.top-workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: stretch;
}

.hero {
  display: block;
  margin-bottom: 14px;
}

.eyebrow,
.hero-card-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--accent);
  margin: 0 0 10px;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  line-height: 1.02;
  max-width: none;
  white-space: nowrap;
  letter-spacing: -0.03em;
}

.hero-text,
.panel-header p,
.field span,
.rule-card p {
  color: var(--muted);
}

.hero-text {
  max-width: 64ch;
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 10px 0 0;
}

.rule-bar,
.panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.rule-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(70px, auto)) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  height: 78px;
  position: relative;
  z-index: 40;
  overflow: visible;
}

.rule-bar-select span {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

.rule-bar-select {
  position: relative;
  z-index: 41;
}

.challenge-native-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.challenge-picker-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(154, 191, 255, 0.12);
  border-radius: 18px;
  background: rgba(15, 31, 55, 0.92);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px 11px 16px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.challenge-picker-button:hover,
.challenge-picker-button:focus-visible {
  border-color: rgba(124, 244, 199, 0.36);
  box-shadow: 0 14px 34px rgba(6, 14, 28, 0.3);
  outline: none;
}

.challenge-picker-copy {
  display: grid;
  gap: 0;
  min-width: 0;
}

.challenge-picker-label {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.challenge-picker-chevron {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-right: 2px solid rgba(239, 245, 255, 0.82);
  border-bottom: 2px solid rgba(239, 245, 255, 0.82);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.rule-bar-select.is-open .challenge-picker-chevron {
  transform: rotate(-135deg) translateX(-1px);
}

.challenge-picker-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: min(70vh, 620px);
  overflow: auto;
  padding: 10px;
  border-radius: 22px;
  background: rgba(7, 17, 31, 0.96);
  border: 1px solid rgba(154, 191, 255, 0.16);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
  z-index: 120;
}

.challenge-picker-section {
  display: grid;
  gap: 8px;
}

.challenge-picker-section + .challenge-picker-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(154, 191, 255, 0.1);
}

.challenge-picker-group {
  border: 1px solid rgba(154, 191, 255, 0.1);
  border-radius: 16px;
  background: rgba(14, 28, 49, 0.72);
  overflow: hidden;
}

.challenge-picker-group summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
}

.challenge-picker-group summary::-webkit-details-marker {
  display: none;
}

.challenge-picker-group-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.challenge-picker-group-title strong {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.challenge-picker-group-title span {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.challenge-picker-group-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid rgba(149, 168, 199, 0.9);
  border-bottom: 2px solid rgba(149, 168, 199, 0.9);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.challenge-picker-group[open] .challenge-picker-group-chevron {
  transform: rotate(-135deg) translateY(-1px);
}

.challenge-picker-options {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
}

.challenge-picker-option {
  width: 100%;
  border: 1px solid rgba(154, 191, 255, 0.08);
  border-radius: 14px;
  background: rgba(11, 24, 43, 0.78);
  color: var(--text);
  padding: 11px 12px;
  display: grid;
  gap: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.challenge-picker-option:hover,
.challenge-picker-option:focus-visible {
  border-color: rgba(124, 244, 199, 0.28);
  background: rgba(15, 33, 58, 0.92);
  outline: none;
  transform: translateY(-1px);
}

.challenge-picker-option.is-selected {
  border-color: rgba(124, 244, 199, 0.42);
  background: linear-gradient(135deg, rgba(124, 244, 199, 0.12), rgba(118, 217, 255, 0.1));
}

.challenge-picker-option-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.challenge-picker-option-name {
  min-width: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.challenge-picker-option-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 184, 107, 0.14);
  color: var(--warm);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.challenge-picker-empty {
  padding: 14px;
  border-radius: 16px;
  background: rgba(14, 28, 49, 0.72);
  color: var(--muted);
  font-size: 0.82rem;
}

.rule-inline-stat {
  min-width: 0;
  text-align: left;
}

.rule-inline-stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.rule-inline-stat strong {
  font-size: 0.98rem;
  white-space: nowrap;
}

.hero-card-grid,
.rules-grid,
.control-grid,
.stats-grid,
.upload-grid,
.button-row {
  display: grid;
  gap: 12px;
}

.stat-card-label {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-card-value {
  font-size: 1rem;
}

.dashboard {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 16px 18px;
}

.results-panel {
  padding-top: 14px;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-header p {
  margin: 0;
}

.controls-panel {
  position: relative;
  overflow: hidden;
  height: 100%;
}

.controls-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 244, 199, 0.05), transparent 35%, rgba(255, 184, 107, 0.05));
  pointer-events: none;
}

.control-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.control-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.control-grid.compact.funded-primary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

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

.field span {
  font-size: 0.78rem;
}

.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-hover-button {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(150, 181, 232, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.info-hover-button:hover {
  color: var(--text);
  border-color: rgba(124, 244, 199, 0.45);
  transform: translateY(-1px);
}

.info-hover-button:focus-visible {
  outline: 2px solid rgba(124, 244, 199, 0.38);
  outline-offset: 2px;
}

.info-tooltip-popup {
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(320px, calc(100vw - 20px));
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(133, 154, 190, 0.42);
  background: linear-gradient(165deg, rgba(13, 23, 39, 0.98), rgba(10, 19, 33, 0.98));
  color: #d9e7fb;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.32;
  text-align: left;
  box-shadow: 0 16px 34px rgba(4, 12, 24, 0.44);
  z-index: 5000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.info-tooltip-popup.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.inline-field-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.field.is-disabled {
  opacity: 0.58;
}

.field.is-disabled input,
.field.is-disabled select {
  cursor: not-allowed;
}

.field.is-disabled .input-with-suffix span {
  color: rgba(149, 168, 199, 0.75);
}

input,
select,
.run-button {
  width: 100%;
  border: 1px solid rgba(150, 181, 232, 0.15);
  border-radius: 16px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}

input,
select {
  padding: 10px 12px;
}

input[type="file"] {
  padding: 10px 12px;
}

input:focus,
select:focus,
.run-button:focus {
  outline: 2px solid rgba(124, 244, 199, 0.35);
  outline-offset: 2px;
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  padding-right: 52px;
}

.input-with-suffix span {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.is-hidden {
  display: none !important;
}

.funded-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.funded-toggle-copy {
  margin-bottom: 0;
}

.inline-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(150, 181, 232, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.inline-switch input {
  width: auto;
  margin: 0;
}

.inline-switch-muted {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.inline-switch-box {
  width: 100%;
  justify-content: flex-start;
}

.funded-inputs-panel {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.custom-rules-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.custom-funded-panel {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.custom-funded-panel .subsection-header {
  margin-bottom: 12px;
}

.custom-funded-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.custom-funded-advanced-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 12px 12px;
}

.funded-mapping-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  padding: 0 12px;
  border: 1px solid rgba(124, 244, 199, 0.28);
  background: rgba(124, 244, 199, 0.09);
  color: #9cebd3;
  font-size: 0.78rem;
}

.funded-mapping-badge.warning {
  border-color: rgba(255, 184, 107, 0.34);
  background: rgba(255, 184, 107, 0.12);
  color: #ffd1a0;
}

.funded-advanced {
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.funded-advanced-block {
  margin-top: 2px;
}

.funded-advanced-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.funded-advanced-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.funded-advanced-body[hidden] {
  display: none !important;
}

.control-grid.compact.funded-advanced-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 12px 12px;
}

.subsection-header {
  margin-bottom: 10px;
}

.subsection-header h3 {
  margin-bottom: 3px;
  font-size: 0.95rem;
}

.subsection-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.run-button {
  margin-top: 14px;
  border: 0;
  padding: 12px 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, #76d9ff 100%);
  color: #082038;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 18px 40px rgba(124, 244, 199, 0.18);
}

.run-button:hover {
  transform: translateY(-1px);
}

.run-button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: default;
  opacity: 0.95;
}

.run-button.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(8, 32, 56, 0.35);
  border-top-color: rgba(8, 32, 56, 0.95);
  animation: button-spin 0.75s linear infinite;
}

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

.ghost-button {
  justify-self: start;
  border: 1px solid rgba(150, 181, 232, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  cursor: pointer;
}

.ghost-button-small {
  padding: 8px 10px;
}

.see-more-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(124, 244, 199, 0.45);
  background: linear-gradient(135deg, #7cf4c7 0%, #76d9ff 100%);
  color: #082038;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.78rem;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(124, 244, 199, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  animation: ctaPulse 2.4s ease-in-out infinite;
}

.see-more-link:hover {
  transform: translateY(-1px) scale(1.01);
  filter: saturate(1.08);
  box-shadow: 0 14px 32px rgba(124, 244, 199, 0.36);
}

.see-more-link:focus-visible {
  outline: 2px solid rgba(124, 244, 199, 0.4);
  outline-offset: 2px;
}

.see-more-link::after {
  content: " ->";
  font-weight: 900;
}

@keyframes ctaPulse {
  0%,
  100% {
    box-shadow: 0 10px 26px rgba(124, 244, 199, 0.28);
  }
  50% {
    box-shadow: 0 14px 36px rgba(124, 244, 199, 0.42);
  }
}

.buy-now-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  width: 100%;
  padding: 0 72px 0 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 165, 55, 0.55);
  background: linear-gradient(135deg, #ffd36a 0%, #ffb347 55%, #ff983b 100%);
  color: #3c2206;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  box-shadow: 0 10px 26px rgba(255, 153, 58, 0.25);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.buy-now-link::before,
.buy-now-link::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: transform 0.16s ease;
}

.buy-now-link::after {
  display: none;
}

.buy-now-link::before {
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 16L16 8M10 8h6v6' fill='none' stroke='%233c2206' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}

.buy-now-link:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
  box-shadow: 0 14px 34px rgba(255, 153, 58, 0.34);
}

.buy-now-link:hover::before,
.buy-now-link:hover::after {
  transform: translateY(-50%) translateX(1px);
}

.buy-now-link:focus-visible {
  outline: 2px solid rgba(255, 186, 84, 0.5);
  outline-offset: 2px;
}

.rating-badge {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 52px;
  min-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 186, 84, 0.12);
  border: 1px solid rgba(255, 186, 84, 0.28);
  color: #ffd79d;
  font-size: 0.84rem;
  font-weight: 700;
}

.proof-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 186, 84, 0.08);
  border: 1px solid rgba(255, 186, 84, 0.16);
  line-height: 1.1;
  white-space: nowrap;
}

.proof-line::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 999px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  flex-shrink: 0;
}

.proof-line[data-kind="years"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6' fill='none' stroke='%23ffd79d' stroke-width='1.6'/%3E%3Cpath d='M8 4.7v3.6l2.4 1.5' fill='none' stroke='%23ffd79d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.proof-line[data-kind="payouts"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8.1 2.2c-1.8 0-3 .9-3 2.2 0 1.2.9 1.8 2.8 2.2 1.8.4 2.4.7 2.4 1.7 0 .9-.8 1.6-2.2 1.6-1.2 0-2.3-.4-3.3-1.2' fill='none' stroke='%23ffd79d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M8 1.4v13.2' fill='none' stroke='%23ffd79d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.proof-line[data-kind="customers"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='5.4' cy='6' r='2' fill='none' stroke='%23ffd79d' stroke-width='1.4'/%3E%3Ccircle cx='10.8' cy='6.6' r='1.6' fill='none' stroke='%23ffd79d' stroke-width='1.4'/%3E%3Cpath d='M2.8 12.6c.6-1.7 2-2.6 3.8-2.6 1.7 0 3.1.9 3.7 2.6' fill='none' stroke='%23ffd79d' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M9.8 12.2c.4-1 1.2-1.6 2.2-1.8' fill='none' stroke='%23ffd79d' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.proof-line[data-kind="generic"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2.2l4.8 2v3.4c0 2.6-1.7 5-4.8 6.2-3.1-1.2-4.8-3.6-4.8-6.2V4.2l4.8-2z' fill='none' stroke='%23ffd79d' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M6.1 7.9l1.2 1.2 2.6-2.7' fill='none' stroke='%23ffd79d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sticky-affiliate-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transform: translateY(120%);
  transition: transform 0.34s ease, opacity 0.3s ease;
}

.sticky-affiliate-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sticky-affiliate-inner {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  pointer-events: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(10, 22, 40, 0.94);
  border: 1px solid rgba(255, 186, 84, 0.34);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
}

.sticky-buy-link {
  min-height: 52px;
}

.button-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-top: 14px;
}

.button-row-full {
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.button-row-full .run-button {
  width: 100%;
}

.status-note,
.upload-card p {
  color: var(--muted);
}

.status-note {
  padding: 0 4px;
  font-size: 0.84rem;
}

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

.results-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: stretch;
  gap: 10px;
  grid-auto-rows: minmax(0, 1fr);
}

#statsGrid,
#combinedStatsGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mc-results-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mc-results-layout .results-subpanel:first-child {
  grid-column: 1;
}

.mc-results-layout .results-subpanel:last-child {
  grid-column: 2;
}

.results-subpanel {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.results-subpanel h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

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

.stat-card {
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: help;
  min-height: 92px;
  border-radius: 18px;
}

.stat-card-value {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.05;
}

.chart {
  position: relative;
  height: 340px;
  min-height: 340px;
  border-radius: 18px;
  overflow: hidden;
}

.chart.is-loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% - 18px);
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid rgba(124, 244, 199, 0.16);
  border-top-color: rgba(124, 244, 199, 0.98);
  border-right-color: rgba(118, 217, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(150, 181, 232, 0.08), 0 10px 28px rgba(4, 12, 24, 0.26);
  z-index: 12;
  animation: chartSpinner 0.85s linear infinite;
}

.chart.is-loading::after {
  content: attr(data-loading-label);
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 13;
  min-width: 148px;
  padding-top: 52px;
  transform: translate(-50%, -50%);
  color: #d8e7fb;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  padding: 52px 14px 0;
  z-index: 13;
}

.chart.is-loading .js-plotly-plot {
  opacity: 0.16;
  filter: saturate(0.72) blur(0.6px);
}

.chart.is-loading .main-svg,
.chart.is-loading .svg-container {
  pointer-events: none;
}

.chart.is-loading {
  background:
    radial-gradient(circle at top, rgba(124, 244, 199, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(8, 16, 29, 0.28), rgba(8, 16, 29, 0.5));
}

.chart.is-loading::before,
.chart.is-loading::after {
  pointer-events: none;
}

@keyframes chartSpinner {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Plotly unified-hover spike line fallback:
   some Plotly modes ignore axis spikecolor and render white from hover layer */
.js-plotly-plot .spikeline,
.js-plotly-plot .hoverlayer .spikeline {
  stroke: rgba(140, 150, 165, 0.42) !important;
  stroke-width: 1px !important;
}

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

.upload-format-note {
  display: grid;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.upload-format-note strong {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.format-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(150, 181, 232, 0.2);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.73rem;
}

.button-row-full {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

.button-row-full .run-button,
.run-button-full {
  display: block;
  width: 100%;
  justify-self: stretch;
  margin-top: 0;
  padding: 14px 18px;
  border-radius: 16px;
  text-align: center;
}

.mc-run-button {
  display: block;
  width: 100%;
  margin-top: 14px;
}

.button-row-full .status-note {
  padding: 0;
}

.status-note-inline {
  margin-top: 10px;
  padding: 0;
}

.rules-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rules-split-layout {
  display: grid;
  gap: 12px;
}

.rule-group {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.rule-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rule-group-header h3 {
  font-size: 0.95rem;
}

.rules-toggle-button {
  min-width: 92px;
}

.rules-collapsible {
  margin-top: 10px;
}

.rules-collapsible.is-collapsed {
  display: none;
}

.rule-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rule-card h3 {
  margin-bottom: 12px;
}

.rule-card p {
  margin: 6px 0 0;
  line-height: 1.5;
  font-size: 0.88rem;
}

.chart-panel .panel-header {
  align-items: center;
}

.chart-panel .panel-header p {
  max-width: 54ch;
  font-size: 0.78rem;
  text-align: right;
}

.rules-panel .panel-header {
  margin-bottom: 12px;
}

.rules-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(720px, calc(100% - 24px));
  width: 100%;
}

.rules-modal::backdrop {
  background: rgba(4, 10, 20, 0.76);
  backdrop-filter: blur(6px);
}

.rules-modal-card {
  background: rgba(11, 24, 43, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.rules-modal-list {
  display: grid;
  gap: 12px;
}

.rules-modal-list strong {
  display: block;
  margin-bottom: 4px;
}

.rules-modal-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

body.loading-overlay-open {
  overflow: hidden;
  cursor: default;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 10, 20, 0.78);
  backdrop-filter: blur(10px);
  cursor: default;
}

.loading-overlay.is-hidden {
  display: none;
}

.loading-overlay-card {
  width: min(520px, 100%);
  padding: 30px 26px 24px;
  border-radius: 24px;
  border: 1px solid rgba(150, 181, 232, 0.16);
  background:
    radial-gradient(circle at top, rgba(124, 244, 199, 0.12), transparent 52%),
    rgba(11, 24, 43, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-overlay-title {
  margin: 0 0 10px;
  color: #7cf4c7;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loading-overlay-message {
  margin: 0;
  width: 100%;
  max-width: 24ch;
  font-size: 1.45rem;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
}

.loading-overlay-detail {
  display: block;
  margin: 10px auto 0;
  width: 100%;
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.loading-overlay-progress {
  position: relative;
  width: min(360px, 100%);
  height: 14px;
  margin: 20px auto 0;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 18, 34, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(150, 181, 232, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

.loading-overlay-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124, 244, 199, 0.96) 0%, rgba(118, 217, 255, 0.98) 56%, rgba(255, 184, 107, 0.95) 100%);
  box-shadow:
    0 0 22px rgba(118, 217, 255, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  will-change: width;
}

.loading-overlay-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.28) 48%, transparent 100%),
    repeating-linear-gradient(
      -55deg,
      rgba(255, 255, 255, 0.18) 0 10px,
      rgba(255, 255, 255, 0.04) 10px 20px
    );
  background-size: 140% 100%, 160% 100%;
  animation: loading-progress-shimmer 1.15s linear infinite;
  opacity: 0.75;
  pointer-events: none;
}

.loading-overlay-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 2px;
  min-height: 14px;
}

.loading-overlay-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7cf4c7 0%, #76d9ff 100%);
  opacity: 0.35;
  transform: translateY(0) scale(0.9);
  animation: loading-dot-bounce 1s ease-in-out infinite;
}

.loading-overlay-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.loading-overlay-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

.loading-hot-firms {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(150, 181, 232, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
  text-align: left;
}

.loading-hot-firms-header {
  margin-bottom: 10px;
}

.loading-hot-firms-header p {
  margin: 0;
  color: #dce9fb;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.loading-hot-firms-list {
  display: grid;
  gap: 10px;
}

.loading-hot-link {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 64px;
  padding: 13px 48px 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(150, 181, 232, 0.14);
  background: rgba(7, 17, 31, 0.52);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.loading-hot-link::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 16L16 8M10 8h6v6' fill='none' stroke='%23dce9fb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  opacity: 0.9;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.loading-hot-link:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 244, 199, 0.28);
  background: rgba(9, 22, 39, 0.74);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.loading-hot-link:hover::after {
  transform: translateY(-50%) translateX(1px);
  opacity: 1;
}

.loading-hot-link:focus-visible {
  outline: 2px solid rgba(124, 244, 199, 0.36);
  outline-offset: 2px;
}

.loading-hot-link-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.1;
}

.loading-hot-link-feature {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(124, 244, 199, 0.1);
  border: 1px solid rgba(124, 244, 199, 0.2);
  color: #a9f0db;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.loading-overlay-cancel {
  margin: 18px auto 0;
  min-width: 132px;
  cursor: pointer;
}

.loading-overlay-cancel[disabled] {
  opacity: 0.6;
  cursor: pointer;
}

@keyframes loading-dot-bounce {
  0%,
  100% {
    opacity: 0.32;
    transform: translateY(0) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px) scale(1.08);
  }
}

@keyframes loading-progress-shimmer {
  from {
    background-position: 160% 0, 0 0;
  }
  to {
    background-position: -40% 0, 160% 0;
  }
}

@media (max-width: 1100px) {
  .toolbar-row {
    grid-template-columns: 1fr;
  }

  .hero,
  .control-grid,
  .stats-grid,
  .rules-grid,
  .upload-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .control-grid.compact {
    grid-template-columns: 1fr 1fr 1fr;
  }

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

  .control-grid.compact.funded-primary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-grid.compact.funded-advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .control-grid.compact.funded-advanced-grid > .field {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 16px;
    padding-bottom: 170px;
  }

  .hero,
  .control-grid,
  .control-grid.compact,
  .strategy-grid,
  .mc-grid,
  .control-grid.compact.funded-primary-grid,
  .custom-rules-grid,
  .custom-funded-grid,
  .custom-funded-advanced-grid,
  .funded-advanced-grid,
  .stats-grid,
  .rules-grid,
  .upload-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .control-grid.compact.funded-advanced-grid > .field {
    grid-column: span 1;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  #statsGrid,
  #combinedStatsGrid {
    grid-template-columns: 1fr;
  }

  .mc-results-layout {
    grid-template-columns: 1fr;
  }

  .mc-results-layout .results-subpanel:first-child,
  .mc-results-layout .results-subpanel:last-child {
    grid-column: auto;
  }

  .mc-metrics-grid {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    display: grid;
    width: 100%;
    height: auto;
  }

  .rule-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    align-items: stretch;
  }

  .rule-bar-select {
    grid-column: 1 / -1;
  }

  .rule-inline-stat,
  .see-more-link {
    min-width: 0;
  }

  .rule-inline-stat strong,
  .proof-line,
  .inline-switch {
    white-space: normal;
  }

  .rule-inline-stat strong {
    overflow-wrap: anywhere;
  }

  .challenge-picker-menu {
    width: 100%;
    max-width: none;
  }

  .challenge-picker-label {
    white-space: normal;
  }

  .see-more-link {
    justify-self: stretch;
    width: 100%;
  }

  .buy-now-link {
    width: 100%;
    justify-content: center;
    padding: 12px 44px 12px 16px;
  }

  .rating-badge {
    min-width: 0;
    width: 100%;
  }

  .proof-line {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .sticky-affiliate-inner {
    width: min(100% - 20px, 100%);
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .sticky-affiliate-cta {
    bottom: 8px;
  }

  .panel-header {
    display: block;
  }

  .funded-toggle-row {
    display: grid;
    gap: 8px;
  }

  .funded-advanced-header,
  .rule-group-header,
  .field-label-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-header p {
    margin-top: 8px;
  }

  .chart-panel .panel-header p {
    text-align: left;
  }

  .chart {
    height: 300px;
    min-height: 300px;
  }

  h1 {
    white-space: normal;
  }

  .loading-hot-link {
    padding-right: 44px;
  }

  .loading-overlay {
    padding: 16px;
  }

  .loading-overlay-card {
    padding: 22px 18px 18px;
  }
}

/* Hard-lock Monte Carlo result columns on desktop/tablet */
body .mc-results-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 12px;
}

body .mc-metrics-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}

@media (max-width: 760px) {
  body .mc-results-layout {
    grid-template-columns: 1fr !important;
  }

  body .mc-metrics-grid {
    grid-template-columns: 1fr !important;
  }
}
