/* catch.rework: same look as fumen (colours, font, star colours, rounded rows). */

@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/bricolage-grotesque-latin-ext-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/bricolage-grotesque-latin-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --accent: #ff66aa;
  --accent-strong: #f04f98;
  --accent-light: #ff8fc3;
  --accent-muted: rgba(255, 102, 170, 0.48);
  --accent-soft: rgba(255, 102, 170, 0.16);
  --bg: #151515;
  --panel: #181818;
  --panel-solid: #121212;
  --row: #1b1b1b;
  --row-hover: #212121;
  --input: #1b1b1b;
  --surface: #222222;
  --surface-strong: #2a2a2a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --separator: rgba(255, 255, 255, 0.06);
  --text: #ececec;
  --text-secondary: #a6a6a6;
  --text-faint: #7c7c7c;
  --text-on-accent: #f5eef3;
  --up: #7fcf98;
  --up-soft: rgba(127, 207, 152, 0.18);
  --down: #e27c7c;
  --down-soft: rgba(226, 124, 124, 0.18);
  --pixel: #e27c7c;
  --tight: #e2b25c;
  --status-ranked: #c9bd94;
  --status-loved: #b39fe0;
  --status-qualified: #8fc7d6;
  --shadow: 0 1rem 3rem rgba(0, 0, 0, 0.45);
  --sans: 'Bricolage Grotesque Variable', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo UI', 'Meiryo', 'Noto Sans JP', 'Noto Sans CJK JP', ui-sans-serif, system-ui, sans-serif;
  --radius-sm: .5rem;
  --radius-md: .625rem;
  --radius-lg: .875rem;
  --radius-pill: 999px;
  --control-h: 2.125rem;
  --row-h: 38px;          /* must match ROW_H in app.js */
  --drawer-w: min(34rem, 100vw);

  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-muted); outline-offset: 2px; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 1rem; justify-items: center;
}
#loading .logo { font-size: 1.75rem; }
#load-bar { width: 16rem; height: 4px; border-radius: var(--radius-pill); background: var(--surface); overflow: hidden; }
#load-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
#load-status { color: var(--text-secondary); font-size: .8125rem; }

/* ── App shell ───────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }
.logo { font-weight: 650; letter-spacing: -0.03em; font-size: 1.25rem; white-space: nowrap; text-decoration: none; }
.logo span { color: var(--accent); }

#header {
  display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap;
  padding: .75rem 1rem .5rem;
}
#dataset { display: flex; gap: .875rem; color: var(--text-faint); font-size: .8125rem; font-variant-numeric: tabular-nums; }
#dataset b { color: var(--text-secondary); font-weight: 550; }
#header-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ── Controls ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .375rem; height: var(--control-h);
  padding: 0 .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input); color: var(--text); font-size: .8125rem; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: var(--border-strong); }
.btn svg { width: 1rem; height: 1rem; flex: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--text-on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.quiet:hover { background: var(--surface); color: var(--text); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.icon { width: var(--control-h); padding: 0; justify-content: center; }

.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-solid); }
.seg button {
  height: calc(var(--control-h) - 6px); padding: 0 .625rem; border: 0; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; color: var(--text-faint); font-size: .8125rem; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-strong); color: var(--text); }
.seg.mods button.on { background: var(--accent-soft); color: var(--accent-light); }

/* Rework picker: "Live vs <rework>" */
#rework-picker { position: relative; }
#rework-btn { gap: .5rem; }
#rework-btn .vs { color: var(--text-faint); font-weight: 450; }
#rework-btn .name { color: var(--accent-light); }

/* ── Toolbar: search, mods, status, filter pills ─────────────────────────── */
#toolbar { display: grid; gap: .5rem; padding: .25rem 1rem .625rem; }
.tb-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
#search {
  height: var(--control-h); width: min(22rem, 100%); padding: 0 .75rem 0 2.1rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--input) no-repeat .65rem center / 1rem
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='none' stroke='%237c7c7c' stroke-width='20' stroke-linecap='round' d='M112 184a72 72 0 1 0 0-144a72 72 0 0 0 0 144zm51-21l53 53'/%3E%3C/svg%3E");
  outline: none; font-size: .875rem;
}
#search:focus { border-color: var(--text-faint); }
#search::placeholder { color: var(--text-faint); }

