:root {
  --bg-main: #FFFDFA;
  --text-main: #212833;
  --text-muted: #71717a;
  --accent-blue: #0061FE;
  --border-light: #E5E7EB;
  --card-bg: #FFFFFF;
  --font-sans: "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  color-scheme: light;
  --bg: var(--bg-main);
  --card: var(--card-bg);
  --text: var(--text-main);
  --muted: var(--text-muted);
  --line: var(--border-light);
  --accent: var(--accent-blue);
  --accent-hover: #0055df;
  --accent-soft: #f7faff;
  --good: var(--accent-blue);
  --bad: #b42318;
  --shadow: 0 2px 8px rgb(33 40 51 / 6%), 0 12px 28px rgb(33 40 51 / 5%);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg-main);
  color: var(--text);
  font: 16px/1.55 var(--font-sans);
}

a { color: var(--accent); }

.hero {
  background-color: var(--bg-main);
  border-bottom: 1px solid var(--line);
}

.hero > div {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

h1 {
  max-width: 18ch;
  margin: 0 0 10px;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-title {
  max-width: 18ch;
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 4vw, 1.875rem);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero-desc {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.65;
}

.chips {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
}

.chip.active {
  border-color: var(--border-light);
  background: var(--accent-soft);
  color: var(--text-main);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.inputs-wrapper { align-self: stretch; }

input,
select,
button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.inputs {
  position: sticky;
  top: 16px;
  z-index: 2;
}

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

fieldset {
  min-width: 0;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 16px;
  padding: 0;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}

.g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.in {
  position: relative;
  display: block;
  min-width: 0;
}

.in:has(input:focus-visible) {
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.15);
}

.in:has(input[aria-invalid="true"]) input { border-color: var(--bad); }

.in span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 16px;
  padding: 0;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.in:has(span:last-child) span:last-child {
  right: 16px;
  left: auto;
}

.in input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--card-bg);
  color: inherit;
  font: 16px var(--font-sans);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.in:has(span:first-child) input { padding-left: 38px; }
.in:has(span:last-child) input { padding-right: 38px; }

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--card-bg);
  color: inherit;
  font: 16px var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--card-bg);
  color: inherit;
  font: 16px var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.in input:focus-visible,
input[type="text"]:focus-visible,
.select:focus-visible {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.15);
  outline: none;
}

.tg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin: 0;
  padding: 9px 0;
  cursor: pointer;
}

.tg + .tg { border-top: 1px solid var(--line); }

.tg span { display: grid; gap: 2px; }

.tg b { font-size: 0.9rem; }

.tg small {
  max-width: 38ch;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
}

.tg input {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 28px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
}

.tg input::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 3px rgb(0 0 0 / 28%);
  content: "";
  transition: transform 140ms ease;
}

.tg input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.tg input:checked::after { transform: translateX(20px); }

button {
  min-height: 44px;
  margin: 0 6px 8px 0;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgb(0 0 0 / 8%);
}

button:active { transform: scale(0.97); }

button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

.primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

a:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-color: var(--text);
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: -2px 0 4px;
}

.preset-grid > div {
  display: grid;
  justify-items: start;
  gap: 0;
}

.preset-grid button {
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  font-size: 0.82rem;
}

.preset-grid small,
.field-hint {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.reset-button {
  min-height: 36px;
  margin: 6px 0 18px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

#warn {
  min-height: 1.2em;
  margin: 0 0 8px;
  color: var(--bad);
  font-size: 0.88rem;
}

.jump-link,
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.mobile-jump { display: none; }

.results {
  min-width: 0;
  max-width: 800px;
  margin: 0 auto;
  padding-right: 24px;
  padding-left: 24px;
}

.summary {
  margin: 0 0 22px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--accent-soft);
}

.summary h2 { margin-bottom: 5px; }

.summary-value {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.summary-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
}

.results-heading h2 { margin: 0; }

.platform-results {
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.platform-result {
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
  border-radius: 16px;
}

.platform-result.best {
  position: relative;
  overflow: hidden;
  margin: 8px -12px;
  border: 1px solid color-mix(in srgb, var(--accent-blue) 24%, var(--line));
  background: var(--accent-soft);
}

@keyframes shimmer {
  from { transform: translateX(-150%); }
  to { transform: translateX(150%); }
}

.platform-result.best.shimmer-active::before {
  position: absolute;
  z-index: 10;
  top: 0;
  left: -50%;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgb(34 197 94 / 15%), transparent);
  content: "";
  transform: skewX(-20deg);
  animation: shimmer 1s ease-out forwards;
  pointer-events: none;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.platform-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.platform-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex: 0 0 24px;
  align-self: center;
}

