/* Primordial Soup: a lab bench at night. xp9's palette and type, ink bench, paper cards, hard shadows. */
:root {
  --ink: #141018; --ink-2: #1f1a26; --paper: #fffdf6; --paper-2: #f4eedd; --line: #d9d2c0; --grey: #625b6b; --mute: #bdb6c6;
  --yellow: #ffe033; --pink: #ff3d8b; --cyan: #35d9ff; --lime: #b9f53c; --violet: #7b4dff; --orange: #ff8a1f;
  --display: "Bricolage Grotesque", "Arial Black", Arial, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  --bw: 3px; --r-s: 10px; --r-m: 14px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.3, 1.45, .4, 1);
  --panel: 380px; --top: 56px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--paper); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
.panel :focus-visible { outline-color: var(--violet); }
.skip { position: fixed; top: 6px; left: 12px; z-index: 50; padding: 10px 16px; background: var(--yellow); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: var(--r-pill); font: 800 15px/1 var(--display); text-decoration: none; translate: 0 -80px; transition: translate .13s var(--ease); }
.skip:focus { translate: none; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: var(--top); padding: 0 16px; background: var(--ink); border-bottom: 2px solid #2c2534; }
.logo { font: 800 26px/1 var(--display); letter-spacing: -.05em; color: var(--paper); text-decoration: none; }
.logo i { font-style: normal; color: var(--pink); }
.crumb { flex: 1; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb::before { content: "/ "; color: #5a5266; }
.tabs { display: flex; gap: 4px; }
.tab { min-height: 40px; padding: 0 14px; background: none; border: 0; border-bottom: 3px solid transparent; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.tab:hover { color: var(--paper); }
.tab.on { color: var(--paper); border-bottom-color: var(--lime); }

/* layout: the slide fills what the panel leaves */
.app { display: grid; grid-template-columns: 1fr var(--panel); height: calc(100dvh - var(--top)); }
.stage { position: relative; overflow: hidden; background: radial-gradient(circle at 50% 50%, #221c2a 0, var(--ink) 70%); touch-action: none; }
#scope { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#scope:active { cursor: grabbing; }
body[data-view="breed"] #scope { cursor: default; }
.panel { overflow-y: auto; background: var(--ink-2); border-left: 2px solid #2c2534; padding: 22px 20px 40px; }
.pv > * + * { margin-top: 14px; }

/* type */
h1, h2, h3, .h2, .h3 { font-family: var(--display); margin: 0; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.h2 { font-size: 32px; line-height: 1.02; }
.h3 { font-size: 19px; line-height: 1.2; margin-top: 26px !important; }
p { margin: 0; text-wrap: pretty; }
.label { font: 500 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--lime); }
.small, .hint { font-size: 14px; line-height: 1.5; color: var(--mute); }
.hint { font: 400 12.5px/1.4 var(--mono); }
.strain { font-size: 34px; line-height: 1; }
.strain i { font-style: italic; font-weight: 700; }
.origin { color: var(--mute); font-size: 14.5px; }
.pv ul { padding-left: 20px; margin: 10px 0 0; } .pv li + li { margin-top: 6px; } .pv li { color: #e8e2ee; font-size: 15px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { background: var(--paper); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: var(--r-s); box-shadow: 3px 3px 0 var(--lime); padding: 8px 8px 6px; text-align: center; min-width: 0; }
.stats b { display: block; font: 800 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.stats span { font: 500 10.5px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--grey); }

/* controls */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; gap: 0; border: var(--bw) solid var(--paper); border-radius: var(--r-pill); overflow: hidden; }
.chip { min-height: 38px; padding: 0 13px; background: transparent; border: 0; font: 500 13px/1 var(--mono); color: var(--paper); }
.chip + .chip { border-left: 2px solid #4a4254; }
.chip[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.btn { min-height: 42px; padding: 0 16px; background: var(--paper); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: var(--r-pill); box-shadow: 3px 3px 0 var(--lime); font: 800 15px/1 var(--display); transition: translate .12s var(--ease), box-shadow .12s var(--ease); }
.btn:hover { translate: -1px -1px; box-shadow: 4px 4px 0 var(--lime); }
.btn:active { translate: 2px 2px; box-shadow: 1px 1px 0 var(--lime); }
.btn.alt { background: var(--lime); box-shadow: 3px 3px 0 var(--paper); }
.btn:disabled { opacity: .45; cursor: default; translate: none; box-shadow: 3px 3px 0 #4a4254; }
.toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; font: 500 14px/1 var(--body); cursor: pointer; }
.toggle input { appearance: none; width: 46px; height: 26px; border-radius: 99px; background: #4a4254; border: 2px solid var(--paper); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); transition: translate .2s var(--spring); }
.toggle input:checked { background: var(--lime); } .toggle input:checked::after { translate: 20px 0; background: var(--ink); }

/* collection */
.coll { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sp { padding: 0; background: var(--paper); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: var(--r-s); overflow: hidden; text-align: left; box-shadow: 3px 3px 0 #4a4254; transition: translate .12s var(--ease), box-shadow .12s; min-width: 0; }
.sp:hover { translate: -1px -1px; box-shadow: 4px 4px 0 var(--lime); }
.sp[aria-current="true"] { box-shadow: 3px 3px 0 var(--lime); outline: 3px solid var(--lime); outline-offset: 1px; }
.sp img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #c9cdc2; }
.sp span { display: block; padding: 5px 7px 6px; font: 700 12px/1.15 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp small { display: block; font: 400 10.5px/1.2 var(--mono); color: var(--grey); }

/* laws */
.laws { margin-top: 22px !important; border-top: 2px solid #2c2534; padding-top: 14px; }
.laws summary { cursor: pointer; font: 800 17px/1.2 var(--display); }
.laws > * + * { margin-top: 10px; }
.pull { color: var(--lime); } .push { color: var(--pink); }
.matrix { display: grid; gap: 2px; width: max-content; max-width: 100%; }
.matrix i, .matrix b { width: 26px; height: 26px; border-radius: 4px; display: block; }
.matrix b { border: 2px solid var(--paper); border-radius: 50%; width: 22px; height: 22px; margin: 2px; }
.chem { list-style: none; padding: 0 !important; font-size: 14px; }
.chem li { color: #e8e2ee; } .chem .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--paper); vertical-align: -1px; margin: 0 2px; }

/* breed */
.prog { height: 10px; border: 2px solid var(--paper); border-radius: 99px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--lime); transition: width .3s linear; }
.board { display: grid; gap: 4px; font: 400 13px/1.3 var(--mono); }
.board .r { display: grid; grid-template-columns: 30px 1fr auto; white-space: nowrap; gap: 8px; align-items: center; color: var(--mute); }
.board .r b { color: var(--paper); font-weight: 500; }
.board .r.par b { color: var(--lime); }
.meter { height: 8px; border-radius: 99px; background: #342c3c; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--lime); transition: width .4s var(--ease); }
.chart svg { display: block; width: 100%; height: 90px; }

/* tiles over the 5 x 5 grid */
.tiles { position: absolute; display: grid; }
.tile { position: relative; padding: 0; margin: 0; background: transparent; border: 2px solid transparent; border-radius: 6px; cursor: pointer; }
.tile:hover { border-color: rgba(255, 253, 246, .55); }
.tile .rk { position: absolute; left: 4px; top: 4px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: var(--paper); font: 500 11px/20px var(--mono); text-align: center; }
.tile .bar { position: absolute; left: 4px; right: 4px; bottom: 4px; height: 5px; border-radius: 9px; background: rgba(20, 16, 24, .55); overflow: hidden; }
.tile .bar i { display: block; height: 100%; background: var(--lime); transition: width .4s var(--ease); }
.tile.top2 .rk { background: var(--lime); color: var(--ink); }
.tile.pick { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow) inset; }
.tile.pick .rk { background: var(--yellow); color: var(--ink); }
.tile.cur { border-color: var(--paper); }

/* hud */
.hud { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; justify-content: space-between; align-items: end; pointer-events: none; font: 500 12px/1 var(--mono); color: var(--ink); }
body[data-view="breed"] .hud { display: none; }
.scalebar { display: inline-flex; flex-direction: column; gap: 5px; background: rgba(255, 253, 246, .78); padding: 6px 8px; border-radius: 6px; }
.scalebar i { display: block; height: 4px; background: var(--ink); width: 80px; }
.clock { background: rgba(255, 253, 246, .78); padding: 6px 8px; border-radius: 6px; }
body.fluo .scalebar, body.fluo .clock { background: rgba(20, 16, 24, .7); color: var(--paper); } body.fluo .scalebar i { background: var(--paper); }

.nogl { position: absolute; inset: 0; padding: 40px; display: grid; align-content: center; gap: 14px; max-width: 640px; margin: auto; }
.nogl img { width: 100%; border-radius: var(--r-m); border: var(--bw) solid var(--paper); }
.nogl p { color: var(--mute); }

.toast { position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 30; margin: 0; padding: 10px 16px; background: var(--paper); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: var(--r-pill); box-shadow: 3px 3px 0 var(--lime); font: 700 14px/1.3 var(--body); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 30px); text-align: center; }
.toast.on { opacity: 1; }

/* narrow screens: slide on top, panel under it */
@media (max-width: 860px) {
  .app { display: block; height: auto; }
  .stage { height: min(100vw, 62dvh); }
  body[data-view="breed"] .stage { height: 100vw; }
  .panel { border-left: 0; border-top: 2px solid #2c2534; padding: 18px 16px 40px; }
  .top { gap: 8px; padding: 0 12px; } .tab { padding: 0 10px; }
  .crumb { display: none; } .tabs { margin-left: auto; }
  .strain { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