.pill {
  display: inline-flex; align-items: center; gap: .375rem; height: var(--control-h); padding: 0 .7rem;
  border: 1px solid var(--border); border-radius: var(--radius-pill); background: transparent;
  color: var(--text-secondary); font-size: .8125rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill.active { border-color: var(--accent-muted); background: var(--accent-soft); color: var(--accent-light); }
.pill .clear { display: none; margin-right: -.3rem; padding: 0 .2rem; border-radius: 4px; color: inherit; opacity: .8; }
.pill.active .clear { display: inline; }
.pill .clear:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.pill .caret { opacity: .55; font-size: .7em; }
#btn-reset b { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .15rem;
  border-radius: var(--radius-pill); background: var(--accent); color: var(--text-on-accent); font-size: .6875rem; }

/* ── Popovers ────────────────────────────────────────────────────────────── */
.popover {
  position: fixed; z-index: 60; min-width: 14rem; max-width: min(24rem, calc(100vw - 1.5rem)); padding: .75rem;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel);
  box-shadow: var(--shadow); display: grid; gap: .625rem;
}
.popover h3 { margin: 0; font-size: .8125rem; font-weight: 600; color: var(--text); }
.popover p.hint { margin: 0; font-size: .75rem; color: var(--text-faint); }
.range-row { display: flex; align-items: center; gap: .5rem; }
.range-row input, .popover input[type=text], .popover input[type=number] {
  width: 100%; height: var(--control-h); padding: 0 .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input); outline: none; font-variant-numeric: tabular-nums;
}
.range-row input:focus, .popover input:focus { border-color: var(--text-faint); }
.range-row span { color: var(--text-faint); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip {
  height: 1.75rem; padding: 0 .55rem; border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: transparent; color: var(--text-secondary); font-size: .75rem; cursor: pointer; font-variant-numeric: tabular-nums;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on { border-color: var(--accent-muted); background: var(--accent-soft); color: var(--accent-light); }
.menu { display: grid; gap: 2px; margin: -.25rem; }
.menu button {
  display: grid; gap: 1px; text-align: left; padding: .45rem .55rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer;
}
.menu button:hover { background: var(--surface); }
.menu button.on { background: var(--accent-soft); }
.menu button small { color: var(--text-faint); font-size: .75rem; }
.menu .row { display: flex; align-items: center; gap: .25rem; }
.menu .row > button:first-child { flex: 1; }
.menu .del { color: var(--text-faint); padding: .3rem .45rem; }
.menu .del:hover { color: var(--down); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .8125rem; color: var(--text-secondary); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.popover select {
  height: var(--control-h); padding: 0 .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input);
}
.popover .divider { height: 1px; background: var(--separator); margin: .125rem 0; }

/* Range filter: distribution bars, a two-thumb slider and tick labels (like fumen's) */
.popover.range-pop { width: 17.5rem; }
.range-pop .range-row input { text-align: center; font-variant-numeric: tabular-nums; }
.rs { position: relative; margin-top: .25rem; padding: 0 .4375rem; }
.rs-hist { position: relative; display: flex; align-items: flex-end; height: 2.125rem; gap: 2px; margin-bottom: -2px; }
.rs-hist button { flex: 1; height: 100%; display: flex; align-items: flex-end; padding: 0; border: 0; background: none; cursor: pointer; }
.rs-hist button i { display: block; width: 100%; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--surface-strong);
  transition: height .26s cubic-bezier(.22, 1, .36, 1), background-color .12s ease; }
.rs-hist button:hover i { background: var(--border-strong); }
.rs-hist button.in i { background: var(--accent-muted); }
.rs-hist button.in:hover i { background: var(--accent); }
.rs-track { position: relative; height: .25rem; margin: .5625rem 0; border-radius: var(--radius-pill); background: var(--separator); }
.rs-track i { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: var(--border-strong); }
.rs.active .rs-track i { background: var(--accent-muted); }
/* Two native range inputs on top of each other: only their thumbs take the mouse */
.rs input[type=range] {
  position: absolute; left: 0; right: 0; bottom: .75rem; z-index: 2; width: 100%; height: 1.375rem; margin: 0;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none; outline: none;
}
.rs input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; }
.rs input[type=range]::-moz-range-track { background: none; border: 0; }
.rs input[type=range]::-moz-range-progress { background: none; }
.rs input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: grab;
  width: .875rem; height: .875rem; border: 0; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 .1875rem var(--panel);
  transition: scale .12s ease;
}
.rs input[type=range]::-moz-range-thumb {
  pointer-events: auto; cursor: grab;
  width: .875rem; height: .875rem; border: 0; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 .1875rem var(--panel);
  transition: scale .12s ease;
}
.rs input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; scale: 1.1; }
.rs input[type=range]:active::-moz-range-thumb { cursor: grabbing; scale: 1.1; }
.rs input[type=range]::-webkit-slider-thumb:hover { scale: 1.1; }
.rs input[type=range]::-moz-range-thumb:hover { scale: 1.1; }
.rs input[type=range]:focus-visible::-webkit-slider-thumb { outline: 1px solid var(--text-secondary); outline-offset: .1875rem; }
.rs input[type=range]:focus-visible::-moz-range-thumb { outline: 1px solid var(--text-secondary); outline-offset: .1875rem; }
.rs-ticks { position: relative; height: .75rem; color: var(--text-faint); font-size: .625rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.rs-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }

