/* Biophony: a field station at night.
   Sections: base · header · layout · globe · player · studio shell · kit · library · recorder · info drawer · responsive */

/* ---------- base ---------- */
:root {
  --bg: #0b1314; --bg2: #101b1c; --card: #132123; --line: #213536; --line2: #34504f; --ink: #e9efe9; --ink2: #c9d6d3; --muted: #8fa5a2;
  --teal: #78d6c0; --gold: #e3b765;
  --bird: #e3b765; --bat: #b59cf0; --insect: #a7d36a; --amphibian: #5fc7a0; --mammal: #e58c6a; --whale: #6fb3ff;
  --lo: #d4683f; --mid: #7b8584; --hi: #2aa98b;          /* balance scale: low → neutral → rich */
  --f-display: "Cormorant Garamond", Georgia, serif;
  --f-body: "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--teal); text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 500; margin: 0; line-height: 1.1; }
p { margin: 0; }
select, input[type=search] { font: inherit; font-size: .8rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lh, .kicker { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lh { margin: 8px 0 2px; }
.hint { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.note { font-size: .76rem; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 9px 11px; }
.empty { color: var(--muted); padding: 30px 6px; text-align: center; }
.small { font-size: .74rem !important; color: var(--muted) !important; }
.grow { flex: 1; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sbi-grad { background: linear-gradient(90deg, var(--lo), var(--mid) 50%, var(--hi)); }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--teal); background: rgba(120,214,192,.12); font-size: .82rem; white-space: nowrap; }
.btn:hover { background: rgba(120,214,192,.22); }
.btn.ghost { border-color: var(--line); background: none; }
.btn.ghost:hover { border-color: var(--line2); }
.btn.sm { padding: 6px 11px; font-size: .78rem; }
.btn[aria-pressed="true"], .btn.playing { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .45; cursor: default; }
.linkish { background: none; border: 0; padding: 0; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.ib { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); font-size: .85rem; display: grid; place-items: center; }
.ib:hover { border-color: var(--teal); color: var(--teal); }
.ib.play.playing, .ib[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: rgba(227,183,101,.1); }
.pill { font-size: .7rem; font-weight: 700; color: var(--bg); background: var(--muted); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.pill.live { background: var(--whale); }
.pill.off { background: #3a4847; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.seg button { border: 0; background: var(--card); padding: 7px 13px; font-size: .8rem; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: rgba(120,214,192,.16); color: var(--ink); }
.seg.sm { margin: 0; align-items: center; background: var(--card); }
.seg.sm span { font-size: .7rem; color: var(--muted); padding: 0 8px; border-right: 1px solid var(--line); }
.seg.sm button { padding: 5px 10px; font-size: .76rem; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex: none; }
.brand h1 { font-size: 1.8rem; letter-spacing: .01em; }
.beta-tag { font-family: var(--f-body); font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); border: 1px solid #5a4a2a; background: rgba(227,183,101,.08); border-radius: 999px; padding: 2px 8px; vertical-align: middle; position: relative; top: -3px; }
.sub { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; margin-left: 6px; }
.dot.on { background: var(--teal); animation: beat 2s infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgba(120,214,192,.55); } 70% { box-shadow: 0 0 0 8px rgba(120,214,192,0); } 100% { box-shadow: 0 0 0 0 rgba(120,214,192,0); } }
#openInfo svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- layout: globe left, studio right ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(560px, 1.1fr); }

/* ---------- globe ---------- */
.globe { position: relative; min-height: 0; background: #070d0e; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { background: rgba(11,19,20,.75) !important; color: var(--muted) !important; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(.8); }
.maplibregl-ctrl-group { background: var(--card) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.9); }
.maplibregl-ctrl-bottom-right { bottom: 92px; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-bottom: 0; }
.maplibregl-popup-content { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .8rem; }
.maplibregl-popup-tip { border-top-color: var(--card) !important; border-bottom-color: var(--card) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 16px; }
.tip .maplibregl-popup-content { padding: 4px 8px; font-size: .74rem; pointer-events: none; }
.tip .maplibregl-popup-tip { display: none; }
.plume-pop img { width: 220px; border-radius: 8px; display: block; margin-top: 8px; }

.layers { position: absolute; z-index: 5; top: 12px; left: 12px; width: 250px; max-height: calc(100% - 120px); overflow: auto; background: rgba(11,19,20,.9); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 12px; font-size: .8rem; }
.layers:not([open]) { width: auto; }
.layers summary { cursor: pointer; font-weight: 700; letter-spacing: .04em; padding: 8px 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.layers summary::-webkit-details-marker { display: none; }
.layers summary::after { content: "▾"; color: var(--muted); font-size: .7rem; }
.layers[open] summary::after { content: "▴"; }
.ly-body { padding: 0 14px 12px; }
.layers label { display: flex; align-items: baseline; gap: 7px; padding: 3px 0; flex-wrap: wrap; cursor: pointer; }
.layers label small { color: var(--muted); width: 100%; padding-left: 21px; margin-top: -2px; font-size: .7rem; }
.layers input { accent-color: var(--teal); }
.legend { margin-top: 6px; font-size: .7rem; color: var(--muted); }
.legend .bar { height: 8px; border-radius: 4px; margin: 4px 0 2px; }
.legend .ends { display: flex; justify-content: space-between; }
.legend img { width: 100%; display: block; background: var(--ink); border-radius: 6px; padding: 2px; }

/* map markers: MapLibre positions the outer element with transform, so only inner elements animate */
.pin { width: 26px; height: 34px; pointer-events: none; }
.pin i { position: absolute; left: 3px; top: 0; width: 20px; height: 20px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--gold); box-shadow: 0 0 0 2px var(--bg), 0 4px 14px rgba(0,0,0,.6); }
.pin i::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); }
.pin::after { content: ""; position: absolute; left: 9px; bottom: -4px; width: 8px; height: 8px; border-radius: 50%; background: rgba(227,183,101,.6); animation: pinPulse 1.8s ease-out infinite; }
@keyframes pinPulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(3.4); opacity: 0; } }
.pulse-m { width: 0; height: 0; pointer-events: none; }
.pulse { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); animation: pop 2.4s ease-out forwards; pointer-events: none; }
@keyframes pop { 0% { transform: scale(.4); opacity: 1; } 60% { opacity: .8; } 100% { transform: scale(3.2); opacity: 0; } }
.plume-ic { width: 0; height: 0; cursor: pointer; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid #ff8a3d; filter: drop-shadow(0 0 4px rgba(255,138,61,.8)); }

/* ---------- listening bar over the globe ---------- */
.player { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: auto auto minmax(0, 1fr) minmax(0, 200px) 90px; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(11,19,20,.92); backdrop-filter: blur(8px); }
.pbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #a8f0de, var(--teal) 60%, #3f9c88); color: #08201b; display: grid; place-items: center; }
.pbtn svg { width: 20px; height: 20px; grid-area: 1 / 1; }
.pbtn .ic-pause, .player.playing .pbtn .ic-play { display: none; }
.player.playing .pbtn .ic-pause { display: block; }
.player.busy .pbtn { animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(120,214,192,.18); } }
.pnext { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--ink); }
.pnext:disabled { opacity: .3; cursor: default; }
.pnext svg { width: 15px; height: 15px; }
.pinfo { min-width: 0; }
.ptitle { font-weight: 700; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psub { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec { position: relative; height: 44px; border-radius: 8px; overflow: hidden; background: #071011; border: 1px solid var(--line); }
.spec canvas { width: 100%; height: 100%; display: block; }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks span { position: absolute; left: 5px; font-size: 8px; color: rgba(233,239,233,.55); transform: translateY(50%); }
.pvol input { width: 100%; accent-color: var(--teal); }

/* ---------- studio shell ---------- */
.studio { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg); container-type: inline-size; }
.st-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(11,19,20,.95); backdrop-filter: blur(8px); flex-wrap: wrap; }
.st-brand { min-width: 0; }
.st-brand h2 { font-size: 1.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-region { font-size: .76rem; color: var(--muted); }
.st-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.st-tab { border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: .82rem; }
.st-tab.on { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.st-pane { padding: 14px 18px 40px; }
.st-status { font-size: .8rem; color: var(--muted); min-height: 1.4em; margin-bottom: 10px; }

/* start screen and "nothing near here" */
.st-empty { padding: 34px 22px 40px; max-width: 620px; }
.st-hello { font-size: 2.3rem; line-height: 1.08; margin-bottom: 22px; }
.st-steps { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 10px; }
.st-steps li { display: flex; align-items: center; gap: 12px; font-size: .95rem; color: var(--ink2); }
.st-steps b { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(120,214,192,.14); border: 1px solid var(--teal); color: var(--teal); font-size: .8rem; }
.st-far { padding: 30px 22px; max-width: 560px; }
#stFarMsg { color: var(--ink2); font-size: .95rem; margin-bottom: 14px; }
.st-suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 6px; }
.suggest { text-align: left; border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 12px 14px; }
.suggest:hover { border-color: var(--teal); }
.suggest b { display: block; font-size: .88rem; }
.suggest span { font-size: .7rem; color: var(--muted); }

/* ---------- kit: pads ---------- */
.kit-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-content: start; }
.pad { position: relative; min-height: 104px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, #172a2c, #0f1c1e); padding: 10px; display: flex; flex-direction: column; text-align: left; overflow: hidden; touch-action: manipulation; }
.pad::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.pad.tonal::after { content: "♪"; position: absolute; right: 9px; bottom: 6px; font-size: .7rem; color: var(--c); opacity: .8; }
.pad.sel { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.pad.hit { animation: hit .22s ease-out; }
@keyframes hit { 0% { background: color-mix(in srgb, var(--c) 45%, #0f1c1e); } 100% { background: linear-gradient(160deg, #172a2c, #0f1c1e); } }
.pad.drop { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; background: rgba(227,183,101,.1); }
body.dragging .pad { border-style: dashed; }
.pad-role { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.pad-role kbd { font: inherit; font-size: .62rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.pad-sp { font-weight: 700; font-size: .84rem; line-height: 1.2; margin-top: 4px; }
.pad-meta { font-size: .68rem; color: var(--muted); }
.pad-wave { width: 100%; height: 30px; flex: none; margin-top: auto; display: block; opacity: .9; }

/* ---------- kit: sound details ---------- */
.ed-toggle { justify-self: center; display: inline-flex; align-items: center; gap: 8px; margin: -2px 0; padding: 5px 14px 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-size: .76rem; }
.ed-toggle:hover { color: var(--ink); border-color: var(--line2); }
.ed-toggle[aria-expanded="true"] { color: var(--ink); }
.ed-arrow { display: inline-block; width: 12px; height: 12px; transition: transform .18s; }
.ed-toggle[aria-expanded="true"] .ed-arrow { transform: rotate(180deg); }
.editor { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-height: 200px; }
.ed-head { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; }
.ed-head img, .ed-ph { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--c, var(--bg)); display: block; }
.ed-role { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ed-head h3 { font-size: 1.35rem; }
.ed-sub { font-size: .72rem; color: var(--muted); }
.ed-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.src-wave { width: 100%; height: 86px; display: block; margin-top: 12px; border-radius: 10px; background: var(--bg); cursor: ew-resize; touch-action: none; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 8px; }

/* knobs: drag up/down, arrow keys, double-click to reset */
.knobs { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.knob { width: 62px; display: grid; justify-items: center; gap: 1px; cursor: ns-resize; user-select: none; touch-action: none; border-radius: 10px; padding: 4px 0 3px; outline: none; }
.knob:hover, .knob:focus-visible, .knob.drag { background: rgba(120,214,192,.07); }
.knob:focus-visible { box-shadow: 0 0 0 1.5px var(--teal); }
.knob svg { width: 40px; height: 40px; display: block; }
.knob .k-l { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.knob output { font-size: .7rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.knob.xs { width: 30px; padding: 0; }
.knob.xs svg { width: 26px; height: 26px; }
.knob.xs .k-l, .knob.xs output { display: none; }
.k-track { fill: none; stroke: #1f3335; stroke-width: 3.5; stroke-linecap: round; }
.k-val { fill: none; stroke: var(--teal); stroke-width: 3.5; stroke-linecap: round; filter: drop-shadow(0 0 3px rgba(120,214,192,.45)); }
.k-dot { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

/* envelope editor */
.env { width: 100%; height: 84px; display: block; background: #0a1415; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; touch-action: none; cursor: grab; }
.env.drag { cursor: grabbing; }
.env-grid { stroke: #172829; stroke-width: 1; }
.env-fill { fill: rgba(120,214,192,.1); }
.env-line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; }
.env-h { fill: var(--bg); stroke: var(--gold); stroke-width: 2; }
.env:hover .env-h { fill: var(--gold); }

/* ---------- kit: transport + sequencer ---------- */
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 10px; }
.tctl { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--muted); }
.tctl input[type=range] { width: 110px; accent-color: var(--teal); }
.tctl output { color: var(--ink); min-width: 32px; font-variant-numeric: tabular-nums; }
.tctl b { color: var(--ink); font-weight: 500; min-width: 1.2em; }
.mtr { display: flex; align-items: center; gap: 6px; }
.mtr canvas { width: 110px; height: 10px; border-radius: 3px; border: 1px solid var(--line); display: block; }
.mtr output { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 52px; }

.seq { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.seq .rows { display: grid; grid-template-rows: repeat(8, 1fr); gap: 4px; font-size: .72rem; color: var(--muted); }
.seq .grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; }
.seq .col { display: grid; grid-template-rows: repeat(8, 1fr); gap: 4px; border-radius: 6px; padding: 1px; }
.seq .col.beat { background: rgba(255,255,255,.025); }
.seq .col.now { background: rgba(120,214,192,.16); }
.rs { display: grid; grid-template-columns: minmax(0, 1fr) 22px 22px 30px; gap: 4px; align-items: center; height: 24px; }
.rs-name { height: 24px; border: 1px solid transparent; border-left: 3px solid var(--c); background: var(--card); border-radius: 5px; padding: 0 7px; text-align: left; font-size: .72rem; color: var(--ink2); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.rs-name span { overflow: hidden; text-overflow: ellipsis; }
.rs-name small { font-size: .58rem; color: var(--muted); }
.rs-name.sel { border-color: var(--line2); border-left-color: var(--c); color: var(--ink); }
.rs.muted .rs-name { opacity: .4; }
.rs-t { height: 22px; border-radius: 5px; border: 1px solid var(--line); background: #0e191a; font-size: .62rem; font-weight: 700; color: var(--muted); padding: 0; }
.rs-t.m[aria-pressed="true"] { background: #5a2e1f; border-color: var(--lo); color: #ffd9c9; }
.rs-t.s[aria-pressed="true"] { background: #5a4a22; border-color: var(--gold); color: #fff0cc; }
.cell { position: relative; min-width: 0; height: 24px; border-radius: 4px; border: 1px solid #22393a; background: #0e191a; padding: 0; touch-action: none; }
.cell:hover { border-color: #3d5c5c; }
.cell.on { background: var(--c); opacity: calc(.45 + var(--v) * .55); border-color: transparent; }
.cell.mel { border-style: dashed; }
.cell.mel.on { border-style: solid; }
.cell .deg { position: absolute; left: 3px; right: 3px; height: 3px; border-radius: 2px; background: var(--bg); bottom: calc(2px + var(--d) * 15px); opacity: .85; }
.exports { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.exports .lh { margin: 0; }
.exports .hint { margin: 0 0 0 auto; }

/* ---------- library ---------- */
.lib-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.lib-bar input[type=search] { flex: 1 1 220px; padding: 8px 10px; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 5px 11px; font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.fchip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, transparent); }
.fchip:not([style])::before { display: none; }
.fchip.on { color: var(--ink); border-color: var(--line2); background: var(--card); }
.lib { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 4px; }
.lib-row { display: grid; grid-template-columns: 18px 32px 40px minmax(110px, 1.1fr) minmax(70px, 1.4fr) 48px 64px auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 12px; background: var(--card); border: 1px solid transparent; cursor: pointer; }
.lib-row:hover { border-color: var(--line); }
.lib-row.cur { border-color: var(--line2); background: #16282a; }
.lib-row.playing { border-color: var(--gold); }
.lib-row img, .lib-row .ed-ph { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.lib-row input { accent-color: var(--teal); }
.lib-name { min-width: 0; }
.lib-name b { display: block; font-size: .85rem; }
.lib-name span { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.lib-wv { position: relative; }
.lib-wave { width: 100%; height: 36px; display: block; }
.ph { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--ink); box-shadow: 0 0 6px rgba(233,239,233,.6); pointer-events: none; }
.lib-tag { font-size: .72rem; color: var(--ink2); line-height: 1.2; text-align: center; }
.lib-tag small { display: block; font-size: .64rem; color: var(--muted); }
.lib-q { font-size: .66rem; color: var(--muted); text-align: right; line-height: 1.2; }
.lib-q b { display: block; font-size: .8rem; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.lib-q.q-clean b { color: var(--teal); }
.lib-q.q-noisy b, .lib-q.q-silent b { color: var(--lo); }
.lib-act { display: flex; gap: 4px; }
.lib-sent { list-style: none; min-height: 28px; text-align: center; font-size: .72rem; color: var(--muted); padding: 8px; }

/* ---------- field recorder ---------- */
.rec { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 20px; }
.rec h3 { font-size: 1.35rem; margin-bottom: 4px; }
.rec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rec-mics { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.mic { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 6px; align-items: center; margin-bottom: 4px; }
.mic-sel { width: 100%; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); text-align: left; font-size: .8rem; }
.mic.on .mic-sel { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.mic-ic { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.mic-ic.hy { border-color: var(--whale); }
.mic.on .mic-ic { background: var(--teal); border-color: var(--teal); }
.mic-n { min-width: 0; }
.mic-n small { display: block; font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; margin-bottom: 16px; }
.opt-grid label { display: grid; gap: 4px; font-size: .74rem; color: var(--muted); }
.opt-grid label.chk { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.opt-grid input { accent-color: var(--teal); }
.bed { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 8px; }
.bed-wave { width: 100%; height: 110px; display: block; background: var(--bg); border-radius: 10px; }

/* ---------- Info drawer (Balance · Site · About) ---------- */
.info { position: fixed; inset: 0; z-index: 50; background: rgba(4,8,9,.45); display: flex; justify-content: flex-end; }
.panel { width: min(440px, 100%); height: 100%; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); box-shadow: -20px 0 40px rgba(0,0,0,.4); animation: slideIn .22s ease-out; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; padding: 12px 6px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: .85rem; }
.tab.on { color: var(--ink); border-bottom-color: var(--teal); }
.tab-x { border: 0; background: none; color: var(--muted); padding: 0 16px; font-size: 1rem; }
.tab-x:hover { color: var(--ink); }
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 24px; }
.sec { margin-top: 18px; }
.sec h3 { font-size: 1.2rem; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec h3 small { font-family: var(--f-body); font-size: .7rem; color: var(--muted); font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two h3 { font-size: 1rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.metrics.m4 { grid-template-columns: repeat(4, 1fr); }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.metric b { display: block; font-family: var(--f-display); font-size: 1.6rem; line-height: 1; color: var(--ink); font-weight: 500; }
.metrics.m4 .metric b { font-size: 1.35rem; }
.metric span { font-size: .68rem; color: var(--muted); }
.idx .metrics { margin: 0; }

/* balance tab */
.prog { margin-bottom: 12px; font-size: .72rem; color: var(--muted); }
.prog-bar { height: 3px; border-radius: 2px; background: var(--teal); margin-bottom: 4px; transition: width .6s; }
.hero { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; }
.hero-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; }
.hero-n { font-family: var(--f-display); font-size: 3.6rem; line-height: .9; font-variant-numeric: tabular-nums; }
.hero-w { font-family: var(--f-display); font-size: 1.5rem; line-height: 1.1; }
.hero-s { font-size: .74rem; color: var(--muted); }
.meter { position: relative; height: 14px; margin: 4px 0; }
.meter-track { position: absolute; inset: 4px 0; border-radius: 3px; opacity: .55; }
.meter-iqr { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; border: 1.5px solid rgba(233,239,233,.75); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--card); }
.meter-scale { display: flex; justify-content: space-between; font-size: .66rem; color: var(--muted); }
.hist-wrap { position: relative; }
.hist { width: 100%; display: block; overflow: visible; }
.hist text { font-size: 9px; fill: var(--muted); }
.hist-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: .72rem; white-space: nowrap; pointer-events: none; }
.regions { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.regions button { width: 100%; display: grid; grid-template-columns: 1fr 120px 28px; gap: 10px; align-items: center; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: .8rem; }
.regions button:hover { background: var(--card); }
.regions b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.r-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-name small { color: var(--muted); font-size: .68rem; }
.r-plot { position: relative; height: 12px; background: linear-gradient(90deg, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)); }
.r-plot::before { content: ""; position: absolute; left: 0; right: 0; top: 5.5px; height: 1px; background: var(--line); }
.r-iqr { position: absolute; top: 4px; height: 4px; border-radius: 2px; background: rgba(233,239,233,.3); }
.r-dot { position: absolute; top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg2); }
.site-chip { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; padding: 5px 6px; margin-bottom: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: .74rem; text-align: left; }
.site-chip:hover { border-color: var(--line2); }
.site-chip i { width: 10px; height: 10px; border-radius: 50%; }
.site-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* site tab */
.site-head h2 { font-size: 1.7rem; }
.site-head p { color: var(--muted); font-size: .8rem; }
.health { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.pillars { display: grid; gap: 7px; margin-top: 10px; }
.pillar { display: grid; grid-template-columns: 84px 1fr 70px; gap: 10px; align-items: center; font-size: .78rem; }
.pl { color: var(--muted); }
.pt { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.pt i { display: block; height: 100%; border-radius: 4px; }
.pt i.na { width: 100%; background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 6px); }
.pv { text-align: right; font-variant-numeric: tabular-nums; }
.taxa { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--card); }
.taxa span { background: var(--c); }
.taxa-key { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .72rem; color: var(--muted); margin-top: 6px; }
.taxa-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.sp { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.sp li { display: grid; grid-template-columns: 30px 1fr 54px; gap: 8px; align-items: center; font-size: .8rem; }
.sp img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: var(--card); }
.sp .bar { height: 5px; border-radius: 3px; background: var(--c, var(--gold)); margin-top: 3px; }
.sp .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .72rem; }
.dets { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .78rem; }
.dets li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px; border-radius: 8px; background: var(--card); }
.dets li span:last-child { color: var(--muted); white-space: nowrap; }
.clickable { cursor: pointer; }
.clickable:hover { background: #1a2c2e !important; }
.scenes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.scenes button { width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: .8rem; text-align: left; }
.scenes button.on { border-color: var(--gold); }
.cloud { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.cloud i { display: inline-block; width: 34px; height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--muted) var(--p), var(--line) var(--p)); margin-left: 6px; vertical-align: middle; }
.browse { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.browse img { width: 100%; border-radius: 8px; display: block; min-height: 120px; background: var(--bg); }
.browse p { font-size: .74rem; color: var(--muted); margin-top: 8px; }

/* about tab */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 18px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stats dt { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--f-display); font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.prose h2 { font-size: 1.6rem; margin-bottom: 8px; }
.prose h3 { font-size: 1.2rem; margin: 16px 0 6px; }
.prose p, .prose li { color: var(--ink2); font-size: .84rem; }
.prose ul { padding-left: 1.1em; margin: 0; display: grid; gap: 5px; }
.prose p + p { margin-top: 8px; }
.refs li { font-size: .74rem !important; color: var(--muted) !important; }

/* ---------- responsive ---------- */
/* The studio column is a size container, so the kit adapts to the panel's own width. */
@container (max-width: 760px) {
  .seq { grid-template-columns: 128px minmax(0, 1fr); padding: 10px; }
  .rs { grid-template-columns: minmax(0, 1fr) 20px 20px; }
  .rs .knob.xs, .rs-name small { display: none; }
  .transport { gap: 8px; }
  .tctl input[type=range] { width: 84px; }
}
@container (max-width: 560px) {
  .pads { grid-template-columns: repeat(2, 1fr); }
  .seq { grid-template-columns: 92px minmax(0, 1fr); }
  .seq .grid { gap: 2px; }
  .rs { grid-template-columns: minmax(0, 1fr) 18px; }
  .rs-t.s { display: none; }
}
@media (max-width: 1280px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .ed-grid, .rec { grid-template-columns: 1fr; }
  .player { grid-template-columns: auto auto minmax(0, 1fr) 80px; }
  .spec { display: none; }
}
@media (max-width: 960px) {
  body { overflow: auto; height: auto; }
  .layout { grid-template-columns: 1fr; }
  .globe { height: 60vh; min-height: 380px; }
  .studio { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .st-top { position: static; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; }
  .brand h1 { font-size: 1.5rem; }
  .sub { font-size: .74rem; }
  #openInfo { padding: 6px 10px; font-size: .76rem; }
  .layers { width: 220px; }
  .player { left: 8px; right: 8px; bottom: 8px; grid-template-columns: auto auto minmax(0, 1fr); padding: 8px 10px; gap: 8px; }
  .pvol, .mtr { display: none; }
  .maplibregl-ctrl-bottom-right { bottom: 76px; }
  .st-top { padding: 10px 16px; }
  .st-right, .st-tabs { width: 100%; }
  .st-tab { flex: 1; padding: 7px 6px; }
  .st-pane { padding: 12px 16px 32px; }
  .st-hello { font-size: 1.8rem; }
  .ed-head { grid-template-columns: 40px 1fr; }
  .ed-btns { grid-column: 1 / -1; justify-content: flex-start; }
  .lib-row { grid-template-columns: 18px 32px minmax(0, 1fr) auto; }
  .lib-row img, .lib-row .ed-ph, .lib-wv, .lib-tag, .lib-q { display: none; }
  .exports .hint { margin: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
