@font-face {
  font-family: Outfit;
  src: url("/assets/fonts/outfit-latin-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-latin-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0b1020;
  --bg-card: #151a27;
  --bg-card-2: #1a2030;
  --card: #151a27;
  --line: #2a2f3d;
  --ink: #f4f6fb;
  --muted: #c9cfdb;
  --dim: #b4bcd0;
  --cyan: #22d3ee;
  --cyan-ink: #042026;
  --violet: #9b7bff;
  --accent: #22d3ee;
  --accent-2: #5b8cff;
  --focus: #22d3ee;
  --warn: #f0d2a8;
  --warn-bg: #1a1610;
  --warn-border: #5a4630;
  --lose: #f0a8a8;
  --lose-bg: rgba(240, 168, 168, 0.12);
  --win: #22d3ee;
  --win-bg: rgba(34, 211, 238, 0.14);
  --close-bg: #1a2030;
  --warn-label: #f0d2a8;
  --path-minimums: #8b9bb8;
  --path-snowball: #5cf0ff;
  --path-avalanche: #5b8cff;
  --path-velocity: #22d3ee;
  --path-consolidate_line: #6d8bff;
  --path-cc_velocity: #2ed3c6;
  --path-balance_transfer: #818cf8;
  --path-ibc: #9b7bff;
  --path-consolidate_policy: #c084fc;
  --font-sans: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: Outfit, Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
  font-family: var(--font-sans);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
body {
  line-height: 1.5;
  min-height: 100vh;
  font-family: var(--font-sans);
}
a { color: var(--cyan); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

header, main, footer { max-width: 960px; margin: 0 auto; padding: 1.25rem 1.25rem; }
header { padding-top: 2rem; }
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
}
h1 { font-size: 2rem; font-weight: 700; margin: 0 0 0.25rem; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; font-weight: 650; margin: 1rem 0 0.4rem; }
.tag { color: var(--muted); font-size: 1.05rem; margin: 0 0 1rem; }

.disclaimer, .notice, .flag, .result-notes li,
label, .hint, button, input, select, table, th, td, .consent,
.privacy, .run-counter, .limit-message, footer p {
  font-family: var(--font-sans);
}
.disclaimer, .notice, .flag, .result-notes li { font-size: 0.95rem; }

.disclaimer {
  background: #12151f;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin: 0.75rem 0;
}
.disclaimer strong { color: var(--ink); font-weight: 650; }

.notice, .limit-message {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin: 0.75rem 0;
}
.limit-message {
  font-size: 1rem;
  margin: 0 0 1rem;
}
.limit-message:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.privacy {
  background: #12151f;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
}

form section, .results {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem 1.25rem;
  margin: 1rem 0;
}

label { display: block; font-size: 0.88rem; font-weight: 600; margin: 0.55rem 0 0.2rem; color: var(--ink); }
.hint { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.hint em { color: var(--ink); }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080c16;
  color: var(--ink);
  font-size: 1rem;
  color-scheme: dark;
}
input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: #9aa6c0;
  opacity: 1;
}
select {
  appearance: auto;
  background-color: #080c16;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover {
  border-color: #3a4256;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus,
input[type="text"]:focus-visible, input[type="number"]:focus-visible,
select:focus-visible, button:focus, button:focus-visible,
input[type="checkbox"]:focus, input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--cyan);
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px #080c16 inset;
  transition: background-color 9999s ease-out;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--dim);
  border-radius: 4px;
  background: #080c16;
  color-scheme: dark;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}
input[type="checkbox"]::before {
  content: "";
  width: 0.62rem;
  height: 0.62rem;
  transform: scale(0);
  transform-origin: center;
  background: var(--cyan-ink);
  clip-path: polygon(14% 44%, 0 57%, 35% 100%, 100% 18%, 85% 0, 33% 62%);
}
input[type="checkbox"]:checked {
  background: var(--cyan);
  border-color: var(--cyan);
}
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover { border-color: var(--cyan); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.4rem 0.8rem; }
.debt-row, .row-actions { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); }
.card-extra, .transfer-fields .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pill.win, .pill.lose, .pill.close { white-space: nowrap; }
.transfer-fields, .promo-fields, .installment-extra, .samebank-fields, details.advanced { margin-top: 0.65rem; }
details.advanced {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card-2);
}
details.advanced summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
}
.samebank-fields, .installment-extra {
  margin-top: 0.65rem;
}
.transfer-fields .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pill.win, .pill.lose, .pill.close { white-space: nowrap; }
.transfer-fields, .promo-fields {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card-2);
}