/* ── Table ───────────────────────────────────────────────────────────────── */
#table-area { position: relative; flex: 1; min-height: 0; display: flex; }
#table-wrap { flex: 1; overflow: auto; margin: 0 .5rem; border-top: 1px solid var(--separator); }
#main-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .8125rem; font-variant-numeric: tabular-nums; }
#main-table thead th {
  position: sticky; z-index: 2; background: var(--bg); color: var(--text-faint); font-weight: 550;
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none;
}
#main-table thead tr.groups th { top: 0; height: 26px; padding: 6px .5rem 0; font-size: .6875rem; text-align: center; color: var(--text-faint); font-weight: 500; }
#main-table thead tr.groups th span { display: block; border-bottom: 1px solid var(--separator); padding-bottom: 3px; }
#main-table thead tr.cols th { top: 26px; height: 30px; padding: 0 .5rem; cursor: pointer; border-bottom: 1px solid var(--separator); }
#main-table thead tr.cols th:hover { color: var(--text); }
#main-table thead th.sorted { color: var(--accent-light); }
#main-table thead th .arrow { margin-left: .2rem; font-size: .75em; }
#main-table th.left, #main-table td.left { text-align: left; }
.resize { position: absolute; right: 0; top: 4px; bottom: 4px; width: 6px; cursor: col-resize; border-right: 2px solid transparent; }
.resize:hover, .resize.dragging { border-right-color: var(--accent-muted); }
#main-table thead tr.cols th { position: sticky; }
#main-table thead tr.cols th > .resize { position: absolute; }

#main-table tbody tr.row { height: var(--row-h); cursor: pointer; }
#main-table tbody td {
  padding: 0 .5rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px solid var(--separator); color: var(--text-secondary);
}
#main-table tbody tr.row:hover td { background: var(--row-hover); }
#main-table tbody tr.row.cursor td { background: var(--row-hover); }
#main-table tbody tr.row.cursor td:first-child { box-shadow: inset 2px 0 var(--text-faint); }
#main-table tbody tr.row.open td { background: var(--accent-soft); }
#main-table tbody tr.row.open td:first-child { box-shadow: inset 2px 0 var(--accent); }
td.group-start, th.group-start { border-left: 1px solid var(--separator); }
.c-rownum { color: var(--text-faint) !important; font-size: .75rem; }
.c-title .t { color: var(--text); font-weight: 550; }
.c-title .a { color: var(--text-faint); }
.c-pp { color: var(--text) !important; font-weight: 550; }
.c-faint { color: var(--text-faint); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-faint); }

.stars {
  display: inline-block; min-width: 2.75rem; padding: 1px .4rem; border-radius: var(--radius-pill);
  font-size: .75rem; font-weight: 650; text-align: center; line-height: 1.35;
}
.status { font-size: .75rem; font-weight: 550; }
.status.ranked, .status.approved { color: var(--status-ranked); }
.status.loved { color: var(--status-loved); }
.status.qualified { color: var(--status-qualified); }
.status.other { color: var(--text-faint); }
.type { font-size: .75rem; color: var(--text-faint); }
.type.native { color: var(--text-secondary); }
.dl-cell a {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: var(--radius-sm); color: var(--text-faint);
}
.dl-cell a:hover { background: var(--surface); color: var(--accent-light); }
.dl-cell svg { width: 1rem; height: 1rem; }

