/* Tuned — visual language.
   Monochrome, light, minimal. No colour anywhere: hierarchy is carried by
   weight, size and whitespace, and separation by hairlines rather than fills.
   Apple HIG principles (clarity, deference, depth) on a strict 4pt scale.
   Phone-first; a wider viewport promotes the tab bar to a top nav and the
   recommendation rail to a grid. */

:root {
  --bg:        #ffffff;
  --surface:   #f7f7f7;
  --surface-2: #ededed;
  --line:      rgba(0, 0, 0, .11);
  --ink:       #000000;
  --ink-2:     rgba(0, 0, 0, .56);
  --ink-3:     rgba(0, 0, 0, .34);
  --radius:    12px;
  --pad:       20px;
  --max:       1060px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- typography ---------- */
.large-title { font-size: 30px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .9px; color: var(--ink-3); margin: 30px 0 10px;
}
.sub   { color: var(--ink-2); margin: 8px 0 24px; font-size: 15px; }
.hint  { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 20px; }
.error { color: var(--ink); font-weight: 600; font-size: 14px; min-height: 20px; margin: 10px 2px; }
.empty { color: var(--ink-3); font-size: 15px; padding: 22px var(--pad); text-align: center; }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: 100%; max-width: 360px; text-align: center; }
.mark {
  width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 14px;
  display: grid; place-items: center; font-size: 26px;
  background: var(--ink); color: #fff;
}
.segmented {
  display: flex; gap: 2px; background: var(--surface-2); border-radius: 9px;
  padding: 2px; margin: 0 0 18px;
}
.seg { flex: 1; padding: 8px; border-radius: 7px; font-size: 14px;
       font-weight: 600; color: var(--ink-2); }
.seg.active { background: #fff; color: var(--ink); }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px;
           color: var(--ink-3); font-size: 12px; }
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- grouped inset list ---------- */
.grouped {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.grouped:empty { display: none; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; background: none;
}
.row:last-child { border-bottom: 0; }
.row input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  padding: 3px 0; font-size: 15px;
}
.row input::placeholder { color: var(--ink-3); }
button.row:hover { background: var(--surface); }

