:root {
  --bg: #0b0d12;
  --bg-2: #101319;
  --surface: #15181f;
  --surface-2: #1c2029;
  --surface-3: #232833;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f5f6f8;
  --muted: #9aa2b1;
  --accent: #1ed760;
  --accent-dark: #16a34a;
  --accent-soft: rgba(30, 215, 96, .14);
  --danger: #f2555a;
  --gold: #ffc857;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 24px 48px -28px rgba(0, 0, 0, .85);
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1100px 560px at 70% -10%, #1b2130 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; font-weight: 700; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b303c; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4150; background-clip: padding-box; }

/* ---------- Icons ---------- */
.icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -.14em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  padding: .55rem .95rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn .icon { width: 1.05em; height: 1.05em; }
.btn:hover { background: rgba(255, 255, 255, .1); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04140a; }
.btn.primary:hover { background: #23e56a; border-color: #23e56a; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); border-color: transparent; }
.btn.small { padding: .35rem .7rem; font-size: .8rem; }
.btn.lg { padding: .8rem 1rem; font-size: 1rem; width: 100%; }

/* ---------- Auth ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 1.5rem;
}
.auth-hero { text-align: center; }
.auth-hero h1 { margin-top: .5rem; font-size: 1.9rem; }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), #0d7a3c);
  color: #04140a;
  font-size: 1.2rem;
  box-shadow: 0 10px 24px -12px rgba(30, 215, 96, .9);
}
.logo-mark.big { width: 64px; height: 64px; font-size: 2rem; border-radius: 18px; }
.logo-mark .icon { width: 1.35rem; height: 1.35rem; }
.logo-mark.big .icon { width: 2.1rem; height: 2.1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.auth-card { width: 100%; max-width: 380px; }

.segmented {
  display: flex;
  gap: .25rem;
  background: var(--bg-2);
  border-radius: 999px;
  padding: .28rem;
  margin-bottom: 1.1rem;
}
.seg {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .55rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: background .15s, color .15s;
}
.seg.active { background: var(--surface-3); color: var(--text); }

form label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .9rem;
  font-weight: 500;
}
input[type="text"], input[type="password"], input[type="search"] {
  width: 100%;
  margin-top: .35rem;
  padding: .7rem .85rem;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #666d7c; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Shell / Sidebar ---------- */
.app-view { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1.1rem .9rem;
  background: linear-gradient(180deg, #12151c, #0a0c11);
  border-right: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: .65rem; padding: .35rem .5rem 1.1rem; }
.logo-text { font-weight: 800; letter-spacing: -.02em; font-size: 1.02rem; }

.nav { display: flex; flex-direction: column; gap: .2rem; }
.tab-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .7rem .75rem;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.tab-link .icon { width: 1.25rem; height: 1.25rem; }
.tab-link:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tab-link.active { color: var(--text); background: var(--surface-2); }
.tab-link.active .icon { color: var(--accent); }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .75rem .5rem .2rem;
  border-top: 1px solid var(--border);
}
.sidebar-foot .who-chip { align-self: flex-start; max-width: 100%; }
.foot-actions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.foot-actions .logout-btn { margin-left: auto; }

.icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn .icon { width: 1.15rem; height: 1.15rem; }
.badge-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  font-size: .6rem;
  font-weight: 800;
  color: #04140a;
  background: var(--accent);
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.who-chip {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  padding: .3rem .7rem;
  border-radius: 999px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }

.content {
  padding: 1.8rem 2rem 3.5rem;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.view { display: flex; flex-direction: column; gap: 1.1rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .9rem;
}
.panel-head h2 { display: flex; align-items: center; gap: .5rem; }
.panel-head h2 .icon { width: 1.2rem; height: 1.2rem; color: var(--accent); }

/* ---------- Today hero ---------- */
.today-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  border-radius: 20px;
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(30, 215, 96, .3), transparent 58%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.today-card .cover {
  width: 156px;
  height: 156px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-2);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .85);
}
.today-card .cover.empty { display: grid; place-items: center; font-size: 3rem; background: rgba(255, 255, 255, .04); }
.today-card .cover.empty .icon { width: 3rem; height: 3rem; color: var(--muted); }
.today-card .name { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin: .15rem 0; }
.today-card .grow { min-width: 0; }

.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.locked { background: rgba(255, 200, 87, .16); color: var(--gold); }
.reset-note { margin-top: .6rem; }

/* ---------- Search ---------- */
.search-row { display: flex; gap: .6rem; align-items: center; position: relative; }
.search-ico {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: inline-flex;
}
.search-ico .icon { width: 1.05rem; height: 1.05rem; }
.search-row input { flex: 1 1 auto; width: auto; padding-left: 2.4rem; margin-top: 0; }
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: .9rem;
  margin-top: .9rem;
}