.platform-identity h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.platform-tag,
.profit-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.best-badge {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profit-wrap { flex: 0 0 auto; text-align: right; }

.profit-label { display: block; }

.profit {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.profit.pos { color: var(--good); }
.profit.neg { color: var(--bad); }

.caveat {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
}

.result-stats dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.result-stats dd {
  margin: 2px 0 0;
  font-size: 0.91rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fee-details { margin-top: 11px; }

.fee-details summary {
  width: fit-content;
  min-height: 36px;
  padding: 5px 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 650;
}

.fee-list {
  max-width: 680px;
  margin: 5px 0 12px;
  padding: 0;
  list-style: none;
}

.fee-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.fee-list li span { color: var(--muted); }
.fee-list li b { font-variant-numeric: tabular-nums; }
.fee-list .fee-total { border-bottom: 0; }

.platform-result .profit-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 0.9em;
}

.platform-result .profit-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 5px 0;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.platform-result .profit-details summary::-webkit-details-marker { display: none; }

.platform-result .profit-details summary::after {
  width: 0;
  height: 0;
  margin-left: 10px;
  border-top: 5px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  content: "";
  transition: transform 140ms ease;
}

.platform-result .profit-details[open] summary::after { transform: rotate(180deg); }

.profit-breakdown {
  max-width: 680px;
  margin: 6px 0 0;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.result-row:last-child { border-bottom: none; }

.row-label {
  color: var(--text-muted);
  font-size: 15px;
}

.row-value {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.row-value.font-bold { font-weight: 700; }

.row-value.text-blue {
  color: var(--accent-blue);
  font-size: 18px;
  font-weight: 700;
}

.result-row.highlight {
  margin: 0 -12px;
  padding: 12px;
  border-radius: 6px;
  background: var(--accent-soft);
}

.assumption {
  max-width: 72ch;
  margin: 7px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 2px;
  font-size: 0.84rem;
  font-weight: 600;
}

.row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.row > div { flex: 1 1 220px; }

.hrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
}

.hrow div { flex: 1 1 280px; }

.notes {
  color: var(--muted);
  font-size: 0.88rem;
}

.notes ul {
  display: block;
  margin: 10px 0 0;
  padding-left: 20px;
  border: 0;
}

.notes li {
  display: list-item;
  padding: 3px 0;
}

details {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

summary {
  min-height: 36px;
  padding: 5px 0;
  cursor: pointer;
  font-weight: 650;
}

.notes details p { max-width: 75ch; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (min-width: 821px) {
  .inputs {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: var(--line) transparent;
    scrollbar-width: thin;
  }
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
    gap: 20px;
  }

  .inputs-wrapper,
  .inputs { grid-column: 1; }

  .results { grid-column: 2; }
}

@media (max-width: 820px) {
  body { padding-bottom: 84px; }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 18px 16px 40px;
  }

  .inputs {
    position: static;
    grid-row: 1;
  }

  .results { grid-row: 2; }
  .wide { grid-column: 1; }

  .mobile-jump {
    position: fixed;
    z-index: 5;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 5px 18px rgb(0 0 0 / 22%);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
  }
}

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

@media (max-width: 520px) {
  .hero > div { gap: 16px; padding: 38px 20px; }
  .layout { padding-right: 12px; padding-left: 12px; }
  .panel { padding: 18px 16px; }
  .summary { padding: 17px 16px; }
  .results-heading { align-items: flex-start; }
  .results-heading .text-link { min-height: 36px; font-size: 0.8rem; }
  .result-head { align-items: flex-start; gap: 8px; }
  .platform-identity { display: grid; gap: 1px; }
  .platform-identity h3 { font-size: 0.96rem; }
  .platform-tag { font-size: 0.74rem; }
  .profit { font-size: 1.25rem; }
  .result-stats { gap: 8px; }
  .result-stats dt { font-size: 0.7rem; line-height: 1.3; }
  .result-stats dd { font-size: 0.84rem; }
  .hrow { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-sans);
}

.brand-icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.brand-text-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.color-navy {
  color: var(--text);
}

.color-blue {
  color: var(--accent);
}

h1, h2, h3, h4, h5, h6, .hook-title {
  font-family: var(--font-serif);
}

h3, h4, h5, h6, .hook-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

input, button, select, textarea {
  font-family: var(--font-sans);
}

@media (max-width: 600px) {
  .platform-result {
    padding: 20px 16px;
  }

  .results {
    padding-right: 16px;
    padding-left: 16px;
  }
}
