:root {
  --ink: #14201b;
  --muted: #4a5c54;
  --paper: #f3efe6;
  --panel: rgba(255, 252, 246, 0.88);
  --accent: #0f6b4c;
  --accent-ink: #f7fff9;
  --line: rgba(20, 32, 27, 0.12);
  --warn: #8a4b16;
  --shadow: 0 24px 60px rgba(20, 32, 27, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--paper);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(15, 107, 76, 0.18), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(196, 145, 72, 0.16), transparent 50%),
    linear-gradient(165deg, #efe8da 0%, #f6f2ea 42%, #e7eee8 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) 0 4rem;
}

.brand .mark {
  margin: 0 0 0.75rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  animation: rise 0.7s ease both;
}

.brand h1 {
  margin: 0;
  max-width: 16ch;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  animation: rise 0.7s ease 0.08s both;
}

.lede {
  margin: 1rem 0 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  animation: rise 0.7s ease 0.16s both;
}

.action {
  margin-top: 2.5rem;
  animation: rise 0.7s ease 0.24s both;
}

button#run {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: 500 1.05rem/1 "IBM Plex Sans", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

button#run:hover:not(:disabled) { transform: translateY(-1px); background: #0c5a40; }
button#run:active:not(:disabled) { transform: translateY(1px); }
button#run:disabled { opacity: 0.55; cursor: wait; }

.status {
  min-height: 1.5em;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.error { color: var(--warn); }
.status.ok { color: var(--accent); }

.results {
  margin-top: 2.25rem;
  padding: 1.25rem 1.35rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.results h2 {
  margin: 0 0 0.85rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#ranking {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

#ranking li {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}

#ranking li:first-child { border-top: 0; }

.conf {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  color: var(--accent);
}

.pick { font-weight: 500; }
.vs { color: var(--muted); font-weight: 400; }
.pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.meta {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  #ranking li {
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
  }
  .pct { grid-column: 2; }
}
