@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #2b2d31;
    --bg-secondary: #1e1f22;
    --bg-tertiary: #313338;
    --text-primary: #f2f3f5;
    --text-secondary: #b5bac1;
    --text-muted: #80848e;
    --brand-primary: #5865f2;
    --brand-hover: #4752c4;
    --success: #23a55a;
    --success-hover: #1a8746;
    --danger: #f23f42;
    --danger-hover: #da373c;
    --warning: #f0b232;
    --border: #3f4147;
    --shadow: rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

header {
    padding: 1rem;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 1rem;
    gap: 1.5rem;
}

.game-controls {
    display: flex;
    align-items: stretch;
    gap: 2rem;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
}

.player-management {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    flex: 1;
    min-width: 400px;
    max-width: 600px;
    min-height: 200px;
}

.player-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

#players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    width: 100%;
    max-width: 500px;
}

.player-box {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.player-box.current {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}

.player-box.eliminated {
    opacity: 0.6;
    background: var(--bg-secondary);
    border-color: var(--danger);
    text-decoration: line-through;
}

.player-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.game-info-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-width: 280px;
    max-width: 320px;
    min-height: 200px;
}

.current-turn {
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

#game-status {
    font-size: 1rem;
    font-weight: 600;
    min-height: 1.2rem;
}

.status-turn {
    color: var(--brand-primary);
}

.status-moving {
    color: var(--warning);
}

.status-winner {
    color: var(--success);
    font-size: 1.125rem;
    font-weight: 700;
}

.score-display {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.score-item {
    font-weight: 600;
    font-size: 0.9rem;
}

.score-item.solids {
    color: var(--warning);
}

.score-item.stripes {
    color: var(--brand-primary);
}

.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--brand-hover);
    transform: translateY(-1px);
}

.btn-wide {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
}

.btn-success {
    background: var(--success);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    transform: scale(1.1);
}

.btn-danger {
    background: var(--danger);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    transform: scale(1.1);
}

#game {
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
    max-width: 100%;
    height: auto;
    touch-action: none;
}

.heart {
    color: #ff6b6b;
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

footer a {
    color: #00d4ff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

@media (max-width: 1024px) {
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .player-management,
    .game-info-panel {
        min-width: 350px;
        max-width: 500px;
        width: 100%;
    }
    
    .game-info-panel {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1rem 0.5rem 0.5rem;
        gap: 1rem;
    }
    
    header {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .player-management {
        min-width: 300px;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        min-height: auto;
    }
    
    .game-info-panel {
        min-width: 300px;
        min-height: auto;
        padding: 1rem;
    }
    
    #players-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-width: 280px;
    }
    
    .player-box {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .score-display {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    .btn-primary {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }
    
    #game {
        width: 100%;
        max-width: 100vw;
        height: auto;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0.75rem 0.25rem 0.25rem;
        gap: 0.75rem;
    }
    
    header {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .player-management,
    .game-info-panel {
        min-width: 280px;
        padding: 0.75rem;
    }
    
    #players-grid {
        max-width: 260px;
        gap: 0.4rem;
    }
    
    .player-box {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .current-turn,
    .score-display {
        padding: 0.6rem 0.8rem;
    }
    
    .btn-success,
    .btn-danger {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .btn-primary {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    #game {
        border-radius: 8px;
    }
    
    footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .player-box {
        min-height: 40px;
        padding: 0.75rem;
    }
    
    #game {
        cursor: crosshair;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    main {
        padding: 1rem 0.5rem;
    }
    
    .game-controls {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        max-width: none;
    }
    
    .player-management,
    .game-info-panel {
        min-width: 280px;
        max-width: 45%;
        flex: 1;
    }
    
    .player-management {
        flex-direction: row;
        min-height: 140px;
    }
    
    #players-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 200px;
    }
}