/* ============================
   VARIABLES
   ============================ */
:root {
  --bg:        #0b0718;
  --bg-2:      #120a26;
  --gold:      #ffd24a;
  --gold-deep: #f0a830;
  --pink:      #ff5db1;
  --violet:    #7c5cff;
  --cyan:      #41e0d0;
  --card:      rgba(255, 255, 255, 0.05);
  --card-line: rgba(255, 255, 255, 0.10);
  --text:      rgba(255, 255, 255, 0.92);
  --muted:     rgba(255, 255, 255, 0.45);
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display:   'Bebas Neue', 'Inter', sans-serif;
  --radius:    18px;
  --shadow:    0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ============================
   RESET / BASE
   ============================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
ol, ul { list-style: none; }

::selection { background: rgba(255, 210, 74, 0.35); color: #fff; }

/* ============================
   BACKGROUND
   ============================ */
.bg-aurora {
  position: fixed; inset: -20%;
  z-index: -3;
  background:
    radial-gradient(40% 40% at 18% 20%, rgba(124, 92, 255, 0.55), transparent 70%),
    radial-gradient(45% 45% at 82% 18%, rgba(255, 93, 177, 0.45), transparent 70%),
    radial-gradient(50% 50% at 50% 95%, rgba(65, 224, 208, 0.30), transparent 70%),
    var(--bg);
  filter: blur(40px) saturate(120%);
  animation: aurora 18s ease-in-out infinite alternate;
}
/* groom photo, blurred soft into the page background */
.bg-photo {
  position: fixed; inset: -10%;
  z-index: -2;
  background-size: cover;
  background-position: center 18%;
  filter: blur(18px) saturate(125%) brightness(1.1);
  opacity: 0.8;
  transform: scale(1.08);
  pointer-events: none;
}
.bg-confetti {
  position: fixed; inset: 0;
  z-index: -1; width: 100%; height: 100%;
  pointer-events: none;
}

/* ============================
   LAYOUT
   ============================ */
.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 4vw, 1.5rem) 3rem;
  padding-top: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-top));
}

.section-title {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.06em;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  color: var(--gold);
  margin: 2.2rem 0 1rem;
  text-transform: uppercase;
}

/* ============================
   HEADER
   ============================ */
.head { text-align: center; }
.head__top {
  display: flex; align-items: center; justify-content: center;
  gap: 0.7rem; margin-bottom: 1rem;
}
.head__avatar {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.15), 0 6px 16px rgba(0,0,0,.5);
}
.head__id { text-align: left; line-height: 1.15; }
.head__live {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.18em;
  color: var(--pink); text-transform: uppercase;
}
.head__live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pink); box-shadow: 0 0 8px var(--pink);
  animation: pulse 1.4s ease-in-out infinite;
}
.head__groom {
  display: block; font-size: 0.92rem; font-weight: 600; color: var(--text);
}
.head__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 13vw, 5rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  background: linear-gradient(100deg, var(--gold) 0%, #fff7d6 35%, var(--gold-deep) 70%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 6px 24px rgba(255, 168, 48, 0.35));
  animation: shine 6s linear infinite;
}
.head__subtitle {
  color: var(--muted); font-size: 0.95rem; margin-top: 0.6rem;
}

/* ============================
   PODIUM
   ============================ */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 0.6rem;
  margin-top: 2.2rem;
}
.pod {
  position: relative;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 1rem 0.5rem 0.9rem;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) backwards;
}
.pod--1 { animation-delay: .15s; }
.pod--2 { animation-delay: 0s; }
.pod--3 { animation-delay: .3s; }
.pod__rank {
  font-family: var(--display); font-size: 1.4rem; color: var(--muted);
}
.pod__medal { font-size: 1.9rem; line-height: 1; margin: 0.1rem 0 0.3rem; }
.pod__name {
  font-weight: 700; font-size: 0.92rem;
  overflow-wrap: break-word;
}
.pod__pts {
  font-family: var(--display); font-size: 2rem; line-height: 1;
  margin-top: 0.25rem; color: var(--gold);
}
.pod__pts small { font-family: var(--font); font-size: 0.6rem; color: var(--muted); display:block; letter-spacing:.1em; }

/* gold winner gets a taller, glowing card */
.pod--1 {
  padding-top: 1.6rem;
  border-color: rgba(255, 210, 74, 0.5);
  background: linear-gradient(180deg, rgba(255, 210, 74, 0.16), rgba(255,255,255,0.04));
  box-shadow: 0 0 40px rgba(255, 188, 64, 0.30), var(--shadow);
}
.pod--1 .pod__pts { font-size: 2.5rem; }
.pod--1::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  padding: 1px; background: linear-gradient(120deg, var(--gold), transparent 40%, var(--gold-deep));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.pod--2 { border-color: rgba(220,225,235,.35); }
.pod--3 { border-color: rgba(210,150,90,.35); }
.pod--empty { opacity: .35; }

