/* PhDJ Library. Everything Score My Score does not have: the wide song list,
   filters, the player bar, the drawer. Tokens, cards, keys, buttons and
   motion come from base.css, which is Score My Score's stylesheet as it is. */

:root { --bar-h: 92px; --nav-h: 0px; --sel-h: 0px; }
header.top.wide, main.wide { max-width: 1360px; }
main.wide { padding-bottom: calc(60px + var(--bar-space, 0px) + var(--sel-space, 0px)); }
body.has-player { --bar-space: var(--bar-h); }
body.has-selbar { --sel-space: 64px; }
.view-root { display: grid; gap: 18px; min-width: 0; }
.view-root:not(.page-library), .page-submit, .page-admin { max-width: 860px; width: 100%; margin: 0 auto; }
.view-root.page-stats { max-width: 980px; }
.view-root > * { animation: rise .22s ease-out both; }
.page-library > * { animation: none; }
.foot { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 26px 0 0; color: var(--muted); }
.ticket.still { animation: none; display: inline-block; }
.ticket.small { font-size: 13px; padding: 0 8px; }
.grow { flex: 1 1 160px; min-width: 0; }
textarea, select, input[type=number], input[type=date], input[type=search] {
  font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; width: 100%;
  transition: box-shadow .15s, transform .15s;
}
textarea { resize: vertical; min-height: 64px; }
textarea:focus, select:focus, input[type=number]:focus, input[type=date]:focus, input[type=search]:focus { outline: none; box-shadow: 4px 4px 0 var(--sun); transform: translate(-1px, -1px); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--violet); cursor: pointer; margin: 0; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.link.danger { color: var(--danger); text-decoration-color: var(--danger); }

