/* The top bar, tabs and what's in the main view: sections, shelves, cards, song rows, page headers, buttons. */
/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 6; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1200px; margin: 0 auto; display: flex; align-items: stretch; height: 56px; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 12px; border-right: 1px solid var(--line);
  font: 700 18px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.mark { width: 26px; height: 26px; position: relative; flex: none; }
.mark i { position: absolute; display: block; }
.mark .c { width: 16px; height: 16px; border-radius: 50%; background: var(--red); left: 0; top: 5px; }
.mark .t { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 13px solid var(--yellow); right: 0; top: 0; }
.mark .s { width: 9px; height: 9px; background: var(--blue); right: 1px; bottom: 0; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; min-width: 0; }
.search svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: 500 15px var(--ui); outline: none; }
.search input::placeholder { color: var(--faint); }
.search { position: relative; }
.recent { position: absolute; left: 0; right: 0; top: 100%; z-index: 7; background: var(--bg); border: 1px solid var(--line); border-top: 0; box-shadow: 0 16px 40px #0006; }
.recent .rrow { display: flex; }
.recent .rq { flex: 1; min-width: 0; text-align: left; padding: 0 16px; height: 44px; font: 500 14px var(--ui); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .rx { width: 44px; height: 44px; color: var(--faint); font-size: 18px; }
.recent .rclear { width: 100%; height: 40px; border-top: 1px solid var(--line); font: 600 11px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
@media (hover: hover) { .recent .rq:hover, .recent .rx:hover, .recent .rclear:hover { background: var(--s1); color: var(--text); } }
.top .home { width: 56px; display: grid; place-items: center; border-left: 1px solid var(--line); transition: background .15s var(--ease); }
@media (hover: hover) { .top .home:hover { background: var(--s1); } }

.nav, .tabs { max-width: 1200px; margin: 0 auto; display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.nav button, .tabs button { height: var(--hit); padding: 0 18px; border-right: 1px solid var(--line); color: var(--muted);
  font: 600 12px var(--display); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; position: relative;
  display: flex; align-items: center; gap: 8px; transition: color .12s, background .12s; }
@media (hover: hover) { .nav button:hover, .tabs button:hover { color: var(--text); background: var(--s1); } }
.brand span::after { content: var(--house, "Tunebox"); }   /* the house's name (shared/look.js) */
/* numbered by CSS, so a page that is switched off leaves no gap */
.nav { counter-reset: nav; }
.nav button { counter-increment: nav; }
.nav button b::before { content: counter(nav, decimal-leading-zero); }
.nav button b { font: 700 11px var(--display); color: var(--faint); letter-spacing: .06em; }
.nav button.on, .tabs button.on { color: var(--text); }
.nav button.on b { color: var(--red); }
.nav button.on::after, .tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--red);
  transform-origin: left; animation: underline .3s var(--ease-out); }
@keyframes underline { from { transform: scaleX(0); } }
.tabs { background: var(--s1); }

main { max-width: 1200px; margin: 0 auto; padding: 0 0 calc(var(--player-h) + 16px); }

/* ---------- section heads ---------- */
.sec { display: flex; align-items: baseline; gap: 12px; padding: 18px 16px 10px; border-bottom: 1px solid var(--line); }
.sec b { font: 700 12px var(--display); color: var(--red); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.sec h2 { margin: 0; font: 600 13px var(--display); letter-spacing: .14em; text-transform: uppercase; }
.sec .aside { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- shelves / grid ---------- */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 137px; overflow-x: auto;
  border-bottom: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); border-bottom: 1px solid var(--line); }
.card { background: var(--bg); padding: 10px; text-align: left; transition: background .15s var(--ease); min-width: 0; }
.shelf .card { border-right: 1px solid var(--line); }
@media (hover: hover) { .card:hover { background: var(--s1); } }
.card img, .card .mosaic, .card .blank { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--s2); }
.card .t { margin-top: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .kind { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; }
.kind.song { background: var(--red); border-radius: 50%; }
.kind.album { background: var(--yellow); }
.kind.playlist, .kind.artist { background: var(--blue); }
.kind.liked { background: var(--red); border-radius: 50%; }
.kind.top { background: var(--blue); border-radius: 50%; }
.kind.mine { background: none; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 8px solid var(--yellow); width: 0; height: 0; }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; overflow: hidden; }
.mosaic img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
.mosaic.one { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.blank { display: grid; place-items: center; color: var(--faint); position: relative; }
.card.new .blank { border: 1px dashed var(--line-2); background: none; }
.sec .aside .link { color: var(--red); font: 600 11px var(--display); letter-spacing: .12em; text-transform: uppercase; }
@media (hover: hover) { .sec .aside .link:hover { text-decoration: underline; } }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border-bottom: 1px solid var(--line); }
/* The lines between tiles (cards, chips, stat tiles) are each tile's own right and bottom edge, drawn just outside it
   and cut off at the grid's edge. A gap over a lined background would leave a short last row next to a grey block. */
.grid, .chips, .tiles { overflow: hidden; }
:is(.grid, .chips, .tiles) > * { position: relative; }
:is(.grid, .chips, .tiles) > *::after { content: ""; position: absolute; inset: 0 -1px -1px 0; border: solid var(--line); border-width: 0 1px 1px 0; pointer-events: none; z-index: 1; }
.chips button { height: 56px; background: var(--bg); text-align: left; padding: 0 14px; display: flex; align-items: center; gap: 12px;
  font: 600 12px var(--display); letter-spacing: .1em; text-transform: uppercase; transition: background .12s; }
@media (hover: hover) { .chips button:hover { background: var(--s1); } }
.chips i { width: 12px; height: 12px; flex: none; }
.chips i.c0 { background: var(--red); border-radius: 50%; }
.chips i.c1 { background: var(--yellow); }
.chips i.c2 { background: var(--blue); }
@media (hover: hover) { .card.new:hover .blank { border-color: var(--red); color: var(--red); } }

/* ---------- song rows ---------- */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 28px 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); position: relative; transition: background .12s var(--ease); }
@media (hover: hover) { .row:hover { background: var(--s1); } }
.row .n { font: 600 12px var(--display); color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.row img { width: 44px; height: 44px; object-fit: cover; background: var(--s2); }
.row .meta { min-width: 0; cursor: pointer; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.playing { background: var(--s1); }
.row.playing::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--yellow); }
.row.playing .n { color: transparent; position: relative; }
.row.playing .n::after { content: ""; position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  border-left: 9px solid var(--yellow); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.acts { display: flex; }
.acts button { width: var(--hit); height: var(--hit); display: grid; place-items: center; color: var(--muted); transition: color .12s, background .12s; }
@media (hover: hover) { .acts button:hover { color: var(--text); background: var(--s2); } }
.like svg path { fill: none; }
.like.on { color: var(--red) !important; }
.like.on svg path { fill: currentColor; }
.ctrls .sq.like { display: none; }
.acts button:disabled { opacity: .3; pointer-events: none; }
.loc { display: inline-block; margin-right: 6px; padding: 0 4px; border: 1px solid var(--line-2); color: var(--muted);
  font: 700 9px/14px var(--display); letter-spacing: .1em; text-transform: uppercase; font-style: normal; vertical-align: 1px; }
.daygroup { padding: 14px 16px 6px; font: 700 11px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 56px; z-index: 2; }

/* ---------- detail header ---------- */
.hero { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); align-items: end; }
.hero > img, .hero > .mosaic, .hero > .blank { width: 132px; height: 132px; object-fit: cover; background: var(--s2); }
.hero .k { font: 600 11px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin: 4px 0 2px; font: 700 clamp(22px, 4vw, 34px)/1.05 var(--display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero .s { color: var(--muted); }
.hero .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero input.name { width: 100%; margin: 4px 0 2px; font: 700 clamp(22px, 4vw, 34px)/1.05 var(--display); background: var(--s1); color: var(--text);
  border: 0; border-bottom: 3px solid var(--red); padding: 4px 6px; outline: none; }
.btn { height: var(--hit); padding: 0 18px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: 600 12px var(--display); letter-spacing: .12em; text-transform: uppercase; border: 1px solid var(--line-2); transition: background .12s, border-color .12s, color .12s; }
@media (hover: hover) { .btn:hover { border-color: var(--text); } }
.btn.red { background: var(--red); border-color: var(--red); color: var(--on-red); }
@media (hover: hover) { .btn.red:hover { filter: brightness(1.08); } }
.btn.ghost { border-color: transparent; color: var(--muted); }
@media (hover: hover) { .btn.ghost:hover { color: var(--text); border-color: var(--line-2); } }
@media (hover: hover) { .btn.danger:hover { border-color: var(--red); color: var(--red); } }
.back { height: var(--hit); padding: 0 16px; display: flex; align-items: center; gap: 8px; color: var(--muted); border-bottom: 1px solid var(--line); width: 100%;
  font: 600 12px var(--display); letter-spacing: .12em; text-transform: uppercase; }
@media (hover: hover) { .back:hover { color: var(--text); } }
.newform { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--s1); }
.field { flex: 1; min-width: 0; height: var(--hit); background: var(--bg); color: var(--text); border: 1px solid var(--line-2); padding: 0 12px; font: 500 14px var(--ui); outline: none; }
.field:focus { border-color: var(--yellow); }

.note { padding: 40px 16px; color: var(--muted); display: flex; align-items: center; gap: 12px; justify-content: center; text-align: center; }
.spin { width: 12px; height: 12px; background: var(--yellow); animation: spin 1s var(--ease) infinite; flex: none; }
@keyframes spin { 0% { transform: rotate(0); } 50% { transform: rotate(90deg); } 100% { transform: rotate(180deg); } }
.newform.plain { background: none; }
.hint.tight { margin: 0 0 8px; }
.blank.heart { color: var(--red); }
/* Liked songs: whose likes to show */
/* find and order inside a long playlist */
.ltools { display: flex; gap: 8px; margin: 0 0 14px; }
.ltools input { flex: 1; min-width: 0; }
.ltools select { flex: none; width: auto; }
.likers { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.likers button { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--line-2);
  font: 600 12px var(--body, inherit); background: var(--bg); }
.likers button .av.sm, .likers button .sem { margin: 0 6px 0 0; }
.likers button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* ---------- Local songs: uploads on their way, files dragged over the page ---------- */
#view .upnote { padding: 0 16px; margin: 10px 0; }
#view > .likers { padding: 12px 16px 0; }
.uprow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 8px 16px 10px; border-bottom: 1px solid var(--line); }
.uprow:first-child { border-top: 1px solid var(--line); }
.uprow .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uprow .s { color: var(--muted); font-size: 12.5px; text-align: right; }
.uprow .upbar { grid-column: 1 / -1; height: 3px; background: var(--s2); }
.uprow .upbar i { display: block; height: 100%; background: var(--yellow); transition: width .2s linear; }
.uprow.wait .t { color: var(--muted); }
.uprow.done .upbar i { background: var(--blue); }
.uprow.bad .s { color: var(--red); grid-column: 1 / -1; text-align: left; white-space: normal; }
.uprow.bad .upbar { display: none; }
#view.dropping { outline: 3px dashed var(--yellow); outline-offset: -6px; }
.whoid.lecover { grid-template-columns: 96px minmax(0, 1fr); }
.lecover img { width: 96px; height: 96px; object-fit: cover; background: var(--s2); }
.lecover .btn { justify-self: start; }

/* Select (select.js): a tap picks a row; the bar acts on what is picked */
.selecting .row { cursor: pointer; }
.selecting .row .acts, .selecting .row .grip { visibility: hidden; }
.row.picked { background: color-mix(in srgb, var(--red) 16%, transparent); box-shadow: inset 3px 0 var(--red); }
.selbar { position: fixed; left: 50%; bottom: calc(var(--player-h) + 12px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 60;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px;
  background: var(--s2); border: 1px solid var(--line-2); box-shadow: 0 16px 40px #0008; }
.selbar span { font: 600 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }

