:root {
  --bg: #0b0910;
  --card: #16121c;
  --card-2: #1c1725;
  --card-border: #2c2536;
  --text: #f6f2ec;
  --muted: #9c92ab;
  --accent-1: #ec4899;
  --accent-2: #f59e0b;
  --accent: #ec4899;
  --accent-grad: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --accent-hover: #f5679f;
  --good: #34d399;
  --bad: #f87171;
  --dot-bg: #221c2b;
  --ring: rgba(236, 72, 153, 0.45);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

::selection {
  background: var(--accent-1);
  color: white;
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(236, 72, 153, 0.18), transparent 40%),
    radial-gradient(circle at 88% 0%, rgba(245, 158, 11, 0.14), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(236, 72, 153, 0.08), transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Firefox / Chromium scrollbar */
* { scrollbar-color: var(--accent-1) var(--card); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-1); background-clip: padding-box; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 9, 16, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.brandMark {
  width: 26px;
  height: 26px;
  color: var(--muted);
  flex-shrink: 0;
}

.brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, var(--text) 55%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

nav { display: flex; gap: 6px; flex-wrap: wrap; }

.navBtn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.navBtn:hover:not(.active) {
  background: var(--card);
  color: var(--text);
  border-color: var(--card-border);
}

.navBtn.active {
  background: var(--accent-grad);
  color: #1a0a12;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.35);
}

.headerRight {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profileMenu {
  position: relative;
}

.profileBtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #1a0a12;
  border: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profileBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.4);
}

.profileBtn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profileDropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  background: var(--card-2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 50;
  animation: popIn 0.14s ease;
}

.profileNameLabel {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.profileMenuItem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  box-sizing: border-box;
}

.profileMenuItem:hover {
  background: var(--card-border);
}

.shareBar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--muted);
}

.shareBar a {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.shareBar a:hover { text-decoration: underline; }

.shareBar button {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 999px;
  margin-left: auto;
}

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  animation: fadeUp 0.25s ease;
}

.hidden { display: none !important; }

/* Setup view */
.searchRow {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.searchRow input,
.searchRow select {
  flex: 1;
}

input[type="text"], input[type="password"], textarea {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 4px var(--ring);
}

textarea {
  width: 100%;
  resize: vertical;
  margin-bottom: 10px;
}

.hintText {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 10px;
}

button {
  background: var(--accent-grad);
  color: #1a0a12;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(236, 72, 153, 0.3); }
button:active { transform: scale(0.97); }
button:disabled {
  background: var(--card-border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
  transform: none;
}

h2 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--muted);
  margin: 26px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.resultsList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resultItem {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.resultItem:hover {
  border-color: var(--accent-1);
  background: var(--card-2);
}

.resultItem img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--dot-bg);
}

.resultItem .meta {
  flex: 1;
  min-width: 0;
}

.resultItem .title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resultItem .artist {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resultItem .removeBtn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--bad);
}

.resultItem .removeBtn:hover {
  border-color: var(--bad);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

.dangerBtn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--bad);
}

.dangerBtn:hover {
  border-color: var(--bad);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

select {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 4px var(--ring);
}

.hint { color: var(--muted); padding: 10px 0; list-style: none; }

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--card-border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Play view */
.progress {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}

.dot {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  border-radius: 999px;
  background: var(--dot-bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.dot.past { background: var(--card-border); color: var(--text); }
.dot.current {
  background: var(--accent-grad);
  color: #1a0a12;
  box-shadow: 0 0 0 4px var(--ring);
  animation: dotPulse 1.6s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--ring); }
  50% { box-shadow: 0 0 0 6px rgba(236, 72, 153, 0.2); }
}

.playerCard {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 36px 20px 28px;
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.playerCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -10%, rgba(236, 72, 153, 0.14), transparent 55%);
  pointer-events: none;
}

.playerCard.won {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12), 0 12px 32px rgba(52, 211, 153, 0.12);
}

.playerCard.lost {
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1), 0 12px 32px rgba(248, 113, 113, 0.08);
}

