:root {
  --bg-1: #0f1020;
  --bg-2: #13152e;
  --bg-3: #1a1c3a;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1ff;
  --muted: #b7c0ff;
  --accent: #7aa2ff;
  --accent-2: #8affc1;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% 10%, #1e214b, transparent 60%),
              radial-gradient(1000px 600px at 90% 20%, #3a1c5f, transparent 60%),
              linear-gradient(160deg, var(--bg-1), var(--bg-2) 40%, var(--bg-3));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Hyperlinks */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
a:hover {
  color: #a8c1ff;
  text-decoration-thickness: 3px;
}
a:visited {
  color: #9aaaff;
}
a:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 24px;
  padding: 36px 16px 28px;
}

.app__header { text-align: center; }
.app__title {
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.app__subtitle {
  margin: 0;
  color: var(--muted);
  opacity: 0.9;
}

.card {
  width: min(860px, calc(100% - 32px));
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  padding: 28px 26px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  width: 70%;
  height: 70%;
  background: radial-gradient(closest-side, rgba(122, 162, 255, 0.18), transparent 70%);
  transform: rotate(8deg);
  pointer-events: none;
}

.card__rank {
  font-weight: 800;
  font-size: clamp(16px, 2.5vw, 20px);
  letter-spacing: 1.2px;
  color: var(--accent-2);
  opacity: 0.95;
}

.card__album {
  margin-top: 6px;
  font-weight: 800;
  font-size: clamp(28px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.card__artist {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(16px, 3.2vw, 22px);
}

.controls { display: grid; gap: 12px; justify-items: center; }

.btn {
  --btn-bg: rgba(255, 255, 255, 0.06);
  position: relative;
  appearance: none;
  border: 0;
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
}

.btn:active:not(:disabled) { transform: translateY(0); }

.btn__glow {
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(120deg, transparent 20%, rgba(122, 162, 255, 0.28), rgba(138, 255, 193, 0.28), transparent 80%);
  filter: blur(10px);
  opacity: 0.7;
  z-index: -1;
}

.app__footer { color: var(--muted); opacity: 0.9; text-align: center; }
.noscript {
  margin: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #2a1f2a;
  color: #ffd6d6;
  border: 1px solid #ff8da1;
}

/* Rolling animation state */
.card.is-rolling {
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: translateZ(0) scale(1); filter: saturate(1); }
  to { transform: translateZ(0) scale(1.01); filter: saturate(1.1); }
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* (removed) Rating controls */

/* Modal styles */
.modal { position: fixed; inset: 0; display: none; z-index: 1000; }
.modal[aria-hidden="false"] { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal__dialog {
  position: relative;
  margin: 8vh auto;
  width: min(940px, calc(100% - 24px));
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.modal__title { margin: 0; }
.modal__body { padding: 0 16px 16px; }
.modal__actions { display: flex; gap: 8px; }
.btn--subtle { background: rgba(255,255,255,0.04); font-weight: 600; }
.btn--subtle:hover { background: rgba(255,255,255,0.08); }

.ratings-summary { margin-bottom: 8px; color: var(--muted); }
.ratings-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.ratings-list li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; padding: 10px 6px; border-bottom: 1px dashed rgba(255,255,255,0.12); align-items: center; }
.ratings-list .rank { color: var(--accent-2); font-weight: 800; text-align: right; }
.ratings-list .meta { color: var(--muted); font-size: 14px; }
.ratings-list .title { font-weight: 700; }
.ratings-list .score { font-weight: 800; }

/* Triage controls */
.triage { width: min(860px, calc(100% - 32px)); margin-top: -2px; }
.triage__group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.triage__btn {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 100ms ease, background 160ms ease, border-color 160ms ease;
}
.triage__btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.09); }
.triage__hint { color: var(--muted); margin-top: 6px; font-size: 13px; }

/* Comparison modal */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-card { border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 12px; background: rgba(255,255,255,0.06); }
.compare-rank { color: var(--accent-2); font-weight: 800; font-size: 14px; }
.compare-title { font-weight: 800; font-size: 20px; }
.compare-artist { color: var(--muted); }
.compare-badge { margin-top: 6px; font-size: 12px; color: var(--muted); }
.compare-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 12px; }
.compare-status { margin-top: 8px; color: var(--muted); display: flex; gap: 8px; align-items: center; }

/* Search modal */
.search-bar { display: grid; margin-bottom: 10px; }
.search-bar input { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: var(--text); }
.search-results { list-style: none; margin: 10px 0; padding: 0; max-height: 40vh; overflow: auto; }
.search-results li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed rgba(255,255,255,0.12); align-items: center; }
.search-results .rank { color: var(--accent-2); font-weight: 800; text-align: right; }
.search-results .title { font-weight: 700; }
.search-results .meta { color: var(--muted); font-size: 14px; }
.search-results button { padding: 6px 10px; }
.add-form { margin-top: 10px; }
.add-form h3 { margin: 8px 0; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.add-grid input { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: var(--text); }
.muted { color: var(--muted); }

/* Notes */
.notes { width: min(860px, calc(100% - 32px)); }
.notes__row { display: grid; }
.notes textarea { resize: vertical; padding: 12px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: var(--text); }
.notes__meta { margin-top: 6px; text-align: right; }


