:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #141926;
    --bg-card: rgba(20, 25, 38, 0.6);
    --accent-primary: #ff6b00;
    --accent-secondary: #00ff88;
    --text-primary: #e8eaed;
    --text-muted: #8a92a6;
    --border: rgba(255, 107, 0, 0.2);
    --border-hover: rgba(255, 107, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(255, 107, 0, 0.15);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 20% 0%, rgba(255, 107, 0, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(0, 255, 136, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, .brand, .nav-link, .stat-value {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-secondary);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(10, 14, 26, 0.85);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 1.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
}

.brand span {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero {
    padding: 5rem 2rem 4rem;
    text-align: center;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 107, 0, 0.04) 100%);
    border-bottom: 1px solid var(--border);
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Stats strip */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    padding: 2rem;
    max-width: 1280px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    color: var(--accent-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* Section */
.section {
    margin: 3rem 0;
}

.section-title {
    font-size: 2rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--accent-primary);
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.card-link {
    color: inherit;
    display: block;
}

.card-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-tier-S { background: rgba(255, 107, 0, 0.15); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.badge-tier-A { background: rgba(0, 255, 136, 0.1); color: var(--accent-secondary); border: 1px solid rgba(0, 255, 136, 0.4); }
.badge-tier-B, .badge-tier-C { background: rgba(138, 146, 166, 0.1); color: var(--text-muted); border: 1px solid var(--text-muted); }

.badge-status-ongoing {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-secondary);
    border: 1px solid var(--accent-secondary);
}

.badge-status-ongoing::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.badge-status-upcoming { background: rgba(255, 107, 0, 0.1); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.badge-status-finished { background: rgba(138, 146, 166, 0.1); color: var(--text-muted); border: 1px solid var(--text-muted); }

.badge-role {
    background: rgba(255, 107, 0, 0.12);
    color: var(--accent-primary);
    border: 1px solid var(--border);
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-secondary); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* Team logo */
.team-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.team-logo-sm {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.rank-pill {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Player avatar */
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--bg-primary);
    margin-bottom: 1rem;
}

/* Detail header */
.detail-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.detail-title {
    font-size: 2.5rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.detail-meta-item strong {
    color: var(--text-primary);
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
}

/* Table */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: rgba(255, 107, 0, 0.05);
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(255, 107, 0, 0.04);
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.filter-select {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
}

.filter-btn:hover { opacity: 0.85; }

.filter-clear {
    padding: 0.5rem 1.25rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
}

/* Group section */
.group-section {
    margin-bottom: 2rem;
}

.group-title {
    font-size: 1.3rem;
    text-transform: uppercase;
    margin-bottom: 1rem;
    color: var(--accent-secondary);
}

/* Footer */
.footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    font-size: 0.9rem;
}

/* 404 */
.error-page {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-code {
    font-family: 'Rajdhani', sans-serif;
    font-size: 8rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

.placement-1 { color: gold; font-weight: 700; }
.placement-2 { color: silver; font-weight: 700; }
.placement-3 { color: #cd7f32; font-weight: 700; }

/* Player tier badges (1=best, 5=newest) */
.badge-ptier {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
    letter-spacing: 0.05em;
}
.badge-ptier-1 { background: linear-gradient(135deg, #ffd700, #ff9500); color: #1a0f00; border: 1px solid #ffd700; }
.badge-ptier-2 { background: rgba(192, 192, 220, 0.18); color: #d4d4f5; border: 1px solid #c0c0dc; }
.badge-ptier-3 { background: rgba(255, 107, 0, 0.15); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.badge-ptier-4 { background: rgba(0, 200, 255, 0.1); color: #66c8ff; border: 1px solid rgba(102, 200, 255, 0.4); }
.badge-ptier-5 { background: rgba(138, 146, 166, 0.12); color: var(--text-muted); border: 1px solid var(--text-muted); }

/* Distribute page */
.tier-row {
    margin-bottom: 1.5rem;
}

.tier-row-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.tier-row-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
}

.tier-row-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    margin: 0.25rem;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
    color: var(--text-primary);
}

.player-chip:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.player-chip strong {
    color: var(--accent-primary);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    transition: all 0.25s;
}

.team-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.team-card-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.team-roster {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-roster-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.team-roster-row .player-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.team-roster-row .player-info strong {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-roster-row .player-info .role-mini {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.distribute-actions {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-shuffle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    background: linear-gradient(135deg, var(--accent-primary), #ff9500);
    color: #1a0f00;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.3);
}

.btn-shuffle:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 107, 0, 0.5);
    color: #1a0f00;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: transparent;
    color: #ff8888;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
}

.btn-delete:hover {
    background: rgba(255, 100, 100, 0.1);
    border-color: #ff8888;
    color: #ffaaaa;
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.25);
    transform: translateY(-1px);
}

/* Admin-gated buttons — disabled state */
.btn-shuffle:disabled,
.btn-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.6);
    box-shadow: none;
    pointer-events: none;
}

.btn-shuffle:disabled:hover,
.btn-delete:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* View-only / Admin status pill */
.admin-status {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    margin-left: auto;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(138, 146, 166, 0.12);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.admin-status.admin-on {
    background: rgba(0, 255, 136, 0.12);
    color: var(--accent-secondary);
    border-color: rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

/* ==================== Tournament Bracket ==================== */
.bracket-container {
    max-width: 1600px;
}

.bk-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0 2rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.bk-section {
    margin-bottom: 3rem;
}

.bk-section-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--accent-primary);
}

.bk-section-lower .bk-section-title {
    color: #ff8888;
    border-left-color: #ff8888;
}

.bk-grid {
    display: grid;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 1rem;
    background: rgba(10, 14, 26, 0.45);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.bk-grid-upper {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.bk-grid-lower {
    grid-template-columns: repeat(6, minmax(160px, 1fr));
}

.bk-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 180px;
}

.bk-round-label {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
    padding: 0.4rem;
    background: rgba(255, 107, 0, 0.06);
    border-radius: 6px;
    border: 1px dashed var(--border);
}

.bk-match {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0.6rem 0;
    padding: 4px;
    border-radius: 8px;
    background: rgba(20, 25, 38, 0.55);
    border: 1px solid var(--border);
    position: relative;
}

.bk-match::after {
    content: "";
    position: absolute;
    right: -1.25rem;
    top: 50%;
    width: 1.25rem;
    height: 2px;
    background: linear-gradient(90deg, var(--border), transparent);
    transform: translateY(-50%);
}

.bk-round:last-child .bk-match::after { display: none; }

.bk-slot {
    padding: 0.7rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    cursor: default;
    user-select: none;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 38px;
}

.bk-slot.drag-enabled {
    cursor: grab;
}

.bk-slot.drag-enabled::before {
    content: "≡";
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0.6;
}

.bk-slot.drag-enabled:hover {
    border-color: var(--border-hover);
    background: rgba(255, 107, 0, 0.08);
    transform: translateX(2px);
}

.bk-slot.tbd {
    color: var(--text-muted);
    font-style: italic;
    background: transparent;
    border-style: dashed;
}

.bk-slot.tbd::before { content: "·"; }

.bk-slot:active,
.bk-slot.dragging {
    cursor: grabbing;
    opacity: 0.45;
    transform: scale(0.97);
    border-color: var(--accent-primary);
}

.bk-slot.drop-target {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.18), rgba(255, 107, 0, 0.18));
    border-color: var(--accent-secondary);
    box-shadow: 0 0 14px rgba(0, 255, 136, 0.45), inset 0 0 10px rgba(255, 107, 0, 0.2);
    transform: scale(1.04);
}

.bk-slot-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grand Final centerpiece */
.bk-grand-final {
    margin: 3rem 0;
    padding: 2rem;
    background:
        linear-gradient(135deg, rgba(255, 215, 0, 0.10), rgba(255, 107, 0, 0.08)),
        var(--bg-card);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
    backdrop-filter: blur(10px);
}

.bk-match-final {
    max-width: 360px;
    margin: 0 auto;
    background: rgba(255, 215, 0, 0.05);
    border-color: rgba(255, 215, 0, 0.4);
}

.bk-match-final .bk-slot {
    border-color: rgba(255, 215, 0, 0.4);
}

.bk-match-final .bk-slot:not(.tbd) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 107, 0, 0.12));
}

.empty-state {
    padding: 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state a {
    color: var(--accent-primary);
    font-weight: 600;
}

@media (max-width: 900px) {
    .bk-grid {
        grid-template-columns: repeat(4, 200px);
    }
}

.distribute-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.unassigned-section {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 100, 100, 0.05);
    border: 1px solid rgba(255, 100, 100, 0.2);
    border-radius: 8px;
}

.unassigned-section h3 {
    color: #ff8888;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* ==================== Draft Animation ==================== */
/* Reshuffle/Distribute дарсны дараа л ажиллана. Зүгээр reload-д шуудхан харагдана. */

/* Phase 1: Tier chip-уудыг "хольж байгаа" — секунд тутамд гэрэлтэн өнгө сольж эхэлнэ */
.animate-draft .player-chip {
    animation: chip-shuffle 1.2s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: calc(var(--chip-idx, 0) * 25ms);
}

@keyframes chip-shuffle {
    0% {
        opacity: 0;
        transform: scale(0.7) rotate(-3deg);
    }
    20% {
        opacity: 1;
        transform: scale(1.08) rotate(2deg);
        background: rgba(255, 107, 0, 0.25);
        border-color: var(--accent-primary);
    }
    50% {
        transform: scale(0.95) rotate(-1deg);
        background: rgba(0, 255, 136, 0.2);
        border-color: var(--accent-secondary);
    }
    80% {
        transform: scale(1.02) rotate(1deg);
        background: rgba(255, 107, 0, 0.15);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* Phase 2: Team card-ууд нэг нэгээрээ "сонгогдож" гарч ирнэ */
.animate-draft .team-card {
    animation: team-draft 0.95s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: calc(1.4s + var(--team-idx, 0) * 0.22s);
}

@keyframes team-draft {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.85);
        filter: blur(6px);
    }
    50% {
        opacity: 1;
        transform: translateY(-8px) scale(1.04);
        filter: blur(0);
        border-color: var(--accent-primary);
        box-shadow: 0 0 60px rgba(255, 107, 0, 0.55), 0 0 0 2px var(--accent-primary);
    }
    75% {
        transform: translateY(2px) scale(0.99);
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Phase 3: Team дотор player бүр slide-аар орж "lock-in" болно */
.animate-draft .team-roster-row {
    animation: player-lock 0.55s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: calc(
        1.4s
        + var(--team-idx, 0) * 0.22s
        + var(--row-idx, 0) * 0.09s
        + 0.35s
    );
    border-radius: 6px;
}

@keyframes player-lock {
    0% {
        opacity: 0;
        transform: translateX(-25px);
        background: rgba(255, 107, 0, 0.4);
        box-shadow: -3px 0 0 var(--accent-primary);
    }
    40% {
        opacity: 1;
        transform: translateX(8px);
        background: rgba(0, 255, 136, 0.25);
        box-shadow: 3px 0 12px rgba(0, 255, 136, 0.5);
    }
    70% {
        transform: translateX(-2px);
        background: rgba(255, 107, 0, 0.1);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        background: transparent;
        box-shadow: none;
    }
}

/* Section title-уудыг бас staggered reveal */
.animate-draft .section-title {
    animation: title-fade 0.8s ease-out backwards;
    animation-delay: 1.2s;
}

@keyframes title-fade {
    from {
        opacity: 0;
        transform: translateX(-15px);
        letter-spacing: 0.5em;
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== LIVE Broadcast Animation ==================== */
/* Socket.IO event-р бусад viewer-уудад харагдах "LIVE DRAFT" animation. */

.live-banner {
    position: sticky;
    top: 70px;
    z-index: 50;
    margin: 1rem auto 1.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(90deg, rgba(255, 0, 80, 0.95), rgba(255, 107, 0, 0.95));
    color: #fff;
    border-radius: 999px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    box-shadow: 0 0 25px rgba(255, 0, 80, 0.5);
    animation: live-banner-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards,
               live-banner-out 0.6s ease-in 6s forwards;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.live-banner strong {
    font-weight: 700;
    letter-spacing: 0.15em;
}

.live-dot {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px #fff;
    animation: live-dot-pulse 1s infinite;
}

@keyframes live-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}

@keyframes live-banner-in {
    from { opacity: 0; transform: translateY(-30px) scale(0.8); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes live-banner-out {
    to { opacity: 0; transform: translateY(-15px); }
}

/* Phase 0: Container-д флэш */
.animate-live::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, rgba(255, 0, 80, 0.35), transparent 60%);
    pointer-events: none;
    z-index: 999;
    animation: live-flash 0.5s ease-out forwards;
}

@keyframes live-flash {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* Phase 1: Tier chip-ууд "static" эффект — secунд тутамд хальт гэрэлтэнэ */
.animate-live .player-chip {
    animation: chip-static 1s ease-out backwards;
    animation-delay: calc(var(--chip-idx, 0) * 15ms);
}

@keyframes chip-static {
    0% {
        opacity: 0;
        transform: scaleX(0.3);
        filter: brightness(2.5) blur(1px);
    }
    40% {
        opacity: 1;
        transform: scaleX(1.05);
        filter: brightness(1.5) blur(0);
    }
    100% {
        opacity: 1;
        transform: scaleX(1);
        filter: brightness(1);
    }
}

/* Phase 2: Team card-ууд 3D flip-ээр орж ирнэ */
.animate-live .team-grid {
    perspective: 1200px;
}

.animate-live .team-card {
    animation: team-flip 1s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: calc(0.8s + var(--team-idx, 0) * 0.2s);
    transform-style: preserve-3d;
}

@keyframes team-flip {
    0% {
        opacity: 0;
        transform: rotateY(-90deg) translateZ(-100px);
        box-shadow: 0 0 0 transparent;
    }
    50% {
        opacity: 1;
        transform: rotateY(15deg) translateZ(20px);
        box-shadow: -20px 0 60px rgba(255, 0, 80, 0.5),
                    0 0 0 2px var(--accent-primary);
    }
    80% {
        transform: rotateY(-5deg) translateZ(0);
        box-shadow: 0 0 30px rgba(255, 107, 0, 0.4);
    }
    100% {
        opacity: 1;
        transform: rotateY(0) translateZ(0);
        box-shadow: 0 0 0 transparent;
    }
}

/* Phase 3: Player row scanline reveal — дээрээс доош scan хийгдэн харагдана */
.animate-live .team-roster-row {
    animation: row-scanline 0.45s ease-out backwards;
    animation-delay: calc(
        0.8s
        + var(--team-idx, 0) * 0.2s
        + var(--row-idx, 0) * 0.07s
        + 0.4s
    );
    overflow: hidden;
    position: relative;
}

.animate-live .team-roster-row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-secondary), transparent);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: scanline-sweep 0.45s ease-out backwards;
    animation-delay: inherit;
    pointer-events: none;
}

@keyframes row-scanline {
    0% {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes scanline-sweep {
    0%   { top: 0;     opacity: 0; }
    20%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%;  opacity: 0; }
}

/* Live mode-д section title өөр төрхтэй */
.animate-live .section-title {
    animation: title-glitch 0.7s ease-out backwards;
    animation-delay: 0.5s;
}

@keyframes title-glitch {
    0%   { opacity: 0; transform: translateX(-20px); text-shadow: 3px 0 #ff0050, -3px 0 var(--accent-secondary); }
    30%  { opacity: 1; transform: translateX(3px); text-shadow: -2px 0 #ff0050, 2px 0 var(--accent-secondary); }
    60%  { transform: translateX(-2px); text-shadow: 1px 0 var(--accent-primary); }
    100% { opacity: 1; transform: translateX(0); text-shadow: none; }
}

/* ==================== About / Intro section ==================== */
.about-section {
    position: relative;
    margin: 3rem 0;
    padding: 3rem 2.5rem;
    background:
        linear-gradient(135deg, rgba(255, 107, 0, 0.06), rgba(0, 255, 136, 0.04)),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.about-section::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.12), transparent 70%);
    pointer-events: none;
}

.about-eyebrow {
    display: inline-block;
    color: var(--accent-secondary);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.about-headline {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent-primary) 60%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    z-index: 1;
}

.about-body {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 760px;
    position: relative;
    z-index: 1;
}

.about-body p + p {
    margin-top: 0.85rem;
}

.about-body strong {
    color: var(--accent-primary);
}

/* Format / feature cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0 3rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(255, 107, 0, 0.08));
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.feature-card:hover::after {
    opacity: 1;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.feature-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.feature-text strong {
    color: var(--text-primary);
}

/* ==================== Live Countdown ==================== */
.countdown-card {
    position: relative;
    margin: 2rem auto;
    max-width: 1280px;
    padding: 2rem 2.5rem;
    background:
        linear-gradient(135deg, rgba(255, 107, 0, 0.10) 0%, rgba(0, 255, 136, 0.06) 100%),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    text-align: center;
}

.countdown-card::before {
    content: "";
    position: absolute;
    top: -100%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255, 107, 0, 0.18), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.countdown-card > * {
    position: relative;
    z-index: 1;
}

.countdown-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-secondary);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.countdown-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.countdown-display {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1.25rem;
}

.countdown-unit {
    min-width: 90px;
    padding: 0.85rem 1rem;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.countdown-num {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    line-height: 1;
    background: linear-gradient(180deg, var(--accent-primary) 0%, #ff9500 50%, var(--accent-secondary) 120%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.countdown-label {
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.countdown-sep {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--accent-primary);
    line-height: 1;
    padding-top: 0.5rem;
    opacity: 0.5;
    animation: blink 1s infinite step-end;
}

@keyframes blink {
    50% { opacity: 0.15; }
}

.countdown-target {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.countdown-target strong {
    color: var(--text-primary);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.countdown-finished {
    color: var(--accent-secondary);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@media (max-width: 600px) {
    .countdown-unit { min-width: 64px; padding: 0.6rem 0.75rem; }
    .countdown-sep { padding-top: 0.3rem; }
}

/* Map list inside feature card */
.map-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.map-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--accent-secondary);
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ==================== Mobile Responsive ==================== */

@media (max-width: 900px) {
    /* Bracket grid scrolls horizontally on tablet/mobile */
    .bracket-container { padding: 1rem; }
    .bk-grid-upper {
        grid-template-columns: repeat(4, 200px);
        min-width: 100%;
    }
    .bk-grid-lower {
        grid-template-columns: repeat(6, 180px);
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    /* Navbar — tighter spacing */
    .navbar {
        padding: 0.75rem 1rem;
    }
    .nav-container {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        justify-content: center;
    }
    .brand {
        font-size: 1.2rem;
    }
    .nav-links {
        gap: 1.25rem;
    }
    .nav-link {
        font-size: 0.85rem;
    }

    /* Container & sections */
    .container {
        padding: 1rem;
    }
    .section { margin: 2rem 0; }
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    /* Hero */
    .hero {
        padding: 3rem 1rem 2.25rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }

    /* Stats */
    .stats {
        padding: 1.25rem 1rem;
        margin: 1.5rem auto;
        gap: 0.5rem;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }
    .stat-value {
        font-size: 1.8rem;
    }
    .stat-label {
        font-size: 0.7rem;
    }

    /* Countdown */
    .countdown-card {
        padding: 1.5rem 1rem;
        margin: 1.5rem auto;
    }
    .countdown-eyebrow {
        font-size: 0.75rem;
        letter-spacing: 0.15em;
    }
    .countdown-display {
        gap: 0.25rem;
    }
    .countdown-unit {
        min-width: 60px;
        padding: 0.55rem 0.4rem;
    }
    .countdown-num {
        font-size: 2rem;
    }
    .countdown-label {
        font-size: 0.65rem;
    }
    .countdown-sep {
        font-size: 1.4rem;
    }
    .countdown-target {
        font-size: 0.85rem;
    }

    /* About */
    .about-section {
        padding: 1.75rem 1.25rem;
        margin: 2rem 0;
    }
    .about-eyebrow {
        font-size: 0.75rem;
        letter-spacing: 0.15em;
    }
    .about-body {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Feature grid → 1 col on mobile */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .feature-card {
        padding: 1.15rem;
    }

    /* Card grid (players, teams) */
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.85rem;
    }
    .card {
        padding: 1rem;
    }
    .card-title {
        font-size: 1.1rem;
    }

    /* Detail header */
    .detail-header {
        padding: 1.5rem 1.25rem;
        gap: 1.25rem;
    }
    .detail-title {
        font-size: 1.7rem;
    }
    .detail-meta {
        gap: 0.75rem;
    }
    .detail-meta-item strong {
        font-size: 1.1rem;
    }

    /* Filters wrap to column */
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 1rem;
    }
    .filter-select, .filter-btn, .filter-clear {
        width: 100%;
        text-align: center;
    }

    /* Distribute page actions */
    .distribute-actions {
        flex-wrap: wrap;
    }
    .admin-status {
        margin-left: 0;
    }
    .btn-shuffle, .btn-delete {
        flex: 1;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Team card grid */
    .team-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .team-card {
        padding: 1rem;
    }
    .team-card-title {
        font-size: 1.2rem;
    }

    /* Bracket controls stack */
    .bk-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .bk-section { margin-bottom: 2rem; }
    .bk-section-title {
        font-size: 1.25rem;
    }
    .bk-grand-final {
        padding: 1.25rem 1rem;
        margin: 2rem 0;
    }

    /* Live broadcast banner smaller */
    .live-banner {
        font-size: 0.75rem;
        padding: 0.55rem 1rem;
        letter-spacing: 0.05em;
        top: 60px;
    }

    /* Tables — horizontal scroll wrapper */
    .table {
        font-size: 0.85rem;
    }
    .table th, .table td {
        padding: 0.6rem 0.5rem;
    }

    /* Player chip */
    .player-chip {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }

    /* Footer */
    .footer {
        padding: 1.25rem 1rem;
        font-size: 0.8rem;
        margin-top: 2.5rem;
    }
}

@media (max-width: 480px) {
    /* Extra-small phones */
    .nav-links {
        gap: 0.85rem;
    }
    .nav-link {
        font-size: 0.78rem;
    }
    .brand {
        font-size: 1.1rem;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-value {
        font-size: 1.5rem;
    }

    .countdown-unit {
        min-width: 52px;
    }
    .countdown-num {
        font-size: 1.7rem;
    }
    .countdown-sep {
        font-size: 1.1rem;
    }

    .about-headline {
        font-size: 1.4rem !important;
    }

    /* Card grid - 2 cols on tiny screens */
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    .avatar {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .error-code {
        font-size: 5rem;
    }

    /* Hero badges full row */
    .hero > div {
        gap: 0.5rem !important;
    }

    /* Bracket grid columns smaller for tiny screens */
    .bk-grid-upper {
        grid-template-columns: repeat(4, 170px);
    }
    .bk-grid-lower {
        grid-template-columns: repeat(6, 150px);
    }
    .bk-slot {
        font-size: 0.85rem;
        padding: 0.55rem 0.6rem;
        min-height: 34px;
    }
}
