/* Palette taken from Fuertafit: mint green from the logo, near-black
   backgrounds, yellow for highlights and blue for the access button. */
:root {
  --bg: #0f1011;
  --bg-2: #151618;
  --surface: #1a1b1e;
  --surface-2: #222327;
  --border: #2b2d32;
  --text: #f4f5f5;
  --muted: #a3a7ad;
  --green: #35c38f;
  --green-bright: #43e0a6;
  --green-ink: #0f2a20;
  --yellow: #ffd60a;
  --blue: #3e6ff6;
  --red: #ff6b6b;

  /* Names read by app.js when drawing on canvas. */
  --accent: var(--green);
  --accent-soft: rgba(53, 195, 143, 0.16);
  --plus: var(--green-bright);
  --minus: var(--red);
  --peak: rgba(255, 214, 10, 0.14);
  --peak-line: var(--yellow);
  --bar: #3a3d44;
  --bar-done: #26282d;
  --grid: #24262b;

  --radius: 16px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
.sprite { position: absolute; }
.icon {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img { display: block; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--border); padding: 0.05em 0.4em; border-radius: 6px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.green { color: var(--green); }
.yellow { color: var(--yellow); }
.red { color: var(--red); }
/* Big O must keep its case inside uppercase headings. */
.nocase { text-transform: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 0.95rem/1 var(--font); text-decoration: none; white-space: nowrap;
  border-radius: 8px; padding: 11px 18px; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible, .tab:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav-links a:focus-visible {
  outline: 2px solid var(--yellow); outline-offset: 2px;
}
.btn-green {
  background: linear-gradient(180deg, var(--green-bright), var(--green));
  color: var(--green-ink); text-transform: uppercase; letter-spacing: 0.02em; font-weight: 700;
  box-shadow: 0 8px 24px -10px rgba(67, 224, 166, 0.6);
}
.btn-green:hover { filter: brightness(1.07); }
.btn-blue { background: var(--blue); color: #fff; border-radius: 4px; }
.btn-blue:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--green); }
.btn-lg { padding: 15px 26px; font-size: 1.05rem; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(28, 29, 31, 0.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand img { border-radius: 8px; }
.brand span { white-space: nowrap; }
.nav-links { display: flex; gap: 26px; margin: 0 auto; }
.nav-links a { text-decoration: none; font-weight: 500; color: var(--text); transition: color 0.15s; }
.nav-links a:hover { color: var(--green); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; padding: 28px 0 0;
  background:
    radial-gradient(600px 380px at 78% 30%, rgba(53, 195, 143, 0.22), transparent 70%),
    linear-gradient(180deg, #161719, var(--bg));
}
.banner {
  width: fit-content; margin: 0 auto 36px; padding: 6px 18px;
  border: 1px solid #3a3c41; background: rgba(0, 0, 0, 0.25);
  color: var(--green); font-weight: 700; font-size: clamp(0.9rem, 2.2vw, 1.5rem);
  text-transform: uppercase; letter-spacing: 0.01em; text-align: center;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding-bottom: 56px; }
h1 { margin: 0 0 26px; font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.02; font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em; }
.hero-sub { max-width: 470px; margin: 24px 0 0; font-size: 1.12rem; color: #e6e7e8; }
.hero-sub strong { font-weight: 700; }

.hero-visual { position: relative; padding: 34px 0 40px; }
.hero-panel {
  position: relative; border-radius: 22px; padding: 18px;
  background: linear-gradient(160deg, rgba(53, 195, 143, 0.28), rgba(15, 16, 17, 0.9) 55%);
  border: 1px solid rgba(53, 195, 143, 0.35);
  box-shadow: 0 30px 80px -30px rgba(53, 195, 143, 0.45);
}
.hero-panel-head { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #d6f5e9; font-weight: 500; margin-bottom: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 0 rgba(67, 224, 166, 0.7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(67, 224, 166, 0); } 100% { box-shadow: 0 0 0 0 rgba(67, 224, 166, 0); } }
.hero-canvas { height: 260px; }
.hero-canvas canvas { width: 100%; height: 100%; display: block; }

.toast {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 14px; min-width: 250px;
  background: rgba(40, 42, 46, 0.78); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
  font-size: 0.78rem; line-height: 1.3;
}
.toast img { border-radius: 7px; flex: none; }
.toast div { display: flex; flex-direction: column; }
.toast b { font-weight: 700; font-size: 0.72rem; letter-spacing: 0.03em; }
.toast span { color: #d9dadc; }
.toast time { margin-left: auto; padding-left: 12px; color: var(--muted); font-size: 0.7rem; font-family: var(--mono); }
.toast-a { top: 0; right: -10px; animation: float 6s ease-in-out infinite; }
.toast-b { bottom: 0; left: -20px; animation: float 6s ease-in-out 1.5s infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

.marquee { background: linear-gradient(90deg, var(--green), var(--green-bright)); border-radius: 18px 18px 0 0; max-width: 1180px; margin: 0 auto; overflow: hidden; }
.marquee-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee span { padding: 12px 28px; font-weight: 800; font-style: italic; color: rgba(15, 42, 32, 0.78); white-space: nowrap; font-size: 1.05rem; }
.marquee span { display: inline-flex; align-items: center; gap: 8px; }
.marquee .icon { width: 1em; height: 1em; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
main.wrap { padding-top: 80px; }
.section { margin-bottom: 88px; }
.section-head { max-width: 760px; margin-bottom: 26px; }
.kicker { margin: 0 0 8px; color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; }
h2 { margin: 0 0 12px; font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.12; font-weight: 800; text-transform: uppercase; }
.section-sub { margin: 0; color: var(--muted); font-size: 1.02rem; }
.tag { font-family: var(--mono); font-weight: 600; padding: 0 6px; border-radius: 6px; }
.tag.plus { color: var(--green-bright); background: rgba(67, 224, 166, 0.12); }
.tag.minus { color: var(--red); background: rgba(255, 107, 107, 0.12); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.select select, .field input, .field textarea {
  font: 500 0.95rem var(--font); color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.select select { min-width: 210px; cursor: pointer; }
.speed { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); font-size: 0.88rem; }
input[type="range"] { accent-color: var(--green); }

.chart { position: relative; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart-tall { height: 400px; }
.chart-short { height: 240px; margin-top: 18px; }

.sweep-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
.side { min-width: 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.kpi span, .metric span { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.kpi strong { font-family: var(--mono); font-size: 1.2rem; }
.kpi-yellow strong { color: var(--yellow); }
.side-title { margin: 18px 0 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.panel > .side-title:first-child { margin-top: 0; }
.log { list-style: none; margin: 0; padding: 0; max-height: 236px; overflow: auto; font-family: var(--mono); font-size: 0.8rem; }
.log li { padding: 6px 10px; border-radius: 8px; border-left: 3px solid transparent; color: #d3d5d8; }
.log li.current { background: var(--accent-soft); border-left-color: var(--green); }
.log .plus { color: var(--green-bright); }
.log .minus { color: var(--red); }
.log .best { color: var(--yellow); font-weight: 600; }
.note { margin: 14px 0 0; color: var(--muted); font-size: 0.92rem; min-height: 1.5em; }
.inline-note { margin: 0; }

/* ---------- decisions ---------- */
.decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.decision { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; border-top: 3px solid var(--green); }
.decision-edge { border-top-color: var(--yellow); }
.decision h3 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.decision p { margin: 0; color: var(--muted); font-size: 0.93rem; flex: 1; }
.badge { width: fit-content; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px; color: var(--green); background: rgba(53, 195, 143, 0.12); }
.decision-edge .badge { color: var(--yellow); background: rgba(255, 214, 10, 0.1); }
.example { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.example code { background: none; border: 0; padding: 0; font-size: 0.82rem; }
.ex-out::before { content: "→ "; color: var(--muted); }
.ex-out.ok { color: var(--green-bright); }
.ex-out.err { color: var(--red); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font: 600 0.85rem var(--font); color: var(--green); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ---------- server ---------- */
.tabs { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab { font: 600 0.9rem var(--font); border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.run-form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.tab-panel { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; flex: 1; }
.tab-panel[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.field input[type="number"] { width: 150px; font-family: var(--mono); }
.field.grow { flex: 1; }
.field textarea { width: 100%; font-family: var(--mono); resize: vertical; }
.chips { display: flex; gap: 6px; padding-bottom: 4px; }
.chip { font: 600 0.82rem var(--font); background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip:hover { border-color: var(--green); color: var(--green); }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.35); color: var(--red); font-family: var(--mono); font-size: 0.88rem; }
.metrics { display: grid; grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.metric { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.metric strong { display: block; font-family: var(--mono); font-size: 1.2rem; overflow-wrap: anywhere; }
.metric small { display: block; color: var(--muted); font-size: 0.78rem; }
.metric-hero { background: linear-gradient(160deg, rgba(53, 195, 143, 0.25), var(--bg-2)); border-color: rgba(53, 195, 143, 0.45); }
.metric-hero strong { font-size: 2rem; color: var(--green-bright); font-family: var(--font); font-weight: 800; }

/* ---------- race ---------- */
.race-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; }
.race-table td { font-family: var(--mono); }
.race-table td.fast { color: var(--green-bright); }
.race-table td.slow { color: var(--red); }
.race-table td.x { color: var(--yellow); font-weight: 600; }
.race-table tr.empty td { color: var(--muted); font-family: var(--font); text-align: center; padding: 40px 10px; }

/* ---------- api ---------- */
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.code { margin: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 0.84rem; line-height: 1.6; }
.code code { background: none; border: 0; padding: 0; }
.status-list, .facts { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.status-list b { font-family: var(--mono); min-width: 38px; }
.s-ok { color: var(--green-bright); }
.s-err { color: var(--yellow); }
.facts li { padding: 6px 0 6px 22px; position: relative; color: #d3d5d8; font-size: 0.92rem; }
.facts li::before { content: ""; position: absolute; left: 0; top: 14px; width: 10px; height: 10px; border-radius: 3px; background: var(--green); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 28px 0 40px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer p { margin: 0; color: var(--muted); font-size: 0.86rem; max-width: 620px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .sweep-grid, .race-grid, .api-grid, .decisions { grid-template-columns: 1fr; }
  .hero-visual { margin: 0 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-hero { grid-column: 1 / -1; }
  .speed { margin-left: 0; }
}
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}
@media (max-width: 640px) {
  .toast { min-width: 0; }
  .toast-a { right: 0; }
  .toast-b { left: 0; }
  .chart-tall { height: 340px; }
  .panel { padding: 16px; }
  .select select { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track, .toast, .dot, .icon-spin { animation: none; }
  html { scroll-behavior: auto; }
}
