/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Hamburger Menu */
.hamburger-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.hamburger-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    /* cam nổi bật */
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
    transition: all 0.3s ease;
}

.hamburger-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.6);
}

.hamburger-icon span {
    width: 20px;
    height: 2px;
    background: white;
    margin: 2px 0;
    transition: all 0.3s ease;
}

.hamburger-icon.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-icon.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-icon.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.menu-overlay.active .menu-content {
    transform: translate(-50%, -50%) scale(1);
}

.menu-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dong-menu {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.dong-menu:hover {
    background: rgba(255, 255, 255, 0.2);
}

.menu-items {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: #2d3748;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.menu-item:hover {
    background: #f8fafc;
    border-left-color: #667eea;
    color: #667eea;
}

.menu-item.active {
    background: #f0f4ff;
    border-left-color: #667eea;
    color: #667eea;
}

.menu-item-highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-left-color: #764ba2 !important;
    color: #764ba2;
}

.menu-item-highlight:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: #667eea;
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
}

.menu-action {
    width: 100%;
    margin: 0;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Section and Card Styles */
.section {
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.card h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Player Input Styles */
.player-group {
    margin-bottom: 25px;
}

.player-group h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.player-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.player-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

/* Số Cặp Selector */
.so-cap-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    /* cho phép wrap trên mobile */
    align-items: stretch;
}

.so-cap-btn {
    flex: 1 1 140px;
    /* cho phép co giãn nhưng giữ min width */
    min-width: 120px;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    /* đảm bảo text xuống dòng đẹp */
    white-space: normal;
}

.so-cap-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.so-cap-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Button Styles */
/* Các Nút Bấm */
.nut-chinh,
.nut-phu,
.nut-cap-nhat {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px auto;
    min-width: 200px;
}

.nut-chinh {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.nut-chinh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.nut-phu {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.nut-phu:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.nut-cap-nhat {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
    min-width: 180px;
}

.nut-cap-nhat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

.nut-cap-nhat-container {
    text-align: center;
    margin-top: 20px;
}

/* Teams Display */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.team-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
    transition: transform 0.3s ease;
}

.team-card:hover {
    transform: translateY(-3px);
}

.team-card h4,
.team-title {
    font-size: 1rem;
    margin-bottom: 0;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.team-members {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-top: 10px;
}

.player {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.player-icon {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Easter Egg Banner */
.easter-egg-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    background: linear-gradient(90deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    font-size: 1.1rem;
    letter-spacing: 0.2px;
    display: inline-block;
    pointer-events: none;
}

.easter-egg-banner small {
    display: block;
    font-size: 0.8rem;
    opacity: 0.95;
    margin-top: 6px;
    font-weight: 600;
}

/* Picker area */
.picker-area {
    margin-top: 16px;
    min-height: 600px;
    /* expanded play area for touch */
    max-width: 100%;
    padding: 18px;
    touch-action: none;
    /* ensure pointer events behave for multi-touch */
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(255, 255, 255, 0.02));
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed rgba(0, 0, 0, 0.06);
}

.picker-instructions {
    position: absolute;
    text-align: center;
    z-index: 2;
    color: #4a5568;
    opacity: 0.7;
    font-weight: 600;
}

.picker-area .picker-dot {
    position: absolute;
    width: 84px;
    /* triple small dot size for finger touch */
    height: 84px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
    transition: transform 0.15s ease, opacity 0.25s ease;
}

.picker-area .picker-dot.pulse {
    animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.12);
        opacity: 0.9;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.picker-area .picker-dot.large {
    width: 240px;
    /* much bigger selection circle */
    height: 240px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff2e2e 100%);
    /* red gradient */
    box-shadow: 0 18px 40px rgba(255, 60, 60, 0.48);
    /* red tinted shadow */
    border: 4px solid rgba(255, 255, 255, 0.08);
    opacity: 0.98;
    transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.2s ease;
}

/* Slight pulse on the chosen large dot */
.picker-area .picker-dot.large.chosen {
    animation: none;
    transform: translate(-50%, -50%) scale(1.02);
    box-shadow: 0 20px 48px rgba(255, 80, 80, 0.6);
}

.picker-clear {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 30;
    display: none;
}

.picker-area.has-selection .picker-clear {
    display: block;
}

.player-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.couple-separator {
    font-size: 1.2rem;
    margin: 0 6px;
    opacity: 0.9;
}

/* Tournament Bracket */
.bracket-container {
    overflow-x: auto;
    padding: 20px 0;
}

.bracket-structure {
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-width: 100%;
}

.winners-bracket,
.losers-bracket,
.grand-final {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.bracket-title {
    text-align: center;
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.6rem;
    font-weight: 600;
}

.bracket-rounds {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 280px;
}

.bracket-round h4 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
}

.match {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.match:hover {
    border-color: #667eea;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.match-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.match-id {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.match-teams {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.team {
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.team.xac-nhan {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border-color: #38a169;
}

.team.cho-ket-qua {
    background: #FEEBC8;
    color: #2d3748;
    border-color: #ED8936;
}

.team.thang {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border-color: #38a169;
    box-shadow: 0 0 15px rgba(72, 187, 120, 0.5);
}

.team.thua {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    border-color: #c53030;
    opacity: 0.7;
}

.team-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 5px;
}

.team-members {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    opacity: 0.9;
}

.team-placeholder {
    text-align: center;
    font-style: italic;
    color: #718096;
    font-size: 0.9rem;
}

.vs-divider {
    text-align: center;
    font-weight: bold;
    color: #4a5568;
    font-size: 0.9rem;
    padding: 5px 0;
    background: #f7fafc;
    border-radius: 4px;
}

/* Grand Final Special Styling */
.grand-final .match {
    border: 3px solid #ffd700;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

.grand-final .match-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #2d3748;
}

/* Schedule */
.schedule-container {
    display: grid;
    gap: 15px;
}

.schedule-item {
    color: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.schedule-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.schedule-item.san-sang {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.schedule-item.cho-ket-qua {
    background: #FEEBC8;
    color: #2d3748;
}

/* Tăng tương phản các phần tử con khi trạng thái chờ kết quả (nền cam nhạt) */
.schedule-item.cho-ket-qua .schedule-time,
.schedule-item.cho-ket-qua .schedule-bracket,
.schedule-item.cho-ket-qua .schedule-match,
.schedule-item.cho-ket-qua .team-schedule,
.schedule-item.cho-ket-qua .vs-schedule,
.schedule-item.cho-ket-qua .match-id {
    color: #2d3748;
}

.schedule-item.cho-ket-qua .team-schedule {
    background: rgba(0, 0, 0, 0.06);
}

.schedule-item.cho-ket-qua .match-id {
    background: rgba(0, 0, 0, 0.08);
}

.schedule-item.chua-xac-dinh {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

.schedule-item.da-ket-thuc {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 4px solid #ffd700;
}

.schedule-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-time {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-match {
    opacity: 0.95;
}

.match-teams-schedule {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.team-schedule {
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
}

.vs-schedule {
    font-weight: bold;
    font-size: 0.8rem;
    opacity: 0.8;
}

.schedule-bracket {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.ket-qua-tran-dau {
    margin-top: 8px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}



.schedule-round {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    min-width: 120px;
}

.match-id {
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.round-name {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.san-sang {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.status-badge.chua-xac-dinh {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.status-badge.da-ket-thuc {
    background: rgba(255, 215, 0, 0.9);
    color: #2d3748;
    font-weight: 700;
}

.status-badge.cho-ket-qua {
    background: rgba(237, 137, 54, 0.25);
    color: #7b341e;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Chúc mừng vô địch */
.tieu-de-chuc-mung {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    color: #ffd700;
    margin: 10px 0 6px;
    position: relative;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), -1px -1px 2px rgba(0, 0, 0, 0.6);
}

.phu-de-chuc-mung {
    text-align: center;
    color: #ffffff;
    position: relative;
    z-index: 10;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.dong-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.dong-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
}

.thong-tin-tran-dau {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.lua-chon-thang h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.doi-lua-chon {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lua-chon-doi-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lua-chon-doi-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.lua-chon-doi-item.chon {
    border-color: #48bb78;
    background: #f0fff4;
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.3);
}

.lua-chon-doi-item input[type="radio"] {
    margin: 0;
    transform: scale(1.2);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.modal-footer .nut-chinh,
.modal-footer .nut-phu {
    margin: 0;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    background: #f56565;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
    }

    .card h2 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    /* Make the size buttons 2-per-row on tablet/mobile */
    .so-cap-selector {
        gap: 12px;
    }

    .so-cap-btn {
        flex: 1 1 45%;
        min-width: 140px;
        padding: 10px 12px;
        font-size: 0.95rem;
    }


    .team-card {
        padding: 12px;
    }

    .team-card h4,
    .team-title {
        font-size: 0.9rem;
        margin-bottom: 0;
        line-height: 1.3;
    }

    .team-members {
        gap: 5px;
        font-size: 0.85rem;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .player-icon {
        font-size: 1rem;
    }

    .player-name {
        font-size: 0.85rem;
    }

    .couple-separator {
        font-size: 1.1rem;
        margin: 0 4px;
    }

    /* Bracket Responsive */
    .bracket-rounds {
        flex-direction: column;
        gap: 20px;
    }

    .bracket-round {
        min-width: 100%;
    }

    .match {
        min-height: 100px;
    }

    .match-header {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .match-teams {
        padding: 12px;
        gap: 8px;
    }

    .team-members {
        flex-direction: column;
        gap: 3px;
    }

    /* Schedule Responsive */
    .schedule-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .schedule-info {
        align-items: center;
    }

    .match-teams-schedule {
        flex-direction: column;
        gap: 5px;
    }

    .schedule-round {
        align-items: center;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 15px;
    }

    .card h2 {
        font-size: 1.3rem;
        margin-bottom: 14px;
    }

    .nut-chinh,
    .nut-phu,
    .nut-cap-nhat {
        padding: 12px 20px;
        font-size: 1rem;
        min-width: 180px;
    }

    /* Mobile Teams Display */
    .team-card {
        padding: 10px;
    }

    .team-card h4,
    .team-title {
        font-size: 0.85rem;
        margin-bottom: 0;
        line-height: 1.2;
    }

    .team-members {
        gap: 3px;
        font-size: 0.8rem;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .player-icon {
        font-size: 0.9rem;
    }

    /* Small mobile: ensure size buttons fit nicely */
    .so-cap-btn {
        flex: 1 1 48%;
        min-width: 120px;
        padding: 10px 8px;
        font-size: 0.92rem;
    }

    .player-name {
        font-size: 0.8rem;
    }

    .couple-separator {
        font-size: 1rem;
        margin: 0 3px;
    }

    /* Mobile Bracket */
    .bracket-title {
        font-size: 1.35rem;
    }

    .match {
        min-height: 90px;
    }

    .match-header {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .match-teams {
        padding: 10px;
    }

    .team-name {
        font-size: 0.9rem;
    }

    .team-members {
        font-size: 0.75rem;
    }

    /* Mobile Schedule */
    .schedule-item {
        padding: 12px;
        gap: 10px;
    }

    .schedule-time {
        font-size: 1rem;
    }

    .team-schedule {
        font-size: 0.8rem;
        padding: 3px 6px;
    }

    .match-id {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Mobile Hamburger Menu */
    .hamburger-menu {
        top: 15px;
        right: 15px;
    }

    .hamburger-icon {
        width: 45px;
        height: 45px;
    }

    .hamburger-icon span {
        width: 18px;
    }

    .menu-content {
        width: 95%;
        max-width: 350px;
    }

    .menu-header {
        padding: 15px 20px;
    }

    .menu-header h3 {
        font-size: 1.1rem;
    }

    .menu-item {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .menu-footer {
        padding: 15px 20px;
    }
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slide-up {
    animation: slideInUp 0.5s ease-out;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== STYLES CHO 6 ĐỘI VÒNG TRÒN ===== */
.bracket-6-doi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.bracket-6-doi .knockout-bracket {
    grid-column: 1 / -1;
}

.group-bracket {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.group-bracket .bracket-title {
    color: #ffd700;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.knockout-bracket {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.knockout-bracket .bracket-title {
    color: #ffd700;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Bảng xếp hạng */
.bang-xep-hang {
    margin-bottom: 20px;
    overflow-x: auto;
}

.table-xep-hang {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.table-xep-hang th,
.table-xep-hang td {
    padding: 10px 8px;
    text-align: center;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-xep-hang th {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    font-weight: 600;
    font-size: 0.85rem;
}

.table-xep-hang td {
    font-size: 0.9rem;
}

.table-xep-hang .ten-doi-xh {
    text-align: left;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-xep-hang tr.top-2 {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.3) 0%, rgba(76, 175, 80, 0.1) 100%);
}

.table-xep-hang tr.top-2 td:first-child {
    color: #4caf50;
    font-weight: bold;
}

.table-xep-hang tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Nhập tỷ số */
.nhap-ty-so {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.nhap-ty-so h4 {
    margin-bottom: 15px;
    color: #667eea;
    text-align: center;
}

.ty-so-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.ty-so-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.ty-so-item label {
    font-size: 0.85rem;
    color: #666;
}

.ty-so-input {
    width: 60px;
    height: 50px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.ty-so-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.ty-so-divider {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

/* Responsive cho 6 đội */
@media (max-width: 768px) {
    .bracket-6-doi {
        grid-template-columns: 1fr;
    }

    .table-xep-hang th,
    .table-xep-hang td {
        padding: 8px 5px;
        font-size: 0.8rem;
    }

    .table-xep-hang .ten-doi-xh {
        max-width: 100px;
        font-size: 0.75rem;
    }

    .ty-so-input {
        width: 50px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Styles cho 12 đội */

/* Thanh điều hướng bảng đấu */
.bracket-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.bracket-nav .nav-btn {
    padding: 10px 18px;
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(245, 245, 250, 0.9) 100%);
    color: #4a5568;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bracket-nav .nav-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.bracket-nav .nav-btn.nav-knockout {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 179, 71, 0.2) 100%);
    border-color: rgba(255, 179, 71, 0.5);
    color: #b7791f;
}

.bracket-nav .nav-btn.nav-knockout:hover {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #2d3748;
    border-color: transparent;
}

@media (max-width: 768px) {
    .bracket-nav {
        position: relative;
        gap: 8px;
        padding: 12px;
    }

    .bracket-nav .nav-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* CSS chung cho bracket 12 đội - dùng class bracket-9-doi */
.bracket-12-doi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

.bracket-12-doi .group-bracket {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
}

.bracket-12-doi .knockout-bracket {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 179, 71, 0.1) 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 25px;
}

/* Hạng 3 (có thể vào vòng knockout) */
.table-xep-hang tr.hang-3 {
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
}

.table-xep-hang tr.hang-3 td {
    border-bottom: 1px dashed rgba(255, 179, 71, 0.5);
}

/* Match card compact cho mobile */
.match-compact .match-teams {
    padding: 10px;
    gap: 6px;
}

.match-compact .team {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.match-compact .team-name {
    font-size: 0.85rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-compact .vs-divider {
    font-size: 0.8rem;
    padding: 3px 0;
}

.match-compact .match-header {
    padding: 8px 12px;
}

.match-compact .match-round {
    font-size: 0.75rem;
}

/* Responsive cho 12 đội */
@media (max-width: 768px) {
    .bracket-12-doi {
        grid-template-columns: 1fr;
    }

    .bracket-12-doi .knockout-bracket {
        grid-column: 1;
    }

    .bracket-12-doi .group-bracket {
        padding: 12px;
    }

    .bracket-12-doi .bracket-rounds {
        gap: 10px;
    }

    /* Hiển thị compact trên mobile cho tất cả các loại bracket */
    .match {
        min-width: unset;
    }

    .match .match-teams {
        padding: 10px;
        gap: 5px;
    }

    .match .team {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .match .team-name {
        font-size: 0.8rem;
        margin-bottom: 0;
        line-height: 1.3;
    }

    .match .vs-divider {
        font-size: 0.75rem;
        padding: 2px 0;
    }

    .match .match-header {
        padding: 6px 10px;
    }

    .match .match-round {
        font-size: 0.7rem;
    }

    .match .match-id {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Table xếp hạng nhỏ gọn hơn */
    .bracket-12-doi .table-xep-hang {
        font-size: 0.75rem;
    }

    .bracket-12-doi .table-xep-hang th,
    .bracket-12-doi .table-xep-hang td {
        padding: 5px 3px;
    }

    .bracket-12-doi .ten-doi-xh {
        max-width: 90px;
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Knockout section compact */
    .bracket-12-doi .knockout-bracket {
        padding: 15px;
    }

    .bracket-12-doi .knockout-bracket .bracket-round {
        min-width: unset;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .match .team-name {
        font-size: 0.75rem;
    }

    .bracket-12-doi .ten-doi-xh {
        max-width: 70px;
        font-size: 0.65rem;
    }

    .bracket-12-doi .table-xep-hang th,
    .bracket-12-doi .table-xep-hang td {
        padding: 4px 2px;
        font-size: 0.7rem;
    }
}