/* NimeOraakel — deliberate dark-only "night bar" design.
   Color roles from the validated dark palette:
   surface #1a1a19, page #0d0d0d, primary ink #fff, secondary #c3c2b7,
   muted #898781, hairline #2c2c2a, baseline #383835.
   Series hue follows the entity in view: women = magenta #d55181 (slot 5, dark),
   men = blue #3987e5 (slot 1, dark). One series on screen at a time. */
:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --hairline: #2c2c2a;
  --baseline: #383835;
  --ring: rgba(255, 255, 255, 0.1);
  --series: #d55181;      /* swapped to #3987e5 in .sex-m */
  --series-soft: rgba(213, 81, 129, 0.16);
}
.sex-m {
  --series: #3987e5;
  --series-soft: rgba(57, 135, 229, 0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
  min-height: 100svh;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }

.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.brand span { background: linear-gradient(90deg, #d55181, #9085e9, #3987e5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lang {
  background: none; border: 1px solid var(--hairline); color: var(--ink-2);
  border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.lang:hover { border-color: var(--muted); }

.lede { color: var(--ink-2); font-size: 16px; margin-bottom: 18px; max-width: 46ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 16px;
  padding: 18px;
  margin-top: 14px;
}

/* controls */
.controls { display: grid; gap: 12px; }
.agebox { background: var(--surface); border: 1px solid var(--ring); border-radius: 16px; padding: 16px 18px 12px; }
.agenum { font-size: 56px; font-weight: 800; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.ageunit { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.agehints { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
#cohortHint { color: var(--ink-2); }

input[type="range"] {
  width: 100%; margin-top: 14px; appearance: none; -webkit-appearance: none;
  height: 28px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--baseline); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--series); border: 3px solid var(--page); margin-top: -12px;
  box-shadow: 0 0 0 1px var(--ring);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--baseline); }
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--series);
  border: 3px solid var(--page); box-shadow: 0 0 0 1px var(--ring);
}

.sexrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sexbtn {
  font: inherit; font-size: 15px; font-weight: 600; padding: 12px;
  border-radius: 12px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.sexbtn.active { border-color: var(--series); color: var(--ink); background: var(--series-soft); }

/* oracle headline */
.oracle { text-align: center; padding: 22px 18px; }
.oracle-pre { color: var(--ink-2); font-size: 14px; }
.oracle-name { font-size: 44px; font-weight: 800; letter-spacing: 0.5px; margin: 6px 0 4px; color: var(--series); }
.oracle-sub { color: var(--muted); font-size: 13px; }
.oracle-sub b { color: var(--ink-2); font-weight: 600; }

/* ranked bars */
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.chart-head h2 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.playbtn {
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px;
  border-radius: 10px; border: 1px solid var(--hairline);
  background: none; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.playbtn.on { border-color: var(--series); color: var(--ink); background: var(--series-soft); }

.bars { list-style: none; display: grid; gap: 2px; }
.bar-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 10px; cursor: default; position: relative;
}
.bar-row:hover { background: rgba(255, 255, 255, 0.03); }
.bar-rank { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.bar-mid { min-width: 0; }
.bar-name { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.bar-track { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--series); min-width: 8px; }
.bar-pct { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.bar-count { color: var(--muted); font-size: 11px; display: block; }

/* party (reveal) mode */
.bar-row.hidden-card .bar-name,
.bar-row.hidden-card .bar-track,
.bar-row.hidden-card .bar-pct { visibility: hidden; }
.bar-row.hidden-card { cursor: pointer; border: 1px dashed var(--baseline); }
.bar-row.hidden-card::after {
  content: "?"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-weight: 700; font-size: 16px;
}
.bar-row.revealed { animation: flip 0.35s ease; }
@keyframes flip { from { transform: rotateX(80deg); opacity: 0; } to { transform: none; opacity: 1; } }

.coverage { color: var(--muted); font-size: 12px; margin-top: 12px; border-top: 1px solid var(--hairline); padding-top: 10px; }

.foot { margin-top: 22px; color: var(--muted); font-size: 12px; }
.foot a { color: var(--ink-2); }

/* tooltip */
.tip {
  position: fixed; z-index: 10; background: #242423; color: var(--ink);
  border: 1px solid var(--ring); border-radius: 10px; padding: 8px 10px;
  font-size: 12.5px; pointer-events: none; max-width: 240px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.tip b { font-variant-numeric: tabular-nums; }

@media (max-width: 420px) {
  .agenum { font-size: 46px; }
  .oracle-name { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar-row.revealed { animation: none; }
}