/* ---------------------------------------------------------- search + shortcuts */
.lib-top { display: grid; gap: 12px; position: relative; z-index: 5; }
.searchwrap { position: relative; display: flex; align-items: center; gap: 12px; }
.searchwrap > span:first-child svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--muted); pointer-events: none; }
input.search { padding: 13px 14px 13px 44px; font-size: 17px; border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); }
input.search:focus { box-shadow: 5px 5px 0 var(--violet); }
input.search::-webkit-search-cancel-button { cursor: pointer; }
.count { flex: none; font-family: var(--hand); font-size: 21px; color: var(--violet); white-space: nowrap; }
.shortcuts { display: flex; gap: 7px; align-items: center; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.shortcuts::-webkit-scrollbar { display: none; }
.shortcut, .fbtn, .tag {
  flex: none; display: inline-flex; align-items: center; gap: 5px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px;
  padding: 4px 13px; font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--ink);
  transition: transform .12s var(--ease), background .15s, box-shadow .12s;
}
.shortcut svg, .fbtn svg { width: 14px; height: 14px; }
@media (hover: hover) { .shortcut:hover, .fbtn:hover, button.tag:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 3px 0 var(--ink); } }
.shortcut:active, .fbtn:active, button.tag:active { transform: translateY(1px); box-shadow: none; }
.shortcut[aria-pressed=true], .tag[aria-pressed=true] { background: var(--ink); color: var(--card); }
.shortcut.more { border-style: dashed; }
.tag { padding: 3px 11px; font-size: 13px; }
.tag.plain { border-color: #c9bdab; color: var(--muted); font-weight: 500; }
.tag.new { border-style: dashed; background: var(--sun); }
.mini-keys { display: inline-flex; gap: 4px; flex: none; padding: 0 4px 4px; }
.pos.tiny { --lift: 3px; padding: 0; width: 34px; height: 34px; border-radius: 9px; border-top-width: 6px; display: inline-grid; place-content: center; }
.pos.tiny b { font-size: 15px; line-height: 1; }
.positions.compact { gap: 6px; }
.positions.compact .pos { padding: 6px 2px 5px; border-top-width: 7px; border-radius: 12px; --lift: 4px; }
.positions.compact .pos b { font-size: 21px; }
.positions.compact .pos span { font-size: 11px; }
.positions.compact .pos i { font-style: normal; font-size: 11px; color: var(--muted); }
.pos[aria-pressed=true] i { color: var(--ink); }

/* ---------------------------------------------------------- filters */
.filterwrap { position: relative; }
.filterbar { display: flex; gap: 7px; flex-wrap: wrap; }
.fbtn { border-radius: 12px; padding: 6px 10px 6px 13px; }
.fbtn.on { background: var(--violet-soft); }
.fbtn[aria-expanded=true] { background: var(--ink); color: var(--card); }
.fbtn b { background: var(--violet); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 12px; padding: 0 5px; }
.pop {
  position: absolute; z-index: 6; left: 0; top: calc(100% + 10px); width: min(560px, 100%);
  background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--violet);
  padding: 14px 16px 16px; display: grid; gap: 12px; animation: pop .22s var(--ease) both; transform-origin: 40px 0;
}
.pop[hidden] { display: none; }
.pop-head { display: flex; align-items: center; gap: 12px; }
.pop-head strong { font-family: var(--display); font-size: 19px; margin-right: auto; }
.pop input.find { padding: 7px 11px; border-radius: 10px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; max-height: min(46vh, 380px); overflow-y: auto; padding: 2px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; padding: 5px 4px; border-radius: 8px; cursor: pointer; min-width: 0; }
.check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.check i { font-style: normal; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.check.none { opacity: .45; }
@media (hover: hover) { .check:hover { background: var(--paper); } }
.check.toggle span { white-space: normal; font-weight: 600; }
.check.toggle.big { font-size: 16px; padding: 10px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); }
.wheel { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.wheelkey { background: var(--card); border: 2px solid var(--ink); border-radius: 9px; padding: 5px 0 3px; display: grid; justify-items: center; line-height: 1.1;
  border-top: 6px solid hsl(var(--h, 0) 62% 62%); transition: transform .12s var(--ease), background .15s; }
.wheelkey b { font-family: var(--display); font-size: 15px; }
.wheelkey i { font-style: normal; font-size: 10px; color: var(--muted); }
.wheelkey[aria-pressed=true] { background: var(--ink); color: var(--card); }
.wheelkey[aria-pressed=true] i { color: #cfc4de; }
.wheelkey.near { background: var(--violet-soft); }
.wheelkey:disabled { opacity: .35; cursor: default; }
.pop input[type=number] { width: 96px; padding: 7px 10px; }
.pop input[type=date] { width: auto; padding: 7px 10px; }
.active-filters { display: flex; gap: 7px 12px; flex-wrap: wrap; align-items: center; min-height: 4px; }
.fchip { display: inline-flex; align-items: center; gap: 5px; background: var(--sun); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 6px 2px 10px;
  font-size: 13px; font-weight: 700; transform: rotate(-.6deg); animation: pop .3s var(--ease) both; }
.fchip:nth-child(even) { transform: rotate(.6deg); }
.fchip svg { width: 13px; height: 13px; }
.list-anchor { height: 0; scroll-margin-top: 8px; }

/* ---------------------------------------------------------- the song list */
.sheet { background: var(--card); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink); position: relative; }
.slist { position: relative; contain: layout; overflow: hidden; border-radius: 0 0 17px 17px; }
.srow {
  display: grid; align-items: center; gap: 0 12px; padding: 0 12px 0 10px; height: 46px; font-size: 14px;
  grid-template-columns: 26px 34px minmax(170px, 2fr) 46px 48px 62px minmax(90px, 1.1fr) minmax(120px, 1.7fr) minmax(70px, .9fr) minmax(60px, .6fr) minmax(70px, .7fr) 54px 42px 32px;
}
.slist .srow { position: absolute; left: 0; right: 0; top: 0; border-top: 1.5px solid var(--soft); cursor: pointer; }
.srow > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .slist .srow:hover { background: var(--paper); } }
.slist .srow.cursor { box-shadow: inset 4px 0 0 var(--violet); background: var(--paper); }
.slist .srow.picked { background: var(--violet-soft); }
.slist .srow.playing { background: #fdf3c9; }
.slist .srow.playing .c-title strong { color: var(--violet); }
.shead { position: sticky; top: 0; z-index: 4; background: var(--ink); color: var(--card); height: 40px; border-radius: 16px 16px 0 0; transition: border-radius .12s, box-shadow .12s; }
.shead.stuck { border-radius: 0; box-shadow: -2px 0 0 var(--ink), 2px 0 0 var(--ink); }
.sortbtn { background: none; border: 0; padding: 0; text-align: left; color: #cfc4de; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; height: 100%; }
.shead .sortbtn { display: flex; align-items: center; }
.sortbtn.on { color: var(--sun); }
.sortbtn i { font-style: normal; margin-left: 4px; }
@media (hover: hover) { .sortbtn:hover { color: #fff; } }
.sortmenu { display: none; }
.c-check { display: grid; place-items: center; height: 100%; overflow: visible !important; cursor: pointer; }
.c-play, .c-dl, .step { background: none; border: 2px solid transparent; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; color: var(--ink);
  transition: transform .12s var(--ease), background .15s, color .15s; overflow: visible !important; }
.c-play { background: var(--ink); color: var(--card); border-color: var(--ink); }
.c-play svg { width: 13px; height: 13px; }
.c-dl svg, .step svg { width: 18px; height: 18px; }
@media (hover: hover) { .c-play:hover:not(:disabled) { transform: scale(1.15) rotate(-5deg); background: var(--violet); } .c-dl:hover:not(:disabled), .step:hover:not(:disabled) { background: var(--sun); border-color: var(--ink); transform: translateY(-1px); } }
.c-play:active, .c-dl:active, .step:active { transform: scale(.9); }
.c-play:disabled, .c-dl:disabled, .step:disabled { opacity: .25; cursor: default; }
.srow.playing .c-play { background: var(--violet); }
.c-title { display: grid; line-height: 1.2; }
.c-title strong { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.c-title span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.c-bpm, .bpm { font-variant-numeric: tabular-nums; font-weight: 700; }
.c-len, .c-added, .c-by, .c-venue, .c-vocals, .c-kw { color: var(--muted); font-size: 13px; }
.c-kw { font-style: italic; }
.c-added { font-size: 12px; font-variant-numeric: tabular-nums; }
.c-len { text-align: right; font-variant-numeric: tabular-nums; }
.keychip { display: inline-block; font-weight: 700; font-size: 12.5px; padding: 1px 7px; border-radius: 7px; border: 2px solid var(--ink);
  background: hsl(var(--h) 70% 82%); font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
/* musical keys: a pill, one hue per note; minors deep, majors light */
.keychip.note { border-radius: 999px; background: hsl(var(--h) 78% 80%); padding: 1px 6px; }
.keychip.note.minor { background: hsl(var(--h) 46% 36%); color: var(--card); }
/* the Camelot / musical switch in the shortcut row */
.keyswitch { flex: none; display: inline-grid; grid-template-columns: 1fr 1fr; position: relative; padding: 2px; margin-left: 2px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; isolation: isolate; }
.keyswitch span { padding: 3px 9px; text-align: center; transition: color .15s; }
.keyswitch::before { content: ''; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 999px; background: var(--ink);
  transition: transform .18s var(--ease); }
.keyswitch[aria-checked=true]::before { transform: translateX(100%); }
.keyswitch[aria-checked=false] span:first-child, .keyswitch[aria-checked=true] span:last-child { color: var(--card); }
.srow .chips { gap: 3px; flex-wrap: nowrap; }
.srow .chip, .now-meta .chip, .mixrow .chip, .item-head .chip { padding: 0 7px; font-size: 12px; animation: none; }
.empty { padding: 60px 20px; text-align: center; display: grid; gap: 6px; color: var(--muted); }
.empty[hidden] { display: none; }
.empty strong { font-family: var(--display); font-size: 24px; color: var(--ink); }
@media (max-width: 1240px) { .srow { grid-template-columns: 26px 34px minmax(170px, 2fr) 46px 48px 62px minmax(90px, 1.1fr) minmax(110px, 1.6fr) minmax(70px, .9fr) 54px 42px 32px; } .srow .c-vocals, .srow .c-by { display: none; } }
@media (max-width: 1000px) { .srow { grid-template-columns: 26px 34px minmax(150px, 2fr) 46px 48px 62px minmax(80px, 1fr) minmax(90px, 1.4fr) 42px 32px; } .srow .c-venue, .srow .c-added { display: none; } }

/* ---------------------------------------------------------- selection bar */
.selbar {
  position: fixed; z-index: 7; left: 12px; right: 12px; margin: 0 auto; bottom: calc(var(--bar-space, 0px) + var(--nav-h) + 14px);
  max-width: 760px; background: var(--sun); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 5px 5px 0 var(--ink);
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; flex-wrap: wrap; animation: rise .3s var(--ease) both;
}
.selbar[hidden] { display: none; }
.sel-text { display: grid; line-height: 1.25; margin-right: auto; min-width: 0; }
.sel-text span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selbar progress { flex: 1 1 140px; }

/* ---------------------------------------------------------- player bar */
.playerbar {
  position: fixed; z-index: 8; left: 0; right: 0; bottom: var(--nav-h); height: var(--bar-h);
  background: var(--card); border-top: 2px solid var(--ink); box-shadow: 0 -5px 0 var(--violet);
  display: flex; align-items: center; gap: 16px; padding: 0 max(18px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(18px, env(safe-area-inset-left));
  animation: rise .35s var(--ease) both;
}
.pb-controls { display: flex; align-items: center; gap: 6px; flex: none; }
.playerbar.loading .play svg { animation: spin 1s linear infinite; }
.pb-now { display: flex; align-items: center; gap: 10px; flex: 0 1 300px; min-width: 0; }
.playerbar.playing .eq i { animation: eq .7s ease-in-out infinite; }
.playerbar.playing .eq i:nth-child(2) { animation-delay: .2s; }
.playerbar.playing .eq i:nth-child(3) { animation-delay: .4s; }
.pb-text { min-width: 0; display: grid; gap: 2px; }
.now-title { background: none; border: 0; padding: 0; text-align: left; display: grid; line-height: 1.2; min-width: 0; }
.now-title strong { font-family: var(--display); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-title span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .now-title:hover strong { text-decoration: underline wavy var(--violet); } }
.now-meta { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.now-meta .keychip { font-size: 11px; padding: 0 5px; min-width: 0; }
.pb-wave { flex: 1 1 200px; min-width: 60px; height: 52px; }
canvas.wave { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; border-radius: 6px; }
.playerbar .time { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; flex: none; }
#toast { bottom: calc(var(--bar-space, 0px) + var(--sel-space, 0px) + var(--nav-h) + 24px); }

/* ---------------------------------------------------------- drawer (song detail) */
.drawer-wrap { position: fixed; inset: 0 0 calc(var(--bar-space, 0px) + var(--nav-h)) 0; z-index: 7; background: rgba(29, 22, 38, .45); display: flex; justify-content: flex-end; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.drawer { position: relative; width: min(520px, 100%); height: 100%; overflow-y: auto; background: var(--paper); border-left: 2px solid var(--ink);
  background-image: radial-gradient(rgba(29, 22, 38, .045) 1px, transparent 1px); background-size: 14px 14px;
  padding: 26px 26px 40px; animation: slide-in .32s var(--ease) both; overscroll-behavior: contain; }
.drawer-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); display: grid; place-items: center; }
.drawer-close svg { width: 16px; height: 16px; }
body.drawer-open { overflow: hidden; }
.detail { display: grid; gap: 18px; }
.detail header { padding-right: 44px; display: grid; gap: 4px; }
canvas.wave.detail-wave { height: 56px; cursor: default; }
.bigfacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bigfacts > div, .statline > div { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 9px 6px 8px; text-align: center; display: grid; box-shadow: 3px 3px 0 var(--ink); }
.bigfacts b, .statline b { font-family: var(--display); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bigfacts span, .statline span { font-size: 12px; color: var(--muted); font-weight: 600; }
.bigfacts > div:nth-child(2) { transform: rotate(-1.2deg); background: var(--violet-soft); }
.field { display: grid; gap: 7px; }
.flabel { font-size: 14px; font-weight: 600; }
.flabel i { font-weight: 400; font-style: normal; }
.facts { display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: baseline; font-size: 15px; }
.fact > span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.fact .row { gap: 6px; }
.mixes { display: grid; gap: 10px; }
.mixlist { display: grid; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; }
.mixlist:empty { display: none; }
.mixrow { display: grid; grid-template-columns: 32px 1fr auto auto auto; gap: 10px; align-items: center; padding: 7px 12px 7px 9px; border-top: 1.5px solid var(--soft); font-size: 14px; }
.mixrow:first-child { border-top: 0; }
.mixname { background: none; border: 0; padding: 0; text-align: left; display: grid; line-height: 1.2; min-width: 0; }
.mixname strong, .mixname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mixname span { color: var(--muted); font-size: 12.5px; }
.original summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.original dl { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 13px; margin: 10px 0 0; }
.original dt { color: var(--muted); } .original dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------- stats + reference */
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.statline > div:nth-child(odd) { transform: rotate(-1deg); } .statline > div:nth-child(even) { transform: rotate(.8deg); }
.chart { gap: 12px; }
.chart .tally-row { background: none; border: 0; padding: 2px 0; text-align: left; grid-template-columns: minmax(110px, 200px) 1fr 44px; border-radius: 8px; width: 100%; }
.chart .tally-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
@media (hover: hover) { .chart .tally-row:hover { background: var(--paper); } .chart .tally-row:hover .name { text-decoration: underline wavy var(--violet); } }
table.camelot td { padding: 7px 10px; }
.enh { gap: 10px; }
.kbds { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 22px; }
.kbd-row { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.kbd-row > span:first-child { flex: 0 0 96px; }
kbd { font: 600 12px var(--body); background: var(--card); border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 7px; padding: 1px 7px; }
.videolink { text-decoration: none; color: inherit; gap: 2px; }

/* ---------------------------------------------------------- forms, submit, admin */
.songform { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tagpick { display: grid; gap: 8px; }
.tagpick-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tagpick input { padding: 7px 11px; border-radius: 10px; max-width: 280px; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding: 0 4px; }
.subtabs button { background: var(--soft); border: 2px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; padding: 7px 14px; font-weight: 700; font-size: 14px; margin-bottom: -2px; transform: translateY(3px); transition: transform .12s var(--ease); }
.subtabs button[aria-selected=true] { background: var(--card); transform: none; padding-bottom: 9px; }
.subcard { gap: 14px; }
.subtitle { font-family: var(--display); font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; }
.status { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--soft); white-space: nowrap; }
.status.pending { background: var(--sun); } .status.approved { background: #bfe3c9; } .status.rejected { background: #f6c9c2; }
.item.slim { padding: 9px 14px; gap: 14px; }
.item.slim .item-head { gap: 10px; }
.item.slim .item-head .t { display: grid; }
.item.slim .item-head > span svg { width: 16px; height: 16px; display: block; }
.item.open { box-shadow: 5px 5px 0 var(--violet); }
.item.open .item-head { cursor: pointer; padding-bottom: 6px; border-bottom: 1.5px solid var(--soft); border-radius: 0; }
.tagrows { display: grid; gap: 6px; }
.tagrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tagrow input[type=text] { padding: 5px 10px; border-radius: 9px; flex: 1 1 180px; width: auto; min-width: 0; }
.tagrow input[type=text]:nth-of-type(2) { flex: 0 1 190px; background: var(--paper); }
.tagrow .num { flex: 0 0 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.page-admin .searchwrap, .page-submit .searchwrap { margin-bottom: -6px; }

/* ---------------------------------------------------------- phones */
@media (max-width: 760px) {
  .count { position: absolute; right: 2px; top: calc(100% + 2px); font-size: 18px; }
  .lib-top { gap: 10px; }
  .shortcuts { margin: 14px -14px 0; padding: 4px 14px 8px; }
  .filterbar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: none; }
  .filterbar::-webkit-scrollbar { display: none; }
  .pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(var(--bar-space, 0px) + var(--nav-h) + 10px); width: auto; z-index: 9; max-height: 70vh; overflow-y: auto; box-shadow: 0 -4px 0 var(--violet), 0 0 0 100vmax rgba(29, 22, 38, .35); }
  .checks { grid-template-columns: 1fr 1fr; }
  .wheel { grid-template-columns: repeat(6, 1fr); }
  .sheet { margin: 0 -8px; border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); }
  .srow { height: 70px; grid-template-columns: 24px 40px auto auto auto minmax(0, 1fr) 34px; grid-template-rows: 1fr 1fr; gap: 0 8px; padding: 0 8px; }
  .srow .c-check { grid-row: 1 / 3; } .srow .c-play { grid-row: 1 / 3; width: 38px; height: 38px; } .srow .c-dl { grid-row: 1 / 3; grid-column: 7; }
  .srow .c-title { grid-column: 3 / 7; grid-row: 1; align-self: end; }
  .srow .c-bpm, .srow .c-key, .srow .c-score, .srow .c-genre { grid-row: 2; align-self: start; padding-top: 3px; font-size: 12.5px; }
  .srow .c-genre { color: var(--muted); }
  .srow .c-len, .srow .c-kw { display: none; }
  .shead { height: 44px; grid-template-rows: 1fr; grid-template-columns: 24px 1fr; }
  .shead .sortbtn, .shead .c-play, .shead .c-dl { display: none; }
  .sortmenu { display: block; background: transparent; color: var(--card); border: 0; font-weight: 700; padding: 0; width: auto; justify-self: start; }
  :root { --bar-h: 112px; }
  .playerbar { flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px; align-content: center; }
  .pb-wave { order: -1; flex: 1 0 100%; height: 34px; }
  .pb-now { flex: 1 1 0; }
  .playerbar .time { display: none; }
  .now-meta { display: none; }
  .playerbar .play { width: 44px; height: 44px; }
  .drawer { padding: 20px 18px 40px; border-left: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 72px 1fr; }
  .mixrow { grid-template-columns: 32px 1fr auto auto; } .mixrow .chips { display: none; }
  .chart .tally-row { grid-template-columns: minmax(90px, 130px) 1fr 36px; }
  .selbar { bottom: calc(var(--bar-space, 0px) + var(--nav-h) + 8px); }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; }
  .subtabs button { flex: none; }
}
@media (max-width: 640px) {
  :root { --nav-h: calc(76px + env(safe-area-inset-bottom)); }
  nav button span { font-size: 11px; white-space: nowrap; }
  main.wide { padding-bottom: calc(110px + var(--bar-space, 0px) + var(--sel-space, 0px) + env(safe-area-inset-bottom)); }
  .playerbar { border-bottom: 0; }
}
[hidden] { display: none !important; }
/* grids must not grow to fit a long unbroken strip (shortcuts, filter bar) */
main.wide, .view-root, .lib-top, .view, .detail, .songform { grid-template-columns: minmax(0, 1fr); }
.pop .row.quick { gap: 6px; }
.tag.group { border-style: dashed; }
.hint-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hint-row:empty { display: none; }

/* ---------------------------------------------------------- covers */
.c-play.art { border-radius: 8px; background-size: cover; background-position: center; background-color: var(--soft); width: 34px; height: 34px; }
.c-play.art svg { opacity: 0; filter: drop-shadow(0 0 2px #000); color: #fff; transition: opacity .12s; width: 15px; height: 15px; }
.c-play.art::before { content: ""; position: absolute; inset: 0; border-radius: 6px; background: rgba(29, 22, 38, 0); transition: background .12s; }
.c-play { position: relative; }
.c-play.art svg { position: relative; }
@media (hover: hover) { .srow:hover .c-play.art svg { opacity: 1; } .srow:hover .c-play.art::before { background: rgba(29, 22, 38, .45); } .c-play.art:hover:not(:disabled) { background-color: var(--soft); } }
.srow.playing .c-play.art { background-color: var(--soft); box-shadow: 0 0 0 2px var(--violet); border-color: var(--ink); }
.srow.playing .c-play.art svg { opacity: 1; } .srow.playing .c-play.art::before { background: rgba(29, 22, 38, .45); }
.pb-cover { flex: none; width: 54px; height: 54px; padding: 0; border: 2px solid var(--ink); border-radius: 10px; background-color: var(--soft); background-size: cover; background-position: center;
  box-shadow: 2px 2px 0 var(--ink); transform: rotate(-2deg); cursor: zoom-in; transition: transform .18s var(--ease), box-shadow .18s; }
@media (hover: hover) { .pb-cover:hover { transform: rotate(1deg) scale(1.08); box-shadow: 3px 3px 0 var(--violet); } }
.pb-cover.open { cursor: zoom-out; box-shadow: 2px 2px 0 var(--violet); }
@keyframes sleeve-in { from { transform: translateY(30px) rotate(-6deg) scale(.4); opacity: 0; } to { transform: rotate(-2deg); opacity: 1; } }
.sleeve { position: fixed; z-index: 8; left: max(18px, env(safe-area-inset-left)); bottom: calc(var(--bar-space, 0px) + var(--nav-h) + 16px);
  width: min(340px, calc(100vw - 36px), calc(100vh - var(--bar-space, 0px) - var(--nav-h) - 60px)); aspect-ratio: 1; padding: 0;
  border: 2px solid var(--ink); border-radius: 18px; background-color: var(--soft); background-size: cover; background-position: center;
  box-shadow: 7px 7px 0 var(--violet); transform: rotate(-2deg); transform-origin: 30px 100%; animation: sleeve-in .28s var(--ease) both; cursor: zoom-out; }
body.entry .sleeve { display: none; }
.detail header.with-art { grid-template-columns: 96px 1fr; column-gap: 16px; align-items: center; }
.detail header.with-art > :not(img) { grid-column: 2; }
.detail-cover { grid-row: 1 / span 3; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-2.5deg); display: block; }
@media (max-width: 760px) { .srow .c-play.art { width: 44px; height: 44px; } .pb-cover { width: 40px; height: 40px; } }

/* ---------------------------------------------------------- entry screens */
body.entry .playerbar, body.entry .selbar, body.entry .drawer-wrap { display: none; }
/* a form under the ball: smaller ball, tighter card, so nothing falls below the screen */
.entry-wrap.compact .ball-slot { height: clamp(110px, 22vh, 230px); min-height: 0; }
.entry-wrap.compact { padding-bottom: 24px; }
.entry-wrap.compact .card { padding: 20px 24px 18px; }
.entry-wrap.compact .card .brand { font-size: 24px; }
.entry-wrap.compact .card .brand svg { width: 36px; height: 36px; }
.entry-wrap.compact form { gap: 10px; }
.entry-wrap.compact h2 { font-size: 22px; }
@media (max-height: 640px) { .entry-wrap.compact .ball-slot { height: 84px; } }
