* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    background-image: url('FloorGoban.JPG');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #333;
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(245, 245, 245, 0.85);
    z-index: -1;
    pointer-events: none;
}


.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

/* Header section with white background */
.header-section {
    background: white;
    padding: 12px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: fit-content;
    margin: 0 auto 20px auto;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.8em;
    margin-top: 0;
}

.share-section {
    margin-bottom: 0;
    position: relative;
}

#new-prediction-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    margin-right: 10px;
}

#new-prediction-button:hover {
    background: #2980b9;
}

#share-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

#share-button:hover {
    background: #2980b9;
}

.copy-feedback {
    position: absolute;
    margin-left: 10px;
    color: #27ae60;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

h2 {
    color: #34495e;
    margin-bottom: 10px;
    border-bottom: 1px solid #3498db;
    padding-bottom: 5px;
    font-size: 1.3em;
}

h3 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.tournament-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Group Stage Styling */
.group-stage {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.groups-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.group {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.group h3 {
    text-align: center;
    background: #3498db;
    color: white;
    padding: 6px;
    margin: -12px -12px 10px -12px;
    border-radius: 4px 4px 0 0;
    font-size: 1em;
}

.match {
    background: white;
    margin-bottom: 6px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.match-players {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.player-button {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px;
}

.player-button:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.player-name {
    font-weight: 500;
    color: #2c3e50;
    font-size: 12px;
    line-height: 1.2;
}

.checkmark {
    color: #27ae60;
    font-weight: bold;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-button.selected {
    background: #d4edda;
    border-color: #27ae60;
    box-shadow: 0 1px 4px rgba(39, 174, 96, 0.2);
}

.player-button.selected .checkmark {
    opacity: 1;
}

.player-button.selected .player-name {
    color: #155724;
    font-weight: 600;
}

.vs-label {
    color: #6c757d;
    font-weight: bold;
    font-size: 10px;
    min-width: 20px;
    text-align: center;
}

/* Knockout Stage Styling */
.knockout-stage {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bracket {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.round {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.round h3 {
    text-align: center;
    background: #3498db;
    color: white;
    padding: 6px;
    margin: -12px -12px 8px -12px;
    border-radius: 4px 4px 0 0;
    font-size: 1em;
}

.final h3 {
    background: #3498db;
}

.semifinals .match {
    border-left: 3px solid #3498db;
}

.final .match {
    border-left: 3px solid #3498db;
}

.round .match-info {
    margin-bottom: 6px;
}

.round .match-label {
    font-size: 11px;
    font-weight: bold;
    color: #2c3e50;
}

/* Group Standings Section */
.group-standings-section {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    grid-column: 1 / -1;
}

.standings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.standings-table {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.standings-table h3 {
    text-align: center;
    background: #3498db;
    color: white;
    padding: 6px;
    margin: -12px -12px 10px -12px;
    border-radius: 4px 4px 0 0;
    font-size: 1em;
}

.standings-table:last-child h3 {
    background: #3498db;
}

.standings-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    font-size: 12px;
}

.standings-table th {
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: bold;
    font-size: 11px;
}

.standings-table th:nth-child(2),
.standings-table th:nth-child(3) {
    text-align: center;
    width: 40px;
}

.standings-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #dee2e6;
}

.standings-table td:nth-child(2),
.standings-table td:nth-child(3) {
    text-align: center;
    font-weight: bold;
}

.standings-table tr:nth-child(even) {
    background: #f8f9fa;
}

.standings-table tr.qualified {
    background: #d4edda !important;
    color: #155724;
    font-weight: bold;
}

.standings-table tr.qualified td:first-child {
    position: relative;
}

.standings-table tr.qualified td:first-child::after {
    content: "✓";
    color: #27ae60;
    font-weight: bold;
    margin-left: 5px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tournament-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .groups-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .standings-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {    
    .match-players {
        flex-direction: column;
        gap: 6px;
    }
    
    .player-button {
        width: 100%;
    }
    
    .vs-label {
        margin: 3px 0;
        font-size: 9px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .container {
        padding: 5px;
    }
}

/* Loading and interaction states */
.match:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Group standings table */
.group-standings {
    margin-top: 20px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.group-standings table {
    width: 100%;
    border-collapse: collapse;
}

.group-standings th,
.group-standings td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.group-standings th {
    background: #3498db;
    color: white;
    font-weight: bold;
}

.group-standings tr:nth-child(even) {
    background: #f8f9fa;
}

.qualified {
    background: #d4edda !important;
    color: #155724;
    font-weight: bold;
}

/* Tiebreaker section */
.tiebreaker-section {
    margin-top: 12px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
}

.tiebreaker {
    margin-bottom: 8px;
}

.tiebreaker:last-child {
    margin-bottom: 0;
}

.tiebreaker h4 {
    color: #856404;
    margin-bottom: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.tiebreaker select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #f39c12;
    border-radius: 3px;
    background: white;
    font-size: 11px;
    cursor: pointer;
}

.tiebreaker select:focus {
    outline: none;
    border-color: #e67e22;
    box-shadow: 0 0 3px rgba(243, 156, 18, 0.3);
}

/* Disabled state for knockout buttons and selects */
select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

.player-button:disabled {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    border-color: #dee2e6 !important;
    transform: none !important;
    box-shadow: none !important;
}

.player-button:disabled .player-name {
    color: #6c757d !important;
}

.player-button:disabled .checkmark {
    opacity: 0 !important;
}

/* Results-only styling - non-interactive */
.player-button.results-only {
    cursor: default !important;
    pointer-events: none;
}

.player-button.results-only:hover {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
    transform: none !important;
    box-shadow: none !important;
}

#predictions-button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

#predictions-button:hover {
    background: #219a52;
}

#results-button {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    margin-right: 10px;
}

#results-button:hover {
    background: #7d3c98;
}

/* Game link styling - only for matches with links */
.match-with-link {
    cursor: pointer;
    transition: all 0.3s ease;
}

.match-with-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Remove hover effects for matches without results/links */
.match:not(.match-with-link) {
    cursor: default;
}

.match:not(.match-with-link):hover {
    transform: none;
    box-shadow: none;
}

.match-link, .knockout-match-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.match-link:hover, .knockout-match-link:hover {
    text-decoration: none;
    color: inherit;
}

.game-link-indicator {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #3498db;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.match-with-link:hover .game-link-indicator {
    opacity: 1;
    background: #2980b9;
}

/* Ensure link doesn't interfere with existing match styling */
.match-link .match-players,
.knockout-match-link .match-players {
    position: relative;
    z-index: 1;
}

.match-link .player-button,
.knockout-match-link .player-button {
    pointer-events: none;
}

/* Special styling for knockout match links */
.knockout-match-link {
    padding: 8px;
    margin: -8px;
    border-radius: 4px;
}

/* Round grouping - subtle visual distinction */
.round-group {
    margin-bottom: 8px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.round-group:last-child {
    margin-bottom: 0;
}

.round-group.round-odd {
    background: rgba(52, 152, 219, 0.03);
    border-left: 2px solid rgba(52, 152, 219, 0.2);
}

.round-group.round-even {
    background: rgba(52, 152, 219, 0.03);
    border-left: 2px solid rgba(52, 152, 219, 0.2);
}

.round-group .match {
    margin-bottom: 4px;
}

.round-group .match:last-child {
    margin-bottom: 0;
}

/* Tiebreak game styling */
.tiebreak-label {
    background: #fffef7;
    color: #8b7355;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px solid #f5f2e8;
}

/* Disclaimer styling */
.disclaimer {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-top: 30px;
    margin-bottom: 20px;
    font-style: italic;
}

/* Best-of-3 Styling */
.best-of-3-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.series-score {
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    padding: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 8px;
}

.series-score .series-winner {
    color: #4CAF50;
}

.score-separator {
    margin: 0 10px;
    color: #666;
}

.best-of-3-game {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    transition: all 0.3s ease;
}

.best-of-3-game:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.1);
}

.game-header {
    text-align: center;
    font-size: 0.9em;
    font-weight: bold;
    color: #666;
    margin-bottom: 8px;
}

.game-wrapper {
    display: block;
    transition: all 0.3s ease;
}

.game-wrapper:hover .best-of-3-game {
    background-color: #f8f9ff;
}

.series-complete .best-of-3-game {
    opacity: 0.8;
}

.player1-wins-series .best-of-3-container,
.player2-wins-series .best-of-3-container {
    border: 2px solid #4CAF50;
    border-radius: 6px;
    padding: 8px;
    background-color: rgba(76, 175, 80, 0.05);
}