/* ============================
   LEADERBOARD LIST
   ============================ */
.board__list { display: flex; flex-direction: column; gap: 0.5rem; }
.row {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), background .3s, border-color .3s;
}
.row__rank {
  font-family: var(--display); font-size: 1.25rem;
  width: 1.7rem; text-align: center; color: var(--muted); flex: none;
}
.row__name { font-weight: 600; font-size: 1rem; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__bar {
  flex: none; width: 34%; max-width: 160px; height: 7px;
  background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden;
}
.row__bar i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.row__pts {
  font-family: var(--display); font-size: 1.4rem; color: var(--gold);
  width: 2.6rem; text-align: right; flex: none;
}
.row--1 {
  border-color: rgba(255,210,74,.45);
  background: linear-gradient(90deg, rgba(255,210,74,.14), rgba(255,255,255,.04));
}
.row--1 .row__bar i { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.row.bump { animation: bump .5s ease; }

/* ============================
   KARAOKE DUTY (bottom two)
   ============================ */
.karaoke { margin-top: 0.6rem; }
.karaoke__list { display: flex; flex-direction: column; gap: 0.4rem; }
.kara {
  display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--card-line);
  border-radius: 11px;
  padding: 0.45rem 0.7rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
/* third-from-bottom — slightly orange */
.kara--warn {
  background: linear-gradient(90deg, rgba(240,168,48,.16), rgba(240,168,48,.05));
  border-color: rgba(240,168,48,.35);
}
/* bottom two — slightly red */
.kara--danger {
  background: linear-gradient(90deg, rgba(255,72,72,.16), rgba(255,72,72,.05));
  border-color: rgba(255,72,72,.35);
}
.kara__mic {
  font-size: 1.2rem; line-height: 1; flex: none;
  width: 1.2rem; text-align: center;
  filter: drop-shadow(0 2px 8px rgba(255,93,177,.5));
}
.kara__info {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; gap: 0.5rem;
}
.kara__rank {
  font-family: var(--display); font-size: 0.85rem;
  color: var(--muted); letter-spacing: .05em; flex: none;
}
.kara__name { font-weight: 600; font-size: 0.85rem; overflow-wrap: break-word; }
.kara__pts {
  font-family: var(--display); font-size: 1.1rem; line-height: 1;
  color: var(--gold); flex: none; text-align: right;
}
.kara__pts small {
  font-family: var(--font); font-size: 0.5rem; color: var(--muted);
  display: block; letter-spacing: .1em;
}

/* ============================
   MATRIX
   ============================ */
.matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--card-line);
  background: var(--card);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.matrix { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.matrix th, .matrix td {
  padding: 0.6rem 0.55rem; text-align: center; white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.matrix thead th {
  position: sticky; top: 0;
  background: rgba(24, 14, 46, 0.96);
  font-family: var(--display); font-weight: 400; letter-spacing: .04em;
  font-size: 0.92rem; color: var(--cyan); text-transform: uppercase;
  z-index: 2;
}
/* sticky first (name) column */
.matrix th.sticky-col, .matrix td.sticky-col {
  position: sticky; left: 0;
  text-align: left; font-weight: 600;
  background: rgba(20, 12, 40, 0.96);
  z-index: 1; min-width: 7.5rem;
  box-shadow: 6px 0 12px -8px rgba(0,0,0,.7);
}
.matrix thead th.sticky-col { z-index: 3; color: var(--gold); }
.matrix .cell-num { font-variant-numeric: tabular-nums; color: var(--text); }
.matrix .cell-zero { color: var(--muted); }
.matrix .col-total {
  font-family: var(--display); font-size: 1.05rem; color: var(--gold);
  background: rgba(255, 210, 74, 0.06);
}
.matrix thead th.col-total { color: var(--gold); }
.matrix tbody tr:last-child td { border-bottom: none; }
.matrix tr.is-leader td { background: rgba(255, 210, 74, 0.07); }
.matrix tr.is-leader td.sticky-col { color: var(--gold); }
.cell-flash { animation: flash 1.1s ease; }

.matrix-hint {
  display: none;
  color: var(--muted); font-size: 0.75rem; margin-top: 0.5rem; text-align: right;
}

/* ============================
   FOOTER
   ============================ */
.foot {
  margin-top: 2.5rem; text-align: center;
  color: var(--muted); font-size: 0.78rem;
  display: flex; gap: 0.5rem; justify-content: center; align-items: center;
  flex-wrap: wrap;
}
.foot__sep { opacity: .5; }

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 560px) {
  .matrix-hint { display: block; }
  .row__bar { width: 22%; }
}
@media (max-width: 380px) {
  .row__bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