.art {
  width: 46px; height: 46px; border-radius: 6px; flex: none; object-fit: cover;
  background: var(--surface-2); display: grid; place-items: center;
  color: var(--ink-3); font-size: 17px;
}
.meta { flex: 1; min-width: 0; }
.meta b { display: block; font-size: 15px; font-weight: 600;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta span { display: block; font-size: 13px; color: var(--ink-2);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .badge {            /* must out-specify .meta span for display AND colour */
  display: inline-block; width: auto; font-size: 9px; color: #fff;
}
.meta .badge.admin { color: var(--ink); }
.trail { font-size: 13px; color: var(--ink-3); flex: none; text-align: right; }
.trail b { color: var(--ink); display: block; font-size: 13px; letter-spacing: 1px; }

/* ---------- controls ---------- */
.primary {
  width: 100%; background: var(--ink); color: #fff; font-weight: 600;
  padding: 13px; border-radius: 10px; margin-top: 4px;
}
.primary:hover { opacity: .86; }
.ghost { color: var(--ink-2); font-size: 15px; padding: 6px 2px; }
.ghost:hover { color: var(--ink); }
.spotify {
  display: block; width: 100%; padding: 13px; border-radius: 10px;
  text-decoration: none; text-align: center;
  border: 1px solid var(--ink); color: var(--ink);
  font-weight: 600; font-size: 15px; background: #fff;
}
.spotify:hover { background: var(--ink); color: #fff; }
.pill {
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 18px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.pill:hover { border-color: var(--ink); }
.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.search-wrap { position: relative; }
.search {
  width: 100%; background: var(--surface); border: 1px solid transparent;
  border-radius: 10px; padding: 12px 38px 12px 14px; outline: none;
}
.search:focus { background: #fff; border-color: var(--ink); }
.search::placeholder { color: var(--ink-3); }
.q-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; color: var(--ink-3); font-size: 13px;
}
.q-clear:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- shell ---------- */
#app { max-width: var(--max); margin: 0 auto; display: flex; flex-direction: column;
       padding: 0 var(--pad) 96px; }
.bar { display: flex; align-items: baseline; justify-content: space-between;
       padding: 22px 0 6px; }
.view.page { min-width: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; z-index: 10;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--ink-3);
  letter-spacing: .3px; text-transform: uppercase;
}
.tab span { font-size: 19px; line-height: 1; }
.tab.active { color: var(--ink); }

/* ---------- recommendation cards ---------- */
.cards { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px;
         scroll-snap-type: x mandatory; scrollbar-width: none; }
.cards::-webkit-scrollbar { display: none; }
.card {
  flex: none; width: 150px; scroll-snap-align: start; text-align: left;
  background: none;
}
.card .cover {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px;
  display: grid; place-items: center; background: var(--surface-2);
  color: var(--ink-3); font-size: 26px; border: 1px solid var(--line);
}
.card .body { padding: 9px 1px 2px; }
.card b { display: block; font-size: 14px; font-weight: 600;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card span { display: block; font-size: 13px; color: var(--ink-2);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- track detail ---------- */
.back { margin: 4px 0 10px; display: inline-block; }
.hero .cover {
  width: 180px; height: 180px; border-radius: 10px; object-fit: cover;
  display: grid; place-items: center; font-size: 44px; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 20px;
}
.hero h2 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.hero p  { color: var(--ink-2); margin: 4px 0 0; font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 16px; }
.tag { font-size: 12px; padding: 5px 11px; border-radius: 16px;
       border: 1px solid var(--line); color: var(--ink-2); }
.review-box {
  width: 100%; margin-top: 16px; background: var(--surface); border: 1px solid transparent;
  border-radius: 10px; padding: 12px; resize: vertical; min-height: 78px;
  outline: none; font-size: 15px;
}
.review-box:focus { background: #fff; border-color: var(--ink); }
.actions { margin-top: 14px; max-width: 280px; }
.badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
         background: var(--ink); color: #fff; margin-left: 7px;
         text-transform: uppercase; letter-spacing: .5px; vertical-align: 2px; }
.badge.admin { background: #fff; color: var(--ink); border: 1px solid var(--ink); }

/* ---------- stars ---------- */
/* A filled row clipped over an empty one: a half star is a 50% width, not a
   different glyph, so 3.5 draws exactly as 3.5. */
.stars { position: relative; display: inline-block; white-space: nowrap;
         color: var(--surface-2); font-size: 13px; letter-spacing: 1px; }
.stars-on { position: absolute; left: 0; top: 0; overflow: hidden;
            white-space: nowrap; color: var(--ink); }

/* ---------- the rating slider ---------- */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
         margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--line);
         border-bottom: 1px solid var(--line); }
.facts b { display: block; font-size: 19px; font-weight: 700; text-align: center;
           font-variant-numeric: tabular-nums; }
.facts span { display: block; font-size: 11px; color: var(--ink-2); text-align: center;
              text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }

.album-link {
  margin-top: 10px; padding: 0; font-size: 14px; font-weight: 600;
  color: var(--ink-2); text-align: left; background: none; border: none;
}
.album-link:hover { color: var(--ink); }

.rate-box { margin-top: 22px; }
.rate-head { display: flex; align-items: baseline; justify-content: space-between; }
.rate-head .section-label { margin: 0; }
.rate-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px;
              font-variant-numeric: tabular-nums; }
.rate-stars { margin: 2px 0 6px; }
.rate-stars .stars { font-size: 24px; letter-spacing: 3px; }
.rate-note { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px;
          background: none; outline: none; display: block; }
.slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px; background: var(--surface-2); }
.slider::-moz-range-track {
  height: 4px; border-radius: 999px; background: var(--surface-2); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px;
  margin-top: -9px; border-radius: 50%; background: var(--ink);
  border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  cursor: grab; }
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--ink);
  border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  cursor: grab; }
.slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.08); }

/* ---------- lyrics ---------- */
.lyrics-box { border: 1px solid var(--line); border-radius: var(--radius);
              padding: 16px 18px; max-height: 320px; overflow-y: auto;
              background: var(--surface); }
.lyrics { margin: 0; font: inherit; font-size: 14px; line-height: 1.65;
          color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }

/* ---------- loading skeletons ---------- */
/* Same geometry as the real rows, so results land without the page jumping. */
.skeleton { pointer-events: none; }
.skeleton.sk-cards { display: flex; gap: 14px; overflow: hidden; }
.sk { background: var(--surface-2); border-radius: 8px;
      animation: sk-pulse 1.2s ease-in-out infinite; }
