:root { --bg: #0b0b0f; --accent: #1db954; --ytm: #ff0033; --pink: #ff2e93; --yellow: #ffd60a; --coral: #ff9482; --text: #ffffff; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
#vizCanvas { position: fixed; bottom: 0; left: 0; width: 100vw; height: 95px; z-index: 40; pointer-events: none; opacity: 0.48; }

.slide-nav { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 95; display: flex; flex-direction: column; gap: 7px; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.28); cursor: pointer; transition: 0.25s; }
.nav-dot.active { background: var(--accent); height: 20px; border-radius: 999px; }

.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: linear-gradient(to bottom, rgba(0,0,0,0.85), transparent); backdrop-filter: blur(6px); gap: 10px; }
.brand { font-weight: 900; letter-spacing: -0.5px; font-size: 1.05rem; white-space: nowrap; }
.brand span { color: var(--accent); }
.controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
select, button, input[type="date"] { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2); padding: 6px 11px; border-radius: 999px; font-weight: 600; cursor: pointer; backdrop-filter: blur(10px); transition: 0.2s; font-size: 0.8rem; }
button:hover, select:hover { background: rgba(255,255,255,0.24); }
select option { background: #18181b; color: #fff; }
.btn-primary { background: var(--accent); color: #000; border: none; }
.btn-active { background: var(--yellow); color: #000; border-color: var(--yellow); }

.deck {
  height: 100vh;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.deck::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  height: 100vh;
  width: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 72px 32px 92px;
  overflow: hidden;
}
.ambient-bg { position: absolute; inset: -40px; z-index: 0; background-size: cover; background-position: center; filter: blur(65px) brightness(0.36) saturate(1.6); transform: scale(1.1); transition: background-image 0.7s ease; }
.slide-content { position: relative; z-index: 2; max-width: 960px; width: 100%; text-align: center; opacity: 0; transform: translateY(30px) scale(0.97); transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.slide.active .slide-content { opacity: 1; transform: translateY(0) scale(1); }

h1 { font-size: clamp(2.4rem, 6.2vw, 5rem); font-weight: 900; line-height: 0.98; letter-spacing: -2px; }
h2 { font-size: clamp(1.7rem, 4vw, 3rem); font-weight: 900; letter-spacing: -1.5px; margin-bottom: 8px; }
.sub { font-size: 1rem; opacity: 0.85; margin-top: 6px; }

/* First Song of the Year Slide (Thermal Aura Style) */
.first-slide { background: #161517; }
.aura-bg {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background:
    radial-gradient(ellipse 22% 14% at 50% 13%, #e9e4ff 0%, #66b8ff 24%, #1fe27a 48%, #ff731d 72%, transparent 92%),
    radial-gradient(ellipse 20% 12% at 50% 28%, #eef7ff 0%, #3bb3ff 25%, #23e675 52%, #ff5722 76%, transparent 94%),
    radial-gradient(ellipse 46% 18% at 15% 24%, #f4faff 0%, #48c9ff 28%, #1ee27c 56%, #ff6c1e 80%, transparent 96%),
    radial-gradient(ellipse 42% 20% at 88% 58%, #f4faff 0%, #43c2ff 26%, #20e378 55%, #ff6022 78%, transparent 96%);
  filter: blur(18px) saturate(1.35);
  animation: auraDrift 12s ease-in-out infinite alternate;
}
.aura-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.22;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes auraDrift {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.06) translateY(-10px); }
}
.first-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
}
.first-cover {
  width: clamp(230px, 42vh, 360px);
  height: clamp(230px, 42vh, 360px);
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
  cursor: pointer;
  transition: transform 0.3s ease;
  margin-bottom: 26px;
}
.first-cover:hover { transform: scale(1.03); }
.first-date {
  color: var(--coral);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 14px;
}
.first-label {
  color: var(--coral);
  font-size: 0.98rem;
  font-weight: 500;
  opacity: 0.92;
  margin-bottom: 8px;
}
.first-title {
  color: var(--coral);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}

/* Staggered Rank Reveal (#5 -> #1) */
.reveal-item {
  opacity: 0;
  transform: translateY(20px) scale(0.96);
}
.slide.active .reveal-item {
  animation: rankReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--delay, 0s);
}
.slide.active .reveal-item.rank-1 {
  border-color: rgba(255, 214, 10, 0.45);
  box-shadow: 0 0 24px rgba(255, 214, 10, 0.16);
}
@keyframes rankReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pills { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.pill { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.14); }

.mosaic { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.mosaic img { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; box-shadow: 0 18px 40px rgba(0,0,0,0.55); animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }

.split-bar { display: flex; height: 20px; border-radius: 999px; overflow: hidden; margin: 18px auto; max-width: 500px; background: rgba(255,255,255,0.12); }
.split-sp { background: var(--accent); } .split-ytm { background: var(--ytm); }
.badge { display: inline-block; padding: 8px 16px; border-radius: 999px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22); font-weight: 800; font-size: 1.05rem; margin-top: 10px; }

.age-circle { width: 128px; height: 128px; border-radius: 50%; margin: 12px auto; background: linear-gradient(135deg, var(--pink), var(--yellow)); display: flex; flex-direction: column; justify-content: center; align-items: center; color: #000; }
.age-circle .num { font-size: 3.3rem; font-weight: 900; line-height: 1; }
.age-circle .lbl { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; margin-top: 16px; text-align: left; }
.stat-card { background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 14px; backdrop-filter: blur(8px); }
.stat-card .k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.72; }
.stat-card .v { font-size: 1.25rem; font-weight: 900; margin: 4px 0; color: var(--yellow); }
.stat-card .d { font-size: 0.8rem; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.era-card .v,
.era-card .d {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.era-card .era-mins {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.badges-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 18px; text-align: left; }
.ach-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.22); }
.ach-card.locked { opacity: 0.4; filter: grayscale(1); border-style: dashed; }
.ach-icon { font-size: 1.8rem; } .ach-title { font-weight: 900; } .ach-desc { font-size: 0.78rem; opacity: 0.82; }

.list-stack { display: flex; flex-direction: column; gap: 8px; max-width: 740px; margin: 14px auto 0; }
.row-card { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: rgba(255,255,255,0.08); border-radius: 14px; text-align: left; cursor: pointer; transition: 0.2s; border: 1px solid transparent; }
.row-card:hover { background: rgba(255,255,255,0.16); }
.row-card.playing { border-color: var(--accent); background: rgba(29,185,84,0.2); }
.rank { font-size: 1.25rem; font-weight: 900; width: 30px; color: var(--yellow); }
.row-card img { width: 48px; height: 48px; border-radius: 9px; object-fit: cover; }
.row-card img.round { border-radius: 50%; }
.meta { flex: 1; min-width: 0; }
.title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desc { font-size: 0.8rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mins { font-weight: 800; font-size: 0.88rem; text-align: right; }

.quiz-grid, .duel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 680px; margin: 18px auto 0; text-align: left; }
.quiz-card { background: rgba(255,255,255,0.09); border: 2px solid rgba(255,255,255,0.16); border-radius: 16px; padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: 0.25s; }
.quiz-card:hover { transform: scale(1.02); background: rgba(255,255,255,0.16); }
.quiz-card img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; filter: blur(6px); transition: 0.4s; }
.quiz-card.revealed img, .quiz-card.clear img { filter: blur(0); }
.quiz-card.correct { border-color: var(--accent); background: rgba(29,185,84,0.25); }
.quiz-card.wrong { border-color: var(--ytm); opacity: 0.55; }

.waves-chart { display: flex; align-items: flex-end; justify-content: space-between; height: 240px; max-width: 860px; margin: 18px auto 8px; gap: 6px; }
.w-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; cursor: pointer; }
.w-cover { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; margin-bottom: 5px; }
.w-bar { width: 100%; max-width: 40px; border-radius: 7px 7px 0 0; background: linear-gradient(to top, var(--pink), var(--yellow)); min-height: 5px; }
.w-label { font-size: 0.72rem; margin-top: 5px; font-weight: 700; }
.detail-pill { margin-top: 8px; padding: 8px 16px; border-radius: 999px; display: inline-block; background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.15); font-weight: 700; color: var(--yellow); font-size: 0.85rem; }

.cal-wrap { overflow-x: auto; padding: 14px; margin: 14px auto 8px; max-width: 880px; background: rgba(0,0,0,0.38); border-radius: 16px; }
.cal-grid { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; gap: 3px; width: max-content; margin: 0 auto; }
.cal-cell { width: 11px; height: 11px; border-radius: 2px; cursor: pointer; }
.cal-cell.playing { outline: 2px solid var(--yellow); }

.clock-wrap { width: 280px; height: 280px; margin: 10px auto; }
.clock-svg { width: 100%; height: 100%; overflow: visible; }
.hour-wedge { cursor: pointer; transition: 0.2s; transform-origin: 0 0; }
.hour-wedge:hover, .hour-wedge.active { filter: brightness(1.35); transform: scale(1.05); }
.clock-label { fill: rgba(255,255,255,0.65); font-size: 10px; font-weight: 800; text-anchor: middle; }
.clock-center-hr { fill: #fff; font-size: 20px; font-weight: 900; text-anchor: middle; }
.clock-center-min { fill: var(--yellow); font-size: 12px; font-weight: 700; text-anchor: middle; }

.dow-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 14px; }
.dow-card { background: rgba(255,255,255,0.09); border-radius: 12px; padding: 10px 6px; cursor: pointer; }
.dow-card .dname { font-weight: 900; color: var(--yellow); } .dow-card .dtr { font-size: 0.7rem; opacity: 0.9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Poster Themes & 9:16 Story */
.poster { background: linear-gradient(135deg, #14142b 0%, #2a0845 50%, #ff2e93 100%); border-radius: 22px; padding: 22px; max-width: 440px; margin: 0 auto; text-align: left; transition: 0.3s; }
.poster.theme-vinyl { background: radial-gradient(circle at 80% 20%, #333 0%, #0d0d0d 70%); border: 2px solid #444; }
.poster.theme-receipt { background: #f8f5ec; color: #111; font-family: 'Courier New', monospace; border-radius: 4px; }
.poster.story-916 { width: 320px; min-height: 540px; display: flex; flex-direction: column; justify-content: space-between; }
.poster-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.poster-head img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; }
.poster-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  font-size: 0.8rem;
}
.poster-cols > div { min-width: 0; }
.poster-cols li {
  list-style: none;
  margin-bottom: 6px;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

/* Lyrics & Audio Pill */
.lyrics-bar { position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%); z-index: 99; background: rgba(0,0,0,0.78); padding: 7px 18px; border-radius: 999px; font-weight: 700; color: var(--yellow); font-size: 0.92rem; max-width: 90vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(10px); }
.audio-pill { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 8px; background: rgba(15,15,20,0.92); border: 1px solid rgba(255,255,255,0.2); padding: 7px 14px; border-radius: 999px; backdrop-filter: blur(16px); font-size: 0.8rem; max-width: 96vw; overflow-x: auto; }
.play-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #000; border: none; flex-shrink: 0; }
.pill-btn { font-size: 0.72rem; padding: 4px 9px; white-space: nowrap; }
.track-info { min-width: 95px; max-width: 155px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.seek-wrap { display: flex; align-items: center; gap: 6px; }
#seekSlider { width: 100px; accent-color: var(--accent); }
.time-txt { font-size: 0.72rem; opacity: 0.78; white-space: nowrap; }
#volSlider { width: 55px; accent-color: var(--accent); }

.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.82); display: none; justify-content: center; align-items: center; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: #16161d; border: 1px solid rgba(255,255,255,0.15); border-radius: 20px; padding: 22px; max-width: 520px; width: 100%; text-align: center; max-height: 85vh; display: flex; flex-direction: column; }
.dropzone { border: 2px dashed rgba(255,255,255,0.28); border-radius: 14px; padding: 30px 16px; margin: 14px 0; cursor: pointer; }
.search-input { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #fff; margin: 10px 0; }
.search-results { overflow-y: auto; display: flex; flex-direction: column; gap: 7px; text-align: left; }

@media (max-width: 720px) {
  .topbar { padding: 8px 12px; }
  .slide { padding: 68px 14px 96px; }
  .dow-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-grid, .duel-grid { grid-template-columns: 1fr; }
  .slide-nav, .vol-wrap { display: none; }
}

/* Tournament Bracket Tree Overview */
.bracket-tree-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
  padding-bottom: 6px;
}
.bracket-tree {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  min-width: max-content;
  margin: 0 auto;
  text-align: left;
}
.bt-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 12px;
  min-width: 165px;
}
.bt-head {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--yellow);
  text-align: center;
  margin-bottom: 4px;
}
.bt-match {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px;
}
.bt-col:not(:last-child) .bt-match::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
}
.bt-slot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.bt-slot img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.bt-slot span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-slot.win {
  background: rgba(29, 185, 84, 0.22);
  color: #fff;
  border-left: 3px solid var(--accent);
}
.bt-slot.lose {
  opacity: 0.42;
  text-decoration: line-through;
}
.bt-champ {
  background: rgba(255, 214, 10, 0.16);
  border: 2px solid var(--yellow);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  max-width: 175px;
  cursor: pointer;
}
.bt-champ img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 6px;
}
