:root {
  --ink: #07070a;
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.1);
  --text: #fff;
  --dim: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);
  --accent: #ff4d6d;
  --accent2: #6b3cff;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--ink); color: var(--text); }
body {
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--ink); }
.bg img {
  position: absolute; inset: -20%; width: 140%; height: 140%; object-fit: cover;
  filter: blur(70px) saturate(1.6); opacity: 0; transform: scale(1.1);
  transition: opacity 0.8s ease;
}
.bg img.on { opacity: 0.85; }
.bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7, 7, 10, 0.15) 0%, rgba(7, 7, 10, 0.55) 50%, rgba(7, 7, 10, 0.92) 90%);
}

.screen { width: 100%; max-width: 560px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.center { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }

h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 0; }
h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 19px; font-weight: 800; margin: 0; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.sub { margin: 0; color: var(--dim); }
.error { min-height: 1.3em; margin: 4px 0 0; color: #ff8a9f; font-weight: 600; }
.logo { width: 64px; height: 64px; border-radius: 15px; }

.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin-top: 14px; }
.field {
  width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08); color: var(--text); font: inherit; font-size: 17px; outline: none;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.field:focus { border-color: rgba(255, 255, 255, 0.35); }
.field.code { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; }

.btn {
  appearance: none; border: 0; border-radius: 14px; padding: 15px 18px; font: inherit; font-weight: 700; font-size: 17px;
  color: #fff; cursor: pointer; transition: transform 0.12s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 30px rgba(255, 77, 109, 0.3); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); }
.btn.small { padding: 9px 16px; font-size: 15px; border-radius: 999px; }

.art { display: block; object-fit: cover; background: linear-gradient(135deg, #2a2a30, #131317); }
.art.lg { width: 210px; height: 210px; border-radius: 18px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55); margin-bottom: 14px; }
.art.xl { width: min(78vw, 320px); height: min(78vw, 320px); border-radius: 20px; box-shadow: 0 34px 70px rgba(0, 0, 0, 0.6); }
.art.sm { width: 48px; height: 48px; border-radius: 8px; flex: none; }

.pulse { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(0.85); opacity: 0.6; } 50% { transform: scale(1); opacity: 1; } }

/* jam screen */
.jam { padding-bottom: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.pill { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--dim); }

.now { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.nowText { width: 100%; text-align: left; }
.now .title { margin: 4px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .artist { margin: 2px 0 0; font-size: 18px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.by { margin: 8px 0 0; display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(255, 77, 109, 0.18); color: #ffb3c1; }
.progress { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.progress div { height: 100%; width: 0; background: #fff; border-radius: 2px; transition: width 1s linear; }
.times { width: 100%; display: flex; justify-content: space-between; margin-top: -8px; font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.offline { margin: 0; color: #ffcf70; font-weight: 700; }

.queue { margin-top: 28px; }
.sectionHead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.quota { font-size: 13px; font-weight: 700; color: var(--dim); }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.row .meta { flex: 1; min-width: 0; }
.row .t { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { margin: 1px 0 0; font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tag { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 700; color: #ffb3c1; }
.empty { color: var(--faint); text-align: center; margin: 18px 0; }

.vote {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--dim); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.vote svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.vote.on { color: #fff; background: rgba(255, 77, 109, 0.25); border-color: rgba(255, 77, 109, 0.5); }
.vote.on svg { fill: var(--accent); stroke: var(--accent); }

.add { flex: none; display: flex; gap: 6px; }
.add button {
  appearance: none; border: 0; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 800; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.add button.next { background: var(--card); border: 1px solid var(--line); }
.add button:disabled { opacity: 0.45; }
.add button.done { background: rgba(255, 255, 255, 0.12); }

.spacer { height: calc(96px + var(--safe-b)); }

.searchSheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px 14px calc(12px + var(--safe-b));
  background: rgba(18, 18, 22, 0.72); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  max-height: 78dvh; display: flex; flex-direction: column;
  transition: max-height 0.3s ease;
}
.searchSheet .results { overflow-y: auto; -webkit-overflow-scrolling: touch; max-width: 560px; width: 100%; margin: 0 auto; }
.searchSheet .results:not(:empty) { margin-top: 8px; padding: 0 6px; }
.searchBar {
  display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%; margin: 0 auto;
  padding: 0 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line);
}
.searchBar svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--dim); stroke-width: 2.4; stroke-linecap: round; }
.searchBar input { flex: 1; min-width: 0; padding: 13px 0; border: 0; outline: none; background: transparent; color: #fff; font: inherit; font-size: 17px; }
.searchBar input::-webkit-search-cancel-button { display: none; }
.clear { appearance: none; border: 0; background: transparent; color: var(--dim); font-size: 15px; padding: 6px; cursor: pointer; }

.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, calc(-100% - 40px - var(--safe-t)));
  padding: 11px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.95); color: #111; font-weight: 700; font-size: 15px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); transition: transform 0.35s cubic-bezier(.2, .9, .3, 1.2); z-index: 10; max-width: 90vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .art.xl { width: 300px; height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
