/* ============================================
   PICK'EMS - Sistema completo de estilos
   ============================================ */

:root {
    --medal-gold:      #f4a942;
    --medal-silver:    #b0b8c8;
    --medal-bronze:    #cd7f32;
    --qualify-color:   #48c774;
    --qualify-bg:      rgba(72, 199, 116, 0.12);
    --qualify-border:  rgba(72, 199, 116, 0.3);
    --elim-color:      #ff4d6d;
    --elim-bg:         rgba(255, 77, 109, 0.12);
    --elim-border:     rgba(255, 77, 109, 0.3);
    /* Fallbacks para admin donde style.css no esta cargado */
    --card-bg:         rgba(255, 255, 255, 0.03);
    --card-bg-hover:   rgba(255, 255, 255, 0.07);
    --text-secondary:  rgba(255, 239, 244, 0.7);
    --text-muted:      rgba(255, 239, 244, 0.5);
}

/* ============================================
   BASE
   ============================================ */

.pickem-page {
    min-height: 100vh;
    padding-top: 80px;
}

/* ============================================
   HERO
   ============================================ */

.pickem-hero {
    background: linear-gradient(135deg,
        rgba(244, 169, 66, 0.1) 0%,
        rgba(255, 143, 163, 0.06) 60%,
        rgba(126, 30, 55, 0.08) 100%);
    border-bottom: 1px solid rgba(244, 169, 66, 0.15);
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}
.pickem-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(244,169,66,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--brand-pink);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    transition: opacity 0.2s;
}
.back-link:hover { opacity: 0.7; }

.pickem-hero-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.pickem-hero-logo {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid rgba(244, 169, 66, 0.35);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.pickem-hero-content h1 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 900;
    color: var(--text-white);
    margin: 0.25rem 0;
}
.pickem-hero-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.pickem-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(244, 169, 66, 0.15);
    border: 1px solid rgba(244, 169, 66, 0.3);
    color: var(--brand-gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
}

/* STATS BAR */
.pickem-stats-bar {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}
.pstat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.pstat i { color: var(--brand-gold); font-size: 1.1rem; }
.pstat-value { font-weight: 700; color: var(--text-white); }

/* BODY */
.pickem-body {
    padding: 2.5rem 1rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   ACCIONES DEL USUARIO (CTAs)
   ============================================ */

.pickem-actions-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pickem-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.6rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
    position: relative;
    flex: 1;
    min-width: 200px;
    justify-content: center;
}
.pickem-cta.open {
    background: linear-gradient(135deg, var(--brand-gold), #e8943a);
    color: #1a0a00;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(244,169,66,0.2);
}
.pickem-cta.open:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(244,169,66,0.35); }
.pickem-cta.done {
    background: rgba(72, 199, 116, 0.12);
    border: 1px solid rgba(72, 199, 116, 0.3);
    color: #48c774;
    cursor: pointer;
}
.pickem-cta.done:hover { transform: translateY(-2px); background: rgba(72,199,116,0.18); }
.pickem-cta.locked {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
}
.cta-pts {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

/* LOGIN CTA */
.pickem-login-cta {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    margin-bottom: 2rem;
}
.pickem-login-cta p { color: var(--text-secondary); margin: 0.75rem 0 1.25rem; line-height: 1.6; }

/* NOTICE */
.pickem-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-radius: 10px;
    background: rgba(244, 169, 66, 0.08);
    border: 1px solid rgba(244, 169, 66, 0.2);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.pickem-notice i { color: var(--brand-gold); flex-shrink: 0; }
.pickem-notice.info {
    background: rgba(255, 143, 163, 0.08);
    border-color: rgba(255, 143, 163, 0.2);
}
.pickem-notice.info i { color: var(--brand-pink); }

/* CLOSED */
.pickem-closed-notice {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.pickem-closed-notice i { font-size: 3rem; margin-bottom: 1rem; display: block; color: var(--brand-gold); }
.pickem-closed-notice h3 { color: var(--text-white); margin-bottom: 0.5rem; }
.pickem-closed-notice a { color: var(--brand-gold); }

/* ============================================
   GUIA DE FORMATO (explicacion visual)
   ============================================ */

.format-guide-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.format-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.format-guide-header:hover { background: rgba(255,255,255,0.03); }
.format-guide-header-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 700;
    color: var(--text-white);
    font-size: 0.95rem;
}
.format-guide-header-left i { color: var(--brand-gold); font-size: 1.1rem; }
.format-guide-toggle-icon { color: var(--text-muted); transition: transform 0.25s; }
.format-guide-toggle-icon.open { transform: rotate(180deg); }

.format-guide-body {
    display: none;
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.format-guide-body.visible { display: block; }

.format-guide-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 1rem 0;
}

.format-flow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1.25rem 0;
}
.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.flow-node-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    font-family: var(--font-display);
}
.flow-node-icon.qualify {
    background: var(--qualify-bg);
    border: 1px solid var(--qualify-border);
    color: var(--qualify-color);
}
.flow-node-icon.elim {
    background: var(--elim-bg);
    border: 1px solid var(--elim-border);
    color: var(--elim-color);
}
.flow-node-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 56px;
    line-height: 1.2;
}
.flow-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
}
.flow-separator {
    width: 1px;
    height: 52px;
    background: rgba(255,255,255,0.1);
    margin: 0 0.5rem;
}
.flow-result {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.flow-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
}
.flow-result-item.qualify { color: var(--qualify-color); }
.flow-result-item.elim { color: var(--elim-color); }