button {
  background: var(--cyan);
  color: var(--cyan-ink);
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  cursor: pointer;
  min-height: 44px;
}
button:hover { filter: brightness(1.08); }
button.secondary {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  font-weight: 650;
}
button.secondary:hover { background: rgba(34, 211, 238, 0.08); filter: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.consent {
  margin: 0.8rem 0;
  display: block;
  position: relative;
  padding-left: 1.7rem;
  color: var(--ink);
}
.consent > input[type="checkbox"]:first-child {
  position: absolute;
  left: 0;
  top: 0.22rem;
  margin-top: 0;
}
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; color: var(--ink); }
th, td { text-align: left; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
tr.winner { background: var(--win-bg); }
tr.loses td:first-child { box-shadow: inset 3px 0 0 var(--lose); }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px; margin-left: 0.3rem; }
.pill.win { background: var(--cyan); color: var(--cyan-ink); }
.pill.lose { background: var(--lose-bg); color: var(--lose); }
.pill.close { background: var(--close-bg); color: var(--dim); border: 1px solid var(--line); }
.pill.fewest { background: rgba(155, 123, 255, 0.18); color: #c4b4ff; }
.muted { color: var(--dim); }

footer { color: var(--dim); font-size: 0.85rem; padding-bottom: 3rem; }
footer p { margin: 0.45rem 0; }

.skip-app {
  position: absolute;
  left: 0.75rem;
  top: -40rem;
  z-index: 100;
  background: var(--cyan);
  color: var(--cyan-ink);
  font-family: var(--font-sans);
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
}
.skip-app:focus { top: 0.75rem; }

.site-bar {
  background: #05070d;
  color: var(--ink);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #22d3ee, #9b7bff) 1;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.site-bar-brand, .site-bar-back {
  font-family: var(--font-sans);
  text-decoration: none;
  color: var(--ink);
}
.site-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-bar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.site-bar-back {
  color: var(--cyan);
  font-weight: 650;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.run-counter {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  align-self: center;
}

/* Estimated comparison charts and path colors */
.results {
  position: relative;
  overflow: hidden;
}
.results::before {
  content: "";
  display: block;
  height: 3px;
  margin: -1.1rem -1.2rem 1.15rem;
  background: linear-gradient(90deg, #22d3ee 0%, #5b8cff 50%, #9b7bff 100%);
}
.results #tableWrap,
.results #horizonWrap,
.results #chartsWrap {
  overflow-x: auto;
}
.results .hint strong { color: var(--ink); font-weight: 650; }
.results .result-notes { color: var(--muted); padding-left: 1.15rem; }
.results .result-notes li { margin: 0.35rem 0; }

.path-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: -0.05rem;
  flex: none;
}

.compare-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0.35rem 0 1.25rem;
}
.compare-chart {
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
}
.compare-chart h3 {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}
.compare-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.compare-bars li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label value"
    "track track";
  gap: 0.3rem 0.7rem;
  align-items: center;
}
.bar-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  grid-area: label;
}
.bar-label .path-swatch { margin-right: 0; margin-top: 0.2rem; }
.bar-track {
  grid-area: track;
  height: 0.85rem;
  background: #111119;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  min-width: 0;
}
.bar-value {
  grid-area: value;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
}
.bar-fill.is-open {
  opacity: 0.45;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(5, 7, 13, 0.5) 4px,
    rgba(5, 7, 13, 0.5) 8px
  );
}
.compare-bars li.bar-unfinished .bar-value { color: var(--dim); font-weight: 500; }

@media (max-width: 800px) {
  .compare-charts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
  button:hover, button.secondary:hover { filter: none; }
  input[type="checkbox"]::before { transition: none; }
}

@media print {
  :root, html, body { color-scheme: light; }
  button, .actions, .consent, .site-bar, .skip-app { display: none !important; }
  html, body { background: #fff; color: #111; }
  h1, h2, h3, label, .consent, table, .bar-label, .bar-value { color: #111 !important; }
  .tag, .hint, .muted, .privacy, footer, th, .compare-chart h3,
  .bar-unfinished .bar-value, .result-notes { color: #333 !important; }
  .hint em { color: #111 !important; }
  form section, .results, .privacy, .disclaimer, .notice, .limit-message, .compare-chart {
    background: #fff !important;
    color: #111 !important;
    border-color: #ccc;
    break-inside: avoid;
  }
  .results { overflow: visible; }
  .results::before { margin-left: 0; margin-right: 0; }
  .disclaimer, .privacy { color: #333 !important; }
  .disclaimer strong { color: #111 !important; }
  .notice, .limit-message { background: #f8eadc !important; border-color: #e2c9a8; color: #7a3e12 !important; }
  input[type="text"], input[type="number"], select {
    background: #fff;
    color: #111;
    border-color: #ccc;
  }
  td, th { border-bottom-color: #ccc; }
  tr.winner { background: #eefbff; }
  .bar-track { background: #f2f2f2; border-color: #ddd; }
  .pill.win { background: #22d3ee; color: #042026; }
  .pill.lose { background: #f8e8e6; color: #7a1f1f; }
  .pill.close { background: #eee; color: #444; border-color: #ccc; }
}

.gps-tag { display: block; margin-top: 4px; font-size: 0.55em; font-weight: 600; letter-spacing: 0.04em; color: #22d3ee; }