@keyframes sk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.sk-row { pointer-events: none; }
.sk-art { width: 48px; height: 48px; flex: none; border-radius: 8px; }
.sk-card { width: 150px; flex: none; }
.sk-cover { width: 100%; aspect-ratio: 1; border-radius: 12px; margin-bottom: 9px; }
.sk-line { height: 11px; border-radius: 999px; margin-bottom: 7px; }
.sk-line.short { width: 55%; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

.muted { font-size: 13px; color: var(--ink-3); }

/* ---------- stats / chart ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 10px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 700; }
.stat span { font-size: 10px; color: var(--ink-3); text-transform: uppercase;
             letter-spacing: .6px; }
.bar-item { margin-bottom: 14px; }
.bar-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.bar-head span:last-child { color: var(--ink-3); font-size: 12px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--ink); }

/* =========================================================================
   Desktop: the bottom tab bar becomes a top nav, and the card rail becomes
   a grid. Below this width everything stays phone-shaped.
   ========================================================================= */
@media (min-width: 760px) {
  body { font-size: 15px; }
  #app { padding-bottom: 60px; }

  .tabbar {
    position: sticky; top: 0; order: -1; left: auto; right: auto; bottom: auto;
    border-top: 0; border-bottom: 1px solid var(--line);
    padding: 0; gap: 4px; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad);
  }
  .tab {
    flex: none; flex-direction: row; gap: 8px; align-items: center;
    padding: 16px 4px; margin-right: 22px; font-size: 12px;
    border-bottom: 2px solid transparent;
  }
  .tab span { font-size: 15px; }
  .tab.active { border-bottom-color: var(--ink); }

  .bar { padding: 30px 0 10px; }
  .large-title { font-size: 34px; }

  .cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 22px 18px; overflow: visible;
  }
  .card { width: auto; }

  /* controls should not stretch to the full content width on a wide screen */
  .review-box { max-width: 560px; }
  .rate-box   { max-width: 560px; }
  .search     { max-width: 520px; }

  .hero { display: flex; gap: 26px; align-items: flex-end; }
  .hero .cover { width: 200px; height: 200px; margin-bottom: 0; flex: none; }
  .hero-text { padding-bottom: 6px; }

  .auth-card { max-width: 380px; }
}

@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}


/* =========================================================================
   Podiums-inspired pass: warm off-white ground, pill geometry, floating
   bottom nav. Same typeface, same monochrome discipline; the single accent
   is the pale-yellow match pill.
   ========================================================================= */
:root {
  --bg: #f4f2ed; --surface: #ffffff; --surface-2: #e8e5df;
  --line: rgba(32, 30, 25, .11); --ink: #1d1b16;
  --ink-2: rgba(32, 30, 25, .56); --ink-3: rgba(32, 30, 25, .35);
  --radius: 16px;
}
body, html { background: var(--bg); }
.grouped, .stat, .search, .review-box, .lyrics-box { background: #fff; }
.primary, .spotify, .pill, .search { border-radius: 999px; }
.seg, .segmented { border-radius: 999px; }
.auth-card .grouped { border-radius: var(--radius); }
.mark { border-radius: 24px; }

/* floating pill nav, every screen size */
#app { padding-bottom: 130px !important; }
.tabbar {
  position: fixed !important; left: 50% !important; right: auto !important;
  top: auto !important; bottom: 16px !important; transform: translateX(-50%);
  order: 0 !important; width: auto !important; max-width: 94vw; margin: 0 !important;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .94); backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid var(--line) !important; border-radius: 999px;
  padding: 8px 14px !important; box-shadow: 0 14px 36px rgba(30, 28, 22, .16);
}
.tab {
  flex: none !important; flex-direction: column !important; gap: 2px !important;
  margin: 0 !important; padding: 4px 18px !important;
  border-bottom: 0 !important; font-size: 10px !important;
}
.tab span { font-size: 18px !important; }
/* profile header, Podiums-style */
.me-head { text-align: center; padding: 12px 0 4px; }
.avatar-big {
  width: 86px; height: 86px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 34px; font-weight: 700; margin: 0 auto 12px;
}
.me-name { font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.stats-row { display: flex; justify-content: center; gap: 52px; margin-top: 18px; }
.stats-row b { display: block; font-size: 22px; font-weight: 700; text-align: center; }
.stats-row span { font-size: 12px; color: var(--ink-2); }

.match-pill {
  flex: none; font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: 999px; background: #f1e9bb; color: #5c5310;
}

/* =========================================================================
   Profile: ratings as cover cards
   ========================================================================= */

/* "Your ratings" is the heading of the page's main shelf, so it is set larger
   than the small all-caps labels the rest of the sections use. */
.section-label.label-lg {
  font-size: 19px; font-weight: 700; text-transform: none;
  letter-spacing: -.2px; color: var(--ink);
}

/* Same card as "For you", but it wraps into a grid instead of scrolling
   sideways: this is your whole library, not a short shelf. */
.rating-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 22px 16px; overflow: visible;
}
.rating-card { width: auto; text-align: left; }
.card-main { display: block; width: 100%; text-align: left; background: none; }
.rating-card .body { padding: 10px 1px 2px; }
.rating-card b { font-size: 15px; }
.rating-card span { font-size: 13px; }