.format-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(244,169,66,0.07);
    border: 1px solid rgba(244,169,66,0.15);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.format-tip i { color: var(--brand-gold); flex-shrink: 0; margin-top: 0.1rem; }
.format-tip strong { color: var(--brand-gold); }

/* ============================================
   SCORING GUIDE
   ============================================ */

.pickem-scoring-guide {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.pickem-scoring-guide h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    font-size: 1rem;
    color: var(--text-white);
}
.pickem-scoring-guide.compact { padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.pickem-scoring-guide.compact h3 { display: none; }
.scoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.scoring-section .scoring-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.scoring-section .scoring-row.muted { opacity: 0.6; font-size: 0.82rem; }
.scoring-title { font-weight: 700; color: var(--text-white); margin-bottom: 0.5rem; font-size: 0.9rem; }
.scoring-note { font-size: 0.78rem; opacity: 0.5; margin-top: 0.5rem; }
.pts { font-weight: 700; color: var(--text-white); }
.pts.gold   { color: var(--brand-gold); }
.pts.silver { color: var(--medal-silver); }

/* Score pills (leaderboard) */
.score-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
}
.score-pill.swiss-pill   { background: rgba(244,169,66,0.12); color: var(--brand-gold); }
.score-pill.bracket-pill { background: rgba(255,143,163,0.12); color: var(--brand-pink); }

/* ============================================
   PROGRESS BAR
   ============================================ */

.picks-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.picks-progress-count {
    font-weight: 700;
    color: var(--brand-gold);
    font-size: 1.1rem;
    white-space: nowrap;
}
.picks-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}
.picks-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-gold), var(--brand-pink));
    border-radius: 4px;
    transition: width 0.35s ease;
}
.picks-progress-pct {
    font-size: 0.82rem;
    color: var(--text-muted);
    min-width: 38px;
    text-align: right;
}

/* ============================================
   SWISS GRID - EQUIPOS
   ============================================ */

.swiss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.team-pickem-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.25rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.team-pickem-card.has-pick {
    border-color: rgba(244, 169, 66, 0.45);
    box-shadow: 0 4px 16px rgba(244,169,66,0.08);
}
.team-pickem-card.qualify-picked {
    border-color: var(--qualify-border);
    box-shadow: 0 4px 16px rgba(72,199,116,0.1);
}
.team-pickem-card.elim-picked {
    border-color: var(--elim-border);
    box-shadow: 0 4px 16px rgba(255,77,109,0.1);
}
.team-pickem-card:hover { transform: translateY(-2px); }

