:root {
  --bg: #f5f1e8;
  --bg-elev: #ece5d4;
  --fg: #1a1a1a;
  --fg-soft: #3a3a3a;
  --muted: #6e6a60;
  --rule: rgba(26, 26, 26, 0.18);
  --accent: #cb1c1f;
  --font-display: "Rockwell", "Rockwell Nova", "Rokkitt", "Roboto Slab", Georgia, serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  --shadow-card: 0 18px 60px -18px rgba(26, 26, 26, 0.28);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
::selection { background: var(--accent); color: var(--bg); }

.canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; cursor: grab; touch-action: none; }
.canvas.dragging { cursor: grabbing; }
.canvas.pointing { cursor: pointer; }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(to right, rgba(26,26,26,0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26,26,26,0.045) 1px, transparent 1px);
  background-size: 38px 38px;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .85;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(26,26,26,0.18) 110%);
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .11; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* masthead */
.masthead { position: fixed; top: 1.6rem; left: 2rem; z-index: 4; pointer-events: none; max-width: 30rem; }
.brand { pointer-events: auto; display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .6rem; text-decoration: none; color: var(--fg); }
.brand-logo { display: block; width: 1.35rem; height: 1.35rem; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; transform: translateY(.207em); }
.masthead h1 { margin: .55rem 0 0; padding-top: .08em; font-weight: 700; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.18; letter-spacing: -.02em; overflow: visible; }
.masthead h1 em { display: block; font-style: normal; color: var(--accent); }

/* glass panels */
.panel {
  position: fixed; z-index: 4;
  background: rgba(245,241,232,.88);
  backdrop-filter: blur(10px) saturate(1.05); -webkit-backdrop-filter: blur(10px) saturate(1.05);
  border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-card);
}
.rail { bottom: 2rem; left: 2rem; padding: .8rem 1rem .75rem; width: 20rem; display: flex; flex-direction: column; gap: .6rem; }
.control-label { font-family: var(--font-mono); font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.search { position: relative; }
.search input {
  width: 100%; appearance: none; background: transparent; border: 0; border-bottom: 1.5px solid var(--rule);
  padding: .45rem 0 .35rem; font-family: var(--font-display); font-size: 1rem; color: var(--fg); outline: none;
  transition: border-color 200ms ease;
}
.search input:focus { border-bottom-color: var(--accent); }
.search input::placeholder { color: var(--muted); font-style: italic; }
.search-list { position: absolute; left: 0; right: 0; bottom: calc(100% + .4rem); max-height: 14rem; overflow: auto; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-card); display: none; }
.search-list.open { display: block; }
.search-item { padding: .4rem .7rem; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; font-size: .92rem; }
.search-item small { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .1em; color: var(--muted); }
.search-item:hover, .search-item.active { background: var(--bg-elev); color: var(--accent); }
.zoom { display: flex; gap: .4rem; align-items: center; }
.zoom button, .btn {
  appearance: none; cursor: pointer; padding: .3rem .7rem; border: 1px solid var(--rule); border-radius: 999px; background: transparent;
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-soft);
  transition: border-color 200ms ease, color 200ms ease;
}
.zoom button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
.zoom button:focus-visible, .btn:focus-visible, .search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* legend */
.legend { bottom: 2rem; right: 2rem; padding: .8rem 1rem .7rem; width: 15.5rem; max-height: 46vh; overflow: auto; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .18rem .8rem; }
.chip { display: flex; align-items: center; gap: .45rem; font-size: .82rem; cursor: pointer; padding: .1rem .2rem; border-radius: 4px; white-space: nowrap; }
.chip:hover, .chip.on { background: var(--bg-elev); }
.chip i { width: .62rem; height: .62rem; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(26,26,26,.15); }
.chip small { margin-left: auto; font-family: var(--font-mono); font-size: .58rem; color: var(--muted); }



/* player card */
.card { top: 10.6rem; left: 2rem; width: 20rem; max-height: calc(100vh - 14rem); overflow: auto; padding: 1rem 1.15rem .9rem; display: none; }
.card.open { display: block; }
.card-eyebrow { font-family: var(--font-mono); font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.card-close { appearance: none; border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); padding: 0 .1rem; }
.card-close:hover { color: var(--accent); }
.card h2 { margin: .3rem 0 .1rem; font-size: 1.45rem; line-height: 1.1; letter-spacing: -.015em; }
.card-sub { margin: 0; font-size: .86rem; color: var(--fg-soft); }
.card-years { margin: .45rem 0 0; display: flex; flex-wrap: wrap; gap: .22rem; }
.year { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .04em; padding: .1rem .35rem; border: 1px solid var(--rule); border-radius: 4px; color: var(--fg-soft); font-variant-numeric: tabular-nums; }
.card h3 { margin: .9rem 0 .35rem; font-size: .8rem; font-weight: 700; color: var(--fg-soft); }
.mates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mate { display: grid; grid-template-columns: .55rem 1fr auto; gap: .5rem; align-items: baseline; padding: .32rem .2rem; border-top: 1px solid var(--rule); cursor: pointer; }
.mate:first-child { border-top: 0; }
.mate:hover { color: var(--accent); }
.mate i { width: .55rem; height: .55rem; border-radius: 50%; align-self: center; }
.mate b { font-weight: 600; font-size: .92rem; }
.mate small { display: block; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .06em; color: var(--muted); }
.mate .n { font-family: var(--font-mono); font-size: .66rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* tooltip */
.tip { position: fixed; z-index: 5; pointer-events: none; display: none; padding: .45rem .65rem; background: var(--fg); color: var(--bg); border-radius: 6px; font-size: .82rem; line-height: 1.35; max-width: 18rem; box-shadow: var(--shadow-card); }
.tip.on { display: block; }
.tip small { display: block; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-top: .15rem; }

/* hint */
.hint { position: fixed; left: 50%; bottom: 2.2rem; transform: translateX(-50%); z-index: 4; padding: .45rem .9rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: .82rem; box-shadow: var(--shadow-card); transition: opacity 300ms ease; }
.hint.gone { opacity: 0; pointer-events: none; }

.meta { position: fixed; right: 2rem; bottom: 2.85rem; z-index: 3; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.legend ~ .meta { display: none; }

@media (max-width: 760px) {
  .masthead { left: 1rem; top: 1rem; max-width: 70vw; }
  .legend { display: none; }
  .rail { left: 1rem; right: 1rem; width: auto; bottom: 3.4rem; }
  .card { left: 1rem; right: 1rem; width: auto; top: auto; bottom: 10.5rem; max-height: 46vh; }
  .hint { bottom: 12rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