.track {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .7rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.track:hover { background: var(--surface-3); border-color: var(--border); }
.track img { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--bg-2); }
.track .info { width: 100%; min-width: 0; }
.track .name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .sub { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .meta { font-size: .74rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .1rem; }
.track .choose { width: 100%; margin-top: .1rem; }

/* ---------- Links ---------- */
.links { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.chip {
  font-size: .72rem;
  font-weight: 700;
  text-decoration: none;
  padding: .22rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, .03);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip.spotify { color: #1ed760; border-color: rgba(30, 215, 96, .4); }
.chip.spotify:hover { background: rgba(30, 215, 96, .12); }
.chip.youtube { color: #ff5555; border-color: rgba(255, 85, 85, .4); }
.chip.youtube:hover { background: rgba(255, 85, 85, .12); }
.chip.apple { color: #d2d2d7; }
.chip .icon { width: 1rem; height: 1rem; }

/* ---------- Reactions ---------- */
.reactions { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .55rem; }
.react {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .03);
  border-radius: 999px;
  padding: .18rem .55rem;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1.3;
  transition: transform .06s ease, border-color .15s ease, background .15s ease;
}
.react:hover { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .07); }
.react:active { transform: scale(.93); }
.react:disabled { opacity: .6; }
.react.mine { border-color: var(--accent); background: var(--accent-soft); }
.react .icon { width: 1.05rem; height: 1.05rem; }
.react-add { padding: .18rem .5rem; color: var(--muted); border-style: dashed; }
.react-add:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.react-add .icon { width: 1rem; height: 1rem; }

.react-picker {
  position: fixed;
  z-index: 150;
  display: flex;
  gap: .1rem;
  padding: .35rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: pop .14s ease;
}
.react-pick {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s, transform .1s;
}
.react-pick:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }
.react-pick .icon { width: 1.35rem; height: 1.35rem; }
.react .count { font-size: .72rem; color: var(--muted); font-weight: 800; }
.react.mine .count { color: var(--accent); }

.grow { flex: 1; min-width: 0; }

/* ---------- Stats / ranking ---------- */
.sub-title {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 1.2rem 0 .5rem;
  font-weight: 700;
}
.stats-totals { margin-top: .3rem; }

.podium {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 215, 96, .2), rgba(30, 215, 96, .03));
  border: 1px solid rgba(30, 215, 96, .35);
}
.podium img { width: 90px; height: 90px; border-radius: 12px; object-fit: cover; flex-shrink: 0; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .8); }
.podium .crown { display: inline-flex; align-items: center; gap: .4rem; color: var(--gold); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.podium .crown .icon { width: 1.1rem; height: 1.1rem; }
.podium .name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; overflow-wrap: anywhere; }
.podium .sub { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.podium .votes { color: var(--accent); font-weight: 800; font-size: .88rem; margin-top: .2rem; }

.rank-list { display: flex; flex-direction: column; gap: .3rem; }
.rank-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .6rem;
  border-radius: 12px;
  transition: background .15s ease;
}
.rank-item:hover { background: var(--surface-2); }
.rank-item[data-track], .podium[data-track] { cursor: pointer; }
.podium[data-track]:hover { border-color: var(--border-strong); }
.rank-item img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.rank-num { width: 1.7rem; text-align: center; font-weight: 800; color: var(--muted); flex-shrink: 0; font-size: .95rem; }
.rank-num.rank-top { width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; color: #101319; }
.rank-num.rank-top-1 { background: linear-gradient(145deg, #ffd76a, #e6a700); box-shadow: 0 4px 10px -3px rgba(230, 167, 0, .8); }
.rank-num.rank-top-2 { background: linear-gradient(145deg, #e2e7ee, #a7b0bd); }
.rank-num.rank-top-3 { background: linear-gradient(145deg, #e6a875, #b5713a); }
.rank-item .info { flex: 1; min-width: 0; }
.rank-item .name { font-weight: 700; font-size: .93rem; overflow-wrap: anywhere; }
.rank-item .sub { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-item .reactions { margin-top: .3rem; }
.votes { display: inline-flex; align-items: center; gap: .22rem; font-weight: 800; font-size: .85rem; color: var(--accent); white-space: nowrap; }
.votes .icon { width: 1rem; height: 1rem; }

.genre-list { display: flex; gap: .4rem; flex-wrap: wrap; }
.genre-chip {
  font-size: .82rem;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
}
.genre-chip b { color: var(--accent); }

/* ---------- Streak ---------- */
.streak {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .6rem;
  font-size: .84rem;
  color: var(--muted);
  padding: .25rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  font-weight: 600;
}
.streak.active { color: var(--gold); border-color: rgba(255, 200, 87, .4); background: rgba(255, 200, 87, .1); }
.streak .icon { width: 1rem; height: 1rem; }

/* ---------- Comments ---------- */
.comments-wrap { margin-top: .55rem; }
.comment-toggle { padding: .22rem .6rem; font-size: .76rem; }
.comments {
  margin-top: .55rem;
  padding: .7rem;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.comment-list { display: flex; flex-direction: column; gap: .55rem; max-height: 240px; overflow-y: auto; }
.comment { font-size: .87rem; }
.comment-head { display: flex; align-items: baseline; gap: .4rem; }
.comment-body { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; gap: .45rem; margin-top: .65rem; }
.comment-form input { flex: 1; margin-top: 0; }

/* ---------- Feed / history ---------- */
.feed { display: flex; flex-direction: column; gap: .35rem; max-height: 520px; overflow-y: auto; }
.pick {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  padding: .6rem;
  border-radius: 12px;
  transition: background .15s ease;
}
.pick:hover { background: var(--surface-2); }
.pick img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.pick .info { flex: 1; min-width: 0; }
.pick .name { font-weight: 700; font-size: .95rem; }
.pick .sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .who { font-size: .75rem; color: var(--accent); font-weight: 800; }
.pick .day-tag { font-size: .72rem; color: var(--muted); margin-top: .1rem; }

.empty-note { color: var(--muted); font-size: .9rem; padding: .9rem; text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: .75rem 1.1rem;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 200;
  max-width: 90vw;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast.error { border-color: var(--danger); color: #ffd7d8; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Bottom nav ---------- */
.tabbar { display: none; }

/* ---------- Home ---------- */
.greeting-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
.greeting-title .accent { color: var(--accent); }
.greeting-sub { margin: .35rem 0 0; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.tile {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  text-align: left;
  padding: .85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.tile:active { transform: translateY(0); }
.tile-ico { display: inline-flex; margin-bottom: .25rem; }
.tile-ico .icon { width: 1.4rem; height: 1.4rem; }
.tile-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.tile-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.tile.gold .tile-ico, .tile.gold .tile-value { color: var(--gold); }
.tile.green .tile-ico, .tile.green .tile-value { color: var(--accent); }
.tile.pink .tile-ico, .tile.pink .tile-value { color: #ff6b9d; }
.tile.blue .tile-ico, .tile.blue .tile-value { color: #58b6ff; }

.rail { display: flex; flex-direction: column; gap: .75rem; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.rail-head h3 { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; font-weight: 800; }
.rail-head h3 .icon { width: 1.15rem; height: 1.15rem; color: var(--accent); }
.rail-more {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: .76rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rail-more:hover { color: var(--text); }

.rail-scroll {
  display: flex;
  gap: .8rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scroll-snap-type: x proximity;
}
.rail-card { flex: 0 0 150px; scroll-snap-align: start; }
.rail-art {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 1;
  border: 1px solid var(--border);
}
.rail-art img { width: 100%; height: 100%; object-fit: cover; }
.rail-art-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.rail-art-empty .icon { width: 2rem; height: 2rem; }
.rail-votes {
  position: absolute;
  right: .4rem;
  bottom: .4rem;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  padding: .16rem .45rem;
  border-radius: 999px;
}
.rail-votes .icon { width: .85rem; height: .85rem; color: var(--gold); }
.rail-title { font-weight: 700; font-size: .88rem; margin-top: .45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.explore-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.explore-chip {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: .42rem .9rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.explore-chip:hover { background: var(--surface-3); transform: translateY(-1px); }
.explore-chip b { color: var(--accent); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 7, 11, .66); backdrop-filter: blur(5px); animation: fade .15s ease; }
.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
  animation: pop .18s ease;
}
.modal-close {
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { background: rgba(255, 255, 255, .12); color: var(--text); }
.modal-close .icon { width: 1.05rem; height: 1.05rem; }

.modal-track { display: flex; gap: .85rem; align-items: center; margin-bottom: 1.05rem; padding-right: 1.6rem; }
.modal-art { width: 66px; height: 66px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--bg-2); }
.modal-art-empty { width: 66px; height: 66px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-2); color: var(--muted); }
.modal-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.modal-sub { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.modal-meta { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.modal-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin-bottom: .55rem; }
.modal-options { display: flex; flex-direction: column; gap: .5rem; }
.opt {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem .85rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: .92rem;
  transition: background .15s, border-color .15s, transform .1s;
}
.opt:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); }
.opt > .icon { width: 1.4rem; height: 1.4rem; }
.opt .opt-ext { margin-left: auto; color: var(--muted); display: inline-flex; }
.opt .opt-ext .icon { width: 1rem; height: 1rem; }
.opt.spotify > .icon { color: #1ed760; }
.opt.youtube > .icon { color: #ff3b30; }
.opt.apple > .icon { color: #f5f5f7; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Sheet generico / actividad ---------- */
.sheet-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; font-weight: 800; font-size: 1.05rem; }
.sheet-head .icon { width: 1.2rem; height: 1.2rem; color: var(--accent); }
.activity-list { display: flex; flex-direction: column; gap: .45rem; max-height: 60vh; overflow-y: auto; }
.activity-row { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem; border-radius: 12px; background: var(--surface-2); }
.activity-ico { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--bg-2); color: var(--accent); }
.activity-ico .icon { width: 1.2rem; height: 1.2rem; }
.activity-row .who { color: var(--accent); font-weight: 800; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #ff666a; }
.delete-form input { margin-bottom: .7rem; }
.delete-note { color: var(--danger); font-size: .8rem; margin-top: .6rem; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 1rem 1rem 6rem; max-width: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: .7rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    background: rgba(11, 13, 18, .9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: .95rem; min-width: 0; white-space: nowrap; }
  .brand .logo-mark { width: 30px; height: 30px; font-size: .9rem; border-radius: 9px; }
  .brand .logo-mark .icon { width: 1rem; height: 1rem; }
  .user-area { display: flex; align-items: center; gap: .5rem; min-width: 0; }
  #current-user { max-width: 34vw; }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    gap: .15rem;
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(11, 13, 18, .96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar .tab-link {
    flex: 1;
    flex-direction: column;
    gap: .1rem;
    padding: .35rem .2rem;
    font-size: .68rem;
    border-radius: 12px;
  }
  .tabbar .tab-link .ico { font-size: 1.25rem; width: auto; }
  .tabbar .tab-link.active { background: var(--accent-soft); color: var(--accent); }

  .results { max-height: none; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .feed, .comment-list { max-height: none; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .greeting-title { font-size: 1.4rem; }
  .content { padding: .8rem .8rem 6rem; }
  .panel { padding: .95rem; border-radius: 14px; }
  .panel-head { margin-bottom: .7rem; }
  .rail-card { flex-basis: 132px; }
  .rail-scroll { gap: .65rem; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: 22px 22px 0 0; padding-bottom: calc(1.15rem + env(safe-area-inset-bottom)); animation: sheet-up .22s ease; }
  .today-card { flex-direction: column; align-items: flex-start; padding: 1.1rem; gap: 1rem; }
  .today-card .cover { width: 118px; height: 118px; }
  .today-card .name { font-size: 1.3rem; }
  .results { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  /* Top: formato movil correcto */
  .podium { flex-direction: column; align-items: stretch; gap: .9rem; }
  .podium img { width: 104px; height: 104px; }
  .podium .info { width: 100%; min-width: 0; }
  .podium .name { font-size: 1.25rem; line-height: 1.25; }
  .rank-item { flex-wrap: wrap; row-gap: .35rem; align-items: center; }
  .rank-item .info { flex: 1 1 auto; min-width: 0; }
  .rank-item .name { line-height: 1.3; }
  .rank-item .sub { white-space: normal; overflow: visible; }
  .rank-item .votes { margin-left: auto; flex-shrink: 0; }
  .rank-item .reactions { gap: .25rem; }
  .stats-totals { line-height: 1.4; }
  .comment-form { flex-direction: column; }
  .comment-form .btn { width: 100%; }
}

@media (max-width: 380px) {
  .results { grid-template-columns: 1fr; }
  #current-user { display: none; }
}

/* ---------- Touch targets ---------- */
@media (pointer: coarse) {
  .btn { min-height: 42px; }
  .btn.small { min-height: 34px; }
  input[type="text"], input[type="password"], input[type="search"] { min-height: 46px; }
  .chip { padding: .3rem .65rem; }
  .react { padding: .38rem .65rem; }
  .tab-link { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