/* Indicador de seleccion en la esquina */
.card-pick-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.team-pickem-card.has-pick .card-pick-indicator { opacity: 1; }

.team-pickem-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
}
.team-pickem-logo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: rgba(126,30,55,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-pink);
}
.team-pickem-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-white);
    text-align: center;
    line-height: 1.3;
}

.btn-view-roster {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-view-roster:hover { background: rgba(244,169,66,0.12); color: var(--brand-gold); border-color: rgba(244,169,66,0.3); }

.btn-view-roster-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 0.3rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.btn-view-roster-sm:hover { background: rgba(244,169,66,0.15); color: var(--brand-gold); }

/* MODAL ROSTER */
.roster-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,2,5,0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.roster-modal-overlay.visible { display: flex; }
.roster-modal {
    width: 100%;
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-deep, #1a0a14);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.roster-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    background: var(--bg-deep, #1a0a14);
}
.roster-modal-header h3 { margin: 0; font-size: 1.05rem; color: var(--text-white); }
.roster-modal-close {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-white);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.roster-modal-close:hover { background: rgba(255,255,255,0.12); }
.roster-modal-body { padding: 0.5rem 0.75rem 1rem; }
.roster-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.roster-player:last-child { border-bottom: none; }
.roster-player-info { display: flex; flex-direction: column; gap: 0.15rem; }
.roster-player-name { font-size: 0.9rem; font-weight: 700; color: var(--text-white); }
.roster-player-name i { color: var(--brand-gold); font-size: 0.85rem; margin-left: 0.2rem; }
.roster-player-role { font-size: 0.72rem; color: var(--text-muted); }
.roster-player-pos {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-pink);
    background: rgba(255,143,163,0.1);
    border: 1px solid rgba(255,143,163,0.25);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    flex-shrink: 0;
}
.roster-empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; font-size: 0.85rem; }

/* RECORD PICKER - botones visuales */
.record-picker {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.record-group-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.record-group-label.qualify { color: var(--qualify-color); }
.record-group-label.eliminate { color: var(--elim-color); }
.record-group-label i { font-size: 0.8rem; }

.record-options {
    display: flex;
    gap: 0.3rem;
    width: 100%;
}
.rp-btn {
    flex: 1;
    padding: 0.45rem 0.1rem;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid;
    transition: all 0.15s;
    background: transparent;
    font-family: var(--font-display);
    touch-action: manipulation;
    min-height: 34px;
}
.rp-btn.qualify {
    border-color: rgba(72,199,116,0.25);
    color: rgba(72,199,116,0.7);
}
.rp-btn.qualify:hover {
    border-color: var(--qualify-border);
    color: var(--qualify-color);
    background: var(--qualify-bg);
}
.rp-btn.qualify.selected {
    background: var(--qualify-bg);
    border-color: var(--qualify-color);
    color: var(--qualify-color);
    box-shadow: 0 0 0 2px rgba(72,199,116,0.15);
}
.rp-btn.eliminate {
    border-color: rgba(255,77,109,0.25);
    color: rgba(255,77,109,0.7);
}
.rp-btn.eliminate:hover {
    border-color: var(--elim-border);
    color: var(--elim-color);
    background: var(--elim-bg);
}
.rp-btn.eliminate.selected {
    background: var(--elim-bg);
    border-color: var(--elim-color);
    color: var(--elim-color);
    box-shadow: 0 0 0 2px rgba(255,77,109,0.15);
}
.rp-divider {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0.15rem 0;
}

/* Vista readonly record */
.team-pickem-record {
    font-size: 1.2rem;
    font-weight: 900;
    font-family: var(--font-display);
    color: var(--brand-gold);
}
.team-pickem-record.empty { color: var(--text-muted); font-size: 0.85rem; font-weight: 400; }
.team-pickem-actual {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}
.team-pickem-actual.correct { background: var(--qualify-bg); color: var(--qualify-color); }
.team-pickem-actual.partial  { background: rgba(244,169,66,0.15); color: var(--brand-gold); }
.team-pickem-actual.wrong    { background: var(--elim-bg); color: var(--elim-color); }

/* SUBMIT ROW */
.wr-id-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    margin-bottom: 1rem;
}
.wr-id-card label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
}
.wr-id-card label i { color: var(--brand-gold); }
.wr-id-card .wr-required { color: var(--text-muted); font-weight: 500; font-size: 0.78rem; }
.wr-id-card input {
    padding: 0.7rem 0.9rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-white);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.wr-id-card input:focus { border-color: var(--brand-gold); background: rgba(255,255,255,0.06); }
