:root {
    --sports-orange: #FF6900;
    --sports-purple: #631B67;
    --sports-purple-hover: #7a2279;
    --sports-purple-light: rgba(99, 27, 103, 0.05);
    --playoff-green: #28a745;
    --playoff-green-light: rgba(40, 167, 69, 0.1);
    --playoff-green-border: rgba(40, 167, 69, 0.3);
    --sports-dark: #1a1a1a;
    --sports-gray: #333333;
    --sports-light-gray: #f5f5f5;
    --sports-border: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 2px 8px rgba(99, 27, 103, 0.1);
    --shadow-hover: 0 4px 16px rgba(99, 27, 103, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --playoff-green-light: rgba(40, 167, 69, 0.2);
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
    
    .khl-predictor-container {
        background: #2d2d2d;
    }
    
    .conference-section {
        background: #3a3a3a;
    }
    
    .club-item {
        border-bottom-color: #444;
        background: #2d2d2d;
    }
    
    .club-item:hover {
        background: #3a3a3a;
    }
    
    .btn-primary {
        background: var(--sports-purple);
        color: #ffffff;
    }
    
    .btn-primary:hover {
        background: var(--sports-purple-hover);
    }
    
    .modal-content {
        background: #2d2d2d;
        color: var(--text-primary);
    }
}

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

body {
    font-family: 'TT Neoris', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0 auto;
    padding: 0;
    width: 100%;
    max-width: 730px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.khl-predictor-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    position: relative;
    margin: 20px auto;
    width: 730px;
    max-width: 100%;
}

.conferences-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.conference-section {
    background: var(--sports-light-gray);
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 1px solid var(--sports-border);
}

.conference-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-primary);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--sports-purple);
}

.clubs-list {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.club-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--sports-border);
    background: white;
    transition: var(--transition);
    cursor: grab;
    user-select: none;
    min-height: 60px;
    position: relative;
    border-left: 2px solid transparent;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.club-item:last-child {
    border-bottom: none;
}

.club-item:hover {
    background: var(--sports-light-gray);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.club-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    z-index: 1000;
    cursor: grabbing;
}

.club-item.drag-over {
    background: var(--sports-purple-light);
    border-color: var(--sports-purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.club-item.touch-dragging {
    opacity: 0.8;
    transform: rotate(3deg);
    box-shadow: 0 8px 24px rgba(99, 27, 103, 0.3);
    border: 2px solid var(--sports-purple);
    background: var(--sports-purple-light);
}

.club-item.touch-active {
    background: var(--sports-purple-light);
    transform: scale(1.02);
    transition: all 0.1s ease;
}

/* Стили для команд плей-офф (топ 8) */
.club-item.playoff-team {
    background: var(--playoff-green-light);
    border-left: 4px solid var(--playoff-green);
    border-bottom-color: var(--playoff-green-border);
}

.club-item.playoff-team:hover {
    background: rgba(40, 167, 69, 0.15);
    box-shadow: 0 2px 12px var(--playoff-green-border);
}

.position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sports-border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Выделение позиций плей-офф команд */
.position.playoff-position {
    background: var(--playoff-green);
    color: white;
    box-shadow: 0 2px 4px var(--playoff-green-border);
}

.club-logo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: contain;
    margin-right: 0.75rem;
    flex-shrink: 0;
    background: white;
    border: 1px solid var(--sports-border);
}

.club-name {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

/* Actions */
.actions {
    text-align: center;
    margin: 1.5rem 0;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    margin: 0 0.5rem;
}

.btn-primary {
    background: var(--sports-purple);
    color: white;
}

.btn-primary:hover {
    background: var(--sports-purple-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 90%;
    width: auto;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content.khl-layout {
    max-width: 800px;
    width: 90%;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
    z-index: 1001;
}

.close-button:hover {
    color: var(--text-primary);
}

.conferences-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.conference-column h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--sports-purple);
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 2px solid var(--sports-purple);
    padding-bottom: 0.5rem;
}

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

.team-row {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--sports-light-gray);
    transition: var(--transition);
}

.team-row.playoff-team {
    background: var(--playoff-green-light);
    border-left: 3px solid var(--playoff-green);
}

.team-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--sports-border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.team-position.playoff-position {
    background: var(--playoff-green);
    color: white;
}

.team-logo {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: contain;
    margin-right: 0.5rem;
    flex-shrink: 0;
    background: white;
    border: 1px solid var(--sports-border);
}

.team-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Large desktop - обеспечиваем центровку и фиксированную ширину */
@media (min-width: 769px) {
    .khl-predictor-container {
        width: 730px;
        margin: 20px auto;
    }
}

/* Very wide screens - максимальная ширина и улучшенное центрирование */
@media (min-width: 1200px) {
    body {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
        padding: 20px;
    }
    
    .khl-predictor-container {
        width: 730px;
        margin: 0;
    }
}

/* Tablet and smaller desktop */
@media (max-width: 768px) {
    body {
        max-width: 100%;
        padding: 15px;
    }
    
    .khl-predictor-container {
        margin: 15px auto;
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        border-radius: 8px;
    }
    
    .conferences-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .conference-section {
        padding: 0.75rem;
    }
    
    .conference-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .club-item {
        padding: 0.65rem;
        min-height: 55px;
    }
    
    .club-logo {
        width: 32px;
        height: 32px;
        margin-right: 0.65rem;
    }
    
    .club-name {
        font-size: 1.05rem;
    }
    
    .position {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        margin-right: 0.65rem;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .conferences-table {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Large mobile */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .khl-predictor-container {
        margin: 10px auto;
        padding: 0.875rem;
        width: 100%;
    }
    
    .conferences-wrapper {
        gap: 0.75rem;
    }
    
    .conference-section {
        padding: 0.625rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .khl-predictor-container {
        margin: 5px auto;
        padding: 0.75rem;
    }
    
    .conference-section {
        padding: 0.5rem;
    }
    
    .club-item {
        padding: 0.6rem;
        min-height: 50px;
    }
    
    .club-logo {
        width: 28px;
        height: 28px;
    }
    
    .club-name {
        font-size: 0.95rem;
    }
    
    .position {
        width: 25px;
        height: 25px;
        font-size: 0.8rem;
        margin-right: 0.6rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .team-row {
        padding: 0.4rem;
    }
    
    .team-logo {
        width: 20px;
        height: 20px;
    }
    
    .team-name {
        font-size: 0.8rem;
    }
}