.artwork {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  margin-bottom: 18px;
  object-fit: cover;
  box-shadow:
    0 0 0 6px var(--bg),
    0 0 0 8px var(--card-border),
    0 12px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
}

.artwork.spinning {
  animation: vinylSpin 3.2s linear infinite;
}

@keyframes vinylSpin {
  to { transform: rotate(360deg); }
}

.revealInfo { margin-bottom: 16px; position: relative; z-index: 1; }
.revealTitle { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.revealArtist { font-size: 15px; color: var(--muted); margin-top: 4px; }

.playBtn {
  font-size: 15px;
  padding: 15px 34px;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.3);
}

.playBtn:hover {
  box-shadow: 0 10px 28px rgba(236, 72, 153, 0.45);
}

.clipLabel {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.guessArea {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.guessArea input { flex: 1; }

.guessInputWrap {
  position: relative;
  flex: 1;
}

.guessInputWrap input {
  width: 100%;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card-2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  text-align: left;
  animation: popIn 0.14s ease;
}

.suggestions li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.suggestions li .suggestTitle {
  font-weight: 600;
  color: var(--text);
}

.suggestions li .suggestArtist {
  font-size: 12px;
  color: var(--muted);
}

.suggestions li:hover,
.suggestions li.active {
  background: var(--accent-grad);
}

.suggestions li:hover .suggestTitle,
.suggestions li:hover .suggestArtist,
.suggestions li.active .suggestTitle,
.suggestions li.active .suggestArtist {
  color: #1a0a12;
}

.feedback {
  min-height: 22px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.feedback.correct { color: var(--good); animation: feedbackPop 0.35s ease; }
.feedback.wrong { color: var(--bad); animation: feedbackShake 0.35s ease; }

@keyframes feedbackPop {
  0% { transform: scale(0.9); opacity: 0.4; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes feedbackShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.sectionLabel {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 4px 0 8px;
}

code {
  background: var(--dot-bg);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.9em;
}

#challengeMissing p {
  line-height: 1.6;
  color: var(--muted);
}

.scoreLine {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.nextBtn {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  font-size: 15px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 9, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.overlayCard {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
  animation: popIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
}

.overlayCard.wide {
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
}

.overlayCard.wide .austinMessage {
  text-align: center;
}

#libraryEditPanel #libraryBackBtn {
  margin-bottom: 8px;
}

.austinPhoto {
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.austinMessage {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 20px;
}

#austinCloseBtn {
  padding: 10px 28px;
  border-radius: 999px;
}

#nameModal .hintText {
  text-align: left;
  margin-bottom: 16px;
}

#nameModal input {
  width: 100%;
  margin-bottom: 14px;
}

#playerNameSubmitBtn {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
}

.modalChoiceBtn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 15px;
}

.modalChoiceBtn:last-child {
  margin-bottom: 0;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  box-shadow: none;
}

.modalChoiceBtn:last-child:hover {
  background: var(--card-2);
  border-color: var(--accent-1);
  box-shadow: none;
}

.linkBtn {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px;
  margin-top: 8px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: none;
}

.linkBtn:hover {
  color: var(--text);
  background: transparent;
  box-shadow: none;
  filter: none;
}

.tableWrap {
  overflow-x: auto;
}

.statsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.statsTable th,
.statsTable td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.statsTable th {
  font-family: var(--font-display);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.statsTable tbody tr {
  transition: background 0.15s ease;
}

.statsTable tbody tr:hover {
  background: var(--card);
}

.statsTable td.rankCell {
  color: var(--muted);
  font-weight: 700;
  font-family: var(--font-display);
}

.statsTable tbody tr:nth-child(1) td.rankCell { color: #ffd166; }
.statsTable tbody tr:nth-child(2) td.rankCell { color: #d8d8e0; }
.statsTable tbody tr:nth-child(3) td.rankCell { color: #e2a26d; }

.statsTable .nameCell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.miniAvatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #1a0a12;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.miniAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