.wr-id-card input::placeholder { color: var(--text-muted); }
.wr-id-card small { color: var(--text-muted); font-size: 0.75rem; }

.swiss-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 1rem;
    z-index: 10;
    backdrop-filter: blur(12px);
}
.submit-row-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.submit-row-info strong { color: var(--text-white); }

.btn-pickem-save {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 2rem;
    background: linear-gradient(135deg, var(--brand-gold), #e8943a);
    color: #1a0a00;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    touch-action: manipulation;
    white-space: nowrap;
}
.btn-pickem-save:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(244,169,66,0.3); }
.btn-pickem-save:active:not(:disabled) { transform: scale(0.98); }
.btn-pickem-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* MSG */
.pickem-msg {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}
.pickem-msg.ok    { background: var(--qualify-bg); color: var(--qualify-color); border: 1px solid var(--qualify-border); }
.pickem-msg.warn  { background: rgba(244,169,66,0.15); color: var(--brand-gold); border: 1px solid rgba(244,169,66,0.3); }
.pickem-msg.error { background: var(--elim-bg); color: var(--elim-color); border: 1px solid var(--elim-border); }

/* ============================================
   BRACKET PICK'EMS
   ============================================ */

.bracket-pickem-container {
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}
.bracket-rounds {
    display: flex;
    gap: 1.5rem;
    min-width: max-content;
    align-items: flex-start;
}
.bracket-round { min-width: 210px; }
.bracket-round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(244,169,66,0.2);
}
.bracket-round-header span:first-child {
    font-weight: 700;
    color: var(--brand-gold);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.round-pts { font-size: 0.72rem; color: var(--text-muted); }
.bracket-round-matches {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-around;
    height: 100%;
}
.bracket-match {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.bracket-match.played { border-color: rgba(244,169,66,0.2); }
.bracket-vs {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.1rem 0;
    background: rgba(255,255,255,0.02);
}
.bracket-team {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    min-height: 44px;
    cursor: default;
    transition: background 0.2s ease, transform 0.15s ease;
    position: relative;
}
.bracket-team[data-pick-key] {
    cursor: pointer;
    touch-action: manipulation;
}
.bracket-team[data-pick-key]:hover { background: rgba(244,169,66,0.1); }
.bracket-team[data-pick-key]:active { transform: scale(0.98); }
.bracket-team.picked {
    background: rgba(244,169,66,0.12);
    box-shadow: inset 3px 0 0 var(--brand-gold);
}
.bracket-team.picked .bt-name { color: var(--brand-gold); font-weight: 700; }
.bracket-team.actual-winner { background: rgba(72,199,116,0.08); }
.bracket-team.actual-winner .bt-name { color: var(--qualify-color); }
.bracket-team.actual-loser { opacity: 0.4; }
.bracket-team.tbd {
    color: var(--text-muted);
    font-size: 0.82rem;
    gap: 0.4rem;
    cursor: default;
}
.bt-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.bt-logo-ph {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(126,30,55,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--brand-pink);
    flex-shrink: 0;
}
.bt-name { font-size: 0.82rem; color: var(--text-white); flex: 1; }
.pick-result {
    font-size: 0.7rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.35rem;
    flex-shrink: 0;
    font-weight: 700;
}
.pick-result.correct { background: var(--qualify-bg); color: var(--qualify-color); border: 1px solid var(--qualify-border); }
.pick-result.correct::after { content: 'OK'; }
.pick-result.wrong   { background: var(--elim-bg); color: var(--elim-color); border: 1px solid var(--elim-border); }
.pick-result.wrong::after { content: 'X'; }

/* ============================================
   LEADERBOARD
   ============================================ */

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-white);
    margin-bottom: 1.5rem;
}
.leaderboard-title i { color: var(--brand-gold); }