.delta-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.delta-bar { width: 2.25rem; height: 4px; border-radius: 2px; background: var(--separator); position: relative; overflow: hidden; }
.delta-bar i { position: absolute; top: 0; bottom: 0; }

#empty, #no-mods { position: absolute; inset: 0; display: grid; place-content: center; gap: .5rem; text-align: center; color: var(--text-secondary); pointer-events: none; }
#empty b, #no-mods b { color: var(--text); font-size: 1rem; }

#col-menu { position: fixed; z-index: 70; }

/* ── Map panel ───────────────────────────────────────────────────────────── */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: var(--drawer-w);
  display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); transform: translateX(105%); transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
#drawer.open { transform: none; }
/* Wide screens: the list makes room for the panel instead of hiding under it */
@media (min-width: 1100px) { body.drawer-open #app { padding-right: var(--drawer-w); } }
@media (prefers-reduced-motion: reduce) { #drawer { transition: none; } }
#drawer-scroll { overflow-y: auto; flex: 1; }

#cover { position: relative; aspect-ratio: 18 / 5; background: var(--surface); overflow: hidden; }
#cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
#cover img.loaded { opacity: 1; }
#cover.draggable img.loaded { cursor: ns-resize; }
#cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(24, 24, 24, .85), rgba(24, 24, 24, 0) 55%); pointer-events: none; }
#cover .nocover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: .8125rem; }
#btn-close { position: absolute; top: .6rem; right: .6rem; z-index: 2; background: rgba(18, 18, 18, .7); border-color: transparent; }
#btn-play {
  position: absolute; left: 1rem; bottom: .8rem; z-index: 2; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 0; display: grid; place-items: center; background: var(--accent); color: var(--text-on-accent); cursor: pointer;
  box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .5);
}
#btn-play:hover { background: var(--accent-strong); }
#btn-play svg { width: 1.2rem; height: 1.2rem; }
#btn-play[disabled] { background: var(--surface-strong); color: var(--text-faint); cursor: default; }
#volume { position: absolute; left: 4.25rem; bottom: 1.45rem; z-index: 2; width: 6rem; accent-color: var(--accent); opacity: .85; }
#audio-note { position: absolute; left: 10.75rem; bottom: 1.35rem; z-index: 2; font-size: .75rem; color: var(--text-secondary); }

#drawer-body { padding: .9rem 1.1rem 1.5rem; display: grid; gap: 1.1rem; }
#m-title { margin: 0; font-size: 1.375rem; line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
#m-artist { color: var(--text-secondary); margin-top: .15rem; overflow-wrap: anywhere; }
#m-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin-top: .5rem; font-size: .8125rem; color: var(--text-secondary); }
#m-sub .diff { color: var(--text); font-weight: 600; }

#m-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); gap: .4rem; }
.stat { padding: .4rem .55rem; border-radius: var(--radius-sm); background: var(--row); font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .6875rem; color: var(--text-faint); }
.stat strong { font-size: .9375rem; font-weight: 600; }

#m-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.section-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: .9375rem; font-weight: 600; }
.section-head .spacer { flex: 1; }
.section-head small { color: var(--text-faint); font-size: .75rem; }

