/* ------------------------------------------------------------------
   Spins — dark "listening room" theme
   Ink-blue surfaces, amber accent, serif display headings, pill controls.
   ------------------------------------------------------------------ */
:root {
  --bg: #0e0f14;
  --bg-2: #161822;
  --bg-3: #1f222e;
  --bg-4: #2a2e3d;
  --line: #262a38;
  --text: #b6bac6;
  --text-dim: #7b8093;
  --text-bright: #eef0f5;
  --white: #ffffff;
  --accent: #f7b733;        /* amber: stars, primary actions */
  --accent-soft: rgba(247, 183, 51, .14);
  --coral: #ff6b6b;         /* likes, your own track ratings */
  --mint: #5fd3c4;          /* links on hover, info */
  --red: #ff5c5c;
  --star: var(--accent);
  --star-empty: #33374a;
  --radius: 10px;
  --radius-sm: 6px;
  --pill: 999px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(247, 183, 51, .06), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-bright); text-decoration: none; transition: color .12s; }
a:hover { color: var(--mint); }
h1, h2, h3, h4 { color: var(--text-bright); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-family: var(--display); font-weight: 500; font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
code { background: var(--bg-3); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--text-dim); }
.small { font-size: .8rem; }
.year { color: var(--text-dim); font-weight: 400; margin-left: .35rem; font-size: .85em; font-family: var(--font); }
.inline-form { display: inline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }
.link-btn:hover { color: var(--mint); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(14, 15, 20, .85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.logo { display: flex; align-items: center; gap: .6rem; color: var(--white); }
.logo:hover { color: var(--white); }
.logo-text { font-family: var(--display); font-size: 2.1rem; letter-spacing: -.02em; line-height: 1; }
.logo-vinyl { display: inline-flex; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.logo-vinyl svg { display: block; width: 100%; height: 100%; animation: spin 3.2s linear infinite; transform-origin: 50% 50%; }
.logo-vinyl-lead { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
/* "Spins": the i is set dotless (ı) and the record sits where its dot would be.
   The offset is measured from the x-height (1ex) so it tracks the display font. */
.logo-i { position: relative; display: inline-block; }
.logo-i .logo-vinyl { position: absolute; left: 50%; bottom: calc(1ex + .1em); width: .52em; height: .52em; margin-left: -.21em; }
.logo:hover .logo-vinyl svg { animation-duration: .9s; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .logo-vinyl svg { animation: none; } }

.main-nav { display: flex; gap: .25rem; }
.main-nav a { color: var(--text); padding: .4rem .85rem; border-radius: var(--pill); font-weight: 500; font-size: .9rem; }
.main-nav a:hover { background: var(--bg-3); color: var(--text-bright); }
.main-nav a.active { background: var(--accent-soft); color: var(--accent); }

/* The form is sized to the input (not the leftover header space) so the
   absolutely positioned icon lands inside the field. */
.search-form { flex: 0 1 300px; margin-left: auto; display: flex; position: relative; }
/* appearance: none stops iOS Safari drawing its own rounded search field
   over the padding and border set here. */
.search-form input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--pill);
  padding: .5rem 1rem .5rem 2.2rem; color: var(--text-bright); outline: none; transition: border-color .12s, background .12s;
  -webkit-appearance: none; appearance: none;
}
.search-form input::-webkit-search-decoration { -webkit-appearance: none; }
.search-form input:focus { border-color: var(--accent); background: var(--bg-3); }
.search-form input::placeholder { color: var(--text-dim); }
.search-form .search-icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; font-size: 1.05rem; }
.search-form:has(input:focus) .search-icon { color: var(--accent); }
.user-nav { display: flex; align-items: center; gap: 1rem; font-size: .88rem; white-space: nowrap; }
.user-nav-name { display: flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--text-bright); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: var(--pill); padding: .55rem 1.15rem; font-weight: 600;
  font-size: .88rem; cursor: pointer; background: var(--bg-3); color: var(--text-bright); text-align: center; transition: background .12s, color .12s, border-color .12s, transform .08s;
}
.btn:hover { background: var(--bg-4); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #1a1405; }
.btn-primary:hover { background: #ffc94d; color: #1a1405; }
.btn-outline { background: transparent; border-color: var(--bg-4); color: var(--text); }
.btn-outline:hover { border-color: var(--text-dim); background: transparent; color: var(--text-bright); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg-3); }
.btn-danger { background: transparent; border-color: rgba(255, 92, 92, .35); color: var(--red); }
.btn-danger:hover { background: rgba(255, 92, 92, .1); }
.btn-sm { padding: .35rem .8rem; font-size: .78rem; }
.btn-block { display: block; width: 100%; }

/* ---------- Flashes ---------- */
.flashes { margin: 1rem 0; }
.flash { padding: .65rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem; background: var(--bg-3); color: var(--text-bright); transition: opacity .6s; border-left: 3px solid var(--text-dim); }
.flash.fade { opacity: 0; }
.flash-success { border-left-color: var(--accent); background: var(--accent-soft); }
.flash-error { border-left-color: var(--red); background: rgba(255, 92, 92, .1); }
.flash-info { border-left-color: var(--mint); background: rgba(95, 211, 196, .1); }

/* ---------- Sections ---------- */
.section { margin: 2.25rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.section-head h2 { font-size: 1.05rem; margin: 0; font-weight: 600; color: var(--text-bright); position: relative; padding-left: .75rem; }
.section-head h2::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 3px; border-radius: 2px; background: var(--accent); }
.section-head a, .section-head span { font-size: .8rem; color: var(--text-dim); }
.section-head a:hover { color: var(--mint); }
.empty { color: var(--text-dim); font-style: italic; padding: 1rem 0; }

/* ---------- Covers / grid ---------- */
.cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--bg-3); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.cover-link { display: block; border-radius: 8px; transition: transform .18s ease, box-shadow .18s ease; }
/* Hover lift only on devices with a real pointer; on touch screens the
   hover state sticks to the last tapped cover. */