/* PODIO TOP 3 */
.lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}
.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 200px;
}
.podium-crown {
    font-size: 1.4rem;
    color: var(--brand-gold);
    animation: floatCrown 2.5s ease-in-out infinite;
}
@keyframes floatCrown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.podium-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2.5px solid transparent;
    position: relative;
}
.podium-place.first .podium-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.3rem;
    background: rgba(244,169,66,0.15);
    border-color: var(--medal-gold);
    box-shadow: 0 0 20px rgba(244,169,66,0.25);
    color: var(--medal-gold);
}
.podium-place.second .podium-avatar {
    background: rgba(176,184,200,0.12);
    border-color: var(--medal-silver);
    color: var(--medal-silver);
}
.podium-place.third .podium-avatar {
    background: rgba(205,127,50,0.12);
    border-color: var(--medal-bronze);
    color: var(--medal-bronze);
}
.podium-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
    text-align: center;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.podium-score {
    font-size: 1.1rem;
    font-weight: 900;
    font-family: var(--font-display);
}
.podium-place.first  .podium-score { color: var(--medal-gold); font-size: 1.25rem; }
.podium-place.second .podium-score { color: var(--medal-silver); }
.podium-place.third  .podium-score { color: var(--medal-bronze); }
.podium-pts-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: -0.35rem;
}
.podium-block {
    width: 100%;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.podium-place.first  .podium-block { background: rgba(244,169,66,0.12); border: 1px solid rgba(244,169,66,0.25); border-bottom: none; height: 90px; }
.podium-place.second .podium-block { background: rgba(176,184,200,0.07); border: 1px solid rgba(176,184,200,0.15); border-bottom: none; height: 65px; }
.podium-place.third  .podium-block { background: rgba(205,127,50,0.07); border: 1px solid rgba(205,127,50,0.15); border-bottom: none; height: 50px; }
.podium-block-num {
    font-size: 1.5rem;
    font-weight: 900;
    font-family: var(--font-display);
    opacity: 0.3;
}
.podium-place.first  .podium-block-num { color: var(--medal-gold); }
.podium-place.second .podium-block-num { color: var(--medal-silver); }
.podium-place.third  .podium-block-num { color: var(--medal-bronze); }
.podium-score-pills {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* TABLA LEADERBOARD */
.leaderboard-table {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
}
.leaderboard-header {
    display: grid;
    grid-template-columns: 50px 1fr 80px 80px 100px;
    padding: 0.75rem 1.25rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.leaderboard-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 80px 100px;
    padding: 0.85rem 1.25rem;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}
.leaderboard-row:hover { background: rgba(255,255,255,0.03); }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row.gold   { background: rgba(244,169,66,0.04); }
.leaderboard-row.silver { background: rgba(176,184,200,0.03); }
.leaderboard-row.bronze { background: rgba(205,127,50,0.03); }
.leaderboard-row.is-me  {
    outline: 1px solid rgba(244,169,66,0.35);
    background: rgba(244,169,66,0.04);
}
.lb-rank {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}
.lb-rank i { font-size: 1.1rem; }
.lb-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.lb-avatar-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(126,30,55,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--brand-pink);
    flex-shrink: 0;
}
.lb-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-me-badge {
    background: rgba(244,169,66,0.2);
    color: var(--brand-gold);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    flex-shrink: 0;
}
.lb-pts { font-weight: 700; font-size: 0.9rem; color: var(--text-secondary); }
.lb-pts.total { color: var(--brand-gold); font-size: 1rem; }

.leaderboard-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.leaderboard-empty i { font-size: 3rem; display: block; margin-bottom: 1rem; color: var(--brand-gold); opacity: 0.4; }
.leaderboard-empty p { font-size: 0.9rem; line-height: 1.6; }

/* ============================================
   ADMIN - Mensajes
   ============================================ */

.admin-flash {
    padding: 0.9rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.admin-flash.success { background: var(--qualify-bg); color: var(--qualify-color); border: 1px solid var(--qualify-border); }
.admin-flash.error   { background: var(--elim-bg); color: var(--elim-color); border: 1px solid var(--elim-border); }

/* ============================================
   ADMIN - Stat cards
   ============================================ */

.pickem-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.pickem-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.pickem-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 14px 0 0 14px;
}
.pickem-stat-card.accent-gold::before   { background: var(--brand-gold); }
.pickem-stat-card.accent-pink::before   { background: var(--brand-pink); }
.pickem-stat-card.accent-green::before  { background: var(--qualify-color); }
.pickem-stat-card.accent-silver::before { background: var(--medal-silver); }
.psc-icon { font-size: 1.6rem; flex-shrink: 0; }
.psc-icon.gold   { color: var(--brand-gold); }
.psc-icon.pink   { color: var(--brand-pink); }
.psc-icon.green  { color: var(--qualify-color); }
.psc-icon.silver { color: var(--medal-silver); }
.psc-value { font-size: 2rem; font-weight: 900; color: var(--text-white); line-height: 1; }
.psc-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ============================================
   ADMIN - Phase cards con toggle
   ============================================ */

.phase-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.phase-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s;
}
.phase-card.is-open {
    border-color: rgba(72,199,116,0.3);
}
.phase-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}
.phase-card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-white);
}
.phase-card-title i { color: var(--brand-gold); font-size: 1.1rem; }
.phase-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}
.phase-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.phase-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.phase-status-dot.open  { background: var(--qualify-color); box-shadow: 0 0 6px rgba(72,199,116,0.5); }
.phase-status-dot.closed { background: rgba(255,255,255,0.2); }
.phase-status-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}
.phase-status-label strong { color: var(--text-white); }

