/* ------------------------------
   ESTILOS GENERALES
------------------------------ */

:root {
    --bg1: #1a0f3b;
    --bg2: #2b0f4a;
    --bg3: #0b0e1a;
    --text: #f4f6ff;
    --muted: #c7c9d9;
    --accent: #ff4fd8;
    --accent2: #4fd8ff;
    --panel: rgba(255,255,255,0.10);
    --radius: 20px;
    --font: "Segoe UI", system-ui, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font);
    background: radial-gradient(circle at top, #ff4fd8 0%, #7a3bd1 40%, #0b0e1a 100%);
    color: var(--text);
    min-height: 100vh;
}

header {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

header nav a {
    margin-left: 24px;
    color: var(--text);
    text-decoration: none;
    opacity: 0.85;
}

h1 {
    text-align: center;
    font-size: 48px;
    margin-top: 20px;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 900;
}

.main {
    max-width: 1600px;
    margin: 0 auto 80px;
    padding: 0 40px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.12);
}

/* ------------------------------
   SELECTORES DE CLASIFICADOS
------------------------------ */

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

.qual-item.shake {
    animation: shake 0.25s;
}

.qual-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-top: 12px;
}

.qual-item {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 12px 8px;
    cursor: pointer;
    text-align: center;
    transition: 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.qual-item:hover {
    background: rgba(255,255,255,0.18);
}

.qual-item.selected {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #0b0e1a;
    font-weight: 700;
    border-color: transparent;
}

.qual-flag-big {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 6px rgba(0,0,0,0.35);
}

.qual-flag-big img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qual-name {
    font-size: 14px;
    font-weight: 600;
}

/* ------------------------------
   MATRIZ FINAL
------------------------------ */

.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.mode-switch button {
    flex: 1;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    background: rgba(255,255,255,0.15);
    color: white;
}

.mode-switch .active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #0b0e1a;
}

.matrix-wrapper {
    overflow-x: auto;
}

.jury-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 14px;
    overflow: hidden;
}

.jury-matrix th,
.jury-matrix td {
    border: 1px solid rgba(255,255,255,0.08);
    padding: 2px 3px;
    text-align: center;
    min-width: 20px;
}

.jury-matrix thead th {
    background: rgba(255,255,255,0.12);
    font-size: 11px;
    color: var(--muted);
}

.jury-matrix tbody td:first-child {
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    background: rgba(255,255,255,0.08);
}

.jury-matrix select {
    width: 45px;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.25);
    background: #e6e6e6;
    color: #0b0e1a;
    font-weight: 600;
    font-size: 12px;
}

.jury-matrix select.invalid {
    background: rgba(180,40,60,0.8);
}

.self {
    opacity: 0.3;
}

/* ------------------------------
   TARJETA SCOREBOARD
------------------------------ */

.card-container {
    display: flex;
    justify-content: center;
}

#scoreCard {
    width: 100%;
    max-width: 1400px;
    border-radius: 40px;
    padding: 32px 40px 36px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,79,216,0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(79,216,255,0.35), transparent 60%),
        linear-gradient(145deg, #120b24, #1c0f3f 55%, #2b0f4a 100%);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 20px 40px rgba(0,0,0,0.45);
    position: relative;
}

.card-year {
    position: absolute;
    top: 14px;
    left: 20px;
    font-size: 60px;
    font-weight: 900;
    opacity: 0.12;
    letter-spacing: -3px;
}

.card-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
}

.scoreboard-table-wrapper {
    overflow-x: auto;
}

.scoreboard-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 9px;
    background: rgba(5,5,20,0.35);
}

.scoreboard-table th,
.scoreboard-table td {
    border: 1px solid rgba(255,255,255,0.18);
    padding: 2px 3px;
    text-align: center;
    white-space: nowrap;
    min-width: 8px;
}

.scoreboard-table thead th {
    background: rgba(255,255,255,0.12);
    color: var(--muted);
    font-size: 10px;
}

.country-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-start;
}

.flag-small {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: #0b0f2c;
    flex-shrink: 0;
}

.flag-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.country-name {
    font-size: 11px;
}

.total-jury-col,
.total-televote-col,
.total-all-col {
    background: rgba(255,255,255,0.08);
    font-weight: 700;
    color: var(--accent2);
}

.btn-download {
    margin-top: 12px;
    width: 100%;
    max-width: 260px;
    padding: 12px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    font-weight: 800;
    color: #0b0e1a;
    cursor: pointer;
    font-size: 15px;
}

/* === GLOBAL FOOTER === */

.global-footer {
  margin-top: 40px;
  padding: 18px 24px;
  background: rgba(0, 0, 0, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #f5f5ff;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.footer-right {
  display: flex;
  gap: 14px;
}

.footer-link {
  font-size: 14px;
  color: #4fd8ff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(79, 216, 255, 0.4);
  background: rgba(10, 15, 35, 0.6);
  transition: 0.2s ease;
}

.footer-link:hover {
  background: rgba(79, 216, 255, 0.15);
  box-shadow: 0 0 10px rgba(79, 216, 255, 0.5);
  transform: translateY(-1px);
}
