@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg: #010A41;
  --bg-elev: #0E1A55;
  --accent: #F10D59;
  --accent-2: #FF3EDE;
  --text: #FFFFFF;
  --text-dim: #A8B0D0;
  --success: #3CD9A8;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── LANDING ─────────────────────────────────────────────── */

.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.landing-hero img.heart {
  width: 64px;
  height: auto;
}

.landing-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.1;
}

.landing-subtitle {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.landing-card {
  background: var(--bg-elev);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.error-msg {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(241, 13, 89, 0.12);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  text-align: left;
}

.form-label {
  display: block;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1.5px solid rgba(168, 176, 208, 0.25);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  transition: border-color 200ms;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-2);
}

.form-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
}

.btn-primary:hover {
  background: #d90b4f;
}

.btn-primary:active {
  transform: scale(0.98);
}

.landing-footer {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.landing-footer img.ubm {
  height: 40px;
  width: auto;
  opacity: 0.7;
}

/* ─── SCORE PAGE ────────────────────────────────────────────── */

.score-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.score-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(168, 176, 208, 0.15);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.score-header-text {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  font-weight: 500;
  color: var(--text);
}

.score-header-text #progress {
  color: var(--accent-2);
  font-weight: 700;
}

.leaderboard-link {
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-2);
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--accent-2);
  border-radius: 6px;
  transition: background 150ms, color 150ms;
}

.leaderboard-link:hover {
  background: var(--accent-2);
  color: var(--bg);
  text-decoration: none;
}

.score-list {
  flex: 1;
  padding: 0.5rem 0 2rem;
}

.score-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid rgba(168, 176, 208, 0.1);
  background: transparent;
  transition: background 200ms;
}

.score-row:hover {
  background: rgba(14, 26, 85, 0.6);
}

.score-row img.flag {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.score-row-info {
  min-width: 0;
}

.score-row-country {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-row-song {
  font-size: 0.8125rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

.score-row-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.score-select {
  padding: 0.375rem 0.5rem;
  background: var(--bg);
  border: 1.5px solid rgba(168, 176, 208, 0.25);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 64px;
  text-align: center;
  transition: border-color 200ms;
  outline: none;
}

.score-select:focus {
  border-color: var(--accent-2);
}

.score-select-scored {
  border-color: var(--success);
}

.saved {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(60, 217, 168, 0.1);
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  animation: fade-in 300ms ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── LEADERBOARD PAGE ─────────────────────────────────────── */

.leaderboard-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.lb-bg-heart {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.lb-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.lb-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.lb-title-heart {
  color: var(--accent);
}

.lb-list {
  position: relative;
  z-index: 1;
  list-style: none;
  padding: 0 1rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.leader-row {
  display: grid;
  grid-template-columns: 2.5rem 96px 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(168, 176, 208, 0.1);
  border-radius: 8px;
  transition: transform 1400ms cubic-bezier(0.22, 1, 0.36, 1), background 200ms;
  will-change: transform;
  margin-bottom: 0.25rem;
}

.leader-row:hover {
  background: rgba(14, 26, 85, 0.5);
}

.leader-row.is-first {
  border: 2px solid var(--accent-2);
  background: rgba(255, 62, 222, 0.06);
  position: relative;
}

.leader-row.is-first::before {
  content: '👑';
  position: absolute;
  top: -0.6rem;
  left: 0.75rem;
  font-size: 1.25rem;
}

.lb-rank {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dim);
  text-align: right;
}

.is-first .lb-rank {
  color: var(--accent-2);
}

.lb-flag {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.lb-info {
  min-width: 0;
}

.lb-country {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-song {
  font-size: clamp(0.8rem, 2vw, 0.9375rem);
  color: var(--text-dim);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score-block {
  text-align: right;
  flex-shrink: 0;
}

.lb-points {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.lb-voters {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ─── WIDE-SCREEN (TV) 2-COLUMN LAYOUT ──────────────────────── */
/* On 1080p+ screens, split 25 finalists across two columns (13 + 12) */
/* so the whole leaderboard fits without scrolling, with room to breathe. */
@media (min-width: 1280px) and (min-height: 900px) {
  .leaderboard-page { padding-bottom: 0; }
  .lb-header { padding: 1.25rem 1rem 0.75rem; }
  .lb-title { font-size: clamp(1.85rem, 3vw, 2.5rem); }

  .lb-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: column;
    grid-template-rows: repeat(13, auto);
    column-gap: 3rem;
    row-gap: 0.2rem;
    max-width: 1600px;
    padding: 0 2rem;
  }

  .leader-row {
    grid-template-columns: 2rem 50px 1fr auto;
    gap: 1.1rem;
    padding: 0.45rem 0.9rem;
    margin-bottom: 0;
  }

  .lb-flag { width: 50px; height: 50px; }
  .lb-country { font-size: 1.1rem; line-height: 1.2; }
  .lb-song { font-size: 0.8rem; margin-top: 0.15rem; }
  .lb-points { font-size: 1.6rem; }
  .lb-voters { font-size: 0.74rem; margin-top: 0.1rem; }
  .lb-rank { font-size: 1rem; }

  .leader-row.is-first { border-width: 2px; }
  .leader-row.is-first::before {
    top: -0.55rem;
    left: 0.5rem;
    font-size: 1rem;
  }

  .lb-footer { padding: 0.75rem 1.25rem 0.5rem; gap: 1.75rem; }
  .lb-footer img.ubm { height: 28px; }
}

/* ─── LEADERBOARD FOOTER ────────────────────────────────────── */

.lb-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem 1rem 1rem;
  flex-wrap: wrap;
}

.lb-footer img.ubm {
  height: 36px;
  width: auto;
  opacity: 0.7;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ─── SCORE ROW — DISABLED STATE ───────────────────────────── */

.score-row-disabled {
  opacity: 0.5;
}

.score-not-yet {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  font-style: italic;
}

.score-badge-readonly {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(168, 176, 208, 0.1);
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
}

/* ─── LEADERBOARD — PENDING (NOT YET OPEN) ROW ─────────────── */

.leader-row.is-pending {
  opacity: 0.45;
}

.lb-open-dot {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ─── ADMIN PAGE ─────────────────────────────────────────────── */

.admin-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(168, 176, 208, 0.15);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.admin-main {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.admin-panel {
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 1.5rem;
}

.admin-panel-heading {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.admin-panel-desc {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.admin-guest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-guest-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(1, 10, 65, 0.5);
  border-radius: 6px;
}

.admin-guest-name {
  font-weight: 600;
  color: var(--text);
}

.admin-guest-time {
  font-size: 0.8125rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.admin-guest-empty {
  font-size: 0.875rem;
  color: var(--text-dim);
  padding: 0.5rem 0;
}

.admin-reset-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-danger {
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
}

.btn-danger:hover {
  background: #d90b4f;
}

.btn-danger:active {
  transform: scale(0.98);
}

.admin-country-table {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.admin-country-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: rgba(1, 10, 65, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(168, 176, 208, 0.08);
}

.admin-row-flag {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.admin-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.admin-row-country {
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-row-song {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-row-toggle {
  flex-shrink: 0;
}

.admin-toggle-btn {
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  border: 1.5px solid;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  white-space: nowrap;
}

.admin-toggle-open {
  background: rgba(60, 217, 168, 0.12);
  border-color: var(--success);
  color: var(--success);
}

.admin-toggle-open:hover {
  background: rgba(60, 217, 168, 0.22);
}

.admin-toggle-closed {
  background: transparent;
  border-color: rgba(168, 176, 208, 0.35);
  color: var(--text-dim);
}

.admin-toggle-closed:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