/* Toggle switch */
.phase-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.toggle-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-track {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 13px;
    transition: background 0.3s;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
}
.toggle-track::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.toggle-switch input:checked + .toggle-track {
    background: var(--qualify-color);
    border-color: var(--qualify-color);
}
.toggle-switch input:checked + .toggle-track::before {
    transform: translateX(22px);
    background: white;
}
.toggle-switch:focus-within .toggle-track {
    outline: 2px solid var(--brand-gold);
    outline-offset: 2px;
}

.phase-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.btn-phase-calc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255,143,163,0.12);
    border: 1px solid rgba(255,143,163,0.25);
    color: var(--brand-pink);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    width: 100%;
    touch-action: manipulation;
}
.btn-phase-calc:hover { background: rgba(255,143,163,0.2); transform: translateY(-1px); }
.btn-phase-calc:active { transform: scale(0.98); }

/* Timeline de fases */
.phase-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
    position: relative;
}
.timeline-step::before {
    content: '';
    position: absolute;
    top: 18px;
    left: calc(50% + 18px);
    width: calc(100% - 36px);
    height: 2px;
    background: rgba(255,255,255,0.1);
}
.timeline-step:last-child::before { display: none; }
.timeline-step.done::before   { background: var(--qualify-color); }
.timeline-step.active::before { background: rgba(244,169,66,0.3); }
.timeline-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 2px solid;
    position: relative;
    z-index: 1;
    background: var(--card-bg);
}
.timeline-dot.done   { border-color: var(--qualify-color); color: var(--qualify-color); }
.timeline-dot.active { border-color: var(--brand-gold); color: var(--brand-gold); background: rgba(244,169,66,0.08); }
.timeline-dot.pending { border-color: rgba(255,255,255,0.15); color: var(--text-muted); }
.timeline-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.3;
}
.timeline-step.done   .timeline-label { color: var(--qualify-color); }
.timeline-step.active .timeline-label { color: var(--brand-gold); }