@media (hover: hover) {
  .cover-link:hover { transform: translateY(-3px) scale(1.01); }
  .cover-link:hover .cover { box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 2px var(--accent); }
}
.cover-placeholder {
  display: flex; flex-direction: column; justify-content: flex-end; padding: 9%; overflow: hidden; color: #fff; text-align: left;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .45) 0 9%, transparent 10%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .05) 0 2px, transparent 2px 5px),
    linear-gradient(150deg, hsl(var(--hue), 40%, 30%), hsl(calc(var(--hue) + 50), 45%, 12%));
}
.cover-placeholder-title { font-family: var(--display); font-size: 1em; line-height: 1.15; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.cover-placeholder-artist { font-size: .68em; opacity: .8; margin-top: .3em; }
/* minmax(0, 1fr) + min-width: 0 stop long titles from widening a column,
   so every cover in a grid stays exactly the same size. */
.poster-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.1rem; }
.poster-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.poster-grid.cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .65rem; }
.poster-item { min-width: 0; display: flex; flex-direction: column; }
.poster-item .cover-link, .poster-item .cover { width: 100%; }
.poster-caption { margin-top: .5rem; line-height: 1.3; min-width: 0; max-width: 100%; }
.poster-title { display: block; max-width: 100%; font-size: .8rem; font-weight: 600; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster-title:hover { color: var(--accent); }
.poster-artist { display: block; max-width: 100%; font-size: .72rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster-meta { display: flex; align-items: center; gap: .4rem; margin-top: .25rem; min-height: 1.1rem; flex-wrap: wrap; min-width: 0; overflow: hidden; }
.poster-meta .review-icon { color: var(--text-dim); font-size: .75rem; }
.cover-xs { width: 42px; height: 42px; border-radius: 6px; }
.cover-sm { width: 100%; }

/* ---------- Stars ---------- */
.stars { position: relative; display: inline-block; font-size: 1rem; line-height: 1; letter-spacing: 1px; color: var(--star-empty); white-space: nowrap; vertical-align: middle; }
.stars-bg { color: var(--star-empty); }
.stars-fg { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--star); }
.stars-sm { font-size: .8rem; }
.stars-lg { font-size: 1.6rem; }
.stars-xl { font-size: 2.2rem; }
.stars-orange .stars-fg { color: var(--coral); }

/* Star input */
.star-input { display: inline-flex; align-items: center; gap: .5rem; }
.si-stars { display: inline-flex; font-size: 2rem; line-height: 1; }
.star-input-sm .si-stars { font-size: 1.15rem; }
.star-input-lg .si-stars { font-size: 2.7rem; }
.si-star { position: relative; display: inline-block; width: 1.05em; height: 1em; cursor: pointer; }
.si-base, .si-fill { position: absolute; left: 0; top: 0; width: 100%; height: 100%; text-align: left; pointer-events: none; }
.si-base { color: var(--star-empty); }
.si-fill { color: var(--star); width: 0; overflow: hidden; transition: width .05s; }
.si-star.half .si-fill { width: 50%; }
.si-star.full .si-fill { width: 100%; }
.si-half { position: absolute; top: 0; width: 50%; height: 100%; background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; z-index: 1; }
.si-half:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.si-left { left: 0; }
.si-right { right: 0; }
.si-value { min-width: 3.2rem; color: var(--text-dim); font-size: .85rem; }
.star-input-sm .si-value { min-width: 2.6rem; font-size: .75rem; }
.si-clear { background: none; border: 0; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; opacity: 0; padding: 0 .2rem; line-height: 1; }
.star-input.has-value .si-clear { opacity: 1; }
.si-clear:hover { color: var(--red); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; width: 40px; height: 40px;
  background: linear-gradient(145deg, hsl(var(--hue), 50%, 48%), hsl(calc(var(--hue) + 30), 55%, 32%)); color: #fff; font-weight: 700; font-size: 1rem; flex-shrink: 0; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.avatar-xs { width: 22px; height: 22px; font-size: .65rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .8rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2.4rem; }
.avatar-link:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Home / hero ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding: 3.5rem 0 2rem; }
.hero .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; margin-bottom: .75rem; }
.hero h1 { font-size: 2.9rem; margin-bottom: 1rem; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { font-size: 1.05rem; color: var(--text); max-width: 32rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.hero-stats span { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.hero-stats strong { display: block; color: var(--text-bright); font-family: var(--display); font-size: 1.9rem; letter-spacing: 0; line-height: 1.1; margin-bottom: .2rem; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 2.5rem; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.activity-row .activity-text { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.activity-row .user { font-weight: 600; }

/* ---------- Review cards ---------- */
.review-card { display: flex; gap: 1.1rem; padding: 1.1rem; margin-bottom: .9rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.review-card-cover { width: 84px; flex-shrink: 0; }
.review-card-body { flex: 1; min-width: 0; }
.review-card-title { font-family: var(--display); font-weight: 500; font-size: 1.2rem; margin-bottom: .2rem; }
.review-card-byline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .85rem; margin-bottom: .6rem; }
.review-card-byline .user { font-weight: 600; }
.review-text { color: var(--text-bright); white-space: pre-line; line-height: 1.65; }
.review-text.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { color: var(--text-dim); margin-top: .25rem; }
.review-card-foot { display: flex; align-items: center; gap: 1rem; margin-top: .8rem; }

/* Like button */
.like-btn { background: none; border: 1px solid transparent; border-radius: var(--pill); color: var(--text-dim); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; font-size: .85rem; transition: color .12s, background .12s; }
.like-btn:hover:not(:disabled) { color: var(--text-bright); background: var(--bg-3); }
.like-btn:disabled { cursor: default; opacity: .6; }
.like-btn .like-heart { font-size: 1.05rem; transition: transform .15s; }
.like-btn.liked { color: var(--coral); background: rgba(255, 107, 107, .1); }
.like-btn.liked .like-heart { transform: scale(1.15); }

/* ---------- Album detail ---------- */
.album-page { display: grid; grid-template-columns: 250px 1fr; gap: 2.75rem; margin-top: 2rem; }
.album-side .cover { box-shadow: var(--shadow); border-radius: 10px; }
.side-panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 1rem; }
.side-panel h3 { font-size: .78rem; color: var(--text-dim); font-weight: 600; margin-bottom: .6rem; }
.my-rating-stars { text-align: center; margin: .25rem 0 .5rem; }
.spotify-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-dim); font-size: .8rem; margin-top: .75rem; }
.spotify-link:hover { color: #1db954; }
.album-title { font-size: 2.3rem; margin-bottom: .15rem; }
.album-artist { font-size: 1.15rem; color: var(--text-bright); margin-bottom: .6rem; }
.album-artist a { color: var(--accent); }
.album-artist a:hover { color: #ffc94d; }
.album-meta { color: var(--text-dim); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: 1.5rem; align-items: center; }
.album-type { text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; border: 1px solid var(--bg-4); border-radius: var(--pill); padding: .1rem .5rem; }
.rating-summary { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; padding: 1rem 1.25rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.rating-summary .big-number { font-family: var(--display); font-size: 2.6rem; color: var(--text-bright); line-height: 1; }
.rating-summary .stars { display: block; margin-top: .3rem; }

/* Histogram */
.histogram { display: flex; align-items: flex-end; gap: .4rem; }
.histogram-edge { color: var(--text-dim); font-size: .75rem; line-height: 1; padding-bottom: .1rem; white-space: nowrap; }
.histogram-bars { display: flex; align-items: flex-end; gap: 3px; height: 44px; flex: 1; }
.histogram-bar { flex: 1; background: var(--bg-4); min-height: 2px; border-radius: 3px 3px 0 0; transition: background .1s; }
.histogram-bar:hover { background: var(--accent); }
.histogram-avg { color: var(--text-bright); font-family: var(--display); font-size: 1.3rem; margin-left: .5rem; }

/* Tracklist */
.tracklist { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tracklist th { text-align: left; font-weight: 600; font-size: .72rem; color: var(--text-dim); padding: .35rem .6rem; border-bottom: 1px solid var(--line); }
.tracklist td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tracklist tbody tr:hover td { background: var(--bg-2); }
.tracklist .num { color: var(--text-dim); width: 2rem; text-align: right; font-variant-numeric: tabular-nums; }
.tracklist .name { color: var(--text-bright); }
.tracklist .dur { color: var(--text-dim); text-align: right; width: 4rem; font-variant-numeric: tabular-nums; }
.tracklist .track-rating { width: 7rem; white-space: nowrap; }
.tracklist .track-input { width: 10rem; }
.tracklist .disc-head td { color: var(--text-dim); font-weight: 600; font-size: .72rem; padding-top: 1rem; }
.explicit { display: inline-block; font-size: .6rem; border: 1px solid var(--text-dim); border-radius: 3px; padding: 0 .25rem; margin-left: .35rem; color: var(--text-dim); vertical-align: middle; }

/* ---------- Rate page ---------- */
.rate-page { display: grid; grid-template-columns: 200px 1fr; gap: 2.25rem; margin-top: 2rem; }
.rate-form { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-top: 1rem; }
.rate-form .form-field { margin-bottom: 1.25rem; }
.rate-form textarea { min-height: 160px; }
.form-row { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }
.form-actions .spacer { flex: 1; }
.track-ratings-toggle summary { cursor: pointer; color: var(--text-bright); font-weight: 600; }

/* ---------- Review page ---------- */
.review-page { display: grid; grid-template-columns: 220px 1fr; gap: 2.75rem; margin-top: 2rem; }
.review-page .review-text { font-size: 1.05rem; }
.review-page .byline { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; color: var(--text-dim); }
.review-page .byline .user { font-weight: 600; color: var(--text-bright); }
.likers { display: flex; gap: .3rem; align-items: center; margin-top: 1rem; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 1.5rem; padding: 2.25rem 0 1.25rem; flex-wrap: wrap; }
.profile-head h1 { margin-bottom: .2rem; }
.profile-head .bio { color: var(--text); margin: .4rem 0 0; max-width: 40rem; white-space: pre-line; }
.profile-stats { display: flex; gap: .6rem; margin-left: auto; }
.profile-stats a { text-align: center; color: var(--text-dim); font-size: .72rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; min-width: 5.2rem; }
.profile-stats strong { display: block; color: var(--text-bright); font-family: var(--display); font-size: 1.4rem; line-height: 1.1; }
.profile-stats a:hover { border-color: var(--accent); color: var(--text); }
.profile-nav { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem; font-size: .88rem; margin-bottom: 1.25rem; }
.profile-nav a { color: var(--text); padding: .35rem .85rem; border-radius: var(--pill); }
.profile-nav a:hover { background: var(--bg-3); color: var(--text-bright); }
.profile-nav a.active { background: var(--accent-soft); color: var(--accent); }
.people-list { list-style: none; padding: 0; margin: 0; }
.people-list li { display: flex; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.people-list .who { flex: 1; }
.people-list .who a { font-weight: 600; color: var(--text-bright); }
.people-list .who .muted { display: block; font-size: .8rem; }

/* ---------- Forms ---------- */
.form-card { max-width: 440px; margin: 3.5rem auto; background: var(--bg-2); border: 1px solid var(--line); padding: 2.25rem; border-radius: 14px; box-shadow: var(--shadow); }
.form-card h1 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-size: .78rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.form-field input[type=text], .form-field input[type=email], .form-field input[type=password], .form-field input[type=date], .form-field textarea, .form-field select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-bright); padding: .6rem .8rem; outline: none; transition: border-color .12s;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); }
.form-field.has-error input, .form-field.has-error textarea { border-color: var(--red); }
.form-field input:disabled { color: var(--text-dim); }
.field-error { color: var(--red); font-size: .8rem; margin-top: .25rem; }
.form-field.checkbox label { display: inline; font-weight: 400; font-size: .9rem; margin-left: .3rem; }
.form-hint { color: var(--text-dim); font-size: .8rem; margin-top: .35rem; }
.form-footer { margin-top: 1rem; font-size: .85rem; color: var(--text-dim); }
.form-footer a { color: var(--accent); }
.settings-page { max-width: 580px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; background: var(--bg-2); }
legend { color: var(--text); font-size: .78rem; font-weight: 600; padding: 0 .4rem; }

/* ---------- Browse / filters ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .82rem; }
.filters .label { color: var(--text-dim); font-size: .72rem; font-weight: 600; margin-right: .35rem; min-width: 3rem; }
.chip { display: inline-block; padding: .25rem .75rem; border-radius: var(--pill); background: var(--bg-2); border: 1px solid var(--line); color: var(--text); }
.chip:hover { border-color: var(--text-dim); color: var(--text-bright); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 2rem 0; }

/* ---------- Search ---------- */
.spotify-note { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid #1db954; padding: .65rem 1rem; border-radius: var(--radius-sm); font-size: .85rem; margin: 1rem 0; }
.search-list { list-style: none; margin: 0; padding: 0; }
.search-list li { display: flex; gap: 1rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.search-list .cover { width: 68px; height: 68px; border-radius: 6px; }
.search-list .cover-placeholder-artist { display: none; }
.search-list .title { font-family: var(--display); font-size: 1.15rem; color: var(--text-bright); }
.search-list .meta { color: var(--text-dim); font-size: .85rem; }
.search-list .meta a { color: var(--text); }
.search-list .meta a:hover { color: var(--accent); }
.search-body { min-width: 0; }
.search-tabs { margin-bottom: .5rem; }
.chip .count { opacity: .65; font-weight: 400; margin-left: .15rem; }
.artist-thumb { display: block; width: 68px; height: 68px; flex-shrink: 0; }
.artist-thumb .cover, .artist-thumb .cover-link { width: 68px; height: 68px; border-radius: 50%; }
.artist-thumb .cover-placeholder-title, .artist-thumb .cover-placeholder-artist { display: none; }
.artist-head { display: flex; align-items: center; gap: 1.5rem; padding: 2rem 0 1rem; }
.artist-head .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; margin: 0 0 .3rem; }
.artist-head h1 { margin-bottom: .2rem; }
.artist-head p { margin: 0; }
.artist-image { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }
.poster-artist:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3.5rem; padding: 1.5rem 0 2.5rem; font-size: .8rem; color: var(--text-dim); }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.site-footer strong { color: var(--text); font-family: var(--display); font-weight: 500; font-size: .95rem; }

/* ---------- Errors ---------- */
.error-page { text-align: center; padding: 5rem 0; }
.error-page h1 { font-size: 5rem; color: var(--bg-4); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  /* Keep the horizontal container padding: "padding: .75rem 0" would put
     the logo, search box and sign-in links flush against the screen edge. */
  .header-inner { flex-wrap: wrap; height: auto; padding: .75rem 1.25rem; gap: .75rem 1rem; }
  .search-form { order: 3; flex: 1 1 100%; margin-left: 0; }
  .poster-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .poster-grid.cols-8 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .hero h1 { font-size: 2.2rem; }
  .two-col, .album-page, .rate-page, .review-page { grid-template-columns: 1fr; }
  .album-side { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; align-items: start; }
  .album-side .side-panel { margin-top: 0; }
  .profile-stats { margin-left: 0; flex-wrap: wrap; }
}

/* Phones (iPhone SE 320px up to Pro Max 430px). */
@media (max-width: 540px) {
  /* iOS Safari zooms the page when a focused field's text is under 16px. */
  input, select, textarea { font-size: 16px; }
  /* The header takes three rows on a phone; pinning it would cost a fifth
     of the screen while scrolling. */
  .site-header { position: static; }
  .header-inner { gap: .5rem .75rem; }
  .main-nav a { padding: .35rem .6rem; font-size: .82rem; }
  .user-nav a.muted { display: none; }

  .poster-grid, .poster-grid.cols-8 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tracklist .dur { display: none; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .hero-stats span { padding: .6rem .3rem; }
  .form-card { margin: 1.5rem auto; padding: 1.5rem 1.25rem; }
  .section { margin: 1.75rem 0; }

  /* Album page: title first, then a modest cover with the rating panels,
     then the rest. display: contents lets the grid order the children of
     both columns as one list. */
  .album-page { margin-top: 1.25rem; gap: 0; }
  .album-side, .album-main { display: contents; }
  .album-main > * { order: 10; }
  .album-page .album-title, .album-page .album-artist, .album-page .album-meta { order: 1; }
  .album-side > div { order: 5; }
  .album-side > div:first-child { width: 100%; max-width: 240px; margin: 0 auto 1rem; text-align: center; }
  .album-side .side-panel + .side-panel { margin-top: 1rem; }
  .album-page .rating-summary { margin-top: 1.5rem; }
  .album-title { font-size: 1.8rem; }
  .album-meta { margin-bottom: .5rem; }

  /* Rate and review pages: small cover beside the title, form/text below. */
  .rate-page, .review-page { grid-template-columns: 96px minmax(0, 1fr); gap: .35rem 1rem; margin-top: 1.25rem; }
  .rate-page > div, .review-page > article { display: contents; }
  .rate-page aside, .review-page aside { grid-row: 1 / span 3; }
  .rate-page > div > *, .review-page > article > * { grid-column: 1 / -1; }
  .rate-page > div > .album-title, .rate-page > div > .album-artist,
  .review-page > article > .byline, .review-page > article > .album-title, .review-page > article > .album-artist { grid-column: 2; }
  .rate-page > div > .album-title { align-self: end; margin-bottom: 0; }
  .review-page > article > .byline { margin-bottom: .25rem; }
  .rate-form { padding: 1.1rem; }
  .form-row { gap: 1rem; }
  /* Five 2.7rem stars plus the value do not fit a 320px screen. */
  .star-input { flex-wrap: wrap; }
  .star-input-lg .si-stars { font-size: 2.4rem; }
  .profile-nav a { padding: .35rem .6rem; }
  /* Four-column policy table: scroll sideways rather than squash the columns. */
  .legal-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Per-track stars: stack under the track name and make the half-star
     buttons wide enough to hit with a thumb. */
  .rate-form .tracklist tr { display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--line); }
  .rate-form .tracklist td { border: 0; padding: .3rem .4rem; }
  .rate-form .tracklist .num { grid-row: 1 / span 2; }
  .rate-form .tracklist .track-input { grid-column: 2; width: auto; padding-top: 0; padding-bottom: .5rem; }
  .rate-form .tracklist .star-input-sm .si-stars { font-size: 1.6rem; }
  .rate-form .tracklist .star-input-sm .si-value { font-size: .85rem; }
  .tracklist .track-rating { width: auto; }

  /* Profile: four stat tiles in one row, tabs may wrap. */
  .profile-head { padding-top: 1.5rem; gap: 1rem; }
  .profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: .4rem; }
  .profile-stats a { min-width: 0; padding: .5rem .2rem; }
  .profile-stats strong { font-size: 1.2rem; }
  .profile-nav { flex-wrap: wrap; }
}

/* ---------- Notices, legal pages, danger zone ---------- */
.notice-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; padding: .65rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--text-bright); font-size: .9rem; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--text-bright); }
.legal-page { max-width: 760px; line-height: 1.6; }
.legal-page h1 { margin-bottom: .25rem; }
.legal-page h2 { font-size: 1.1rem; margin: 1.75rem 0 .5rem; color: var(--text-bright); }
.legal-page ul { padding-left: 1.25rem; }
.legal-page li { margin: .35rem 0; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .75rem 0; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: .5rem .6rem; border-top: 1px solid var(--line); }
.legal-table th { color: var(--text-dim); font-weight: 600; }
.danger-zone { border-color: rgba(255, 92, 92, .35); }
.danger-zone legend { color: var(--red); }
.form-field.checkbox label a { text-decoration: underline; }