/* stars on the left, the review chevron on the right when there is one */
.card-foot { display: flex; align-items: center; justify-content: space-between;
             gap: 8px; padding: 5px 1px 0; }
.card-stars .stars { font-size: 15px; letter-spacing: 1.5px; }
.card-more {
  flex: none; width: 22px; height: 22px; border-radius: 50%; line-height: 1;
  font-size: 16px; color: var(--ink-2); background: var(--surface-2);
  display: grid; place-items: center;
  transition: transform .15s ease, background .15s ease;
}
.card-more:hover { color: var(--ink); }
.card-more.open { transform: rotate(90deg); background: var(--ink); color: #fff; }
.card-review {
  margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2);
  border-left: 2px solid var(--line); padding-left: 9px; white-space: pre-wrap;
}

.people-note { margin: 10px 2px 0; }

/* .card span sets a muted colour for the card's subtitle, and it out-specifies
   the star rules, which flattened both rows to the same grey. Restore the
   contrast the overlay depends on. */
.card-stars .stars    { color: var(--surface-2); }
.card-stars .stars-on { color: var(--ink); }

/* An avatar may be an <img> or the initial-letter <div>; both need the circle.
   Only avatars are round -- album and track art in the same .art slot stays
   square, which is how a cover is meant to read. */
img.avatar-big, img.art { object-fit: cover; }
.art.avatar { border-radius: 50%; }

/* A comment under a rating wraps; the name and stars above it do not. */
.meta .review-text {
  white-space: normal; color: var(--ink-2); font-size: 14px; margin-top: 4px;
}

/* .card span truncates with an ellipsis, which is right for a title and wrong
   for the stars: it matched the star spans too, so the overlay was measured
   against a shrunk box and every rating rendered as "★ ★ …". These have to
   out-specify it, and .stars-on keeps overflow:hidden because clipping the
   filled row by width IS how a half star is drawn. */
.card-foot .card-stars { flex: none; width: auto; overflow: visible; }
.card .stars {
  display: inline-block; width: auto; overflow: visible; text-overflow: clip;
}
.card .stars-on { display: block; width: auto; text-overflow: clip; }

/* A saved review reads as text, with the pen as the only affordance. */
.my-review {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface); max-width: 560px;
}
.my-review p { margin: 0; flex: 1; min-width: 0; font-size: 15px;
               line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pen {
  flex: none; width: 30px; height: 30px; border-radius: 50%; font-size: 14px;
  color: var(--ink-2); background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.pen:hover { color: var(--ink); border-color: var(--ink); }
.actions { display: flex; align-items: center; gap: 12px; max-width: 560px; }
.actions .primary { max-width: 240px; }

/* Search sections: a heading with a chevron that reveals the rest. */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-head .section-label { margin: 30px 0 10px; }
.sec-more {
  flex: none; width: 26px; height: 26px; margin-top: 18px; border-radius: 50%;
  font-size: 17px; line-height: 1; color: var(--ink-2); background: var(--surface-2);
  display: grid; place-items: center; transition: transform .15s ease;
}
.sec-more:hover { color: var(--ink); }
.sec-more.open { transform: rotate(90deg); background: var(--ink); color: #fff; }