/* ============================================
   ADMIN - Tabla leaderboard
   ============================================ */

.admin-lb-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-lb-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.admin-lb-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.88rem;
    color: var(--text-secondary);
    vertical-align: middle;
}
.admin-lb-table tr:last-child td { border-bottom: none; }
.admin-lb-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-lb-rank {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 40px;
}
.admin-lb-name {
    font-weight: 700;
    color: var(--text-white);
}
.admin-lb-pts-total {
    font-size: 1rem;
    font-weight: 900;
    color: var(--brand-gold);
    font-family: var(--font-display);
}
.pts-breakdown {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================
   ADMIN - Buttons y lista de torneos
   ============================================ */

.pickem-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}
.pickem-tournament-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.2s, transform 0.2s;
}
.pickem-tournament-card:hover { border-color: rgba(244,169,66,0.25); transform: translateY(-1px); }
.ptc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ptc-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.ptc-logo-ph {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(126,30,55,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-pink);
    font-size: 1.2rem;
    flex-shrink: 0;
}
.ptc-title { font-weight: 700; color: var(--text-white); font-size: 1rem; margin: 0; }
.ptc-status { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.ptc-phases {
    display: flex;
    gap: 0.5rem;
}
.ptc-phase {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    flex: 1;
    justify-content: center;
}
.ptc-phase.open   { background: var(--qualify-bg); border: 1px solid var(--qualify-border); color: var(--qualify-color); }
.ptc-phase.closed { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--text-muted); }
.ptc-actions {
    display: flex;
    gap: 0.6rem;
}
.btn-ptc {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
}
.btn-ptc.primary {
    background: rgba(244,169,66,0.15);
    border: 1px solid rgba(244,169,66,0.3);
    color: var(--brand-gold);
}
.btn-ptc.primary:hover { background: rgba(244,169,66,0.25); transform: translateY(-1px); }
.btn-ptc.secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
}
.btn-ptc.secondary:hover { background: rgba(255,255,255,0.1); transform: translateY(-1px); }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .phase-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .swiss-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .pickem-actions-row { flex-direction: column; }
    .scoring-grid { grid-template-columns: 1fr; gap: 1rem; }
    .lb-podium { gap: 0.5rem; }
    .podium-place { max-width: 130px; }
    .leaderboard-header,
    .leaderboard-row { grid-template-columns: 44px 1fr 90px; }
    .leaderboard-header span:nth-child(3),
    .leaderboard-header span:nth-child(4),
    .leaderboard-row .lb-pts:nth-child(3),
    .leaderboard-row .lb-pts:nth-child(4) { display: none; }
    .bracket-pickem-container { overflow-x: visible; padding-bottom: 0; }
    .bracket-rounds { flex-direction: column; gap: 1.75rem; min-width: 0; }
    .bracket-round  { min-width: 0; width: 100%; }
    .bracket-round-matches { height: auto; }
    .picks-progress { flex-wrap: wrap; gap: 0.5rem; }
    .picks-bar { max-width: 100%; flex: 1 0 100%; }
    .pickem-index-grid { grid-template-columns: 1fr; }
    .swiss-submit-row { position: static; }
}

@media (max-width: 480px) {
    .pickem-hero { padding: 1.5rem 0 1rem; }
    .pickem-hero-content h1 { font-size: 1.25rem; }
    .swiss-grid { grid-template-columns: repeat(2, 1fr); }
    .team-pickem-card { padding: 1rem 0.75rem; }
    .pickem-stats-bar { gap: 1rem; }
    .pstat-label { display: none; }
    .lb-podium { gap: 0.4rem; }
    .podium-avatar { width: 44px; height: 44px; }
    .podium-place.first .podium-avatar { width: 54px; height: 54px; }
}
