:root {
  --bg: #05050b; --panel: rgba(12, 12, 24, .86); --line: rgba(255, 255, 255, .09); --ink: #eef0ff; --dim: #9aa0bd;
  --green: #26ff8a; --pink: #ff4fd8; --gold: #ffd23a; --blue: #5aa8ff; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.5 "Space Grotesk", "Segoe UI", system-ui, sans-serif; }
a { color: inherit; }
button, select { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* header */
.top { position: relative; z-index: 5; height: 54px; display: flex; align-items: center; gap: 24px; padding: 0 18px;
  background: rgba(5, 5, 11, .75); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.logo { font-weight: 700; font-size: 22px; letter-spacing: .12em; text-decoration: none; color: var(--green); text-shadow: 0 0 14px rgba(38, 255, 138, .6); }
.logo span { color: var(--pink); text-shadow: 0 0 14px rgba(255, 79, 216, .6); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--dim); font-weight: 600; }
.top nav a:hover { color: var(--ink); background: var(--line); }

/* lab layout */
.lab { display: grid; grid-template-columns: 220px 1fr 380px; height: calc(100vh - 54px); }
.list { overflow: auto; padding: 12px; border-right: 1px solid var(--line); background: var(--panel); }
.list h4 { margin: 14px 6px 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.scene-link { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.scene-link span { width: 22px; text-align: center; }
.scene-link:hover { background: var(--line); }
.scene-link.on { background: linear-gradient(90deg, rgba(38, 255, 138, .2), rgba(255, 79, 216, .12)); box-shadow: inset 3px 0 0 var(--green); }
.stagewrap { position: relative; min-width: 0; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; touch-action: none; }
.side { overflow: auto; border-left: 1px solid var(--line); background: var(--panel); }
.info, .mixer { padding: 16px 18px; }
.mixer { border-top: 1px solid var(--line); }
.info h1 { margin: 6px 0 2px; font-size: 24px; line-height: 1.2; }
.info h3, .mixer h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.mixer h2 { margin: 0 0 10px; font-size: 18px; }
.info ul { margin: 0; padding-left: 18px; color: #d5d8ee; }
.info li { margin: 4px 0; }
.info .try li::marker { content: "▸ "; color: var(--green); }
.blurb { color: var(--dim); margin: 0 0 8px; }
.what p { margin: 8px 0; }
.stat { padding: 8px 12px; border-radius: 10px; background: rgba(38, 255, 138, .08); border: 1px solid rgba(38, 255, 138, .25); font-size: 13.5px; min-height: 38px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.tag.science { background: rgba(90, 168, 255, .18); color: #a9cfff; }
.tag.theory { background: rgba(255, 79, 216, .18); color: #ffb3ef; }
.theory-note { padding: 10px 12px; border-radius: 10px; background: rgba(255, 79, 216, .1); border: 1px solid rgba(255, 79, 216, .35); font-size: 13.5px; margin: 8px 0; }
.sl { display: block; margin: 10px 0; }
.sl span { display: flex; justify-content: space-between; font-size: 13.5px; color: #d5d8ee; }
.sl b { color: var(--green); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--green); }
.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 13.5px; }
.row.col { justify-content: space-between; }
input[type=color] { width: 44px; height: 28px; border: 0; background: none; padding: 0; }
.btn { display: inline-block; margin: 6px 6px 0 0; padding: 8px 14px; border: 0; border-radius: 10px; font-weight: 700; color: #04130a;
  background: linear-gradient(135deg, var(--green), #8affc4); }
.btn.ghost { background: var(--line); color: var(--dim); font-weight: 600; margin-top: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.pt { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--ink); font-size: 13px; }
.pt i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.ptinfo { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 13.5px; }

/* music source bar */
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources button { padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(10, 10, 20, .8); color: var(--ink); font-size: 13px; font-weight: 600; }
.sources button:hover { border-color: var(--green); }
.sources button.on { background: linear-gradient(135deg, var(--green), var(--blue)); color: #04130a; border-color: transparent; }
.labmusic { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; pointer-events: none; }
.labmusic > * { pointer-events: auto; }
.np { font-size: 13px; color: var(--dim); background: rgba(5, 5, 11, .7); padding: 5px 10px; border-radius: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* visualiser */
.full { position: fixed !important; inset: 0; }
.vis .top { position: fixed; left: 0; right: 0; top: 0; }
.visbar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
  padding: 8px 10px; border-radius: 14px; background: rgba(5, 5, 11, .65); border: 1px solid var(--line); backdrop-filter: blur(8px); max-width: calc(100vw - 32px); }
.visbar select, .visbar > button { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(10, 10, 20, .9); color: var(--ink); font-size: 13px; }
.vis-np { position: fixed; left: 16px; bottom: 16px; z-index: 6; font-size: 15px; color: var(--ink); }
.scene-name { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 6; font-size: 30px; font-weight: 700; letter-spacing: .04em;
  text-shadow: 0 0 20px rgba(38, 255, 138, .8); opacity: 0; transition: opacity .6s; pointer-events: none; white-space: nowrap; }
.scene-name.show { opacity: 1; }
.keys-hint { position: fixed; right: 16px; bottom: 12px; z-index: 6; margin: 0; font-size: 12px; color: var(--dim); }
body.bare .top, body.bare .visbar, body.bare .keys-hint, body.bare .vis-np { opacity: 0; pointer-events: none; }
body.embed .top, body.embed .keys-hint { display: none; }
body.embed .visbar { top: 8px; }
.startcard { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0, 0, 0, .55); text-align: center; }
.startcard h2 { margin: 0 0 6px; }
.big { padding: 14px 40px; font-size: 20px; font-weight: 700; border: 0; border-radius: 14px; color: #04130a; background: linear-gradient(135deg, var(--green), var(--pink)); }

/* home */
.home { overflow: auto; }
.home .bg { z-index: 0; opacity: .75; }
.hero { position: relative; z-index: 2; max-width: 1100px; margin: 0 auto; padding: 8vh 16px 40px; }
.hero h1 { margin: 0; font-size: clamp(54px, 12vw, 120px); letter-spacing: .12em; color: var(--green); text-shadow: 0 0 30px rgba(38, 255, 138, .6); line-height: 1; }
.hero h1 span { color: var(--pink); text-shadow: 0 0 30px rgba(255, 79, 216, .6); }
.sub { font-size: 18px; color: #d5d8ee; max-width: 640px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 28px 0; }
.card, .mini { display: block; text-decoration: none; padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid rgba(90, 168, 255, .35); backdrop-filter: blur(6px); transition: transform .15s; }
.card:hover, .mini:hover { transform: translateY(-3px); }
.card b { display: block; font-size: 20px; margin-bottom: 6px; }
.card span, .mini span { color: var(--dim); font-size: 14px; }
.card.theory, .mini.theory { border-color: rgba(255, 79, 216, .4); }
.card.vis { border-color: rgba(38, 255, 138, .4); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mini { padding: 14px; }
.mini i { font-style: normal; font-size: 22px; }
.mini b { display: block; margin: 4px 0; }
.foot { position: relative; z-index: 2; text-align: center; color: var(--dim); font-size: 12px; padding: 20px; }

.toast { position: fixed; top: 70px; left: 50%; transform: translate(-50%, -10px); z-index: 30; padding: 10px 16px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--green); font-weight: 600; opacity: 0; transition: .3s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .lab { grid-template-columns: 1fr; grid-template-rows: auto 55vh auto; height: auto; }
  .list { display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; }
  .list h4 { width: 100%; }
  .stagewrap { height: 55vh; }
  .side { border-left: 0; }
  .keys-hint { display: none; }
}

/* Pinology calculator */
.calc { padding: 12px 14px; border-radius: 12px; background: rgba(255, 201, 74, .08); border: 1px solid rgba(255, 201, 74, .35); font-size: 13.5px; line-height: 1.7; }
.calc code { color: var(--gold); word-break: break-all; }
.eq { font-size: 17px; text-align: center; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); color: var(--gold); }
.big-eq { display: inline-block; margin: 6px 0; color: #fff; }

/* Mixer extras (2026-11-12): time buttons, dropdowns, little graphs */
.seg { display: flex; gap: 4px; margin: 10px 0; }
.seg button { flex: 1; padding: 7px 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .04); color: var(--dim); font-size: 12.5px; }
.seg button.on { background: var(--green); color: #04130a; border-color: transparent; font-weight: 700; }
.mixer select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: rgba(10, 10, 20, .9); color: var(--ink); max-width: 60%; }
.mixhead { margin: 16px 0 4px; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; color: var(--dim); }
.graph { width: 100%; height: 120px; display: block; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); margin-top: 8px; }
.race { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.race td, .race th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.race td b { color: var(--green); font-variant-numeric: tabular-nums; }