/* pp comparison: live and rework bars on one scale per mod */
#m-pp { display: grid; gap: .7rem; }
.ppcmp { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 6.5rem 4.25rem; grid-template-rows: auto auto; align-items: center; column-gap: .75rem; row-gap: .3rem; font-variant-numeric: tabular-nums; }
.ppcmp .mod { grid-column: 1; grid-row: 1 / span 2; font-weight: 650; font-size: .8125rem; }
.ppcmp .bar { height: .625rem; border-radius: var(--radius-pill); background: var(--separator); overflow: hidden; }
.ppcmp .bar i { display: block; height: 100%; border-radius: inherit; }
.ppcmp .live { grid-row: 1; }
.ppcmp .rework { grid-row: 2; }
.ppcmp .bar { grid-column: 2; }
.ppcmp .v { grid-column: 3; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.ppcmp .v small { color: var(--text-faint); font-weight: 450; font-size: .75rem; margin-left: .3rem; }
.ppcmp .v.rework { color: var(--accent-light); }
.ppcmp .d { grid-column: 4; grid-row: 1 / span 2; text-align: right; font-weight: 650; font-size: .875rem; }
.ppcmp .d small { display: block; font-weight: 500; font-size: .75rem; }
.bar.live i, .key .sw.live { background: #5a5a5a; }
.bar.rework i, .key .sw.rework { background: var(--accent); }
.keys { display: flex; gap: .75rem; flex-wrap: wrap; }
.key { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-secondary); font-size: .75rem; }
.key .sw { width: .625rem; height: .625rem; border-radius: 2px; }

/* Jumps */
#j-summary { font-size: .8125rem; color: var(--text-secondary); }
#j-summary b { color: var(--text); }
#j-summary .px { color: var(--pixel); }
#j-summary .tg { color: var(--tight); }
#timeline-wrap { position: relative; border-radius: var(--radius-sm); background: var(--panel-solid); }
#timeline { display: block; width: 100%; height: 56px; }
#tl-tip {
  position: absolute; top: -1.9rem; padding: .2rem .45rem; border-radius: 6px; background: var(--surface-strong);
  font-size: .75rem; white-space: nowrap; pointer-events: none; display: none; font-variant-numeric: tabular-nums;
}
#j-table { width: 100%; border-collapse: collapse; font-size: .8125rem; font-variant-numeric: tabular-nums; }
#j-table th { text-align: right; font-weight: 500; color: var(--text-faint); padding: .3rem .45rem; border-bottom: 1px solid var(--separator); }
#j-table td { text-align: right; padding: .3rem .45rem; border-bottom: 1px solid var(--separator); color: var(--text-secondary); }
#j-table th:first-child, #j-table td:first-child { text-align: left; }
#j-table tr:hover td { background: var(--row-hover); }
.jt { font-size: .6875rem; font-weight: 650; padding: 1px .4rem; border-radius: var(--radius-pill); }
.jt.px { color: var(--pixel); background: var(--down-soft); }
.jt.tg { color: var(--tight); background: rgba(226, 178, 92, .16); }
#j-more { width: 100%; justify-content: center; }
#j-note { font-size: .8125rem; color: var(--text-faint); }

/* ── Toast + overlay ─────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 90; transform: translate(-50%, 1rem); opacity: 0;
  padding: .55rem .9rem; border-radius: var(--radius-sm); background: var(--surface-strong); box-shadow: var(--shadow);
  font-size: .8125rem; pointer-events: none; transition: opacity .18s ease, transform .18s ease; max-width: calc(100vw - 2rem);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#busy { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(10, 10, 10, .6); }
#busy-box { width: min(22rem, calc(100vw - 2rem)); padding: 1.1rem; border-radius: var(--radius-md); background: var(--panel); border: 1px solid var(--border); display: grid; gap: .6rem; }
#busy-box h3 { margin: 0; font-size: .9375rem; }
#busy-bar { height: 4px; border-radius: 2px; background: var(--surface); overflow: hidden; }
#busy-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
#busy-text { font-size: .8125rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ── Small screens ───────────────────────────────────────────────────────── */
#pills { display: contents; }
#btn-filters { display: none; }
#btn-filters b { color: var(--accent); font-weight: 650; margin-left: .3rem; }

@media (max-width: 720px) {
  #header { padding: .6rem .75rem .4rem; }
  #toolbar { padding: .25rem .75rem .5rem; }
  #search { width: auto; flex: 1 1 10rem; }
  /* Phones: filters fold away behind one button so the list gets the screen */
  #btn-filters { display: inline-flex; }
  #toolbar:not(.expanded) .tb-row > :not(#search):not(#btn-filters),
  #toolbar:not(.expanded) #tb-filters { display: none; }
  #dataset { display: none; }
  #header-right { margin-left: 0; }
  #table-wrap { margin: 0; }
  #volume, #audio-note { display: none; }
}
